User Tools

Site Tools

Please note, that this is an old archived version of this site. Check out the new version at!

Convert a Key

Convert P12 to Java Keystore

keytool -importkeystore -srckeystore testkey.p12 -srcstoretype pkcs12 -srcalias 1 -destkeystore testkey.jks -deststoretype jks -destalias testkey

You can add -deststorepass PASSWORD to set the password on the command line. If you don't, keytool will ask you for a password.

Convert PEM to P12

To convert cert.pem and key.pem to key.p12:

openssl pkcs12 -export -in cert.pem -inkey key.pem -out key.p12

Export Certificate from P12

Export the certificate with the complete certificate chain:

openssl pkcs12 -in testkey.p12 -out testkey.pem -nokeys

Export the certificate only:

openssl pkcs12 -in testkey.p12 -out testkey.pem -nokeys -clcerts
info/cryptography/openssl/convert_key.txt · Last modified: 2019-01-17 19:19 by andunix