Convert Certificate Format
Convert Certificate Format⚓
In some cases there is a need to convert the certificate to a specific format to be consumed by the client application, some application expect a cert+key pair while other will support only pfx or will require you to import the cert+key pair into a keystore.
We included few command line option to allow converting from one format to the other.
Convert a PEM file to DER (crt etc)⚓
openssl x509 -outform der -in certificate.pem -out certificate.crt
Convert cert+key pair to a PFX⚓
openssl pkcs12 -export -out certificate.pfx \
-inkey privateKey.key -in certificate.crt
Convert a PKCS#12 file (.pfx .p12) containing a private key and certificates to PEM⚓
openssl pkcs12 -in keyStore.pfx -out keyStore.pem -nodes
Import cert+key pair to key store⚓
keytool -importkeystore -srckeystore mypfxfile.pfx \
-srcstoretype pkcs12 -destkeystore clientcert.jks -deststoretype JKS