是否可以使用sha1和sha256证书双重签名安装程序和卸载程序?

Rob*_*beN 11 inno-setup verisign signtool

在Inno Setup中是否可以同时使用sha1和sha256对Uninstaller和Installer进行签名?

我知道可以通过命令工具使用两个证书签署可执行文件,但想知道这是否可以SignTool在Inno中实现.

Rob*_*beN 10

自动应答...

是的,这是可能的.正如@Wosi建议您可以编写批处理,然后使用$f添加的参数调用它.

样品批次(signtool.bat):

@echo off

"PATH_TO_SIGNTOOL\signtool.exe" sign /v /du "COMPANY_NAME" /fd sha1 /t "http://timestamp.verisign.com/scripts/timstamp.dll" /f "sha1_cert.pfx" /p PASSWORD %1

set SIGN_RESULT_1=%ERRORLEVEL%

"PATH_TO_SIGNTOOL\signtool.exe" sign /as /v /du "COMPANY_NAME" /fd sha256 /tr "http://timestamp.comodoca.com/rfc3161" /td sha256 /f "sha256_cert.pfx" /p PASSWORD %1

set SIGN_RESULT_2=%ERRORLEVEL%

set /a RESULT=%SIGN_RESULT_1%+%SIGN_RESULT_2%

if %RESULT% NEQ 0 (
   echo Warning! Signing failed with %SIGN_RESULT_1% for sh1 and %SIGN_RESULT_2% for sha256
   pause
   exit /B %RESULT%
) 

echo Signing succeeded
exit /B 0
Run Code Online (Sandbox Code Playgroud)

然后在Inno Setup的,你可以调用signtool.bat $f其中$f将被传递到%1批处理.

对于sha1的 Windows XP兼容性:删除/as,/tr替换/t,删除/td(根据需要/tr)

我会把它留在这里,因为也许有人会发现它有用.

  • 在此过程中,请注意,[自Inno Setup 5.5.8起](http://jrsoftware.github.io/issrc/whatsnew.htm#5.5.8),您可以有多个[SignTool指令](http:/ /www.jrsoftware.org/ishelp/topic_setup_signtool.htm),如[TheArtTrooper的回答](http://stackoverflow.com/a/38753662/850848)所示。 (2认同)

The*_*per 5

我正在使用 Inno Setup 5.5.9。我使用从命令行编译我的脚本ISCC。我的设置脚本在该部分中包含这两行[Setup]

SignTool=sha1
SignTool=sha256
Run Code Online (Sandbox Code Playgroud)

ISCC命令如下所示:

ISCC "/ssha1=signtool.exe /f <cert.pfx> /p <certpwd> /fd SHA1 /t <timestamp.url> /v $f" "/ssha256=signtool.exe /f <cert.pfx> /p <certpwd> /fd SHA256 /tr <timestamp.url> /td SHA256 /as /v $f" setup.iss
Run Code Online (Sandbox Code Playgroud)

Inno Setup 将使用两个证书对安装和卸载进行签名。