Author: spouliot
Date: 2008-01-02 12:34:34 -0500 (Wed, 02 Jan 2008)
New Revision: 92119

Modified:
   trunk/mcs/class/corlib/Test/System.Security.Cryptography/ChangeLog
   
trunk/mcs/class/corlib/Test/System.Security.Cryptography/RC2CryptoServiceProviderTest.cs
   
trunk/mcs/class/corlib/Test/System.Security.Cryptography/TripleDESCryptoServiceProviderTest.cs
Log:
2008-01-02  Sebastien Pouliot  <[EMAIL PROTECTED]>

        * RC2CryptoServiceProviderTest.cs: Fix Create[De|En]cryptor_KeyNull 
        test case not to fail about 1 out of 256 times under the 2.0 profile.
        * TripleDESCryptoServiceProviderTest.cs: Fix 
Create[De|En]cryptor_KeyNull
        test case not to fail about 1 out of 256 times under the 2.0 profile.



Modified: trunk/mcs/class/corlib/Test/System.Security.Cryptography/ChangeLog
===================================================================
--- trunk/mcs/class/corlib/Test/System.Security.Cryptography/ChangeLog  
2008-01-02 17:16:45 UTC (rev 92118)
+++ trunk/mcs/class/corlib/Test/System.Security.Cryptography/ChangeLog  
2008-01-02 17:34:34 UTC (rev 92119)
@@ -1,3 +1,10 @@
+2008-01-02  Sebastien Pouliot  <[EMAIL PROTECTED]>
+
+       * RC2CryptoServiceProviderTest.cs: Fix Create[De|En]cryptor_KeyNull 
+       test case not to fail about 1 out of 256 times under the 2.0 profile.
+       * TripleDESCryptoServiceProviderTest.cs: Fix 
Create[De|En]cryptor_KeyNull
+       test case not to fail about 1 out of 256 times under the 2.0 profile.
+
 2007-11-20  Sebastien Pouliot  <[EMAIL PROTECTED]>
 
        * DESCryptoServiceProviderTest.cs: Fix CreateDecryptor_KeyNull test 

Modified: 
trunk/mcs/class/corlib/Test/System.Security.Cryptography/RC2CryptoServiceProviderTest.cs
===================================================================
--- 
trunk/mcs/class/corlib/Test/System.Security.Cryptography/RC2CryptoServiceProviderTest.cs
    2008-01-02 17:16:45 UTC (rev 92118)
+++ 
trunk/mcs/class/corlib/Test/System.Security.Cryptography/RC2CryptoServiceProviderTest.cs
    2008-01-02 17:34:34 UTC (rev 92119)
@@ -60,6 +60,12 @@
                        ICryptoTransform decryptor = rc2.CreateDecryptor 
(rc2.Key, rc2.IV);
                        byte[] decdata = decryptor.TransformFinalBlock 
(encdata, 0, encdata.Length);
                        // null key != SymmetricAlgorithm.Key
+
+                       // in about 1 out of 256 runs the exception will not be 
thrown because the padding will be
+                       // the same as expected - however this still won't 
produce the right results (next check)
+                       Assert.IsFalse (BitConverter.ToString (data) == 
BitConverter.ToString (decdata), "Compare");
+                       // so this case is ok too, throw the expected exception 
to make the unit test succeed
+                       throw new CryptographicException ("1/256");
                }
 
                [Test]
@@ -108,6 +114,12 @@
                        ICryptoTransform decryptor = rc2.CreateDecryptor (null, 
rc2.IV);
                        byte[] decdata = decryptor.TransformFinalBlock 
(encdata, 0, encdata.Length);
                        // null key != SymmetricAlgorithm.Key
+
+                       // in about 1 out of 256 runs the exception will not be 
thrown because the padding will be
+                       // the same as expected - however this still won't 
produce the right results (next check)
+                       Assert.IsFalse (BitConverter.ToString (data) == 
BitConverter.ToString (decdata), "Compare");
+                       // so this case is ok too, throw the expected exception 
to make the unit test succeed
+                       throw new CryptographicException ("1/256");
                }
 
                [Test]

Modified: 
trunk/mcs/class/corlib/Test/System.Security.Cryptography/TripleDESCryptoServiceProviderTest.cs
===================================================================
--- 
trunk/mcs/class/corlib/Test/System.Security.Cryptography/TripleDESCryptoServiceProviderTest.cs
      2008-01-02 17:16:45 UTC (rev 92118)
+++ 
trunk/mcs/class/corlib/Test/System.Security.Cryptography/TripleDESCryptoServiceProviderTest.cs
      2008-01-02 17:34:34 UTC (rev 92119)
@@ -60,6 +60,12 @@
                        ICryptoTransform decryptor = tdes.CreateDecryptor 
(tdes.Key, tdes.IV);
                        byte[] decdata = decryptor.TransformFinalBlock 
(encdata, 0, encdata.Length);
                        // null key != SymmetricAlgorithm.Key
+
+                       // in about 1 out of 256 runs the exception will not be 
thrown because the padding will be
+                       // the same as expected - however this still won't 
produce the right results (next check)
+                       Assert.IsFalse (BitConverter.ToString (data) == 
BitConverter.ToString (decdata), "Compare");
+                       // so this case is ok too, throw the expected exception 
to make the unit test succeed
+                       throw new CryptographicException ("1/256");
                }
 
                [Test]
@@ -108,6 +114,12 @@
                        ICryptoTransform decryptor = tdes.CreateDecryptor 
(null, tdes.IV);
                        byte[] decdata = decryptor.TransformFinalBlock 
(encdata, 0, encdata.Length);
                        // null key != SymmetricAlgorithm.Key
+
+                       // in about 1 out of 256 runs the exception will not be 
thrown because the padding will be
+                       // the same as expected - however this still won't 
produce the right results (next check)
+                       Assert.IsFalse (BitConverter.ToString (data) == 
BitConverter.ToString (decdata), "Compare");
+                       // so this case is ok too, throw the expected exception 
to make the unit test succeed
+                       throw new CryptographicException ("1/256");
                }
 
                [Test]

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to