Manifest XML signature is not valid(安装ClickOnce签名未通过验证)

转载:http://stackoverflow.com/questions/12826798/manifest-xml-signature-is-not-valid

安装时,我的问题:

 PLATFORM VERSION INFO
Windows  : 5.2.3790.131072 (Win32NT)
Common Language Runtime  : 4.0.30319.1
System.Deployment.dll  : 4.0.30319.1 (RTMRel.030319-0100)
clr.dll  : 4.0.30319.1 (RTMRel.030319-0100)
dfdll.dll  : 4.0.30319.1 (RTMRel.030319-0100)
dfshim.dll  : 4.0.31106.0 (Main.031106-0000)

SOURCES
Deployment url : file:///E:/TlsMsg/TlsMsg.application

ERROR SUMMARY
Below is a summary of the errors, details of these errors are listed later in the log.
* Activation of E:TlsMsgTlsMsg.application resulted in exception. Following failure messages were detected:
+ Exception reading manifest from file:///E:/TlsMsg/TlsMsg.application: the manifest may not be valid or the file could not be opened.
+ Manifest XML signature is not valid.
+ SignatureDescription could not be created for the signature algorithm supplied.

COMPONENT STORE TRANSACTION FAILURE SUMMARY
No transaction error was detected.

WARNINGS
There were no warnings during this operation.

OPERATION PROGRESS STATUS
* [2014-3-7 10:41:06] : Activation of E:TlsMsgTlsMsg.application has started.

ERROR DETAILS
Following errors were detected during this operation.
* [2014-3-7 10:41:06] System.Deployment.Application.InvalidDeploymentException (ManifestParse)
- Exception reading manifest from file:///E:/TlsMsg/TlsMsg.application: the manifest may not be valid or the file could not be opened.
- Source: System.Deployment
- Stack trace:
at System.Deployment.Application.ManifestReader.FromDocument(String localPath, ManifestType manifestType, Uri sourceUri)
at System.Deployment.Application.DownloadManager.DownloadDeploymentManifestDirectBypass(SubscriptionStore subStore, Uri& sourceUri, TempFile& tempFile, SubscriptionState& subState, IDownloadNotification notification, DownloadOptions options, ServerInformation& serverInformation)
at System.Deployment.Application.DownloadManager.DownloadDeploymentManifestBypass(SubscriptionStore subStore, Uri& sourceUri, TempFile& tempFile, SubscriptionState& subState, IDownloadNotification notification, DownloadOptions options)
at System.Deployment.Application.ApplicationActivator.PerformDeploymentActivation(Uri activationUri, Boolean isShortcut, String textualSubId, String deploymentProviderUrlFromExtension, BrowserSettings browserSettings, String& errorPageUrl)
at System.Deployment.Application.ApplicationActivator.ActivateDeploymentWorker(Object state)
--- Inner Exception ---
System.Deployment.Application.InvalidDeploymentException (SignatureValidation)
- Manifest XML signature is not valid.
- Source: System.Deployment
- Stack trace:
at System.Deployment.Application.Manifest.AssemblyManifest.ValidateSignature(Stream s)
at System.Deployment.Application.ManifestReader.FromDocument(String localPath, ManifestType manifestType, Uri sourceUri)
--- Inner Exception ---
System.Security.Cryptography.CryptographicException
- SignatureDescription could not be created for the signature algorithm supplied.
- Source: System.Security
- Stack trace:
at System.Security.Cryptography.Xml.SignedXml.CheckSignedInfo(AsymmetricAlgorithm key)
at System.Security.Cryptography.Xml.SignedXml.CheckSignature(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)

COMPONENT STORE TRANSACTION DETAILS
No transaction information is available.
=======解决方法====================================================

The problem is: Framework 4.5 uses SHA-256 algorithm for the signature, and 4.0 uses SHA-1. When we changed the target framework to 4.0 and vs2012 didn't changed the algorithm.

Solution: Change the algorithm manually, generating a new certificate.

Go to Project properties -> signing

You will see the algorithm that is being used in 'Signature Algorithm'. You can create a new test certificate and then you will notice that it changes to 'sha1RSA'

=======说明=======================================================

意思是 把项目从Framework 4.5转化为Framework 4.0或3.5后,ClickOnce清单签名失效。

解决方法是  打开项目属性 -> 签名 。点击‘创建测试证书’。

此时签名算法将由SHA-256转变为sha1rsa

原文地址:https://www.cnblogs.com/senyier/p/3591448.html