How to configure an SSL Certificate with Play Framework for https
I spent hours tryĀing to get this to work, and in the end, then probĀlem was that I did not genĀerĀate the CSR (CerĀtifiĀcate Request) myself with the keytool.
I kept getĀting this error when I tried accessĀing Play with https:
javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated
The probĀlem ended up being that the keyĀstore I creĀated and imported the SSL cerĀtifiĀcate into did not have the pubĀlic key that was used for the CSR (cerĀtifiĀcate request).
So here it the quick verĀsion of genĀerĀatĀing an SSL CerĀtifiĀcate with godaddyā.com and installing it with Play FrameĀworkĀ 2.1+.
- FolĀlow these instrucĀtions from godaddyā.com to genĀerĀate the CSR like this:
First genĀerĀate the key pair likeĀ this:
keytool -keysize 2048 -genkey -alias tomcat -keyalg RSA -keystore tomcat.keystore
Then genĀerĀate theĀ CSR:
keytool -certreq -alias tomcat -file csr.txt -keystore tomcat.keystore
- Use the CSR to apply for certificate
- Add the InterĀmeĀdiĀate CerĀtifiĀcate BunĀdle and the CerĀtifiĀcate that were genĀerĀated to your keyĀstore.
NOTE: make sure this is the same keyĀstore that you genĀerĀated the priĀvate key in, in stepĀ 1!keytool -import -alias intermed -keystore tomcat.keystore -trustcacerts -file gd_bundle.crt keytool -import -alias tomcat -keystore tomcat.keystore -trustcacerts -file mycert.crt
(Replace mycert.crt with the file name and locaĀtion of the new GoDaddy certificate)
- Finally, folĀlowĀing the instrucĀtions for conĀfigĀurĀing https with Play 2.1+ ( http://āwwwā.playframeāworkā.com/ādāoācāuāmāeānātāaātāiāoānā/ā2ā.ā2ā.ā1ā/āCāoānāfāiāgāuārāiānāgāHātātps ) which had already worked great with the self genĀerĀated key, I creĀated a shell script for startĀing Play with the corĀrect parameters:
# script for starting play in production with SSL and the keystore target/start -Dhttps.port=443 -Dhttps.keyStore=/Users/bp/mypath/tomcat.keystore -Dhttps.keyStorePassword=itl80809
Note: you need to do a āplay distā beforeĀhand, so that the curĀrent SoftĀware is comĀpiled into a disĀtriĀbĀuĀtion in the tarĀget subdirectory.




