This is a useful page for referance on crating a cert on Windows for IIS:
http://www.iis-resources.com/modules/AMS/article.php?storyid=459
SSL is the industry standard encryption protocol used for encrypting sensitive data such as credit card information on pretty much all major ecommerce sites.
The problem is that SSL certificates can be expensive. One of the primary providers, Verisign charges up to $350 for one year. Yes, you have to renew them on a subscription basis as well
Developing a website that uses SSL technology can therefore be expensive. However there is a way to create a self-signed cert. Note that self-sign certs are useless in the real world and should not be used. It will take too long to explain here why but basically SSL certs have to be verified by an authorised provider. And unless you are a large multinational SSL cert issuing company that ain’t you.
So anyway, on to how to create your own. It was something I had to do whilst building an eccomerce site and it took me a while to figure out how to do it so I thought I’d share…
First off, this tutoral is for users running Microsofts IIS on at least Windows XP Pro. The same method will work for Windows 2000 and 2003. You will need a fully patched operating system (which you should have anyway). If you are running Apache (on any platform) this won’t work for you - it also assumes you have IIS installed and working correctly. If you don’t I suggest you read Installing Internet Information Server (IIS) on Windows XP Pro or Installing IIS 6.0 on Windows Server 2003
You need to download a little application from Microsoft called“makecert.exe”
Copy it to the root of your C drive
Now, open a command prompt (Start > Run > type “cmd”)
In the command prompt navigate to the root of C (type “cd..” a few times to move up the directory structure)
Now copy this string into the command prompt:
makecert.exe -a SHA1 -ss my -sr LocalMachine -n “CN=”%ComputerName% -b 01/01/2000 -e 01/01/2050 -eku 1.3.6.1.5.5.7.3.1 -sky exchange -sp “Microsoft RSA SChannel Cryptographic Provider” -sy 12
See that variable %ComputerName%? That will be replaced by the ComputerName environment variable ¡ ie the name of your computer. You could change it to www.yourname.org and it would generate a signed cert for that domain but as I’ve said this is useless ¡ you are only generating a self-signed cert so you can use localhost with SSL
If everything goes according to plan you should see the message “successful”. Great. Now you have to install it.
To check everything has went according to plan you can use the Certificates mmc snapin to view it. To do this:
- start> run > mmc
- File > Add/Remove snap-in
- Select Add and select “Certificates” from the list
- Select “Computer Account” from the options then “Local Computer” then “Finish”
- Close the options panel and hit “ok”
Incidentally you can save the snap in configuration to the Administrative Tool start menu by selecting File > Save As
You should now be able to see the Certificates snap in. Expand it and select Personal > Certificates. If everything has worked properly there should be a personal certificate with the name of your computer in there. If not something has gone wrong and try the above again.
Okay, now to install your cert.
Open IIS and bring up the properties of the website you want to apply the cert to. If you are running XP Pro you will only have one site available anyway. Select the “Directory Security” tab. In the section titled “Secure Communications” select the “Server Certificate” button.
A wizard will popup. Hit “next” then “Assign an existing certificate” You should see the cert you created and viewed using the mmc console. Select it and hit “next” and you should see some info about the cert. Hit “next” again and finish.
Right that’s it ¡ your done! You have installed your certificate. Verify in the website properties that the SSL port is set to 443.
Try accessing the website through ssl ¡ https://localhost/ You will get a security alert, hit yes to proceed and you should see the site loading with the tell-tale padlock in the status bar!