2013-12-09 76 views
3

我拥有我公司发布的可执行程序的数字代码签名证书。在Inno安装程序安装中签署所有exe文件

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

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

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

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

是的,你可以。您可以简单地调用预处理器的['Exec'](http://jrsoftware.org/ispphelp/topic_exec.htm)函数。你很可能也想在指定的目录中['遍历所有文件](http://jrsoftware.org/ispphelp/topic_findfirst.htm)。 – TLama

+1

非常感谢,对我来说工作得很好! –

+0

你介意发布inno设置代码签名EXE吗?我试过这个,但它不起作用:#expr Exec(''C:\ Program Files(x86)\ Windows Kits \ 8.0 \ bin \ x64 \ signtool.exe“符号/ n XXX/tr http:// tsa。 starfieldtech.com Folder \ File.exe') –

回答

6

使用signsignonce国旗在[Files]部分。

+1

这是最好的解决方案,但它在Inno Setup的5.5.9版本中可用。 –

-2

I'll后从我的批处理脚本一些代码用于安装可执行文件,并使用安装程序:

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

Inno Setup的http://www.jrsoftware.org/isdl.php

ComodoCertificatehttp://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 [email protected]! 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 [email protected]! $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 
+0

所以你最终写了一个bat文件?我以为你找到了一个解决方案,所以你可以在InnoSetup脚本中签名exe。不幸的是,这并不能帮助我,因为我需要在InnoSetup脚本内部进行签名。 –

+0

是的,在我的情况下,它解决了,因为,我用这个脚本做了很多其他的工作。 –

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") 
相关问题