31

我刚刚从 Comodo 购买了代码签名证书。我已经构建了一个小型 MS Access 数据库,我想使用 Inno Setup Installer 进行部署。该脚本运行良好,但我对代码签名完全陌生。

我该如何签署我的安装文件?我需要外部软件来签署证书还是可以在 Inno Setup 中进行?

我试图寻找类似问题的答案,但没有人能够告诉我我需要什么开始,以及如何去做。

4

3 回答 3

31

你做的很简单,试着跟着

  1. 打开 Inno Setup 并选择 Tools-> Configure Sign Tools符号工具对话框
  2. 单击“添加..”并为其命名,我们称它为 MsSign,因为我使用的是Microsoft的 signtool.exe ,你现在应该有这样的东西在此处输入图像描述
  3. 然后会询问您用于签名的工具的命令行,因为我正在使用我将使用的 signtool.exe

signtool.exe 签名 /tr http://timestamp.digicert.com /td sha256 /fd sha256 /a $p

注意最后的$p,Inno Setup 需要这个......你现在应该有这个,并注意我已经在我的路径变量中添加了 signtool.exe 的路径,并且我正在使用 DigiCert 的时间服务器为我的签名。在此处输入图像描述

  1. 在脚本中,您现在将以下代码添加到 setup 段

    SignTool=MsSign $f

这一行告诉编译器使用代码签名,它将使用我称为 MsSign 的变量,并对设置生成的输出进行签名。

它应该看起来像这样 在此处输入图像描述

当您查看生成的 EXE 时,您将看到数字签名 在此处输入图像描述

现在这对我有用,因为我已经以命令行可以获取签名的方式准备了我的签名存储,并且我只有一个代码签名签名,所以我不需要命名它,你的参数可能与我的不同,这没关系,只要最终您的设置有效并且您的代码得到签名。

希望有所帮助并记住您需要在变量中使用$p

于 2018-02-19T08:04:41.353 回答
19

To sign executable (installer generated by Inno Setup) simply create a batch file (.bat) and put this content into it:

"c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\signtool.exe" sign /f Installer_Wizard_Code_Signing_Certificate.pfx /p password123 /t http://timestamp.verisign.com/scripts/timstamp.dll MySetupFile.exe

where

"c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\signtool.exe" is path to Microsoft signing utility (part of Microsoft SDK)

Installer_Wizard_Code_Signing_Certificate.pfx is your certificate

password123 is password for your certificate

MySetupFile.exe is your setup file you want to sign

Put all files in one directory (certificate, setup to sign, and the batch file) and run the batch file. Signtool signs the file with certificate and checks the validity against official server.

(You can use http://timestamp.verisign.com/scripts/timstamp.dll server although you have Comodo certificate, it does not matter.)

于 2013-10-04T05:11:11.370 回答
2

signtool.exe从 Microsoft下载并安装后,signtool.exe如果在上一个答案的第三步未将其添加到路径变量中,则将其完整路径放入签名工具的命令中:

D:\GUI\signtool.exe sign /tr http://timestamp.digicert.com /td sha256 /fd sha256 /a $p

在此处输入图像描述

于 2019-04-10T16:37:58.367 回答