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.
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..."
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;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With