Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / web / IIS

Create self signed key...the easy way

5.00/5 (1 vote)
30 Jan 2010CPOL 9.4K  
This is a short bat program to create a self signed key (with private key), if you call the bat makecertif.bat, to create a key named ServerKey you need to type :makecertif.bat ServerKey, it will create ServerKey.pfx, a certificate with a private key you can use to secure a web site in...
This is a short bat program to create a self signed key (with private key), if you call the bat "makecertif.bat", to create a key named ServerKey you need to type :

makecertif.bat ServerKey, it will create ServerKey.pfx, a certificate with a private key you can use to secure a web site in IIS, or to secure a WCF service or to use to authenticate a client.

You need to put the script in Windows SDK bin directory (mine is C:\Program Files\Microsoft SDKs\Windows\v7.0\Bin).

VB
makecert -r -pe -n "CN=CompanyXYZ Server" -b 01/01/2007 -e 01/01/2012 -sky exchange %1.cer -sv %1.pvk
pvk2pfx.exe -pvk %1.pvk -spc %1.cer -pfx %1.pfx
del %1.cer
del %1.pvk

License

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