As we all know that different platforms and devices require SSL certificates in different formats, for example a Windows server exports and imports .pfx files whereas an Apache server uses individual PEM (.crt, .cer) files for SSL.
Using the OpenSSL utility, we can easily convert SSL certificates in different formats from PFX to PEM or vice-versa.
You can use the following OpenSSL commands to convert SSL certificate to different formats on your own machine ::
OpenSSL Convert PEM
Convert PEM to DER
openssl x509 -outform der -in certificate.pem -out certificate.der
Convert PEM to P7B
openssl crl2pkcs7 -nocrl -certfile certificate.cer -out certificate.p7b -certfile CACert.cer
Convert PEM to PFX
openssl pkcs12 -export -out certificate.pfx -inkey privateKey.key -in certificate.crt -certfile CACert.crt
OpenSSL Convert DER
Convert DER to PEM
openssl x509 -inform der -in certificate.cer -out certificate.pem
OpenSSL Convert P7B
Convert P7B to PEM
openssl pkcs7 -print_certs -in certificate.p7b -out certificate.cer
Convert 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 Convert PFX
Convert SSL Certificate from PEM to P7B
openssl pkcs12 -in certificate.pfx -out certificate.cer -nodes
Note :: It is highly recommended that you convert to and from .pfx files on your own machine using OpenSSL so that you can keep the private key intact.
And, if you are looking for graphical interface for the above commands then browse the URL : https://www.sslshopper.com/ssl-converter.html
That’s all.
