+2010-07-09 Atsushi Enomoto <atsushi@ximian.com>
+
+ * SignedXml.cs : avoid using LoadXml() to load xml element as in
+ literal string. Use ImportNode() instead.
+ Copy namespaces for a referenced node found in envelope document too.
+
2009-07-14 Sebastien Pouliot <sebastien@ximian.com>
* SignedXml.cs: Fix HMACOutputLength to match XMLDSIG erratum (ref:
XmlElement xel = GetIdElement (signatureElement.OwnerDocument, r.Uri.Substring (1));
if (xel == null)
throw new CryptographicException ("Manifest targeted by Reference was not found: " + r.Uri.Substring (1));
- doc.LoadXml (xel.OuterXml);
+ doc.AppendChild (doc.ImportNode (xel, true));
FixupNamespaceNodes (xel, doc.DocumentElement, false);
}
}
if (obj.Id == objectName) {
found = obj.GetXml ();
found.SetAttribute ("xmlns", SignedXml.XmlDsigNamespaceUrl);
- doc.LoadXml (found.OuterXml);
+ doc.AppendChild (doc.ImportNode (found, true));
// FIXME: there should be theoretical justification of copying namespace declaration nodes this way.
foreach (XmlNode n in found.ChildNodes)
// Do not copy default namespace as it must be xmldsig namespace for "Object" element.
}
if (found == null && envdoc != null) {
found = GetIdElement (envdoc, objectName);
- if (found != null)
- doc.LoadXml (found.OuterXml);
+ if (found != null) {
+ doc.AppendChild (doc.ImportNode (found, true));
+ FixupNamespaceNodes (found, doc.DocumentElement, false);
+ }
}
if (found == null)
throw new CryptographicException (String.Format ("Malformed reference object: {0}", objectName));