Why do I keep getting a failed when trying to make a .cer for testing?

26

I'm trying to make a certificate for testing and I am using this site How to: Create Your Own Test Certificate as a tutorial on how to but when it comes time to enter in the password after you create the password it says failed in the command prompt why is that?

What I've done:

First, I open a command prompt and type in:

  cd C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin

Second, I type in

  makecert -sv myPrivateKeyFile.pvk -n "TestCert" myCertFile.cer -b 01/01/2011 -e 01/01/2015 -r

Then I create the password then enter the password on the sencond pop up box and then it says failed in command prompt

When I enter in this again, the popup is asking for the password pops up first this time, and I enter it in and it says:

Error: CryptCertStrToNameW failed => 0x80092023 (-2146885597)

    makecert -sv myPrivateKeyFile.pvk -n "TestCert" myCertFile.cer -b 01/01/2011 -e 01/01/2015 -r
certificate
ssl-certificate
asked on Stack Overflow Feb 29, 2012 by Shredder2500 • edited Dec 16, 2018 by Peter Mortensen

5 Answers

70

I solved the problem by running the program as an administrator, but I had to change also the name of certificate in a LDAP style like this (CN=...):

makecert -sv myPrivateKeyFile.pvk -n "CN=TestCert" myCertFile.cer -b 01/01/2011 -e 01/01/2015 -r
answered on Stack Overflow Sep 15, 2013 by Renzo Ciot • edited Sep 15, 2013 by kleopatra
5

This was a bit of a shotgun-debug for me. I started with this after reading the makecert guide:

makecert.exe /b 01/01/2014 /e 01/01/2114 /len 256 /m 1200 /n "CN=In-House-Software" /pe /r /sr localMachine Test_Cert.cer

There's two error-causing flaws here:

  1. /e and /m likely are not supposed to overlap; seems kind of obvious, but they didn't document it or create an expressive error message for it.
  2. /len 256 was an invalid value -- too low. This also didn't seem too obvious/documented/expressed in a good error message. 512 did work. I didn't bother finding the floor-value, but by default 1024 is used.

I ended up using this with success:

makecert.exe /b 01/01/2014 /e 01/01/2114 /len 512 /pe /r /n "CN=In-House-Software" /sr localMachine Test_Cert.cer

answered on Stack Overflow Oct 7, 2016 by kayleeFrye_onDeck
4

The reason why I was getting this error is, because I didn't right click on cmd when I ran it. So when you have this problem you need to right click on cmd and then run as administrator and see if that fixes your problem as it did mine.

answered on Stack Overflow Mar 5, 2012 by Shredder2500 • edited Dec 16, 2018 by Peter Mortensen
3

I also received this error when I specified the CA name for a self-signed cert, in other words, if you specify the '-cy authority' and the '-r' options, then DON'T specify the CA name explicitly in the name via the -n option.

answered on Stack Overflow Feb 10, 2016 by david.barkhuizen • edited Feb 10, 2016 by david.barkhuizen
0

For some reason I couldn't run makecert properly from Dropbox folders. So try moving it to a solid disk like C:\ and try again.

answered on Stack Overflow Jul 20, 2015 by Armand G. • edited Dec 16, 2018 by Peter Mortensen

User contributions licensed under CC BY-SA 3.0