Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Automate makecert password

I am using the following command to generate a certificate:

makecert.exe" –sv cnName.pvk -n "cn=cnName" cnName.cer -r -eku 1.3.6.1.5.5.7.3.1
pvk2pfx -pvk cnName.pvk -spc cnName.cer -pfx cnName.pfx -po <password>

Both these commands pop up a password window to be entered. Is there a way to automate this, so there is no popup window?

like image 259
Romonov Avatar asked Oct 13 '15 23:10

Romonov


2 Answers

makecert.exe only prompts for a password when you don't provide a private key.
Create a private key and the popup won't be displayed.


To create a private key:

1 - Install OpenSSL if it is not installed already.

2 - openssl genrsa -out pvt.key 2048

like image 82
Pedro Lobito Avatar answered Oct 19 '22 18:10

Pedro Lobito


Instead of specifying "-sv" option, if we specify the "-sk" option there is no prompt for any password. Here as per the documentation from Microsoft, "sk" option looks for container where the private keys can be stored whereas "sv" looks for file and creates the file if not exist.

The command will change as follows

"makecert.exe" –sk "c:\{any location}" -n "cn=cnName" cnName.cer -r -eku 1.3.6.1.5.5.7.3.1

This information is collected as per the documentation given by Microsoft on "makecert" command from below link

https://learn.microsoft.com/en-us/windows-hardware/drivers/devtest/makecert

like image 1
Mayank Maria Avatar answered Oct 19 '22 16:10

Mayank Maria