Exporting SSL certificate from IIS to Apache

I was recently required to implement SSL on a Apache web server to which I currently held a SSL certificate for the namespace which was generated using IIS.

So rather than purchasing an additional certificate, I was able to convert the original SSL certificate from IIS into a the format required for Apache using OpenSSL, as below:

1) Open the Certificates snap-in for the computer account of local machine containing the SSL certificate.

2) Browse to Personal, highlight your certificate you wish to convert and select Export.

3) To extract the private key and the certificate from the from the exported .pfx file, perform the following:

openssl pkcs12 -in <filename>.pfx -nocerts -out key.pem

4) From the generated .pem file we will be required to remove the password:

openssl rsa -in <filename>.pem -out <filename>.key

5) Now will we will need to export the certificate:

openssl pkcs12 -in <filename>.pfx -clcerts -nokeys -out cert.pem

Within the key.pm file this will contain RSA private key, copy and save this with the .key file extension and the cert.pem file will contain the certificate, copy and save this with the .cert file extenstion.

You should now be able to use the SSL certificate on the Apache web server.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s