How to Seamlessly Change the Format of Digital Certificates?

There are many formats in which digital certificates can be downloaded or converted. Following are X.509 certificate encoding formats and extensions:
However, different certificate forms have no advantages or disadvantages. It all depends on the certificate’s format requirements for the application that will be using it.
You can convert the following file format into different formats by changing the extensions.
You can change the PEM file format to the following formats by changing its extension:
For Example: Convert the .crt certificate file into .pem file.
Open the .crt certificate file in any text editor.
Go to File.
Click on Save As
In Save as type “Select All Files.”
In the File name, enter the file name and the extension you want to convert (.cer, .key, .pem, .crt).
click on Save.
You can change the DER file format to the following formats by changing its extension:
For Example: Convert the .der certificate file into .cer file.
Open the certificate in any text editor.
Go to File.
Click on Save As
In Save as type “Select All Files.”
In the File name, enter the file name and the extension you want to convert (.cer, .der).
Click on Save As
Convert PEM to DER:
You can convert the PEM certificate file format to DER by using the command below:
$ openssl x509 -outform der -in certificate.pem -out certificate.der
Convert PEM to P7B
You can convert the PEM certificate file format to P7B by using the command below:
$ openssl crl2pkcs7 -nocrl -certfile certificate.cer -out certificate.p7b -certfile CAcert.cer
Note: -certfile CAcert.cer is optional, use this if having more than one PEM certificates and wants to include into P7B file.
Convert PEM to PFX
You can convert the PEM certificate file format to PFX by using the command below:
$ openssl pkcs12 -export -out certificate.pfx -inkey privateKey.key -in certificate.crt -certfile CAcert.crt
Note: -certfile CAcert.cer is optional, use this if having more than one PEM certificates and wants to include into PFX file.
Convert DER (.crt, .cer, .der) to PEM:
You can convert the DER certificate file format to PEM by using the command below:
$ openssl x509 -inform der -in certificate.der -out certificate.pem
Convert P7B to PEM
You can convert the P7B certificate file format to PEM by using the command below:
$ openssl pkcs7 -print_certs -in certificate.p7b -out certificate.cerConvert P7B to PFX
You can convert the P7B certificate file format to PFX by using the two commands below:
$ openssl pkcs7 -print_certs -in certificate.p7b -out certificate.cer $ openssl pkcs12 -export -in certificate.cer -inkey privateKey.key -out certificate.pfx -certfile CAcert.cerNote: -certfile CAcert.cer is optional, use this if having more than one P7B certificates and wants to include into PFX file.
Convert PFX to PEM
You can convert the PFX certificate file format to PEM by using the command below:
$ openssl pkcs12 -in certificate.pfx -out certificate.cer -nodes
Note: OpenSSL will combine all the Certificates and Private Keys into a single file when converting PFX to PEM format. You will need to open the file in Text Editor and copy each
Certificate and Private key (including the BEGIN/END instructions) to its text file.