在Inno Setup Installation上签署所有exe文件

时间:2013-12-09 10:33:36

标签: inno-setup

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

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

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

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

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

3 个答案:

答案 0 :(得分:6)

使用sign部分中的signonce[Files]标记。

答案 1 :(得分:2)

好的,我找到了解决方案。以下是使用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")

答案 2 :(得分:-2)

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

来自http://support.ksoftware.net/support/solutions/articles/17169-how-do-i-automate-code-signing-with-innosetup-and-ksign-

KSignCMD

Inno设置http://www.jrsoftware.org/isdl.php

ComodoCertificate http://support.ksoftware.net/support/solutions/25585

.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