I’ve been continuously frustrated when working with the IIS tools for managing SSL certificates. There are issues when the two servers you are using are on different versions of Windows, or are on different Active Directory Domains. The best way that I have found to get around all of this is to export the certificate as a .pfx file and copy the file over to the other machine. This option can be hard to find because depending on how the cert was created and your version of Windows you may or may not have the option to export a .pfx from within the IIS admin tool.
There is a little known alternative method for exporting the SSL certificate that can help you get around these problems, so I’m going to give you a quick walkthrough tutorial about how to do this:
First, you will need to open the Certificates MMC snap-in. Click Start > Run and then type MMC and click Ok. Then click on File > Add/Remove Snap-in. In the window that pops up click on Add, and scroll down until you see the Certificates snap-in (not the Certificate Templates, or Certification Authority ones), then highlight it and click Add. A new window will ask you if you want to manage certificates for your user account, a service account, or the computer account. Choose Computer account and click Finish. Then click Close and Ok, etc. until you are back to the MMC main screen.
You will now see a tree menu that has Console Root at the top and “Certificates – Current User” beneath that. Beneath here you will see a number of folders. The certificate you are hoping to export could be in a number of places depending on your situation. The certs that I wanted to move were created by the Microsoft SelfSSL tool (which I will be covering in a later post) and they appeared under Trusted Root Certification Authorities > Certificates. Find the certificate you are looking for, right click and go to All Tasks > Export. You will be asked if you want to export the Private key, and you need to say yes in order to have a fully functioning cert on your new server that you want to serve web pages with. If the Yes option is ghosted out then that means that the MMC can’t find the private key. This happens with certs that you have installed from visiting web pages with Internet Explorer, and similar things. If the cert was one that you purchased from someone like Thawte or Verisign, or one that you created with SelfSSL it should be fine. After you click next it will ask you about the format you want to export. You want to choose .pfx, and make sure that Enable Strong Protection is checked and the other two are not. Click next, and it will ask you to choose a password. This is used to encrypt the cert, and you will be asked for this when you import the cert on the new machine. Enter a password and click next. Choose a file name and location and click next, then click Finish. If all goes well then you should see a pop up that says the export was successful.
Now use your favorite method to move the .pfx file over to the other server and use the IIS admin tool to import the key. Open the IIS manager, navigate to the web site that you want to import the cert into, right click and choose Properties, click on the Directory Security tab, click “Server Certificate…”, click next, choose Import a certificate from a .pfx file and click next, chose the path of the .pfx file that you copied over and click next, enter the password you choose when you exported it and click next, choose the port that IIS should use to serve SSL (this will almost always be 443) and click next, click next, click finished.
If this worked then when you go back to the “Directory Security” tab the “View Certificate” button will no longer be ghosted out. You can test to see of IIS is serving pages securely by opening up any web page in your site and add an “s” in front of the http. For example http://www.mysite.com/default.aspx would become https://www.mysite.com/default.aspx. If your browser shows the little lock icon (or whatever your particular browser shows for secure pages) then you are good to go. In Internet Explorer this will be near the bottom right of the browser window. If you mouse over the lock it should say “SSL Secured (128 bit)”, and if you double click on it, it should show you the details of the certificate that you installed on your server.
I hope that helps! In another article I’ll be explaining how you can create and install your own certificates for IIS using a tool called SelfSSL.