Skip to content
Advertisement

Import PEM into Java Key Store

I am trying to connect to an SSL server which requires me to authenticate myself. In order to use SSL over Apache MINA I need a suitable JKS file. However, I have only been given a .PEM file.

How would I go about creating a JKS file from a PEM file?

Advertisement

Answer

First, convert your certificate in a DER format :

openssl x509 -outform der -in certificate.pem -out certificate.der

And after, import it in the keystore :

keytool -import -alias your-alias -keystore cacerts -file certificate.der
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement