To convert a SSL certificate to a Java Keystore (JKS) file, you’ll need your SSL certificate file (mycertificate.crt
) and your private key file (mykey.key
). Your private key file is what you used to generate your certificate signing request.
Once you have these files, simply run the following commands.
openssl pkcs12 -export -in mycertificate.crt -inkey mykey.key -out PKCS12.p12
keytool -importkeystore -srckeystore PKCS12.p12 -srcstoretype pkcs12 -destkeystore mykeystore.jks -deststoretype JKS
Your Java Keystore file will now be located at mykeystore.jks
.
Note: The passwords entered when using the openssl and keytool commands must match, or your JKS file won’t work.