Author: atsushi
Date: 2007-01-12 09:35:05 -0500 (Fri, 12 Jan 2007)
New Revision: 70919
Modified:
trunk/mcs/class/System.Security/System.Security.Cryptography.Xml/ChangeLog
trunk/mcs/class/System.Security/System.Security.Cryptography.Xml/SignedXml.cs
trunk/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/ChangeLog
trunk/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/SignedXmlTest.cs
trunk/mcs/class/System.Security/Test/standalone_tests/ChangeLog
trunk/mcs/class/System.Security/Test/standalone_tests/xmldsig.cs
Log:
2007-01-12 Atsushi Enomoto <[EMAIL PROTECTED]>
* SignedXml.cs : when there is an envelope document and no referenced
DataObject was found, then look for the target element from the
envelope.
* SignedXmlTest.cs : added DataReferenceToNonDataObject().
* xmldsig.cs : signature-big.xml also depends on the input document.
Modified:
trunk/mcs/class/System.Security/System.Security.Cryptography.Xml/ChangeLog
===================================================================
--- trunk/mcs/class/System.Security/System.Security.Cryptography.Xml/ChangeLog
2007-01-12 13:11:28 UTC (rev 70918)
+++ trunk/mcs/class/System.Security/System.Security.Cryptography.Xml/ChangeLog
2007-01-12 14:35:05 UTC (rev 70919)
@@ -1,5 +1,11 @@
2007-01-12 Atsushi Enomoto <[EMAIL PROTECTED]>
+ * 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 <[EMAIL PROTECTED]>
+
* DataObject.cs : don't clear attributes or children unnecessarily.
2007-01-12 Atsushi Enomoto <[EMAIL PROTECTED]>
Modified:
trunk/mcs/class/System.Security/System.Security.Cryptography.Xml/SignedXml.cs
===================================================================
---
trunk/mcs/class/System.Security/System.Security.Cryptography.Xml/SignedXml.cs
2007-01-12 13:11:28 UTC (rev 70918)
+++
trunk/mcs/class/System.Security/System.Security.Cryptography.Xml/SignedXml.cs
2007-01-12 14:35:05 UTC (rev 70919)
@@ -314,17 +314,25 @@
}
}
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 ("//[EMAIL PROTECTED]"))
+ 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));
}
}
Modified:
trunk/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/ChangeLog
===================================================================
---
trunk/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/ChangeLog
2007-01-12 13:11:28 UTC (rev 70918)
+++
trunk/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/ChangeLog
2007-01-12 14:35:05 UTC (rev 70919)
@@ -1,5 +1,9 @@
2007-01-12 Atsushi Enomoto <[EMAIL PROTECTED]>
+ * SignedXmlTest.cs : added DataReferenceToNonDataObject().
+
+2007-01-12 Atsushi Enomoto <[EMAIL PROTECTED]>
+
* DataObjectTest.cs : test to make sure to not clear attributes or
children unnecessarily.
Modified:
trunk/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/SignedXmlTest.cs
===================================================================
---
trunk/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/SignedXmlTest.cs
2007-01-12 13:11:28 UTC (rev 70918)
+++
trunk/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/SignedXmlTest.cs
2007-01-12 14:35:05 UTC (rev 70919)
@@ -519,6 +519,25 @@
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
Modified: trunk/mcs/class/System.Security/Test/standalone_tests/ChangeLog
===================================================================
--- trunk/mcs/class/System.Security/Test/standalone_tests/ChangeLog
2007-01-12 13:11:28 UTC (rev 70918)
+++ trunk/mcs/class/System.Security/Test/standalone_tests/ChangeLog
2007-01-12 14:35:05 UTC (rev 70919)
@@ -1,3 +1,7 @@
+2007-01-12 Atsushi Enomoto <[EMAIL PROTECTED]>
+
+ * xmldsig.cs : signature-big.xml also depends on the input document.
+
2005-04-04 Atsushi Enomoto <[EMAIL PROTECTED]>
* Makefile : Fixed reference to Mono.Security.dll. Added decent-reader
Modified: trunk/mcs/class/System.Security/Test/standalone_tests/xmldsig.cs
===================================================================
--- trunk/mcs/class/System.Security/Test/standalone_tests/xmldsig.cs
2007-01-12 13:11:28 UTC (rev 70918)
+++ trunk/mcs/class/System.Security/Test/standalone_tests/xmldsig.cs
2007-01-12 14:35:05 UTC (rev 70919)
@@ -146,6 +146,8 @@
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 ();
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches