SignedXML.CheckSignature总是失败 [英] SignedXML.CheckSignature Always Fails

查看:372
本文介绍了SignedXML.CheckSignature总是失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我认为我没有在正确的论坛中发布我原来的问题,所以我要关闭那个并在这里发帖。

我正在做一个需要XML帖子要进行数字签名。从我们的客户那里得到任何测试帖来验证以下代码似乎没有任何好运:


I don't think I posted my original question in the correct forum, so I'm going to close that one and post here.

I'm currently working on a project which requires the XML posts to be digitally signed. I do not seem to have any luck with getting any test posts from our client to validate with the below code:


public static bool verifySignature(string xmlData)

{



    XmlDocument theDocument = new XmlDocument();

    XmlNodeList nodeList;

    SignedXml signedDocument;



    theDocument.PreserveWhitespace = true;

    theDocument.LoadXml(xmlData);

    signedDocument = new SignedXml(theDocument);



    nodeList = theDocument.GetElementsByTagName(

        "ds:Signature");



    signedDocument.LoadXml((XmlElement)nodeList[0]);



     return signedDocument.CheckSignature();



}

推荐答案

所以究竟发生了什么?你收到错误了吗?如果是这样的话?或者,verifySignature方法是否始终返回false?是否可以发布您传递的xmlData的示例值,但是会得到错误?是
So what exactly happens? Do you get an error? If so which one? Or is the verifySignature method always returning false?
Can you post an example value of xmlData that you pass in where you expect to get true but get false?


这篇关于SignedXML.CheckSignature总是失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