Click here to Skip to main content
15,860,972 members
Articles / Database Development / SQL Server / SQL Server 2000

4 steps to create free SSL certificate for development

Rate me:
Please Sign up or sign in to vote.
4.61/5 (57 votes)
4 May 2009CPOL5 min read 338.3K   191   34
4 steps to create free SSL certificate for development

4 steps to create free SSL certificate for development

Introduction and Goal

Step 1 :- Locate makecert.exe

Step 2:- Create the certificate

Step 3 :- Assign the certificate to the site

Step 4:- Test the site

Step 5 :- Find a nice restaurant

SSL diagnostic tool

Introduction and Goal
 

There are times where we would like to have SSL enabled in our development environment. SSL certificates needs to be bought from places like Thawte, Verisign, GeoTrust etc. Typical cost of SSL certificate is shown below.
 

Description

Certificate

Setup Fee

Recurring Fee

Total

Month 1

$27.95

$25.00

$9.00

$61.95

Every quarter

$0.00

$0.00

$9.00

$9.00

Once every 12 months

$27.95

$0.00

$0.00

$27.95

This means you also need to buy SSL certificate for your development server. This cost can double if you also setup of development and testing environment. So this article will save you 100$ atleast . Microsoft has provided ‘makecert.exe’ tool which helps us to create test certificates for our development environment.

Now a days I am distributing my 400 questions and answers eBook which covers major .NET related topics like WCF,WPF,WWF,Ajax,Core .NET,SQL Server,Architecture and lot lot more. I am sure you will enjoy this eBook.
http://www.questpond.com/SampleDotNetInterviewQuestionBook.zip
 

Step 1 :- Locate makecert.exe
 

The first thing is to locate makecert.exe. You can get the same from “C:\Program Files\Microsoft Visual Studio 8\Common7\Tools\Bin” or you can also get it from windows SDK.

Let’s run through what is “makecert.exe” and the explanation of different parameters. I admit this section I have shamelessly copied from http://msdn.microsoft.com/en-us/library/dd434713.aspx 

MakeCert (Makecert.exe) is a command-line tool that creates an X.509 certificate that is signed by a system test root key or by another specified key. The certificate binds a certificate name to the public part of the key pair. The certificate is saved to a file, a system certificate store, or both.

Below is a detail list of how to use make cert
 

MakeCert [/b DateStart] [/e DateEnd] [/m nMonths] [/n "Name"] [/pe] [/r] [/sc SubjectCertFile] [/sk SubjectKey] [/sr SubjectCertStoreLocation] [/ss SubjectCertStoreName] [/sv SubjectKeyFile] OutputFilePartial list of switches and arguments

/b DateStart
Specifies the start date when the certificate first becomes valid. The format of DateStart is

mm/dd/yyyy.
If the /b switch is not specified, the default start date is the date when the certificate is created.

/e DateEnd
Specifies the end date when the certificate’s validity period ends. The format of DateEnd is

mm/dd/yyyy.
If the /e switch is not specified, the default end date is 12/31/2039.

/m nMonths

Specifies the number of months starting from the start date during which the certificate will remain valid.

/n "Name"
Specifies a name for the certificate. This name must conform to the X.500 standard. The simplest method is to use the "CN=MyName" format.
If the /n switch is not specified, the default name of the certificate is "Joe's Software Emporium".

/pe
Configures MakeCert to make the private key that is associated with the certificate exportable.

/r
Configures MakeCert to create a self-signed root certificate./sc SubjectCertFile
Specifies the subject's certificate file name along with the existing subject public key that is used.

/sk SubjectKey
Specifies the name of the subject's key container that holds the private key. If a key container does not exist, a new key container is created. If neither /sk nor /sv switch is entered, a default key container is created and used by default.

/sr SubjectCertStoreLocation
Specifies the registry location of the certificate store. The SubjectCertStoreLocation argument must be either of the following:
currentUser
Specifies the registry location HKEY_CURRENT_USER.
localMachine
Specifies the registry location HKEY_LOCAL_MACHINE.
If the /r switch is not specified along with the /s switch, currentUser is the default.

/ss SubjectCertStoreName
Specifies the name of the certificate store where the generated certificate is saved.

/sv SubjectKeyFile
Specifies the name of the subject's .pvk file that holds the private key. If neither /sk nor /sv switch is entered, a default key container is created and used by default.
OutputFile
The name of the file in which the generated certificate is saved.
 

Step 2:- Create the certificate
 

The second step is to create the certificate. You can type the below thing through your dos prompt on “C:\Program Files\Microsoft Visual Studio 8\Common7\Tools\Bin”. Please note “compaq-jzp37md0” is the server name so you need to replace with your PC name.
 

makecert -r -pe -n "CN= compaq-jzp37md0 " -b 01/01/2000 -e 01/01/2050 -eku 1.3.6.1.5.5.7.3.1 -ss my -sr localMachine -sky exchange -sp "Microsoft RSA SChannel Cryptographic Provider" -sy 12

