Short Walks - MakeCert is dead - long live New-SelfSignedCertificate

December 26, 2018

If you wanted to produce a self-signed certificate, the way to do this used to be makecert. It was part of the Windows SDK. Since Microsoft removed the Visual Studio Command Prompt (not sure why), you would run it like so:

“C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\Tools\vsdevcmd”

And then you could call MakeCert; for example:

makecert -r -pe “CN=testcert” -b 12/12/2018 -e 12/12/2021 -sky signature -a sha256 -len 2048 -ss my -sr LocalMachine

However, one thing that you’ll notice now if you visit the MakeCert page is that it’s deprecated. The new way is a Powershell command; which can be used like so:

New-SelfSignedCertificate -Subject “CN=testcert” -KeySpec “Signature” -CertStoreLocation “Cert:\CurrentUser\My”

Profile picture

A blog about one man's journey through code… and some pictures of the Peak District

© Paul Michaels 2024