Author: spouliot
Date: 2007-03-22 15:34:13 -0500 (Thu, 22 Mar 2007)
New Revision: 74840
Modified:
trunk/mcs/class/corlib/Test/System.Security.Cryptography/ChangeLog
trunk/mcs/class/corlib/Test/System.Security.Cryptography/Rfc2898DeriveBytesTest.cs
Log:
2007-03-22 Sebastien Pouliot <[EMAIL PROTECTED]>
* Rfc2898DeriveBytesTest.cs: Add test case to trigger an endian bug.
Modified: trunk/mcs/class/corlib/Test/System.Security.Cryptography/ChangeLog
===================================================================
--- trunk/mcs/class/corlib/Test/System.Security.Cryptography/ChangeLog
2007-03-22 20:28:03 UTC (rev 74839)
+++ trunk/mcs/class/corlib/Test/System.Security.Cryptography/ChangeLog
2007-03-22 20:34:13 UTC (rev 74840)
@@ -1,4 +1,4 @@
-2007-03-22 Sebastien Pouliot <[EMAIL PROTECTED]>
+2007-03-22 Sebastien Pouliot <[EMAIL PROTECTED]>
* CryptoConfigTest.cs: Fix upper/lower/mixed cases tests as they work
only for 2.0.
@@ -7,6 +7,7 @@
* DSACryptoServiceProviderTest.cs: Normalize line endings.
* PasswordDeriveBytesTest.cs: Fix test case that used Reset (as the
method was fixed to reset the state in fx 2.0).
+ * Rfc2898DeriveBytesTest.cs: Add test case to trigger an endian bug.
* RSACryptoServiceProviderTest.cs: Normalize line endings.
* SymmetricAlgorithmTransformTest.cs: Change/split test cases so that
they work properly under both MS 1.1 and 2.0. In some cases tests are
Modified:
trunk/mcs/class/corlib/Test/System.Security.Cryptography/Rfc2898DeriveBytesTest.cs
===================================================================
---
trunk/mcs/class/corlib/Test/System.Security.Cryptography/Rfc2898DeriveBytesTest.cs
2007-03-22 20:28:03 UTC (rev 74839)
+++
trunk/mcs/class/corlib/Test/System.Security.Cryptography/Rfc2898DeriveBytesTest.cs
2007-03-22 20:34:13 UTC (rev 74840)
@@ -249,6 +249,18 @@
}
[Test]
+ public void GetBytes_Endian ()
+ {
+ string expected =
"0B-40-39-04-B9-2B-F1-B9-C0-A0-64-E6-03-0A-5E-42-4B-88-1E-5E-94-8F-77-87-16-A6-C4-9E-E6-C7-6D-38";
+ Rfc2898DeriveBytes pkcs5 = new Rfc2898DeriveBytes
("password", salt, 5);
+ // this will overflow F on multiple bytes (where
endianess comes to play)
+ byte[] key = pkcs5.GetBytes (32768);
+ // just check the last 32 bytes
+ string actual = BitConverter.ToString (key, key.Length
- 32);
+ AssertEquals ("Endian", expected, actual);
+ }
+
+ [Test]
public void RFC3211_TC1 ()
{
byte[] expected = { 0xd1, 0xda, 0xa7, 0x86, 0x15, 0xf2,
0x87, 0xe6 };
@@ -313,4 +325,4 @@
}
}
-#endif
\ No newline at end of file
+#endif
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches