Skip to content

Instantly share code, notes, and snippets.

@mortezaadi
Last active December 19, 2017 17:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mortezaadi/63b4e8c7e23deac90b5c13e47b61d076 to your computer and use it in GitHub Desktop.
Save mortezaadi/63b4e8c7e23deac90b5c13e47b61d076 to your computer and use it in GitHub Desktop.
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