This article show you step by step approach how to convert ".jks" to ".pem". Two different tools will be used for the process and there are two steps...
Keytool – It a Java key and certificate management utility. It allows users to manage their own public/private key pairs and certificates. It comes with Java/JRE/JDK and almost all computer has JRE.
OpenSSL - It comes with LoadRunner. If not can be downloaded from internet (https://www.openssl.org).
First, convert JKS to PKCS12 format:
- Save the ".jks" file in your computer. My ".jks" file name is "demo.jks" and saved in "C:\temp".
- Open the command prompt ("Start >> All Programs >> Accessories >> Command Prompt" or "Start >> Run and type 'cmd' and hit enter")
- Navigate to Java or JRE bin folder on the command prompt. On the command prompt type "Java\jre1.x.x_xx\bin". It could be different on your computer.
- On the command prompt, type following and it will create another file with “.p12” extension. Make sure to replace file and folder path.
keytool -importkeystore -srckeystore "C:\Temp\demo.jks" -srcalias cpwxc_test -destkeystore "C:\Temp\demo.p12" -deststoretype PKCS12
- It prompts you to enter password, enter the password. Remember this password, you will need it on the next step.
Next, convert PKCS12 to PEM format:
On the command prompt, go to the OpenSSL location and type following text and it will create a file with “.pem” extention.
openssl pkcs12 -in "C:\Temp\demo.p12" -out "C:\Temp\demo.pem"
It will ask you to enter password. Enter the password you entered in the previous step.
>>> Let me know what you think in the comment. Any constructive feedback will be appreciated & will helpful to others…