Converting Certificate Files

Last Updated : Apr 11, 2022 |

The intermediate .crt file can be in PEM or DER format; it is PEM format if viewable using a text editor. See Certificate File Naming and File Formats for more information.

If other formats are required OpenSSL can be used:

To convert PEM to DER:

openssl x509 -outform der -in intermediate.crt -out intermediate.der

To convert DER to PEM:

openssl x509 -inform der -in intermediate.crt -out intermediate.pem

To convert PKCS#7 to PEM:

openssl pkcs7 –print_certs -in certificate.pb7 -out certificate.pem

To convert PKCS#7 and private key to PKCS#12:

openssl pkcs7 –print_certs -in certificate.pb7 -out certificate.pem
openssl pkcs12 -export -in certificate.pem -inkey privateKey.key -certificate.pfx -certfile CAcert.cer

You will be asked for an encryption key for the resultant PKCS#12 file.

To convert PEM certificate and private key to PKCS#12:

openssl pkcs12 -export -in certificate.pem -inkey privateKey.pem -
certificate.pfx

You will be asked for an encryption key for the resultant PKCS#12 file. You may also be asked for the private key password.