2010-05-10 Sebastien Pouliot <sebastien@ximian.com>
[mono.git] / mcs / class / corlib / System.Security.Cryptography / TripleDES.cs
index add883b6ce8757948ae5b9242de87647aa25c8f1..0bc887a15a3f825c2d09959a8c289aea98ab706b 100644 (file)
@@ -5,7 +5,7 @@
 //     Sebastien Pouliot <sebastien@ximian.com>
 //
 // (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2004-2006 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
@@ -27,8 +27,8 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-using System;
 using System.Globalization;
+using System.Runtime.InteropServices;
 using System.Security.Cryptography;
 
 namespace System.Security.Cryptography {
@@ -40,9 +40,10 @@ namespace System.Security.Cryptography {
 //     not free :-(
 //     http://webstore.ansi.org/ansidocstore/product.asp?sku=ANSI+X9%2E52%2D1998
 
+[ComVisible (true)]
 public abstract class TripleDES : SymmetricAlgorithm {
 
-       public TripleDES ()
+       protected TripleDES ()
        {
                // from SymmetricAlgorithm
                KeySizeValue = 192;
@@ -86,6 +87,8 @@ public abstract class TripleDES : SymmetricAlgorithm {
        //      if ( b == c ) then TripleDES == DES(a) (hence weak key)
        public static bool IsWeakKey (byte[] rgbKey)
        {
+               if (rgbKey == null)
+                       throw new CryptographicException (Locale.GetText ("Null Key"));
                // 128 bits (16 bytes) is 3 DES with 2 keys
                if (rgbKey.Length == 16) {
                        // weak if first half == second half
@@ -128,3 +131,4 @@ public abstract class TripleDES : SymmetricAlgorithm {
 }
 
 }
+