Search code examples
sslopensslcertificatessl-certificatejks

How to create certificate from keystore.jks and truststore.jks files


I need to authenticate with two-way authentication. I have two JavaKeyStore files keystore.jks and truststore.jks that I use when authentication with java client , now I want to use Python client that needs .cer file . so how can I create the certificate file from the jks files ?


Solution

  • Use this command:

    keytool -export -alias keystore_alias -file your_cert.cer -keystore keystore.jks
    

    Here keystore_alias is the alias of the keystore. You will prompted for the keystore password, which you also must know in order to generate a certificate.

    This website is a great reference for the various things that can be done with Java keystore files:

    https://www.sslshopper.com/article-most-common-java-keytool-keystore-commands.html