Author: atsushi
Date: 2007-01-12 05:51:17 -0500 (Fri, 12 Jan 2007)
New Revision: 70911
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
Log:
2007-01-12 Atsushi Enomoto <[EMAIL PROTECTED]>
* SignedXml.cs : actually ComputeSignature() itself does not raise
silly exception. It always use CryptographicException.
Added another check; malformed reference object.
* SignedXmlTest.cs : fixed ComputeSignatureNoSigningKey() to not
expect silly exception. Added test for malformed reference.
Modified:
trunk/mcs/class/System.Security/System.Security.Cryptography.Xml/ChangeLog
===================================================================
--- trunk/mcs/class/System.Security/System.Security.Cryptography.Xml/ChangeLog
2007-01-12 10:49:13 UTC (rev 70910)
+++ trunk/mcs/class/System.Security/System.Security.Cryptography.Xml/ChangeLog
2007-01-12 10:51:17 UTC (rev 70911)
@@ -1,5 +1,11 @@
2007-01-12 Atsushi Enomoto <[EMAIL PROTECTED]>
+ * SignedXml.cs : actually ComputeSignature() itself does not raise
+ silly exception. It always use CryptographicException.
+ Added another check; malformed reference object.
+
+2007-01-12 Atsushi Enomoto <[EMAIL PROTECTED]>
+
* SignedXml.cs : ComputeSignature() should check empty key.
2006-10-11 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 10:49:13 UTC (rev 70910)
+++
trunk/mcs/class/System.Security/System.Security.Cryptography.Xml/SignedXml.cs
2007-01-12 10:51:17 UTC (rev 70911)
@@ -314,14 +314,18 @@
}
}
if (objectName != null) {
+ bool found = false;
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;
break;
}
}
+ if (!found)
+ throw new
CryptographicException (String.Format ("Malformed reference object: {0}",
objectName));
}
}
@@ -649,11 +653,7 @@
}
}
else
-#if NET_2_0 // correct
throw new CryptographicException ("signing key
is not specified");
-#else // silly
- throw new ArgumentNullException ("signing key
is not specified");
-#endif
}
public void ComputeSignature (KeyedHashAlgorithm macAlg)
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 10:49:13 UTC (rev 70910)
+++
trunk/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/ChangeLog
2007-01-12 10:51:17 UTC (rev 70911)
@@ -1,5 +1,10 @@
2007-01-12 Atsushi Enomoto <[EMAIL PROTECTED]>
+ * SignedXmlTest.cs : fixed ComputeSignatureNoSigningKey() to not
+ expect silly exception. Added test for malformed reference.
+
+2007-01-12 Atsushi Enomoto <[EMAIL PROTECTED]>
+
* SignedXmlTest.cs : added ComputeSignatureNoSigningKey().
2006-11-01 Atsushi Enomoto <[EMAIL PROTECTED]>
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 10:49:13 UTC (rev 70910)
+++
trunk/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/SignedXmlTest.cs
2007-01-12 10:51:17 UTC (rev 70911)
@@ -482,14 +482,12 @@
}
[Test]
-#if NET_2_0
- [ExpectedException (typeof (CryptographicException))] // correct
-#else
- [ExpectedException (typeof (ArgumentNullException))] // silly
-#endif
+ [ExpectedException (typeof (CryptographicException))]
public void ComputeSignatureNoSigningKey ()
{
- SignedXml signedXml = new SignedXml (new XmlDocument
());
+ XmlDocument doc = new XmlDocument ();
+ doc.LoadXml ("<foo/>");
+ SignedXml signedXml = new SignedXml (doc);
Reference reference = new Reference ();
reference.Uri = "";
@@ -501,6 +499,26 @@
signedXml.ComputeSignature ();
}
+ [Test]
+ [ExpectedException (typeof (CryptographicException))]
+ public void ComputeSignatureMissingReferencedObject ()
+ {
+ XmlDocument doc = new XmlDocument ();
+ doc.LoadXml ("<foo/>");
+ SignedXml signedXml = new SignedXml (doc);
+ DSA key = DSA.Create ();
+ signedXml.SigningKey = key;
+
+ Reference reference = new Reference ();
+ reference.Uri = "#bleh";
+
+ XmlDsigEnvelopedSignatureTransform env = new
XmlDsigEnvelopedSignatureTransform ();
+ reference.AddTransform (env);
+ signedXml.AddReference (reference);
+
+ signedXml.ComputeSignature ();
+ }
+
#if NET_2_0
[Test]
[Category ("NotWorking")] // bug #79483
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches