我正在尝试签署我的 clickonce 应用程序。我有一个使用 SHA256 的 EV 代码签名证书。问题是当我使用构建后命令签署我的应用程序时,它似乎使用的是 SHA1 而不是 SHA256。这是输出窗口的剪辑:
Running Code Analysis...
1> Code Analysis Complete -- 0 error(s), 0 warning(s)
1> The following certificate was selected:
1> Issued to: Certificate Subject Name Here
1>
1> Issued by: DigiCert EV Code Signing CA (SHA2)
1>
1> Expires: Thu Apr 14 06:00:00 2016
1>
1> SHA1 hash: HASH-HERE
1>
1>
1> Done Adding Additional Store
1> Successfully signed and timestamped: C:\Users\AnyBody\Documents\Visual Studio 2013\Projects\My Project\Project Folder\obj\x86\My Configuration\MyProgram.exe
1>
1>
1> Number of files successfully Signed: 1
1>
1> Number of warnings: 0
1>
1> Number of errors: 0
这是我正在使用的后期构建命令:
"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Bin\signtool.exe" sign /fd SHA256 /t "http://timestamp.digicert.com" /n "Certificate Subject Name Here" /v "$(ProjectDir)obj\x86\$(ConfigurationName)\$(TargetFileName)"
当我查看文件的属性时,我可以看到 MyProgram.exe.deploy 附加了数字签名。
运行 signtool /verify 时没有返回错误
当我尝试启动应用程序时,我收到错误“应用程序验证未成功。无法继续”。
在错误消息的详细信息中,有这一行:
+ File, MyProgram.exe, has a different computed hash than specified in manifest.
当我打开并查看清单时,MyProgram.exe 的哈希被指定为 SHA256
可能是什么问题呢?是什么让 signtool 拒绝使用 SHA256?根据我的阅读,默认情况下它应该使用 SHA256。
我已经卸载/重新安装了 Visual Studio、Windows sdk,所有安装的 .net 库都无济于事。
我真的希望有人有一些想法......