c# - 如何将清单从 sha1 更新到 sha256?
问题描述
我在Visual Studio 2010、C#、.NET Framework 3.5、VSTO Excel COM-Addin上有项目。最近一位客户增加了要求:需要用证书签名。我从 Sectigo 购买了“EV 证书”,我可以对我的整个设置、exe、.dll 等进行签名。但后来我尝试使用这个证书对 Project --> Properties --> "Sign the ClickOnce manifests" 进行签名,我什至不能运行项目。我在下面收到错误粘贴。
这是我第一次体验证书。似乎我的项目正在使用sha1,它已从 2017 年开始弃用。如何将我的项目更新为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,然后它将“正常工作”。
推荐阅读
- angular - 如何使用 ngx translate 翻译角材料小吃栏中的文本
- sql - BigQuery SQL:从日志表创建每日当前状态表
- ruby - Sidekiq 中未删除的繁忙工作
- javascript - 如何从 React 中的 Promise 获取值?
- hadoop - 超长单行输入文件的 Hadoop mapreduce 输入格式
- soap - JAVA11:java.lang.ClassNotFoundException:找不到 javax.jws.soap.SOAPBinding$Style
- sql - 将 jsonb 展平为列
- python - Pandas DataFrame.itertuples() 自动将对象 dtypes 转换为日期和时间 dtypes
- html - THEAD 与打印页眉上的页面内容重叠
- c++ - 使用 Boost Spirit X3 解析 ipv4 地址