To convert SSL certificate from formats .cer/.crt to .pfx
Follow the steps below on windows server
1. Download the OpenSSL from this Official Website
https://www.openssl.org/source/ OR Download the
OpenSSL for Windows installation package.
2. Install OpenSSL on Windows Server
Double-click the installation file.
If the following error message appears as "Missing: Microsoft Visual C++ 2008 Redistributable ", you should install Microsoft Visual C++ 2008 Redistributables. The installation file can be downloaded
here. Double-click the installation file and click on
Next
- Click on I accept the agreement, followed by Next.
- Leave the default installation path (C:\OpenSSL-Win32) and click on Next.
- Leave the default Startmenu folder(OpenSSL) and click on Next
- Leave the The Windows system directory and click on Next.
- Click on Install.
- Click on Finish once the installation has been completed.
OpenSSL for Windows has now been installed and can be found as OpenSSL.exe in C:\OpenSSL-Win32\bin\. Always open the program as Administrator.
OR
Open cmd prompt as administrator and access the OpenSSL directory to use OpenSSL commands.
How to convert .crt/.cer to PFX : ( You need Private Key to convert SSL to .PFX)
openssl pkcs12 -export -in certName.cer -inkey privatekey.key -out certificate.pfx
You will be prompted to type the import password.
To export Private Key in text format from .PFX. First convert .PFX certificate to .PEM format using following openssl cmd
openssl pkcs12 -in D:\www.certName.co.in.pfx -nocerts -out www_certName.pem -nodes
Then export Private Key from .PEM format
openssl rsa -in www_certName.pem -out www_certName_co_in.key