Thursday, 4 July 2013

Java – Keytool - Create a TrustStore and Import X.509 Certificate as a Trusted Certificate

 

Open a console/command prompt (in admin mode if on windows), ‘cd’ to your JDK’s bin directory (if you do not have the JDK’s bin setup in your PATH) and run following command:

NOTE - This command was named -import in previous releases. This old name is still supported in this release and will be supported in future releases, but for clarify the new name, -importcert, is preferred going forward.

Once you run above command, it will create a new truststore (if not already exists) at following location:

Windows : %JAVA_HOME%\bin\test-truststore

Linux/Mac/Solaris : $Java_HOME/bin/test-truststore

Run the following command to list truststore entries: