Merged into single file, added assertions
[mono.git] / mcs / class / corlib / System.Security / SecureString.cs
index 8ed4571475124e96f3f9fa649c0cb14fb1b1b635..7b1d142ac1de0037dc2b5cd21fcac92c85a321b9 100644 (file)
@@ -26,8 +26,6 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if NET_2_0
-
 using System.Globalization;
 using System.Reflection;
 using System.Runtime.CompilerServices;
@@ -35,11 +33,14 @@ using System.Runtime.InteropServices;
 using System.Runtime.ConstrainedExecution;
 using System.Security.Cryptography;
 using System.Security.Permissions;
+#if NET_4_0
+using System.Runtime.ExceptionServices;
+#endif
 
 namespace System.Security {
 
        [MonoTODO ("work in progress - encryption is missing")]
-       public sealed class SecureString : CriticalFinalizerObject, IDisposable {
+       public sealed class SecureString : IDisposable {
 
                private const int BlockSize = 16;
                private const int MaxSize = 65536;
@@ -90,6 +91,9 @@ namespace System.Security {
                        }
                }
 
+#if NET_4_0
+               [HandleProcessCorruptedStateExceptions]
+#endif
                public void AppendChar (char c)
                {
                        if (disposed)
@@ -146,6 +150,9 @@ namespace System.Security {
                        length = 0;
                }
 
+#if NET_4_0
+               [HandleProcessCorruptedStateExceptions]
+#endif
                public void InsertAt (int index, char c)
                {
                        if (disposed)
@@ -187,6 +194,9 @@ namespace System.Security {
                        read_only = true;
                }
 
+#if NET_4_0
+               [HandleProcessCorruptedStateExceptions]
+#endif
                public void RemoveAt (int index)
                {
                        if (disposed)
@@ -208,6 +218,9 @@ namespace System.Security {
                        }
                }
 
+#if NET_4_0
+               [HandleProcessCorruptedStateExceptions]
+#endif
                public void SetAt (int index, char c)
                {
                        if (disposed)
@@ -304,5 +317,3 @@ namespace System.Security {
                }
        }
 }
-
-#endif