SignedXml.CheckSignature() of XML created by Componentspace.SAML.dll?

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
We are using componentspace.SAML.dll to create a SAML signed XML file.
The receiving end does not have any software from the ComponentSpace company.
I am trying to use existing .Net functionality so they can verify signature, such as:
<span style="font-size:x-small <font size="2
<div style="color:Black;background-color:White; <pre>
System.Xml.XmlDocument xmlDocument;
System.Xml.XmlNodeList xmlNodeList;
System.Security.Cryptography.Xml.SignedXml signedXml;
System.Security.Cryptography.X509Certificates.X509Certificate2 x509Certificate;

x509Certificate = <span style="color:Blue; new X509Certificate2(certificateFileName);

xmlDocument = <span style="color:Blue; new System.Xml.XmlDocument();
xmlDocument.PreserveWhitespace = <span style="color:Blue; true;

<span style="color:Green; //
<span style="color:Green; // This signed assertion file was created by componentspace.SAML.dll
<span style="color:Green; //
xmlDocument.Load(signedAssertionFileName);

signedXml = <span style="color:Blue; new SignedXML(xmlDocument);
nodeList = xmlDocument.GetElementsByTagName(<span style="color:#A31515; "Signature");
signedXml.LoadXml((XmlElement)nodeList[0]);

<span style="color:Green; //
<span style="color:Green; // All of the following throw the same exception: Malformed reference element
<span style="color:Green; //
signedXml.CheckSignature();
signedXml.CheckSignature(x509Certificate, <span style="color:Blue; true);
signedXml.CheckSignature(x509Certificate, <span style="color:Blue; false);
[/code]
</font>
I always get a System.Security.Cryptography.CryptographicException:
"Malformed reference element."

How can I use existing .Net software to CheckSignature() of SAML XML produced by componentspace.SAML.dll?

Thank you.

View the full article
 
Back
Top