Convert cer to pfx in OpenSSL

In this post we will look at how to convert cer to pfx in OpenSSL. If you are just starting generating your certificate, please refer to the article on how to generate a CSR with OpenSSL.

OpenSSL is a popular command line tool to help you generate certificates for TLS protocols. 

For this workflow you will need the .cer certificate file you downloaded from your certificate authority (Digicert, Verisign, GeoCerts) as well as the private key you used to generate the CSR on your server. Place them into the same folder. 

Using a Terminal application, make sure you change to the directory containing both your .cer and your private key. For example:

cd /path/to/your/directory/with/the/crt/and/private/key

Next run the following command.

openssl pkcs12 -export -in certificate.cer -inkey privatekey.key -out certificate.pfx

command to convert cer to pfx in OpenSSL
Be sure to replace certificate.cer with the name of your .cer file. Change privatekey.key with the name of your private key and change the name of the certificate.pfx with the name you want for the .pfx file that is generated from the command.

Once you run the command you should see the new pfx file in your directory folder.

Here’s another link if you want to convert your new pfx certificate to pem.

About Admin

IT Director in Austin TX • Husband & Father • Apple and Linux aficionado • Passionate about connecting w/ & supporting educators to improve teaching and learning.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *