Friday, 7 October 2011

How to deal with SSL certificates when you didn't originate the request: AKA no private key corresponding to the certificate

Ok, this is a typical "how to fix this again next time" post...

If you find yourself in a situation where you're installing an SSL cert in IIS without having initiated the cert request from that machine but you do have a text file with the RSA private key data and the cert data in it then make sure they're arranged like this:


-----BEGIN RSA PRIVATE KEY-----
<key data here>
-----END RSA PRIVATE KEY-----
---BEGIN CERTIFICATE---
<key data here>
---END CERTIFICATE---

and saved with a .crt file extension.

Then download and install openssl and open a command prompt in the bin directory of openssl.

Then type the following at the command prompt:

openssl pkcs12 -export -in foo.crt -inkey foo.key -out foo.p12
where foo.crt is the path to file mentioned above, and foo.p12 is your output certificate path.

Once you have this you can then open the MMC console, fire up the certificates plugin for local computer and install it to the personal store (set blank passwords if you don't have one).

Done! Restart IIS, apply the SSL cert to the correct site and all should be well!

-rob

No comments: