Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Inno Setup, how to import a certificate .cer file?

Can I use Inno Setup to import a .cer file (a certificate)?

How can I do it?

I need to create a certificate installer for Windows XP, Windows Vista and Windows 7.

like image 896
Guilherme de Jesus Santos Avatar asked Oct 05 '12 21:10

Guilherme de Jesus Santos


2 Answers

Actually the CertMgr.exe is not available on all PCs and furthermore it does not appear to be redistributable (as hinted by @TLama); and besides you don't even need it.

CertUtil is available on every Windows machine (that I have tested) and works perfectly:

[Run]
Filename: "certutil.exe"; Parameters: "-addstore ""TrustedPublisher"" {app}\MyCert.cer"; \
    StatusMsg: "Adding trusted publisher..." 
like image 108
SlowLearner Avatar answered Oct 07 '22 11:10

SlowLearner


Add Certmgr.exe and yourcertificate.cer into setup:

[Files]
Source: CertMgr.exe; DestDir: {app}; Flags: deleteafterinstall
Source: yourcertificate.cer; DestDir: {app}; Flags: deleteafterinstall

And in [Run] section, write something like this:

Filename: {app}\CertMgr.exe; Parameters: "-add -all -c yourcertificate.cer -s -r localmachine trustedpublisher"; Flags: waituntilterminated runhidden;
like image 41
SimaWB Avatar answered Oct 07 '22 12:10

SimaWB