Click here to Skip to main content
11,630,646 members (75,961 online)
Click here to Skip to main content

4 steps to create free SSL certificate for development

, 4 May 2009 CPOL 200.6K 182
Rate this:
Please Sign up or sign in to vote.
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.
 

 

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.
 

 

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.

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

 

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.
 

 

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 courtesy :- http://pranas.net/Tutorials/ssl/SSLDiagnostics.htm

License

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

Share

About the Author

Shivprasad koirala
Architect http://www.questpond.com
India India

I am an ex-Microsoft MVP for ASP/ASP.NET and currently a CEO of a small
E-learning company in India. We are very much active in making training videos, writing books and corporate trainings. Do visit my site for 
.NET, C#, Design Pattern, WCF, Silverlight, LINQ, ASP.NET, ADO.NET, SharePoint, UML, SQL Server  training 
and Interview questions and answers


You may also be interested in...

Comments and Discussions

 
GeneralThanks. Pin
zamkinos21-Jun-15 6:04
memberzamkinos21-Jun-15 6:04 
QuestionGreat information. but i have one question here . Pin
saravanakumart17-Feb-15 22:01
membersaravanakumart17-Feb-15 22:01 
QuestionGreat...!!!! Pin
Amol Jadhao26-Feb-14 20:19
memberAmol Jadhao26-Feb-14 20:19 
QuestionMy Vote Of 4 Pin
Alireza_13626-Dec-12 16:46
memberAlireza_13626-Dec-12 16:46 
Suggestionuseful for a begineer Pin
baksh28-Nov-12 3:12
memberbaksh28-Nov-12 3:12 
GeneralMy vote of 5 Pin
Martin Lottering27-Aug-12 1:19
memberMartin Lottering27-Aug-12 1:19 
Questionfeedback Pin
Android Parth20-Mar-12 2:26
memberAndroid Parth20-Mar-12 2:26 
It was very helpful to me..thanks !
GeneralMy vote of 4 Pin
Member 43208446-Jan-12 0:57
memberMember 43208446-Jan-12 0:57 
GeneralMy vote of 5 Pin
SATYA NARAYAN SAHOO28-Jul-11 7:43
memberSATYA NARAYAN SAHOO28-Jul-11 7:43 
GeneralMy vote of 5 Pin
Vivek Johari9-Jan-11 4:04
memberVivek Johari9-Jan-11 4:04 
GeneralMy vote of 5 Pin
AbdullahSoft19-Nov-10 22:54
memberAbdullahSoft19-Nov-10 22:54 
GeneralMy vote of 5 Pin
Rudru15-Sep-10 17:58
memberRudru15-Sep-10 17:58 
Generalthanks Pin
Brisa Argelia22-Mar-10 8:32
memberBrisa Argelia22-Mar-10 8:32 
NewsAn easy way to create a self Signed Certificate with OpenSSL Pin
Elmue21-Jul-09 7:09
memberElmue21-Jul-09 7:09 
GeneralGenerated on VIsta and exported to Win2003 Pin
valamas24-May-09 1:04
membervalamas24-May-09 1:04 
GeneralOther ways Pin
Wiebe Tijsma12-May-09 1:20
memberWiebe Tijsma12-May-09 1:20 
GeneralRe: Other ways Pin
skantg14-Feb-12 0:11
memberskantg14-Feb-12 0:11 
GeneralBit Harsh Pin
Tim Grindley12-May-09 1:01
memberTim Grindley12-May-09 1:01 
General[Message Deleted] Pin
icestatue4-May-09 2:21
membericestatue4-May-09 2:21 
GeneralRe: Completely inaccurate and misleading article. Pin
Shivprasad koirala4-May-09 2:40
memberShivprasad koirala4-May-09 2:40 
GeneralRe: Completely inaccurate and misleading article. Pin
Steven Relis21-Jun-09 2:17
memberSteven Relis21-Jun-09 2:17 
GeneralRe: Completely inaccurate and misleading article. Pin
mjanulaitis123416-Dec-09 4:39
membermjanulaitis123416-Dec-09 4:39 
GeneralMy vote of 1 Pin
icestatue4-May-09 2:18
membericestatue4-May-09 2:18 
GeneralRe: My vote of 1 Pin
senorbadger31-Aug-10 2:00
membersenorbadger31-Aug-10 2:00 
GeneralReally useful article Pin
saanj3-May-09 23:22
membersaanj3-May-09 23:22 
GeneralGood one Pin
Abhishek Sur3-May-09 22:30
memberAbhishek Sur3-May-09 22:30 
GeneralMy vote of 2 Pin
Talking Clipboard3-May-09 21:22
memberTalking Clipboard3-May-09 21:22 
GeneralRe: My vote of 2 Pin
Shivprasad koirala3-May-09 22:07
memberShivprasad koirala3-May-09 22:07 
GeneralRe: My vote of 2 Pin
Alexey Prosyankin4-May-09 2:37
memberAlexey Prosyankin4-May-09 2:37 
GeneralRe: My vote of 2 Pin
Shivprasad koirala4-May-09 2:45
memberShivprasad koirala4-May-09 2:45 
GeneralRe: My vote of 2 Pin
Shivprasad koirala4-May-09 2:52
memberShivprasad koirala4-May-09 2:52 
GeneralRe: My vote of 2 Pin
supercat94-May-09 12:16
membersupercat94-May-09 12:16 
GeneralRe: My vote of 2 - Not signed by Root CA Pin
ptmcomp12-May-09 7:48
memberptmcomp12-May-09 7:48 

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

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

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.150723.1 | Last Updated 4 May 2009
Article Copyright 2009 by Shivprasad koirala
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid