+2007-01-12 Atsushi Enomoto <atsushi@ximian.com>
+
+ * SignedXml.cs : when there is an envelope document and no referenced
+ DataObject was found, then look for the target element from the
+ envelope.
+
2007-01-12 Atsushi Enomoto <atsushi@ximian.com>
* DataObject.cs : don't clear attributes or children unnecessarily.
}
}
if (objectName != null) {
- bool found = false;
+ XmlElement found = null;
foreach (DataObject obj in m_signature.ObjectList) {
if (obj.Id == objectName) {
- XmlElement xel = obj.GetXml ();
- doc.LoadXml (xel.OuterXml);
- FixupNamespaceNodes (xel, doc.DocumentElement);
- found = true;
+ found = obj.GetXml ();
break;
}
}
- if (!found)
+ if (found == null && envdoc != null) {
+ foreach (XmlElement el in envdoc.SelectNodes ("//*[@Id]"))
+ if (el.GetAttribute ("Id") == objectName) {
+ found = el;
+ break;
+ }
+ }
+ if (found != null) {
+ doc.LoadXml (found.OuterXml);
+ FixupNamespaceNodes (found, doc.DocumentElement);
+ }
+ else
throw new CryptographicException (String.Format ("Malformed reference object: {0}", objectName));
}
}
+2007-01-12 Atsushi Enomoto <atsushi@ximian.com>
+
+ * SignedXmlTest.cs : added DataReferenceToNonDataObject().
+
2007-01-12 Atsushi Enomoto <atsushi@ximian.com>
* DataObjectTest.cs : test to make sure to not clear attributes or
signedXml.ComputeSignature ();
}
+ [Test]
+ public void DataReferenceToNonDataObject ()
+ {
+ XmlDocument doc = new XmlDocument ();
+ doc.LoadXml ("<foo Id='id:1'/>");
+ SignedXml signedXml = new SignedXml (doc);
+ DSA key = DSA.Create ();
+ signedXml.SigningKey = key;
+
+ Reference reference = new Reference ();
+ reference.Uri = "#id:1";
+
+ XmlDsigC14NTransform t = new XmlDsigC14NTransform ();
+ reference.AddTransform (t);
+ signedXml.AddReference (reference);
+
+ signedXml.ComputeSignature ();
+ }
+
#if NET_2_0
[Test]
[Category ("NotWorking")] // bug #79483
+2007-01-12 Atsushi Enomoto <atsushi@ximian.com>
+
+ * xmldsig.cs : signature-big.xml also depends on the input document.
+
2005-04-04 Atsushi Enomoto <atsushi@ximian.com>
* Makefile : Fixed reference to Mono.Security.dll. Added decent-reader
SignedXml s = null;
if (filename.IndexOf ("enveloped") >= 0)
s = new SignedXml (doc);
+ else if (filename.IndexOf ("signature-big") >= 0)
+ s = new SignedXml (doc);
else
s = new SignedXml ();