Inno setup 在Inno安装程序安装上对所有exe文件进行签名

Inno setup 在Inno安装程序安装上对所有exe文件进行签名,inno-setup,Inno Setup,我有公司分发的可执行文件的数字代码签名证书 我们使用Inno安装程序使安装可执行,它有一个选项来签署安装程序和卸载程序文件,但我想签署安装程序中的所有可执行文件,是否可以使用Inno中的一些脚本作为预处理器任务 我想我可以使用ISPP调用kSign工具,使用命令Exec对文件进行签名 如何仅对安装中的.EXE文件调用它? 如何在命令行中使用下面的键值: SignTool=KSign /d $qAPP_NAME-$q /du $qhttp://www.app_site.com.br$q $f 我

我有公司分发的可执行文件的数字代码签名证书

我们使用Inno安装程序使安装可执行,它有一个选项来签署安装程序和卸载程序文件,但我想签署安装程序中的所有可执行文件,是否可以使用Inno中的一些脚本作为预处理器任务

我想我可以使用ISPP调用
kSign
工具,使用命令
Exec
对文件进行签名

如何仅对安装中的.EXE文件调用它?
如何在命令行中使用下面的键值:

SignTool=KSign /d $qAPP_NAME-$q /du $qhttp://www.app_site.com.br$q $f

我将发布用于安装可执行文件的批处理脚本中的一些代码,安装程序使用:

KSignCMD发件人:

创新设置

ComodoCertificate

.bat文件基本上是这样的:

 ECHO OFF
@ECHO OFF
CLS

:: Its just because my certificate file is in the root path
cd ..
SET PARENT_DIR=%CD%

:Inno_Path
SET INNOSetup=ERROR
if EXIST "%ProgramFiles%\Inno Setup 5\iscc.exe" SET INNOSetup="%ProgramFiles%\Inno Setup 5\iscc.exe"
if EXIST "%ProgramFiles(x86)%\Inno Setup 5\iscc.exe" SET INNOSetup="%ProgramFiles(x86)%\Inno Setup 5\iscc.exe"
if %INNOSetup% == ERROR goto error_innoSetup

:ksign_path
SET KSIGN=ERROR
if EXIST "%ProgramFiles%\kSign\kSignCMD.exe" SET KSIGN="%ProgramFiles%\kSign\kSignCMD.exe" 
if EXIST "%ProgramFiles(x86)%\kSign\kSignCMD.exe" SET KSIGN="%ProgramFiles(x86)%\kSign\kSignCMD.exe" 
if %KSIGN% == ERROR goto error_ksign

:: To sign an file, I just use this command
%KSIGN% /du "http://www.xxxxxxxxxx.com" /d "MyCompany - Software Description" /f ..\cert_comodo.p12 /p P@55W0rd! file.exe 

:: Adjusting variables, removing "
SET KSIGN=%KSIGN:"=%
SET PARENT_DIR=%PARENT_DIR:"=%

:: The next command require the InnoSetup "Configure Sign Tools", configuration with name Standard, indicated below on /s parameter
:: Link to this configuration: http://www.jrsoftware.org/ishelp/index.php?topic=setup_signtool
%INNOSetup% "/sStandard=%KSIGN% /f %PARENT_DIR%\cert_comodo.p12 /p P@55W0rd! $p" MySoftwareInstaller.iss
if %ERRORLEVEL% GTR 0 goto iscc_error

:iscc_error
ECHO ISCC.EXE[ERRO(%ERRORLEVEL%)]: Error on generate installer.
goto end

:error_innoSetup
ECHO ISCC.exe not installed on: %ProgramFiles%\Inno Setup\  or  %ProgramFiles(x86)%\Inno Setup\
ECHO Please install ISCC, from Inno Setup: - http://www.jrsoftware.org/isdl.php
goto end

:error_ksign
ECHO KSignCMD.exe not found on: %ProgramFiles%\kSign\  or  %ProgramFiles(x86)%\kSign\
ECHO Please install KSign first: - http://codesigning.ksoftware.net/
goto end

:end
echo Press any key to continue....
pause

好的,我找到了解决办法。以下是使用inno安装脚本对exe文件进行签名的方法。只需在inno脚本的开头添加以下行:

#expr Exec("C:\Program Files (x86)\Windows Kits\8.0\bin\x64\signtool.exe", "sign /n MyCertName /tr http://tsa.starfieldtech.com " + AddBackslash(SourcePath) + "MyFolder\MyFile.exe")

使用
[文件]
部分中的
签名
签名一次
标志。

可以。您可以简单地调用预处理器的函数。你很可能还想把它放在一个指定的目录中。非常感谢你,它对我来说很好!你介意发布inno设置代码来签名exe吗?我试过了,但没有成功:#expr Exec(''C:\Program Files(x86)\Windows Kits\8.0\bin\x64\signtool.exe“sign/n XXX/tr Folder\File.exe')所以你最后写了一个bat文件?我以为您找到了一个解决方案,可以在InnoSetup脚本中对exe进行签名。不幸的是,这对我没有帮助,因为我需要在InnoSetup脚本中进行签名。是的,在我的情况下,它解决了,因为我用这个脚本做了很多其他工作。这是最好的解决方案,但它在InnoSetup的版本>5.5.9中可用。