我们执行代码签名和时间戳为我们的所有生产建设。偶尔(通常是在我们即将进行RTM (!)时)Veri符号的时间戳服务器("http://timestamp.verisign.com/scripts/timstamp.dll")决定断断续续地脱机。
在这种情况下我们该怎么办?
发布于 2012-08-28 13:37:52
我使用下面的批处理文件,最多循环300次。有两个参数,%1是包含批处理文件、pfx文件和signtool.exe的文件夹的路径。%2是要签名的文件的完整路径。您可以通过调用"$(SolutionDir)thirdparty\signing\sign.bat“”$(SolutionDir)第三方\signing“"$(TargetPath)”这样的方式在visual构建事件中调用它--我已经修改了这个批处理文件,以便在每次迭代中使用不同的时间戳服务器。目前它使用的是Comodo,Verisign.GlobalSign和Starfield。希望这是终极签名脚本;)
@echo off
REM create an array of timestamp servers...
set SERVERLIST=(http://timestamp.comodoca.com/authenticode http://timestamp.verisign.com/scripts/timestamp.dll http://timestamp.globalsign.com/scripts/timestamp.dll http://tsa.starfieldtech.com)
REM sign the file...
%1\signtool.exe sign /f %1\comodo.pfx /p videodigital %2
set timestampErrors=0
for /L %%a in (1,1,300) do (
for %%s in %SERVERLIST% do (
REM try to timestamp the file. This operation is unreliable and may need to be repeated...
%1\signtool.exe timestamp /t %%s %2
REM check the return value of the timestamping operation and retry a max of ten times...
if ERRORLEVEL 0 if not ERRORLEVEL 1 GOTO succeeded
echo Signing failed. Probably cannot find the timestamp server at %%s
set /a timestampErrors+=1
)
REM wait 2 seconds...
choice /N /T:2 /D:Y >NUL
)
REM return an error code...
echo sign.bat exit code is 1. There were %timestampErrors% timestamping errors.
exit /b 1
:succeeded
REM return a successful code...
echo sign.bat exit code is 0. There were %timestampErrors% timestamping errors.
exit /b 0我还把http://timestamp.comodoca.com放到了可信的站点(谢谢文斯)。我认为这可能是重要的一步。我也在PC上更新了根证书。
发布于 2010-07-13 18:51:26
我不确定时间戳服务器是否必须由根CA拥有。
我们使用http://timestamp.comodoca.com/authenticode (并且有一个Comodo证书),但实际上也有一个类似的问题,因为他们的服务器似乎偶尔会出现错误或超时。我们在我们的持续集成服务器上作为夜间(或按需)构建的一部分进行签名,只用于发布版本(而不是Debug构建)。
我用两种方式(主要是)解决了这个问题:
在这两者之间,时间戳服务器问题导致的构建失败已经从每周一次或两次变为几乎从未发生过。
编辑:我有一个MSBuild任务,在https://gist.github.com/gregmac/4cfacea5aaf702365724执行这个任务(以及读取存储库外存储的证书密码。)
发布于 2012-04-02 11:56:06
它可以很好地工作,方法是用以下其中之一替换verisign时间戳url:
http://timestamp.comodoca.com/authenticode
http://www.trustcenter.de/codesigning/timestamp
https://stackoverflow.com/questions/2872105
复制相似问题