【发布时间】:2020-07-15 12:54:27
【问题描述】:
我正在尝试使用docker-windows 设置在Gitlab Pipeline 中签署.exe 和.dll 文件,使用docker 映像:mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-ltsc2019
我尝试调用这些命令:> sn.exe -R myfile.exe myKey.snk> signtool.exe sign /v /f myCert.p12 /p myPassword /fd sha256 /tr "http://sha256timestamp.ws.symantec.com/sha256/timestamp" /td sha256 myFile.exe
在我的机器上本地执行此操作时,文件会成功签名:
> sn.exe -R myfile.exe myKey.snk
Microsoft (R) .NET Framework Strong Name Utility Version 4.0.30319.0
Copyright (c) Microsoft Corporation. All rights reserved.
Assembly 'myFile.exe' successfully re-signed
> signtool.exe sign /v /f myCert.p12 /p myPassword /fd sha256 /tr "http://sha256timestamp.ws.symantec.com/sha256/timestamp" /td sha256 myFile.exe
The following certificate was selected:
Issued to: someone
Issued by: some-private-ca
Expires: Fri Aug 28 09:40:11 2020
SHA1 hash: hash
Done Adding Additional Store
Successfully signed: myFile.exe
Number of files successfully Signed: 1
Number of warnings: 0
Number of errors: 0
但是,使用 Gitlab 管道强名称工具 (sn.exe) 和 signtool.exe 失败:
> sn.exe -R myfile.exe myKey.snk
Microsoft (R) .NET Framework Strong Name Utility Version 4.0.30319.0
Copyright (c) Microsoft Corporation. All rights reserved.
Failed to re-sign the assembly -- Error code: 80131701
> signtool.exe sign /v /f myCert.p12 /p myPassword /fd sha256 /tr "http://sha256timestamp.ws.symantec.com/sha256/timestamp" /td sha256 myFile.exe
The following certificate was selected:
Done Adding Additional Store
我没有找出错误代码80131701 指的是什么。
在某些情况下,人们会在System.Runtime.InteropServices.COMException (0x80131701) 上收到错误代码。
这可能是由于我的计算机上存在的 docker 映像中缺少某些证书造成的吗?
【问题讨论】:
-
搜索我找到的答案someone else also having problems with signing inside Docker。但是错误消息不同。
-
我已经通过在我的机器上运行相同的 docker 容器进行了尝试,它按预期工作。
-
我已经用
C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\sn.exe替换了本地sn.exe,现在sn.exe部分工作。signtool.exe仍然没有检测到任何证书。 -
我尝试在 Gitlab CI Runner 机器上安装来自
myCert.p12证书链的证书...但没有任何帮助。 -
似乎签名仅适用于
提供的安装了 Windows 的机器。 Gitlab Runner 机器是普通的 Windows Server。而能够执行签名的开发人员机器是使用来自 的专有 Windows 安装程序安装的。
标签: windows docker certificate signtool sn.exe