Ask a Question

Solution ID : SO17200

Last Modified : 05/02/2018

How to convert a JKS Keystore to a PKCS#12 (.p12) format

Problem

How to convert a JKS keystore file to PKCS#12 format.
How to move a certificate from Tomcat to IIS

Solution

To convert a JKS (.jks) keystore to a PKCS#12 (.p12) keystore, run the following command:

Note: This command is supported on JDK / JRE keytool versions 1.6 and greater.

keytool -importkeystore -srckeystore [MY_KEYSTORE.jks] -destkeystore [MY_FILE.p12] -srcstoretype JKS - deststoretype PKCS12 -deststorepass [PASSWORD_PKCS12]


List of example parameters:

MY_KEYSTORE.jks: is the path to the keystore that you want to convert.
MY_FILE.p12: path to the PKCS#12 file (.p12 or .pfx extension) that is going to be created.
PASSWORD_PKCS12: is the password that will be requested at the PKCS#12 file opening.

 

To verify the contents of the .p12 file (e.g. MY_FILE.p12), run the following command:

keytool -list -v -keystore MY_FILE.p12 -storetype pkcs12


For more information on Keytool, please visit the following web site.

https://docs.oracle.com/javase/6/docs/technotes/tools/windows/keytool.html