Skip to content

Instantly share code, notes, and snippets.

@andreasbotsikas
Created February 10, 2015 14:10
Show Gist options
  • Save andreasbotsikas/ddee90452b9905983bc6 to your computer and use it in GitHub Desktop.
Save andreasbotsikas/ddee90452b9905983bc6 to your computer and use it in GitHub Desktop.
Certificates
@ECHO OFF
@rem Check for visual studio tools if not already loaded
if defined VCINSTALLDIR goto GenerateCerts
@rem Ensure that visual studio is available
if not defined VS120COMNTOOLS goto msbuild-not-found
if not exist "%VS120COMNTOOLS%..\..\vc\vcvarsall.bat" goto msbuild-not-found
call "%VS120COMNTOOLS%..\..\vc\vcvarsall.bat"
@rem Check that vs is properly loaded
if not defined VCINSTALLDIR goto msbuild-not-found
:GenerateCerts
@REM Generate a CA
makecert -r -pe -n "CN=ca.localhost" -e 10/25/2985 -ss my -sr CurrentUser -sky exchange -sp "Microsoft RSA SChannel Cryptographic Provider" -sy 12
@REM Generate sts signing certificate
makecert -pe -n "CN=localhost" -e 01/01/2982 -is my -ir CurrentUser -in "ca.localhost" -ss my -sr CurrentUser -sky exchange -sp "Microsoft RSA SChannel Cryptographic Provider" -sy 12
@REM In order to export the newly created certificates
@REM Run mmc.exe
@REM File-> Add or Remove Snap-ins
@REM Select Certificates from the left and then My User account (if above is CurrentUser)
@REM They should be in the Personal->Certificates folder.
pause
exit /B 0
:msbuild-not-found
echo Visual studio tools were not found! Please check the VS100COMNTOOLS path variable
exit /B 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment