Import SSL Certificates

The process of adding something like a self-signed certificate to your environment can be complicated and error prone. Therefore I have scripted the steps to make it repeatable and maintainable.

rem print the Self-Signed certificate
keytool -file path/to/my/certificate/myCertificate.crt -printcert

pause

rem list all certificates
keytool -keystore path/to/jre/lib/security/cacerts -storepass changeit -list

pause

rem delete the Self-Signed certificate
keytool -keystore path/to/jre/lib/security/cacerts -storepass changeit -delete -alias myCertificateAlias

pause

rem import the Self-Signed certificate
keytool -keystore path/to/jre/lib/security/cacerts -storepass changeit -noprompt -import -file path/to/my/certificate/myCertificate.crt -alias myCertificateAlias

pause

rem list the Self-Signed certificate
keytool -keystore path/to/jre/lib/security/cacerts -storepass changeit -list -alias myCertificateAlias

pause

echo #####################################################################################
echo #####################################################################################
echo Don't forget to restart the ColdFusion instances that depend on these certificates!!!
echo #####################################################################################
echo #####################################################################################

pause