我正在尝试签署我的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库,但都没有用。
我真的希望有人能有一些想法...