Skip to content
Home » Import SSL Certificates in trust store

Import SSL Certificates in trust store

  • by

First download certificate in java file

echo -n | openssl s_client -servername <hostname> -connect <hostname>:443 
| sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > /tmp/key.cert

Import it using keytool command

keytool -import -alias <alias> -file key.cert -keystore <keystore_location>

Java Trust store location : <JRE_HOME>/lib/security/cacerts

Leave a Reply

Your email address will not be published. Required fields are marked *