Skip to content

File Format Conversion

Convert File Format

Run these OpenSSL commands on your machine to easily convert certificate file from one format to the other.

PEM to other formats

PEM→→→→→DER

openssl x509 -outform der -in certificate.pem -out certificate.der

PEM→→→→→P7B

openssl crl2pkcs7 -nocrl -certfile certificate.cer -out certificate.p7b -certfile CACert.cer

PEM→→→→→PFX

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

DER to other format

DER→→→→→PEM

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

P7B to other format

P7B→→→→→PEM

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

P7B→→→→→PFX

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

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

PFX to other format

PFX→→→→→PEM

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