Created
July 20, 2017 15:09
-
-
Save pierrefevrier/13fdf2a2ace9d67aaa85f7535268b30f to your computer and use it in GitHub Desktop.
Java add certificate to trustStore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Download ca certificate as .pem or .der | |
# [Step only for .pem certificates] | |
openssl x509 -outform der -in certificate.pem -out certificate.der | |
# Import .der certificate into Java trustStore | |
# "changeit" is the default password for alias | |
keytool -import -keystore path/to/cacerts -file certificate.der -storepass changeit -alias alias-of-your-certificate | |
# Verify certificates trusted | |
keytool -list -keystore path/to/cacerts -storepass changeit | |
# Force the use of a particular trustStore by your JVM | |
# Add the following instruction to your JAVA_OPTS | |
# -Djavax.net.ssl.trustStore=path/to/cacerts |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment