diff options
author | Sebastien Pouliot <sebastien@ximian.com> | 2004-03-25 17:09:45 +0300 |
---|---|---|
committer | Sebastien Pouliot <sebastien@ximian.com> | 2004-03-25 17:09:45 +0300 |
commit | bbcc5c79c3a2e6889e059332b2b7672dd757e521 (patch) | |
tree | ce5b94f5a6b1ed46c405bccbcc19b160eb3b96c4 /mcs/class/System.Security/Test/standalone_tests/xmldsig.cs | |
parent | a7dac8bbbdcae2d67bfaced7f69aa31be3e3b35a (diff) |
2004-03-25 Sebastien Pouliot <sebastien@ximian.com>
* xmldsig.cs: Added code to automagically ajust for presence of
HMAC-MD5 and ExC14N in the framework and to manualy skip signatures
containing <Manifest> (not supported).
svn path=/trunk/mcs/; revision=24587
Diffstat (limited to 'mcs/class/System.Security/Test/standalone_tests/xmldsig.cs')
-rwxr-xr-x | mcs/class/System.Security/Test/standalone_tests/xmldsig.cs | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/mcs/class/System.Security/Test/standalone_tests/xmldsig.cs b/mcs/class/System.Security/Test/standalone_tests/xmldsig.cs index 1a775cd4ac5..28fb4a3ad52 100755 --- a/mcs/class/System.Security/Test/standalone_tests/xmldsig.cs +++ b/mcs/class/System.Security/Test/standalone_tests/xmldsig.cs @@ -25,10 +25,18 @@ public class MyClass { static int valid = 0; static int invalid = 0; static int error = 0; + static int skip = 0; + + static bool exc14n; + static bool hmacmd5; public static void Main() { try { + // automagically ajust tests to run depending on system config + exc14n = (CryptoConfig.CreateFromName ("http://www.w3.org/2001/10/xml-exc-c14n#WithComments") != null); + hmacmd5 = (CryptoConfig.CreateFromName ("HMACMD5") != null); + Console.WriteLine ("MERLIN"); Merlin (); Console.WriteLine (); @@ -45,6 +53,7 @@ public class MyClass { Console.WriteLine ("TOTAL VALID {0}", valid); Console.WriteLine ("TOTAL INVALID {0}", invalid); Console.WriteLine ("TOTAL ERROR {0}", error); + Console.WriteLine ("TOTAL SKIP {0}", skip); Console.WriteLine ("Finished."); } @@ -210,12 +219,19 @@ DumpSignedXml (s); byte[] key = Encoding.ASCII.GetBytes ("test"); foreach (FileInfo fi in new DirectoryInfo ("phaos-xmldsig-three").GetFiles ("signature-*.xml")) { - if (fi.Name.IndexOf ("exclusive") >= 0) { + if ((fi.Name.IndexOf ("exclusive") >= 0) && (!exc14n)) { Console.WriteLine ("NOT RUN: " + fi.Name + " : System.Security.dll cannot validate exclusive-c14n."); + skip++; continue; } - if (fi.Name.IndexOf ("md5") >= 0) { + if ((fi.Name.IndexOf ("md5") >= 0) && (!hmacmd5)) { Console.WriteLine ("NOT RUN: " + fi.Name + " : System.Security.dll doesn't support HMAC-MD5."); + skip++; + continue; + } + if (fi.Name.IndexOf ("manifest") >= 0) { + Console.WriteLine ("NOT RUN: " + fi.Name + " : System.Security.dll doesn't support <Manifest>."); + skip++; continue; } if (fi.Name.IndexOf ("hmac") >= 0) { |