繁体   English   中英

如何将清单从 sha1 更新为 sha256?

[英]How to update manifest from sha1 to sha256?

我在Visual Studio 2010C# 、.NET Framework 3.5VSTO Excel COM-Addin 上有项目 最近一位客户增加了要求:需要用证书签名。 我从 Sectigo 购买了“EV 证书”,我可以签署我的整个设置、exe、.dll 等。但后来我尝试使用此证书进行项目 --> 属性 -->“签署 ClickOnce 清单”,我什至不能运行项目。 我在下面收到错误粘贴。

这是我第一次使用证书。 似乎我的项目正在使用从 2017 年开始弃用的sha1 。如何将我的项目更新为sha256

在清单中,例如我看到:

<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1/> <dsig:DigestValueBjwCX1w9SEEN4XGlQJVNJgdAr24=</dsig:DigestValue>

错误代码:

Exception reading manifest from file:///C:/Users/...vsto: the manifest may not be valid or the file could not be opened.

************** Exception Text **************
System.Deployment.Application.InvalidDeploymentException: Exception reading manifest from file:///C:/Users/...vsto: the manifest may not be valid or the file could not be opened. ---> System.Deployment.Application.InvalidDeploymentException: Manifest XML signature is not valid. ---> System.Security.Cryptography.CryptographicException: SignatureDescription could not be created for the signature algorithm supplied.
   at System.Security.Cryptography.Xml.SignedXml.CheckSignedInfo(AsymmetricAlgorithm key)
   at System.Security.Cryptography.Xml.SignedXml.CheckSignatureReturningKey(AsymmetricAlgorithm& signingKey)
   at System.Deployment.Internal.CodeSigning.SignedCmiManifest.Verify(CmiManifestVerifyFlags verifyFlags)
   at System.Deployment.Application.Manifest.AssemblyManifest.ValidateSignature(Stream s)
   --- End of inner exception stack trace ---
   at System.Deployment.Application.Manifest.AssemblyManifest.ValidateSignature(Stream s)
   at System.Deployment.Application.ManifestReader.FromDocument(String localPath, ManifestType manifestType, Uri sourceUri)
   --- End of inner exception stack trace ---
   at Microsoft.VisualStudio.Tools.Applications.Deployment.ClickOnceAddInDeploymentManager.GetManifests(TimeSpan timeout)
   at Microsoft.VisualStudio.Tools.Applications.Deployment.ClickOnceAddInDeploymentManager.InstallAddIn()

Visual Studio 2010(和 VSTO for Framework 3.5)不理解 SHA256 证书。 您需要升级您的 Visual Studio 并将您的项目迁移到当前版本的 VSTO,然后它就会“正常工作”。

这是一个老问题,我想(希望)您很久以前就找到了解决方案。 但我会在这里发表我的意见,以防将来有人在这方面绊倒。 如果您坚持使用较早版本的 VS,也许您可​​以尝试不在 VS 中唱 clickonce 清单,而是在外部使用较新版本的 mage.exe 或 mageui.exe。 但请记住,在您的客户端计算机上运行的旧 .Net Frameworks 中的 Clickonce 基础结构不支持 SHA256,因此您可能需要针对 .Net framework 4.0 或 4.5,因为 .Net 3.5 可能无法识别 SHA256 签名。 首先尝试不使用时间戳服务器并确保发布者被识别,然后使用时间戳服务器并再次检查在客户端计算机上安装应用程序时显示的发布者是否正确(我注意到使用 Comodo / Sectigo 时间戳服务器不会工作(导致“未知发布者”),但您可以使用任何其他时间戳服务器)。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM