* MD5.cs: Create using CryptoConfig, set HashSizeValue, removed TODO.
* Rijndael.cs: Create using CryptoConfig. Removed TODO.
* RSAParameters.cs: Modulus must be serialized. Removed TODO.
* SHA256.cs: Create using CryptoConfig, set HashSizeValue, removed TODO.
* SHA384.cs: Create using CryptoConfig, set HashSizeValue, removed TODO.
* SHA512.cs: Create using CryptoConfig, set HashSizeValue, removed TODO.
* FromBase64Transform.cs: Removed ToString()
* ToBase64Transform.cs: Removed ToString()
* SymmetricAlgorithm.cs: Create using CryptoConfig, set default Mode and
Padding, added Clear, Dispose
* TripleDES.cs: New. Abstract class.
* MaskGenerationMethod.cs: New. Abstract class.
* PKCS1MaskGenerationMethod.cs: New. Implement PKCS#1 MGF (currently not
compatible with MS implementation - but not sure the bug is mine!).
svn path=/trunk/mcs/; revision=8254
+2002-10-14 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * MD5.cs: Create using CryptoConfig, set HashSizeValue, removed TODO.
+ * Rijndael.cs: Create using CryptoConfig. Removed TODO.
+ * RSAParameters.cs: Modulus must be serialized. Removed TODO.
+ * SHA256.cs: Create using CryptoConfig, set HashSizeValue, removed TODO.
+ * SHA384.cs: Create using CryptoConfig, set HashSizeValue, removed TODO.
+ * SHA512.cs: Create using CryptoConfig, set HashSizeValue, removed TODO.
+ * FromBase64Transform.cs: Removed ToString()
+ * ToBase64Transform.cs: Removed ToString()
+ * SymmetricAlgorithm.cs: Create using CryptoConfig, set default Mode and
+ Padding, added Clear, Dispose
+ * TripleDES.cs: New. Abstract class.
+ * MaskGenerationMethod.cs: New. Abstract class.
+ * PKCS1MaskGenerationMethod.cs: New. Implement PKCS#1 MGF (currently not
+ compatible with MS implementation - but not sure the bug is mine!).
+
2002-10-13 Sebastien Pouliot <spouliot@videotron.ca>
* HashAlgorithm.cs: Added Dispose() to HashAlgorithm because it
return res;
}
-
-
- /// <summary>
- /// </summary>
- public override string ToString ()
- {
- return "mono::System.Security.Cryptography.FromBase64Transform";
- }
-
} // FromBase64Transform
} // System.Security.Cryptography
//\r
// Authors:\r
// Matthew S. Ford (Matthew.S.Ford@Rose-Hulman.Edu)\r
+// Sebastien Pouliot (spouliot@motus.com)\r
//\r
// Copyright 2001 by Matthew S. Ford.\r
+// Portions (C) 2002 Motus Technologies Inc. (http://www.motus.com)\r
//\r
\r
\r
using System.Security.Cryptography;\r
\r
namespace System.Security.Cryptography {\r
- \r
/// <summary>\r
- /// Common base class for all derived MD5 iplementations.\r
+ /// Common base class for all derived MD5 implementations.\r
/// </summary>\r
public abstract class MD5 : HashAlgorithm {\r
- \r
/// <summary>\r
/// Called from constructor of derived class.\r
/// </summary>\r
- protected MD5 () {\r
- \r
+ // Why is it protected when others abstract hash classes are public ?\r
+ protected MD5 () \r
+ {\r
+ HashSizeValue = 128;\r
}\r
\r
/// <summary>\r
/// Creates the default derived class.\r
/// </summary>\r
- public static new MD5 Create () {\r
- return new MD5CryptoServiceProvider();\r
+ public static new MD5 Create () \r
+ {\r
+ return Create ("System.Security.Cryptography.MD5");\r
}\r
- \r
+\r
/// <summary>\r
/// Creates a new derived implementation.\r
/// </summary>\r
- /// <param name="st">FIXME: No clue. Specifies which derived class to create?</param>\r
- [MonoTODO]\r
- public static new MD5 Create (string st) {\r
- return Create();\r
+ /// <param name="hashName">Specifies which derived class to create</param>\r
+ public static new MD5 Create (string hashName) \r
+ {\r
+ return (MD5) CryptoConfig.CreateFromName (hashName);\r
}\r
}\r
}\r
--- /dev/null
+//
+// MaskGenerationMethod.cs: Handles mask generation.
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System;
+using System.Security.Cryptography;
+
+namespace System.Security.Cryptography
+{
+
+public abstract class MaskGenerationMethod
+{
+ protected MaskGenerationMethod () {}
+
+ public abstract byte[] GenerateMask (byte[] rgbSeed, int cbReturn);
+}
+
+}
\ No newline at end of file
--- /dev/null
+//
+// PKCS1MaskGenerationMethod.cs: Handles PKCS#1 mask generation.
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System;
+using System.Security.Cryptography;
+
+namespace System.Security.Cryptography
+{
+
+// PKCS#1: RSA Cryptography Standard
+// http://www.rsasecurity.com/rsalabs/pkcs/pkcs-1/index.html
+public class PKCS1MaskGenerationMethod : MaskGenerationMethod
+{
+ private string hashName;
+
+ public PKCS1MaskGenerationMethod()
+ {
+ hashName = "SHA1";
+ }
+
+ public string HashName
+ {
+ get { return hashName; }
+ set { hashName = value; }
+ }
+
+ // I2OSP converts a nonnegative integer to an octet string of a specified length.
+ // in this case xLen is always 4 so we simplify the function
+ protected byte[] I2OSP( uint x )
+ {
+ byte[] array = BitConverter.GetBytes( x );
+ Array.Reverse( array ); // big-little endian issues
+ return array;
+ }
+
+ // from MGF1 on page 48 from PKCS#1 v2.1 (pdf version)
+ public override byte[] GenerateMask( byte[] mgfSeed, int maskLen )
+ {
+ // 1. If maskLen > 2^32 hLen, output \93mask too long\94 and stop.
+ // easy - this is impossible by using a int (32bits) as parameter ;-)
+
+ int mgfSeedLength = mgfSeed.Length;
+ HashAlgorithm hash = HashAlgorithm.Create( hashName );
+ int hLen = ( hash.HashSize >> 3 ); // from bits to bytes
+ int iterations = ( maskLen / hLen );
+ if ( maskLen % hLen != 0 )
+ iterations++;
+ // 2. Let T be the empty octet string.
+ byte[] T = new byte[ ( iterations * hLen ) ];
+
+ byte[] toBeHashed = new byte[ mgfSeedLength + 4 ];
+ int pos = 0;
+ // 3. For counter from 0 to ( maskLen / hLen ) \96 1, do the following:
+ for ( uint counter = 0; counter < iterations; counter++ )
+ {
+ // a. Convert counter to an octet string C of length 4 octets
+ // C = I2OSP (counter, 4)
+ byte[] C = I2OSP( counter );
+
+ // b. Concatenate the hash of the seed mgfSeed and C to the octet string T:
+ // T = T || Hash (mgfSeed || C)
+ Array.Copy( mgfSeed, 0, toBeHashed, 0, mgfSeedLength );
+ Array.Copy( C, 0, toBeHashed, mgfSeedLength, 4 );
+ byte[] output = hash.ComputeHash( toBeHashed );
+ Array.Copy( output, 0, T, pos, hLen );
+ pos += mgfSeedLength;
+ }
+
+ // 4. Output the leading maskLen octets of T as the octet string mask.
+ byte[] mask = new byte[ maskLen ];
+ Array.Copy( T, 0, mask, 0, maskLen );
+ return mask;
+ }
+}
+
+}
//\r
// (C) 2002\r
//\r
-// Stubbed.\r
-//\r
\r
using System;\r
\r
namespace System.Security.Cryptography {\r
\r
- [MonoTODO]\r
[Serializable]\r
public struct RSAParameters {\r
[NonSerialized]\r
public byte[] DQ;\r
[NonSerialized]\r
public byte[] InverseQ;\r
- [NonSerialized]\r
\r
public byte[] Modulus;\r
public byte[] Exponent;\r
//\r
// Authors: Dan Lewis (dihlewis@yahoo.co.uk)\r
// Andrew Birkett (andy@nobugs.org)\r
-// (C) 2002\r
//\r
+// (C) 2002\r
//\r
\r
using System;\r
\r
namespace System.Security.Cryptography {\r
\r
- [MonoTODO]\r
public abstract class Rijndael : SymmetricAlgorithm {\r
- public static new Rijndael Create () { return new RijndaelManaged(); }\r
- public static new Rijndael Create (string alg) { return Create (); }\r
+\r
+ public static new Rijndael Create () \r
+ {\r
+ return Create ("System.Security.Cryptography.Rijndael");\r
+ }\r
+\r
+ public static new Rijndael Create (string algName) \r
+ {\r
+ return (Rijndael) CryptoConfig.CreateFromName (algName);\r
+ }\r
\r
- public Rijndael () {\r
+ public Rijndael () \r
+ {\r
KeySizeValue = 256;\r
BlockSizeValue = 128;\r
FeedbackSizeValue = 128;\r
\r
LegalBlockSizesValue = new KeySizes[1];\r
LegalBlockSizesValue[0] = new KeySizes(128, 256, 64);\r
-\r
}\r
}\r
}\r
//\r
// Authors:\r
// Matthew S. Ford (Matthew.S.Ford@Rose-Hulman.Edu)\r
+// Sebastien Pouliot (spouliot@motus.com)\r
//\r
// Copyright 2001 by Matthew S. Ford.\r
+// Portions (C) 2002 Motus Technologies Inc. (http://www.motus.com)\r
//\r
\r
\r
using System.Security.Cryptography;\r
\r
namespace System.Security.Cryptography {\r
- \r
/// <summary>\r
- /// Common base class for all derived SHA256 iplementations.\r
- /// Abstract.\r
+ /// Common base class for all derived SHA256 implementations.\r
/// </summary>\r
public abstract class SHA256 : HashAlgorithm {\r
- \r
/// <summary>\r
/// Called from constructor of derived class.\r
/// </summary>\r
- public SHA256 () {\r
- \r
+ public SHA256 () \r
+ {\r
+ HashSizeValue = 256;\r
}\r
\r
/// <summary>\r
/// Creates the default derived class.\r
/// </summary>\r
- public static new SHA256 Create () {\r
- return new SHA256Managed ();\r
+ public static new SHA256 Create () \r
+ {\r
+ return Create ("System.Security.Cryptography.SHA256");\r
}\r
\r
/// <summary>\r
/// Creates a new derived class.\r
/// </summary>\r
- /// <param name="st">FIXME: No clue. Specifies which derived class to create?</param>\r
- [MonoTODO]\r
- public static new SHA256 Create (string st) {\r
- return Create ();\r
+ /// <param name="hashName">Specifies which derived class to create</param>\r
+ public static new SHA256 Create (string hashName) \r
+ {\r
+ return (SHA256) CryptoConfig.CreateFromName (hashName);\r
}\r
}\r
}\r
-\r
//\r
// Authors:\r
// Matthew S. Ford (Matthew.S.Ford@Rose-Hulman.Edu)\r
+// Sebastien Pouliot (spouliot@motus.com)\r
//\r
// Copyright 2001 by Matthew S. Ford.\r
+// Portions (C) 2002 Motus Technologies Inc. (http://www.motus.com)\r
//\r
\r
\r
using System.Security.Cryptography;\r
\r
namespace System.Security.Cryptography {\r
- \r
/// <summary>\r
- /// Common base class for all derived SHA384 iplementations.\r
+ /// Common base class for all derived SHA384 implementations.\r
/// </summary>\r
public abstract class SHA384 : HashAlgorithm {\r
- \r
/// <summary>\r
/// Called from constructor of derived class.\r
/// </summary>\r
- public SHA384 () {\r
- \r
+ public SHA384 () \r
+ {\r
+ HashSizeValue = 384;\r
}\r
\r
- \r
/// <summary>\r
/// Creates the default derived class.\r
/// </summary>\r
- public static new SHA384 Create () {\r
- return new SHA384Managed();\r
+ public static new SHA384 Create () \r
+ {\r
+ return Create ("System.Security.Cryptography.SHA384");\r
}\r
\r
/// <summary>\r
/// Creates a new derived class.\r
/// </summary>\r
- /// <param name="st">FIXME: No clue. Specifies which derived class to create?</param>\r
- [MonoTODO]\r
- public static new SHA384 Create (string st) {\r
- return Create();\r
+ /// <param name="hashName">Specifies which derived class to create</param>\r
+ public static new SHA384 Create (string hashName) \r
+ {\r
+ return (SHA384) CryptoConfig.CreateFromName (hashName);\r
}\r
}\r
}\r
-\r
//\r
// Authors:\r
// Matthew S. Ford (Matthew.S.Ford@Rose-Hulman.Edu)\r
+// Sebastien Pouliot (spouliot@motus.com)\r
//\r
// Copyright 2001 by Matthew S. Ford.\r
+// Portions (C) 2002 Motus Technologies Inc. (http://www.motus.com)\r
//\r
\r
\r
using System.Security.Cryptography;\r
\r
namespace System.Security.Cryptography {\r
- \r
/// <summary>\r
- /// Common base class for all derived SHA512 iplementations.\r
+ /// Common base class for all derived SHA512 implementations.\r
/// </summary>\r
public abstract class SHA512 : HashAlgorithm {\r
- \r
/// <summary>\r
/// Called from constructor of derived class.\r
/// </summary>\r
- public SHA512 () {\r
- \r
+ public SHA512 () \r
+ {\r
+ HashSizeValue = 512;\r
}\r
\r
- \r
/// <summary>\r
/// Creates the default derived class.\r
/// </summary>\r
- public static new SHA512 Create () {\r
- return new SHA512Managed();\r
+ public static new SHA512 Create () \r
+ {\r
+ return Create ("System.Security.Cryptography.SHA512");\r
}\r
\r
/// <summary>\r
/// Creates a new derived class.\r
/// </summary>\r
- /// <param name="st">FIXME: No clue. Specifies which derived class to create?</param>\r
- [MonoTODO]\r
- public static new SHA512 Create (string st) {\r
- return Create();\r
+ /// <param name="hashName">Specifies which derived class to create</param>\r
+ public static new SHA512 Create (string hashName) \r
+ {\r
+ return (SHA512) CryptoConfig.CreateFromName (hashName);\r
}\r
}\r
}\r
-\r
//\r
// Authors:\r
// Thomas Neidhart (tome@sbox.tugraz.at)\r
+// Sebastien Pouliot (spouliot@motus.com)\r
+//\r
+// Portions (C) 2002 Motus Technologies Inc. (http://www.motus.com)\r
//\r
\r
using System;\r
\r
namespace System.Security.Cryptography {\r
- \r
/// <summary>\r
/// Abstract base class for all cryptographic symmetric algorithms.\r
/// Available algorithms include:\r
/// DES, RC2, Rijndael, TripleDES\r
/// </summary>\r
- public abstract class SymmetricAlgorithm {\r
+ public abstract class SymmetricAlgorithm \r
+ {\r
protected int BlockSizeValue; // The block size of the cryptographic operation in bits. \r
protected int FeedbackSizeValue; // The feedback size of the cryptographic operation in bits. \r
protected byte[] IVValue; // The initialization vector ( IV) for the symmetric algorithm. \r
/// <summary>\r
/// Called from constructor of derived class.\r
/// </summary>\r
- public SymmetricAlgorithm () {\r
+ public SymmetricAlgorithm () \r
+ {\r
+ // default for all symmetric algorithm\r
+ ModeValue = CipherMode.CBC;\r
+ PaddingValue = PaddingMode.PKCS7;\r
}\r
\r
/// <summary>\r
/// Called from constructor of derived class.\r
/// </summary>\r
- ~SymmetricAlgorithm () {\r
- if (KeyValue != null) {\r
- Array.Clear(KeyValue, 0, KeyValue.Length);\r
- KeyValue = null;\r
- }\r
+ ~SymmetricAlgorithm () \r
+ {\r
+ Dispose (true);\r
}\r
\r
/// <summary>\r
/// Gets or sets the actual key size in bits\r
/// </summary>\r
public virtual int KeySize {\r
- get {\r
- return this.KeySizeValue;\r
- }\r
+ get { return this.KeySizeValue; }\r
set {\r
if (!IsLegalKeySize(this.LegalKeySizesValue, value))\r
throw new CryptographicException("key size not supported by algorithm");\r
/// Gets all legal block sizes\r
/// </summary>\r
public virtual KeySizes[] LegalBlockSizes {\r
- get {\r
- return this.LegalBlockSizesValue;\r
- }\r
+ get { return this.LegalBlockSizesValue; }\r
}\r
\r
/// <summary>\r
/// Gets all legal key sizes\r
/// </summary>\r
public virtual KeySizes[] LegalKeySizes {\r
- get {\r
- return this.LegalKeySizesValue;\r
- }\r
+ get { return this.LegalKeySizesValue; }\r
}\r
\r
/// <summary>\r
/// Gets or sets the actual cipher mode\r
/// </summary>\r
- public virtual CipherMode Mode {\r
- get {\r
- return this.ModeValue;\r
- }\r
+ public virtual CipherMode Mode {\r
+ get { return this.ModeValue; }\r
set {\r
if (Enum.IsDefined(ModeValue.GetType(), value))\r
this.ModeValue = value;\r
/// Gets or sets the actual padding\r
/// </summary>\r
public virtual PaddingMode Padding {\r
- get {\r
- return this.PaddingValue;\r
- }\r
+ get { return this.PaddingValue; }\r
set {\r
if (Enum.IsDefined(PaddingValue.GetType(), value))\r
this.PaddingValue = value;\r
}\r
}\r
\r
+ public void Clear() \r
+ {\r
+ Dispose (true);\r
+ }\r
+\r
/// <summary>\r
/// Gets an Decryptor transform object to work with a CryptoStream\r
/// </summary>\r
- public virtual ICryptoTransform CreateDecryptor() {\r
- return CreateDecryptor(Key, IV);\r
+ public virtual ICryptoTransform CreateDecryptor () \r
+ {\r
+ return CreateDecryptor (Key, IV);\r
}\r
\r
/// <summary>\r
/// Gets an Decryptor transform object to work with a CryptoStream\r
/// </summary>\r
- public abstract ICryptoTransform CreateDecryptor(byte[] rgbKey, byte[] rgbIV);\r
+ public abstract ICryptoTransform CreateDecryptor (byte[] rgbKey, byte[] rgbIV);\r
\r
/// <summary>\r
/// Gets an Encryptor transform object to work with a CryptoStream\r
/// </summary>\r
- public virtual ICryptoTransform CreateEncryptor() {\r
- return CreateEncryptor(Key, IV);\r
+ public virtual ICryptoTransform CreateEncryptor () \r
+ {\r
+ return CreateEncryptor (Key, IV);\r
}\r
\r
/// <summary>\r
/// Gets an Encryptor transform object to work with a CryptoStream\r
/// </summary>\r
- public abstract ICryptoTransform CreateEncryptor(byte[] rgbKey, byte[] rgbIV);\r
+ public abstract ICryptoTransform CreateEncryptor (byte[] rgbKey, byte[] rgbIV);\r
+\r
+ protected virtual void Dispose (bool disposing) \r
+ {\r
+ // zeroize key material for security\r
+ if (KeyValue != null) {\r
+ Array.Clear(KeyValue, 0, KeyValue.Length);\r
+ KeyValue = null;\r
+ }\r
+ }\r
\r
/// <summary>\r
/// used to generate an inital vector if none is specified\r
/// </summary>\r
- public abstract void GenerateIV();\r
+ public abstract void GenerateIV ();\r
\r
/// </summary>\r
/// used to generate a random key if none is specified\r
/// </summary>\r
- public abstract void GenerateKey();\r
+ public abstract void GenerateKey ();\r
\r
- internal bool IsLegalKeySize(KeySizes[] LegalKeys, int Size) {\r
+ internal bool IsLegalKeySize (KeySizes[] LegalKeys, int Size) \r
+ {\r
foreach (KeySizes LegalKeySize in LegalKeys) {\r
for (int i=LegalKeySize.MinSize; i<=LegalKeySize.MaxSize; i+=LegalKeySize.SkipSize) {\r
if (i == Size)\r
/// Checks wether the given keyLength is valid for the current algorithm\r
/// </summary>\r
/// <param name="bitLength">the given keyLength</param>\r
- public bool ValidKeySize(int bitLength) {\r
- return IsLegalKeySize(LegalKeySizesValue, bitLength);\r
+ public bool ValidKeySize (int bitLength) \r
+ {\r
+ return IsLegalKeySize (LegalKeySizesValue, bitLength);\r
}\r
\r
/// <summary>\r
/// Creates the default implementation of the default symmetric algorithm (Rijndael).\r
/// </summary>\r
- public static SymmetricAlgorithm Create () {\r
- return Rijndael.Create();\r
+ // LAMESPEC: Default is Rijndael - not TripleDES\r
+ public static SymmetricAlgorithm Create () \r
+ {\r
+ return Create ("System.Security.Cryptography.SymmetricAlgorithm");\r
}\r
\r
/// <summary>\r
/// Creates a specific implementation of the given symmetric algorithm.\r
/// </summary>\r
- /// <param name="algName">the given algorithm</param>\r
- [MonoTODO]\r
- public static SymmetricAlgorithm Create (string algName) {\r
- // TODO: Use Reflection to create a new algorithm instance\r
- return null;\r
+ /// <param name="algName">Specifies which derived class to create</param>\r
+ public static SymmetricAlgorithm Create (string algName) \r
+ {\r
+ return (SymmetricAlgorithm) CryptoConfig.CreateFromName (algName);\r
}\r
}\r
}\r
return res;
}
-
-
- /// <summary>
- /// </summary>
- public override string ToString ()
- {
- return "mono::System.Security.Cryptography.ToBase64Transform";
- }
-
} // ToBase64Transform
--- /dev/null
+//
+// TripleDES.cs: Handles TripleDES (abstract class)
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System;
+using System.Security.Cryptography;
+
+namespace System.Security.Cryptography {
+
+// References:
+// a. FIPS PUB 46-3: TripleDES
+// http://csrc.nist.gov/publications/fips/fips46-3/fips46-3.pdf
+// b. ANSI X9.52
+// http://webstore.ansi.org/ansidocstore/product.asp?sku=ANSI+X9%2E52%2D1998
+
+abstract class TripleDES : SymmetricAlgorithm {
+
+ public TripleDES ()
+ {
+ // from SymmetricAlgorithm
+ KeySizeValue = 192;
+ BlockSizeValue = 64;
+ FeedbackSizeValue = 64;
+ }
+
+ public override byte[] Key {
+ get { return KeyValue; }
+ set {
+ if (value == null)
+ throw new ArgumentNullException ();
+ // this will check for both key size and weak keys
+ if (IsWeakKey (value))
+ throw new CryptographicException ();
+ KeyValue = (byte[]) value.Clone();
+ }
+ }
+
+ // Triple DES is DES in EDE = Encrypt - Decrypt - Encrypt
+ // with 2 keys (a,b)
+ // EDE = Encrypt (a) - Decrypt (b) - Encrypt (a)
+ // if a == b then TripleDES == DES(a) (hence weak key)
+ // with 3 keys (a,b,c)
+ // EDE = Encrypt (a) - Decrypt (b) - Encrypt (c)
+ // if ( a == b ) then TripleDES == DES(c) (hence weak key)
+ // if ( b == c ) then TripleDES == DES(a) (hence weak key)
+ public static bool IsWeakKey (byte[] rgbKey)
+ {
+ // 128 bits (16 bytes) is 3 DES with 2 keys
+ if (rgbKey.Length == 16) {
+ // weak if first half == second half
+ for (int i = 0; i < 8; i++)
+ if (rgbKey [i] != rgbKey [i+8])
+ return false;
+ }
+ // 192 bits (24 bytes) is 3 DES with 3 keys
+ else if (rgbKey.Length == 24) {
+ bool bFirstCase = true;
+ // weak if first third == second third
+ for (int i = 0; i < 8; i++) {
+ if (rgbKey [i] != rgbKey [i+8]) {
+ bFirstCase = false;
+ break;
+ }
+ }
+ // weak if second third == third third
+ if (!bFirstCase) {
+ for (int i = 8; i < 16; i++)
+ if (rgbKey [i] != rgbKey [i+8])
+ return false;
+ }
+ }
+ else
+ throw new CryptographicException ();
+
+ return true;
+ }
+
+ public static new TripleDES Create ()
+ {
+ return Create ("System.Security.Cryptography.TripleDES");
+ }
+
+ public static new TripleDES Create (string str)
+ {
+ return (TripleDES) CryptoConfig.CreateFromName (str);
+ }
+}
+
+}
+