SignedXML.CheckSignature Always Fails

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
I dont think I posted my original question in the correct forum, so Im going to close that one and post here.<br/><br/>Im 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:<br/><br/>
<div style="background-color:white;color:black
<pre><span style="color:blue public <span style="color:blue static <span style="color:blue bool verifySignature(<span style="color:blue string xmlData)

{



XmlDocument theDocument = <span style="color:blue new XmlDocument();

XmlNodeList nodeList;

SignedXml signedDocument;



theDocument.PreserveWhitespace = <span style="color:blue true;

theDocument.LoadXml(xmlData);

signedDocument = <span style="color:blue new SignedXml(theDocument);



nodeList = theDocument.GetElementsByTagName(

<span style="color:#a31515 "ds:Signature");



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



<span style="color:blue return signedDocument.CheckSignature();



}

[/code]

<br/>The posts are signed using the XML Signature tag with a namespace of "ds". I am simply base64 decoding the post and sending it straight to here without any modifications of whitespace or casing.<br/><br/>Any help would be greatly appreciated!<br/><br/>- Jake

View the full article
 
Back
Top