A reader recently asked about enabling SSL for a web application, but without the hassle of applying for a verified certificate. This article will outline the process to enable HTTPS on a Windows XP machine, but the process of creating a self-signed certificate is applicable to just about any version of Windows.
What is a certificate?
A certificate is a file that contains a set of instructions, which are read by a client computer, outlining the process of properly encrypting and decrypting data. The certificate is unique to a website, and ensures the security of the client’s data to and from a server.
To increase security, these certificates are often signed by a third party, called a certificate authority, who verifies that the server is who they say they are. Unfortunately, the process of obtaining a third-party verification costs money and takes time.
Why self-sign?
If you don’t want to pay money to have an official SSL certificate, but you still want the security of an encrypted HTTP session, then you can self-sign the certificate. Self-signing simply means that instead of having a third-party verify the integrity of the server/certificate, you’re doing it yourself. A client computer won’t recognize your self-signature as being reliable, but at least you’ll have encrypted data.
Obviously if you’re running a full-scale, professional website you’ll want to get a third-party verification, but if you’re running small-scale web applications off a personal computer for your own use, then there’s no reason to spend money for verification. Unfortunately, Windows XP doesn’t make it easy to self-sign your certificate to enable SSL on your local machine.
How to create your own SSL certificate
cd c:\OpenSSL\bin
openssl genrsa -des3 -out CA.key 1024
(Note that you will be asked for a pass phrase — you’ll have to make one up that is 4-511 character is length)
openssl req -new -key CA.key -x509 -days 1095 -out CA.cer
(Note that you will have to enter the pass phrase from the previous step. In addition, it will ask you the same questions that were asked from IIS — fill in the same answers or hit enter for default responses)
openssl x509 -req -days 730 -in c:\certreq.txt -CA CA.cer -CAkey CA.key -CAcreateserial -out SelfSignedCert.cer
(Note that you will have to enter the pass phrase from the previous two steps again)
A note about the warning to clients
Whenever a browser goes to a self-signed HTTPS site, they will receive a notification that the security of the site cannot be validated. This warning makes sense because you signed the certificate, and you are not one of the few certificate authorities. Regardless, be sure to “accept” the warning and the site’s certificate — the web session will still be securely encrypted.

Conclusion
Once Windows Server 2003 came out, Microsoft realized how essential it was to be able to SSL on the fly, so they made it much, much easier to self-sign certificates. For those still using XP, however, you’re stuck using OpenSSL to self-sign certificates.
Keep in mind that this process is really only meant for personal applications — users don’t like to get unfriendly “unknown certificate” messages when they visit your site.
June 12th, 2008 at 1:05 pm
Hi,
Quite useful..but how to create client certificate.
[Reply]