Author: spouliot
Date: 2007-11-20 20:56:10 -0500 (Tue, 20 Nov 2007)
New Revision: 90058

Modified:
   trunk/mcs/class/corlib/Test/System.Security.Cryptography/ChangeLog
   
trunk/mcs/class/corlib/Test/System.Security.Cryptography/DESCryptoServiceProviderTest.cs
Log:
2007-11-20  Sebastien Pouliot  <[EMAIL PROTECTED]>

        * DESCryptoServiceProviderTest.cs: Fix CreateDecryptor_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  
2007-11-21 01:52:09 UTC (rev 90057)
+++ trunk/mcs/class/corlib/Test/System.Security.Cryptography/ChangeLog  
2007-11-21 01:56:10 UTC (rev 90058)
@@ -1,3 +1,8 @@
+2007-11-20  Sebastien Pouliot  <[EMAIL PROTECTED]>
+
+       * DESCryptoServiceProviderTest.cs: Fix CreateDecryptor_KeyNull test 
+       case not to fail about 1 out of 256 times under the 2.0 profile.
+
 2007-10-23  Sebastien Pouliot  <[EMAIL PROTECTED]>
 
        * DESCryptoServiceProviderTest.cs: Fix CreateEncryptor_KeyNull test 

Modified: 
trunk/mcs/class/corlib/Test/System.Security.Cryptography/DESCryptoServiceProviderTest.cs
===================================================================
--- 
trunk/mcs/class/corlib/Test/System.Security.Cryptography/DESCryptoServiceProviderTest.cs
    2007-11-21 01:52:09 UTC (rev 90057)
+++ 
trunk/mcs/class/corlib/Test/System.Security.Cryptography/DESCryptoServiceProviderTest.cs
    2007-11-21 01:56:10 UTC (rev 90058)
@@ -130,6 +130,12 @@
                        ICryptoTransform decryptor = des.CreateDecryptor (null, 
des.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