Post

Java keytool add cert to keystore

Java keytool add cert to keystore

When your Java app needs to trust a certificate that isn’t in the default JDK truststore — usually a corporate CA cert or a self-signed cert from an internal service — this is how you add it. The alias is just a label; make it descriptive so you can identify it later with keytool -list.

  • To add pem or X.509 cert to java keystore
1
keytool -import -alias corporate_proxy -file ~/Downloads/proxy.pem -keystore jssecacerts

or

1
keytool -import -alias corporate_proxy -file ~/Downloads/proxy.crt -keystore jssecacerts
This post is licensed under CC BY 4.0 by the author.