【问题标题】:How to update manifest from sha1 to sha256?如何将清单从 sha1 更新到 sha256?
【发布时间】:2021-02-17 02:23:23
【问题描述】:

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

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

在清单中,例如我看到:

错误代码:

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 community 2019来构建项目吗?
  • 遗憾的是甚至无法选择 2013,因为 Visual Studio 不再支持“Visual Studio Installer”。

标签: c# visual-studio visual-studio-2010 vsto sha256


【解决方案1】:

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

【讨论】:

  • VS 2019 的问题是只能从 Office 2013 支持 VSTO 项目。因此,仍然使用 Office 2007/2010 的客户将无法使用产品。同样从 VS 2013 开始,它们不支持 MS 创建的 Visual Studio Installer 项目。
【解决方案2】:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-09-18
    • 1970-01-01
    • 2014-10-31
    • 2015-12-16
    • 1970-01-01
    • 2020-11-05
    • 1970-01-01
    • 2017-03-30
    相关资源
    最近更新 更多