9

I recently came across a problem generating self-signed certificates in an automated fashion. Anytime I run makecert.exe I get a pop-up window for a password for the certificate. However, these certificates will never be distributed, so I don't need a password or anything.

How can I get makecert.exe to work without requiring a GUI?

If it helps, my command line takes this kind of form:

makecert.exe mycert.cer -r -n "CN=random-hex-number" -$ individual -sv private.pkv -pe -cy end

Earlz
  • 62,085
  • 98
  • 303
  • 499
  • Also, I searched and the only thing I could find(even with this exact title) is something locked away behind a paywall at a certain hyphenated site heh – Earlz Oct 23 '12 at 20:30

2 Answers2

3

I didn't solve the root problem, but found a way to work around it. It only prompts for a password when you don't provide a private key. By generating a private key beforehand and passing it as the PVK, it won't prompt for a password now.

Earlz
  • 62,085
  • 98
  • 303
  • 499
  • 1
    I've got exactly the same problem - I don't suppose you could update your answer and include how you generated the .pvk before hand? – Stephen Edmonds Jan 24 '13 at 11:24
  • @StephenEdmonds I can't remmeber exact commands now, but basically all you need to do is generate a PVK file(without a password) and then pass it to makecert. you'll have to google it – Earlz Jan 24 '13 at 15:54
  • If the .pvk file doesn't exist makecert.exe will create it for you after asking for the password. Therefore, you only need to provide a password on the first execution and then you can use the file that makecert.exe creates going forward. See [this answer](http://stackoverflow.com/a/1690143/24490) for instructions on how to use makecert.exe – Mark Capaldi May 03 '14 at 20:49
-1

Put the certificate and the private keys in a folder. then use the pvk2pfx tool to combine them into one file. Then when your ready to install use @pushd "%~dp0" @start "" /b (command) "%~dp0"

The pushd keeps it the files directory, and start "" /b runs the program without bring up the interface.

NoNo
  • 315
  • 1
  • 4
  • 13
  • This won't work. makecert.exe pops up a regular Win32 graphical window to prompt for a password. This will just cause the program to fail (because it doesn't get a password) – Earlz Oct 23 '12 at 20:47