Extracting SSL certificate from the Java Keystore (JKS)

To extract SSL certificate and private key from Keystore (JKS) file, run

keytool -importkeystore \
    -srckeystore keystore.jks \
    -destkeystore keystore.p12 \
    -deststoretype PKCS12

It will ask for the new Keystore password and current Keystore password. Once you enter the password, JKS file gets converted to P12 format.

This will include all certificates in the keystone. If you only need a specific certificate, then use

Advertisement

-srcalias NAME_HERE


To extract SSL certificate (Apache format), run
openssl pkcs12 -in keystore.p12  -nokeys -out cert.pem

To extract Private key, run

openssl pkcs12 -in keystore.p12  -nodes -nocerts -out key.pem
Add a comment

Leave a Reply

Your email address will not be published. Required fields are marked *

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Advertisement