in

code for eternity !!!

community website for .net freaks ;-)

Technology

Creating Self Signed SSL Certificates on IIS 6.0 and Windows Server 2003

If you need to deploy and test your code in SSL environment on IIS 6.0 and Windows Server 2003, but you do not have a valid SSL certificate on your development / test server issued by a trusted third party Certificate Authority (since it costs money), you can easily do so by creating a self signed test certificate using a tool called SelfSSL which comes with IIS 6.0 Resource Kit Tools. SelfSSL is a console line application which is free to use :-). You can download IIS 6.0 Resource Kit Tools from here.

After downloading and executing this kit, make sure you either choose Complete installation option or if you choose Custom installation option, make sure you have selected the SelfSSL feature. See below step by step screen shots for the Custom installation option.

Step 1: Click Next.

Step 2: Choose I Agree and click Next.

Step 3: Enter appropriate details and click Next.

Step 4: Choose Custom installation option if you just want to install SelfSSL else choose Complete installation option to install all features and click Next.

Step 5: Enter the installation location and click Next.

Step 6: Select SelfSSL and click Next.

Step 7: Review settings and click Next.

Step 8: Click Finish.

Once you have successfully installed, click on Start > All Programs > IIS Resources > SelfSSL > SelfSSL to run the SelfSSL utility. On doing so, you should see the command prompt along with help instructions (see below screen shot).

If you simply type selfssl.exe and press enter, it would use the default settings to install the SSL certificate which are equivalent to:

/N:CN=<YOUR COMPUTER NAME> (common name of the certificate)
/K:1024 (key length of the certificate)
/V:7 (validity of the certificate in days)
/S:1 (ID of the site to which the certificate needs to be installed)
/P:443 (SSL port)

Type selfssl.exe and press enter, then type y and press enter again to confirm the installation (see screen shot below).

The most important option here is the site id parameter and SelfSSL uses the site id 1 by default which maps to "Default Web Site".

To find the site id for any website in IIS 6.0 you can simply execute iisweb.vbs /query "<NAME OF THE WEBSITE>" from command prompt (see below screen shot).

In the above screen shot, you can clearly see that I executed iisweb.vbs /query "Default Web Site" to find the site id for "Default Web Site" which is "W3SVC/1", however we are only interested in the text which follows "W3SVC/" which is "1".

Suppose you had another website by the name "RajTest" and you wanted to install a test SSL certificate having common name "RajTestCertificate" valid for 10 days to "RajTest" on port 444, you would first find the site id for "RajTest" by executing the following command at command prompt: iisweb.vbs /query "RajTest". Once you know the site id for "RajTest" (lets assume it was "1234567") you would execute the following command at the SelfSSL command prompt: selfssl.exe /N:CN=RajTestCertificate /V:10 / S:1234567 /P:444

Cheers,
Raj

~~~ CODING FOR ETERNITY !!! ~~~


I would really appreciate votes / kicks for this blog post if you found it useful ;-)

  kick it on DotNetKicks.com     Receive Email Updates


Comments

 

DotNetKicks.com said:

You've been kicked (a good thing) - Trackback from DotNetKicks.com

February 22, 2008 1:45 PM
 

Nat said:

Very helpful little guide just to setup and test.

February 22, 2008 9:56 PM
 

raj said:

Hi Nat,

Thanks for your kind words :-)

Cheers,
Raj

~~~ CODING FOR ETERNITY !!! ~~~

February 23, 2008 6:09 AM
 

John S. said:

There's a bug in SelfSSL that causes issues if you try to use it on multiple sites. The bug has been fixed but its not included in SelfSSL, but instead in SSLDiag.

See: blogs.msdn.com/.../SelfSSL-Bug-with-websites.aspx

February 23, 2008 10:49 AM
 

John S. said:

SelfSSL is nice unless you plan to use it with multiple sites, in which case there is a bug that will break SSL on any existing site when you add it to a second site. The bug has been fixed but SelfSSL could not be updated. Instead the fix was included in SSLDiag

See: blogs.msdn.com/.../SelfSSL-Bug-with-websites.aspx

February 23, 2008 10:51 AM
 

CRM SDK said:

Self Signed SSL Certificate

February 23, 2008 2:16 PM
 

?????????? ?????? ?????????? ?????? » Blog Archive » SSL ?????????? ?????????? ??????????! said:

Pingback from  ?????????? ?????? ?????????? ??????  &raquo; Blog Archive   &raquo; SSL ?????????? ?????????? ??????????!

February 25, 2008 12:48 AM
 

Nour said:

Nice Post.

March 4, 2008 8:56 AM
 

Benjamin said:

I have used this tool before, but I am unable to determine why it is not working for me now. When I go to the site on SSL the website does not come up. Comes up with site could not be found

March 4, 2008 3:57 PM
 

raj said:

Hi Nour,

Glad you found this post useful ;-)

Cheers,
Raj

~~~ CODING FOR ETERNITY !!! ~~~

March 5, 2008 1:35 AM
 

raj said:

Hi Benjamin,

Are you using SelfSSL for more than 1 website? If yes, there is a bug with SelfSSL which does not let it support more than 1 website. See above comments by John S for more details.

Cheers,
Raj

~~~ CODING FOR ETERNITY !!! ~~~

March 5, 2008 1:37 AM
 

http://codeforeternity.com/blogs/technology/archive/2008/02/15/creating-self-signed-ssl-certificates-on-iis-6-0-and-windows-server-2003.aspx said:

March 25, 2008 1:24 AM
 

emaint said:

helpfull

April 6, 2008 4:59 AM
 

Mangesh Patil (PA) said:

Cheers Mate, very interesting blog, keep posting.

TC

Mangesh

May 6, 2008 7:13 AM
 

raj said:

Hi Mangesh,

Glad you found this blog useful. Would strive to post interesting .NET stuff in my free time.

Cheers,

Raj

~~~ CODING FOR ETERNITY !!! ~~~

May 6, 2008 8:11 AM
 

Self-signed SSL certs on IIS 6 said:

Pingback from  Self-signed SSL certs on IIS 6

August 26, 2008 2:04 PM

Leave a Comment

(required)  
(optional)
(required)  
Add
Powered by Community Server (Non-Commercial Edition), by Telligent Systems