Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/mcs
diff options
context:
space:
mode:
authorAtsushi Eno <atsushieno@gmail.com>2007-01-23 20:40:38 +0300
committerAtsushi Eno <atsushieno@gmail.com>2007-01-23 20:40:38 +0300
commit34dc209f21b08693acf11cbe222f76cf6b6c461a (patch)
treeee0678d8815a80570cc7c8e8f466aa3657a63d3b /mcs
parent5fb5a4687d9c0b1f83aeb51d06407a6d75e9692e (diff)
2007-01-23 Atsushi Enomoto <atsushi@ximian.com>
* XmlCanonicalizer.cs : it should be reset before being reused. * SignedXmlTest.cs : run the transformation in yesterday's test twice. svn path=/trunk/mcs/; revision=71529
Diffstat (limited to 'mcs')
-rw-r--r--mcs/class/System.Security/Mono.Xml/ChangeLog4
-rw-r--r--mcs/class/System.Security/Mono.Xml/XmlCanonicalizer.cs7
-rw-r--r--mcs/class/System.Security/Test/System.Security.Cryptography.Xml/ChangeLog5
-rw-r--r--mcs/class/System.Security/Test/System.Security.Cryptography.Xml/SignedXmlTest.cs13
4 files changed, 26 insertions, 3 deletions
diff --git a/mcs/class/System.Security/Mono.Xml/ChangeLog b/mcs/class/System.Security/Mono.Xml/ChangeLog
index 2709e7178b9..502863cc6c9 100644
--- a/mcs/class/System.Security/Mono.Xml/ChangeLog
+++ b/mcs/class/System.Security/Mono.Xml/ChangeLog
@@ -1,3 +1,7 @@
+2007-01-23 Atsushi Enomoto <atsushi@ximian.com>
+
+ * XmlCanonicalizer.cs : it should be reset before being reused.
+
2007-01-22 Atsushi Enomoto <atsushi@ximian.com>
* XmlCanonicalizer.cs : Fixed incorect is-visibly-utilized check. Got
diff --git a/mcs/class/System.Security/Mono.Xml/XmlCanonicalizer.cs b/mcs/class/System.Security/Mono.Xml/XmlCanonicalizer.cs
index 0ca433dd0c5..9da0c48a363 100644
--- a/mcs/class/System.Security/Mono.Xml/XmlCanonicalizer.cs
+++ b/mcs/class/System.Security/Mono.Xml/XmlCanonicalizer.cs
@@ -65,14 +65,21 @@ namespace Mono.Xml {
res = new StringBuilder ();
comments = withComments;
exclusive = excC14N;
+ }
+
+ void Initialize ()
+ {
state = XmlCanonicalizerState.BeforeDocElement;
visibleNamespaces = new ArrayList ();
prevVisibleNamespacesStart = 0;
prevVisibleNamespacesEnd = 0;
+ res.Length = 0;
}
public Stream Canonicalize (XmlDocument doc)
{
+ Initialize ();
+
WriteDocumentNode (doc);
UTF8Encoding utf8 = new UTF8Encoding ();
diff --git a/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/ChangeLog b/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/ChangeLog
index dd7279ce4f8..187042f2cac 100644
--- a/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/ChangeLog
+++ b/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/ChangeLog
@@ -1,3 +1,8 @@
+2007-01-23 Atsushi Enomoto <atsushi@ximian.com>
+
+ * SignedXmlTest.cs :
+ run the transformation in yesterday's test twice.
+
2007-01-22 Atsushi Enomoto <atsushi@ximian.com>
* XmlDsigExcC14NTransformTest.cs, XmlDsigC14NTransformTest.cs,
diff --git a/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/SignedXmlTest.cs b/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/SignedXmlTest.cs
index 8939a4cbe14..9ad25050cf4 100644
--- a/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/SignedXmlTest.cs
+++ b/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/SignedXmlTest.cs
@@ -546,7 +546,10 @@ namespace MonoTests.System.Security.Cryptography.Xml {
byte [] decrypted = Convert.FromBase64String (
"1W5EigVnbnRjGLbg99ElieOmuUgYO+KcwMJtE35SAGI=");
- AssertEquals (expected, SignWithHMACSHA1 (input, decrypted));
+ Transform t = new XmlDsigC14NTransform ();
+ AssertEquals ("#1", expected, SignWithHMACSHA1 (input, decrypted, t));
+ // The second result should be still identical.
+ AssertEquals ("#2", expected, SignWithHMACSHA1 (input, decrypted, t));
}
[Test]
@@ -563,6 +566,11 @@ namespace MonoTests.System.Security.Cryptography.Xml {
string SignWithHMACSHA1 (string input, byte [] key)
{
+ return SignWithHMACSHA1 (input, key, new XmlDsigC14NTransform ());
+ }
+
+ string SignWithHMACSHA1 (string input, byte [] key, Transform transform)
+ {
XmlDocument doc = new XmlDocument ();
doc.LoadXml (input);
SignedXml sxml = new SignedXml (doc);
@@ -574,8 +582,7 @@ namespace MonoTests.System.Security.Cryptography.Xml {
d.Id = "_1";
sxml.AddObject (d);
Reference r = new Reference ("#_1");
- //r.AddTransform (new XmlDsigExcC14NTransform ());
- r.AddTransform (new XmlDsigC14NTransform ());
+ r.AddTransform (transform);
r.DigestMethod = SignedXml.XmlDsigSHA1Url;
sxml.SignedInfo.AddReference (r);
sxml.ComputeSignature (keyhash);