A while ago I registered Rapid SSL certificate. I forgot to check what OS was this machine running on. In most cases I was registering certificates for Linux/UNIX machines, so why to do otherwise :). So I payed for certificate, get my csr and all and then tried to ssh to machine to install it. Nothing! WTF!? Then I realized that machine runs on Windows server and not Linux/UNIX.
Certificate for Linux is a little different that the one for Windows. Also install procedure is different. So if you searching for how to transfer and find this article, than I’m sure that you know how to install certificate on Linux or Windows machine. Otherwise there are a million tutorials that you can find on google. I will explain how to transfer your certificate from Linux to Windows.
Don’t worry. It can be solved easily. Just follow steps below:
- Realize that you screwed up, and that next time you must be a little more careful.
- Log in your Linux machine. First, you need to create .pem file. This file must contain private key and certificate hash (.key and .crt). Open your favorite text editor (vi) and paste the content of your key and certificate file in one file. You must paste it in that order with a line break. First key and then crt. Save this file as mybad.pem.
- On IIS server you’ll need a file in p12 format. You can simply create p12 file by execute this command on your Linux machine:
openssl pkcs12 -export -in mybad.pem -out mybad.p12 “I won’t screw my certificate again” //replace with your attributes :)
You’ll have to define password for your .p12 file. Remember this password because you’ll need it later!
- Transfer your freshly created mybad.p12 file on to your Windows machine.
- In this step all the magic happens. You’ll import your mybad.p12 in your IIS. On Windows machine, find properties of your website in IIS and then go into Directory Security tab. Click on button Server Certificate and then select option Import. Than will asked you to find file. You need to change scope to All files as otherwise, mybad.p12 file won’t be visible. When you’ll select mybad.p12 file, you’ll be asked to enter password. Enter the password that you defined in step 3. This is it! You transferred SSL certificate from Linux to Windows.