Upon receiving the signed certificate from the CA, import the certificate into the keystore.
cp GLASSFISH_CONFIG/keystore.jks GLASSFISH_CONFIG/keystore-backup.jks
openssl x509 -text -in signedcertificate.pem
In addition,the private key of the s1as certificate will need to be obtained from the keystore file.
keytool -importkeystore -srckeystore GLASSFISH_CONFIG/keystore.jks -destkeystore keystore.p12 -deststoretype PKCS12 -srcalias s1as
openssl pkcs12 -in keystore.p12 -nocerts -out privatekey.pem
Once the externally signed certificate and the encrypted private key are obtained from the keystore, use openssl to combine them into a new PKCS12 keystore.
openssl pkcs12 -export -out signedcertificate.p12 -in signedcertificate.pem -inkey privatekey.pem -name s1as
rm privatekey.pem
Before importing this PKCS12 keystore, the old s1as certificate from keystore.jks must be removed to make space for the new one.
Delete the old s1as certificate.
keytool -delete -alias s1as -keystore GLASSFISH_CONFIG/keystore.jks
keytool -v -importkeystore -srckeystore signedcertificate.p12 -srcstoretype PKCS12 -destkeystore GLASSFISH_CONFIG/keystore.jks -deststoretype JKS
sudo service glassfishd restart
To test if the certificate is working, connect to your domain’s IP with port 8181.