[docs] Import of Microsoft BCL Documentation.
[mono.git] / mcs / class / corlib / System.Security.Cryptography / SymmetricAlgorithm.cs
index 2ee27a7fabcbdea3b57f808622b05abb2c89b935..ba713e8c6e5a3b41374f05672ec3e3421147f111 100644 (file)
@@ -42,35 +42,22 @@ namespace System.Security.Cryptography {
                protected byte[] KeyValue; 
                protected KeySizes[] LegalBlockSizesValue; 
                protected KeySizes[] LegalKeySizesValue; 
-#if MOONLIGHT
-               // Silverlight 2.0 only supports CBC
-               internal int FeedbackSizeValue;
-               internal CipherMode ModeValue;
-               internal PaddingMode PaddingValue;
-#else
                protected int FeedbackSizeValue;
                protected CipherMode ModeValue;
                protected PaddingMode PaddingValue;
-#endif
                private bool m_disposed;
 
                protected SymmetricAlgorithm ()
                {
                        ModeValue = CipherMode.CBC;
                        PaddingValue = PaddingMode.PKCS7;
-                       m_disposed = false;
                }
 
-#if MOONLIGHT
-               // No Finalizer or IDisposable.Dispose in Silverlight 2.0
-               // Documentation makes it "clear" that Clear MUST BE CALLED to zero out sensitive information
-#else          
-               ~SymmetricAlgorithm () 
-               {
-                       Dispose (false);
-               }
-#endif
+#if NET_4_0
+               public void Dispose ()
+#else
                void IDisposable.Dispose () 
+#endif
                {
                        Dispose (true);
                        GC.SuppressFinalize (this);  // Finalization is now unnecessary
@@ -120,6 +107,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;
                        }
                }
@@ -235,7 +226,11 @@ namespace System.Security.Cryptography {
                // LAMESPEC: Default is Rijndael - not TripleDES
                public static SymmetricAlgorithm Create () 
                {
+#if FULL_AOT_RUNTIME
+                       return new System.Security.Cryptography.RijndaelManaged ();
+#else
                        return Create ("System.Security.Cryptography.SymmetricAlgorithm");
+#endif
                }
 
                public static SymmetricAlgorithm Create (string algName)