【问题标题】:SignTool error : The specified timestamp server either could not be reachedSignTool 错误:无法访问指定的时间戳服务器
【发布时间】:2020-07-19 15:47:01
【问题描述】:

我们有一个构建后事件命令来执行代码签名。最近遇到以下错误。

Post-Build cmd: 
$(SignToolPath)BuildScripts\SignTool\signtool.exe sign /f $(SignToolPath)BuildScripts\codesign.pfx /p $(CodeSigningPassword) /t http://timestamp.verisign.com/scripts/timstamp.dll /n AP /i "Symantec Class 3 SHA256 Code Signing CA" $(TargetPath)

SignTool error : The specified timestamp server either could not be reached.
/t http://timestamp.verisign.com/scripts/timstamp.dll

以前没见过这个问题。

那么我怎样才能再尝试一次基于错误或错误代码在构建后事件命令中进行代码签名呢?或者如果发生任何错误,有什么建议可以执行代码签名?

【问题讨论】:

    标签: code-signing post-build-event signtool


    【解决方案1】:

    使用批处理脚本执行签名操作并添加基于“ERRORLEVEL”值的重试签名。

    @echo off
    setlocal enabledelayedexpansion
    Set SigningToolPath=%1
    Set CodesigningCertsPath=%2
    Set SigningPassword=%3
    Set TargetProjPath=%4
    
    IF EXIST "%TargetProjPath%" (
        call :SignFile "%SigningToolPath%", "%CodesigningCertsPath%", %SigningPassword%, "%TargetProjPath%", 0
        IF !ERRORLEVEL! NEQ 0 (
            goto end
        )
    )
    :end
    exit /b %ERRORLEVEL%
    
    :SignFile
    set "signToolPath=%~1"
    set "certPath=%~2"
    set "pass=%~3"
    set "projFilePath=%~4"
    set attempt=%~5
    set /a attempt=%attempt%+1
    
    echo.
    echo ---signing %TargetProjPath% attempt %attempt%---
    "%signToolPath%" sign /f "%certPath%" /p %pass% /fd sha256 /t http://timestamp.digicert.com "%projFilePath%"
    
    IF %ERRORLEVEL% NEQ 0 (
        IF %attempt% LSS 2 (
            call :SignFile "%signToolPath%", "%certPath%", %pass%, "%projFilePath%", %attempt%
        )
    )
    exit /b %ERRORLEVEL%
    

    并从 MSBuild 脚本中调用此批处理文件,例如 "$(WorkDirectory)\BuildScripts\SupportFiles\CodeSigningCertificates\signing.bat" "$(SigningToolPath)" "$(CodesigningCertsPath)" "$(SigningPassword)" "$(TargetProjPath)"

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-02-18
      • 1970-01-01
      • 1970-01-01
      • 2018-10-14
      • 2014-07-07
      • 1970-01-01
      相关资源
      最近更新 更多