How to convert SSL certificate from .pfx format to .pem format

How to convert SSL certificate from .pfx format to .pem format

SSL certificate has to be uploaded in SiteWALL WAF configuration for scanning and blocking SSL based attacks. Sitewall support's certificate import in .pem format.

Follow the below process to convert your SSL certificates format from .pfx to .pem 

1) Download Win32 OpenSSL package for windows --> Link

2) Install the downloaded package in your pc by double clicking on it and complete the installation.

3) Create a folder c:\certs and copy the file SSL certificate yourcert.pfx into the folder c:\certs 

4) Open Run in the start menu and Enter CMD to open the Command prompt

5) In command prompt move to the openssl\bin directory by executing the following command --> cd %homedrive%\OpenSSL\bin

6) Execute the following command to convert your certificate into .pem format --> OpenSSL pkcs12 -in c:\certs\yourcert.pfx -out c:\certs\yourcert.pem –nodes
 


Command

openssl pkcs12 -in "<filepath>" -in "<file_path>" -export -out "C:\cert\<filename>.pem
Eg: assuming your certificate filename is mycert.pfx:
openssl pkcs12 -in "C:\cert\mycert.pfx" -out "C:\cert\mycert.pem" -nodes

Also, for specific certs and key, please follow below commands:
For root certificate: openssl pkcs12 -in yourfile.pfx -cacerts -nokeys -out rootcert.pem
For bundled certificate: openssl pkcs12 -in yourfile.pfx -clcerts -nokeys -out certificate.pem
For Private Key:  openssl pkcs12 -in yourfile.pfx -nocerts -out privatekey.pem
For Private key from in plain text format:  openssl rsa -in privatekey.pem -out plain_key.pem
Copy the generated key and bundled certificate in .pem format and upload on https://admin.sitewall.net Settings>> Add certificate.