SymmetricAlgorithm.FeedbackSize must be a multiple of 8 (bits)
authorSebastien Pouliot <sebastien@xamarin.com>
Thu, 3 Jan 2013 20:59:11 +0000 (15:59 -0500)
committerSebastien Pouliot <sebastien@xamarin.com>
Mon, 7 Jan 2013 01:08:01 +0000 (20:08 -0500)
mcs/class/corlib/System.Security.Cryptography/SymmetricAlgorithm.cs
mcs/class/corlib/Test/System.Security.Cryptography/RijndaelTest.cs

index 60b57e7e7536b33dd99ebfab6ab36f4be80bae13..99b41562aef5e07b5075f35377e8b9fff6e210c7 100644 (file)
@@ -114,6 +114,10 @@ namespace System.Security.Cryptography {
                                        throw new CryptographicException (
                                                Locale.GetText ("feedback size larger than block size"));
                                }
+                               if ((value & 3) != 0) {
+                                       throw new CryptographicException (
+                                               Locale.GetText ("feedback size must be a multiple of 8 (bits)"));
+                               }
                                this.FeedbackSizeValue = value;
                        }
                }
index a45dc64d1f4b86a4f614aeffa509f0f6336a2237..ea5c32c15f99ff9f41229f64267a1e1a8b60a343 100644 (file)
@@ -194,6 +194,13 @@ public class RijndaelTest {
                        }
                }
        }
+
+       [Test]
+       [ExpectedException (typeof (CryptographicException))]
+       public void FeedbackSize_NotMultipleOf8 ()
+       {
+               aes.FeedbackSize = 9;
+       }
 }
 
 }