DEV Community

Geoffrey Roguelon
Geoffrey Roguelon

Posted on

Convert a keystore file (.jks) into a PEM certificate

# Export the certificate
keytool -export -alias mydomain -file mydomain.der -keystore mycert.jks
# Convert the certificate into PEM
openssl x509 -inform der -in mydomain.der -out mydomain.pem
# Export the key
keytool -importkeystore -srckeystore mycert.jks -destkeystore keystore.p12 -deststoretype PKCS12
# concert PKCS12 key to unencrypted PEM
openssl pkcs12 -in keystore.p12  -nodes -nocerts -out mydomain.key


Top comments (0)