Skip to content

Instantly share code, notes, and snippets.

@mortezaadi
Last active Dec 19, 2017
Embed
What would you like to do?
Add a certificate to JAVA truststore
Windows
"%jreHome%\bin\keytool.exe" -keystore "%jreHome%\lib\security\cacerts" -importcert -file {filepath} -alias {sample} -storepass {pass} -noprompt
Linux:
**get the cert from site :
echo -n | openssl s_client -connect 185.79.62.45:443 | 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