Convert a .pfx certificate to a .pem

As is often the case different bits of software require things in different formats and you might find yourself with a pfx file when you really need a pem file.

It is pretty simply to convert a pfx into a pem with open SSL. Assuming you are on windows download and install the win32 OpenSSL package from http://www.slproweb.com/products/Win32OpenSSL.html

Then you can simply open a command window and change directory to the location of your OpenSSL install. (by default C:\OpenSSL-Win32\bin)

Then execute the following command: (where C:\cert\certfile.pfx is your source pfx file and C:\cert\certfile.pem is the desired name and location of the exported pem file.)

C:\OpenSSL-Win32\bin>openssl pkcs12 -in C:\cert\certfile.pfx -out C:\cert\certfile.pem -nodes

Note: you will be prompted to enter an import password if the pfx file is password protected.

If all is well you should see “MAC verified OK” and the .pem file will be written.

pfx to pem with openssl screenshot