Skip to content

Instantly share code, notes, and snippets.

Last active Dec 19, 2017
What would you like to do?
Add a certificate to JAVA truststore
"%jreHome%\bin\keytool.exe" -keystore "%jreHome%\lib\security\cacerts" -importcert -file {filepath} -alias {sample} -storepass {pass} -noprompt
**get the cert from site :
echo -n | openssl s_client -connect | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > examplecert.crt
**add the cert to truststore
keytool -import -trustcacerts -keystore /opt/java/jre/lib/security/cacerts -storepass changeit -noprompt -alias mycert -file examplecert.crt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment