[英]C# Add Timestamp to PKCS#7 CMS Digital Signature problem
This question is the continuation of that one .这个问题是那个问题的延续。 I also try to communicate with a 3rd party AS2 server.
我还尝试与第 3 方 AS2 服务器进行通信。 I use the same code as the author of that post.
我使用与那篇文章的作者相同的代码。 This code (the corrected version) is:
此代码(更正版本)是:
private byte[] Sign(byte[] content)
{
CmsSigner cmsSigner = new CmsSigner(_cert);
cmsSigner.SignedAttributes.Add(new Pkcs9SigningTime(DateTime.Now));
SignedCms signedCms = new SignedCms(new ContentInfo(content));
signedCms.ComputeSignature(cmsSigner, true);
return signedCms.Encode();
}
But I get the following error back from the server:但我从服务器收到以下错误:
Unable to verify content integrity: Message digest mismatch in signature.
无法验证内容完整性:签名中的消息摘要不匹配。
in spite of signedCms.CheckSignature(false);
尽管有
signedCms.CheckSignature(false);
doesn't throw an exception.不会抛出异常。
Where should I search the reason of this error?我应该在哪里搜索此错误的原因?
you can change the project type to .net 5 by using project properties (right click on project -> properties) -> application and changed target framework from .net core 3.0 to .net 5.0 i hope it will help anybody您可以使用项目属性(右键单击项目-> 属性)-> 应用程序将项目类型更改为 .net 5,并将目标框架从 .net 核心 3.0 更改为 Z2D50972FCECD376120任何人。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.