If you run the same through your command prompt you should get a succeeded message as shown below.
 

Image 1

 

Step 3 :- Assign the certificate to the site
 

Now it’s time to assign this certificate to your IIS website. So go to IIS properties , click on directory security tab and you should see server certificate tab.
 

Image 2

 

So click on the server certificate tab and you will then be walked through a IIS certificate wizard. Click ‘Assign a existing certificate’ from the wizard.

Image 3

You can see a list of certificates. The “compaq-jzp37md0” certificate is the one which we just created using ‘makecert.exe’.

 

Image 4

Step 4:- Test the site


Now try to test the site without ‘https’ and you will get an error as shown below….That means your certificate is working.
 

Image 5

 

Step 5 :- Find a nice restaurant
 

Now that you have saved 100$ find a nice restaurant to burn it… 
 

SSL diagnostic tool
 

There is a other easy way also using the SSL diagnostic tool. Download this tool from http://www.microsoft.com/downloads/details.aspx?familyid=CABEA1D0-5A10-41BC-83D4-06C814265282&displaylang=en  and create new cert on the IIS application with just a click as shown below.
 

Image 6

Image courtesy :- http://pranas.net/Tutorials/ssl/SSLDiagnostics.htm

For further reading do watch the below interview preparation videos and step by step video series.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Architect https://www.questpond.com
India India

Comments and Discussions

 
GeneralThanks. Pin
zamkinos21-Jun-15 6:04
zamkinos21-Jun-15 6:04 
QuestionGreat information. but i have one question here . Pin
Saravana Kumar Thangavelu17-Feb-15 22:01
Saravana Kumar Thangavelu17-Feb-15 22:01 
QuestionGreat...!!!! Pin
Amol Jadhao26-Feb-14 20:19
Amol Jadhao26-Feb-14 20:19 
QuestionMy Vote Of 4 Pin
Alireza_13626-Dec-12 16:46
Alireza_13626-Dec-12 16:46 
Suggestionuseful for a begineer Pin
baksh28-Nov-12 3:12
baksh28-Nov-12 3:12 
GeneralMy vote of 5 Pin
Martin Lottering27-Aug-12 1:19
Martin Lottering27-Aug-12 1:19 
Questionfeedback Pin
Android Parth20-Mar-12 2:26
Android Parth20-Mar-12 2:26 
GeneralMy vote of 4 Pin
Member 43208446-Jan-12 0:57
Member 43208446-Jan-12 0:57 
GeneralMy vote of 5 Pin
SATYA NARAYAN SAHOO28-Jul-11 7:43
SATYA NARAYAN SAHOO28-Jul-11 7:43 
GeneralMy vote of 5 Pin
Vivek Johari9-Jan-11 4:04
Vivek Johari9-Jan-11 4:04 
GeneralMy vote of 5 Pin
Abdullah Atta19-Nov-10 22:54
Abdullah Atta19-Nov-10 22:54 
GeneralMy vote of 5 Pin
Rudru15-Sep-10 17:58
Rudru15-Sep-10 17:58 
Generalthanks Pin
Brisa Argelia22-Mar-10 8:32
Brisa Argelia22-Mar-10 8:32 
NewsAn easy way to create a self Signed Certificate with OpenSSL Pin
Elmue21-Jul-09 7:09
Elmue21-Jul-09 7:09 
GeneralGenerated on VIsta and exported to Win2003 Pin
valamas24-May-09 1:04
valamas24-May-09 1:04 
GeneralOther ways Pin
User 19428912-May-09 1:20
User 19428912-May-09 1:20 
GeneralRe: Other ways Pin
skantg14-Feb-12 0:11
skantg14-Feb-12 0:11 
GeneralBit Harsh Pin
Tim Grindley12-May-09 1:01
Tim Grindley12-May-09 1:01 
General[Message Deleted] Pin
icestatue4-May-09 2:21
icestatue4-May-09 2:21 
GeneralRe: Completely inaccurate and misleading article. Pin
Shivprasad koirala4-May-09 2:40
Shivprasad koirala4-May-09 2:40 
GeneralRe: Completely inaccurate and misleading article. Pin
Steven Relis21-Jun-09 2:17
Steven Relis21-Jun-09 2:17 
GeneralRe: Completely inaccurate and misleading article. Pin
Michael Janulaitis16-Dec-09 4:39
Michael Janulaitis16-Dec-09 4:39 
GeneralMy vote of 1 Pin
icestatue4-May-09 2:18
icestatue4-May-09 2:18 
GeneralRe: My vote of 1 Pin
senorbadger31-Aug-10 2:00
senorbadger31-Aug-10 2:00 
GeneralReally useful article Pin
saanj3-May-09 23:22
saanj3-May-09 23:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.