OpenSSL cert conversion

Convert PFX to PEM

openssl pkcs12 -in certificate.pfx -out certificate.cer -nodes

Convert PEM to PFX

 openssl pkcs12 -export -out certificate.pfx -inkey privateKey.key -in certificate.crt -certfile CACert.crt 

Convert P7B to PEM

openssl pkcs7 -print_certs -in certificate.p7b -out certificate.cer

Convert P7B to PFX

Note: This requires 2 commands

# Step 1
openssl pkcs7 -print_certs -in certificate.p7b -out certificate.cer

# Step 2
openssl pkcs12 -export -in certificate.cer -inkey privateKey.key -out certificate.pfx -certfile CACert.cer
openssl pkcs7 -print_certs -in old.p7b -out new.crt

Convert DER to PEM

openssl x509 -inform der -in certificate.cer -out certificate.pem

Convert DER to CRT

Use the following command to convert a DER encoded certificate into a PEM encoded certificate:

Use the following command to convert a DER encoded private key into a PEM encoded private key:

Convert CER to PEM

Convert PEM to DER

Convert CRT to DER

Use the following command to convert a PEM encoded certificate into a DER encoded certificate:

Use the following command to convert a PEM encoded private key into a DER encoded private key:

Convert PEM to P7B

Convert CRT to PEM

PEM format:

Check to see if your Certificate is in PEM format:

Last updated