How to convert PEM certificate to PFX and import to IIS

How to convert PEM certificate to PFX and import to IIS

Please follow the below steps to convert a PEM certificate to PFX.

 

  1. Install OpenSSL. Please refer to this URL for Windows- https://www.xolphin.com/support/OpenSSL/OpenSSL_-_Installation_under_Windows

 

    2. Open the command prompt and change the directory to OpenSSL

 

Once you are in the OpenSSL folder, please execute the below command. This is to convert the PEM file to the key file. Make sure you are giving correct certificate paths.

 

openssl rsa -in E:\certificate\mycertificate.pem -out E:\certificate\private.key

 

 

It will ask for the passphrase, please type it and hit enter. Once it is successful you can see the below message.

 

 

 

    3. Once you have the key file then you can convert the PEM to PFX using the below command,

         openssl pkcs12 -export -out E:\certificate\mycertificate.pfx -inkey E:\certificate\private.key -in E:\certificate\mycertificate.pem -certfile E:\certificate\mycertificate.pem

 

      #privatekey – Which we have created in step2

      #pfx – output format

      #pem – source format

      

 

      Hit enter and it will ask you to provide an export password. Please note this password somewhere for future reference.
     

      Confirm the password

      

 

      Once confirmed you can see the pfx file in the output path.

     

  1. Import the PFX to IIS.
  1. Open IIS
  2. Open Server Certificates
  3. Click on import

      

  1. Enter the password which you have given in step 3 

      

  1. Once imported you can see the certificate in IIS. 

      

  1. Go to default web site-> Bindings 

      

  1. Add binding

      

  1. Choose Type, the SSL certificate and enter the host name. 

      

  1. Click on OK

    Now the server will be reachable with HTTPS