OpenSSL Commands to Convert Your SSL Certificate File Format
Convert SSL Certificate in Your Required File Format Using OpenSSL Commands
CA (Certificate Authority) often sends you the SSL certificate file in a format that isn't compatible and isn't accepted by your server. Henceforth, it becomes necessary to convert the SSL certificate file format into one that gets accepted by your server.
Here are the easy-to-understand and use OpenSSL commands to convert your SSL certificate file format into the one supported by your server.
OpenSSL Commands to Convert Your PEM File
-
From PEM to DER
openssl x509 -outform der -in certificate.pem -out certificate.der
-
From PEM to P7B
openssl crl2pkcs7 -nocrl -certfile certificate.cer -out certificate.p7b -certfile CACert.cer
-
From PEM to PFX
openssl pkcs12 -export -out certificate.pfx -inkey privateKey.key -in certificate.crt -certfile CACert.crt
OpenSSL Commands to Convert Your P7B File
-
From P7B to PEM
openssl pkcs7 -print_certs -in certificate.p7b -out certificate.cer
-
From P7B to 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
OpenSSL Commands to Convert Your PFX File
-
From PFX to PEM
openssl pkcs12 -in certificate.pfx -out certificate.cer -nodes