This documentation is archived and is not being maintained.

MACTripleDES.MACTripleDES(String, Byte[]) Constructor

Initializes a new instance of the MACTripleDES class with the specified key data using the specified implementation of TripleDES.

Namespace: System.Security.Cryptography
Assembly: mscorlib (in mscorlib.dll)

public MACTripleDES (
	string strTripleDES,
	byte[] rgbKey
)
public MACTripleDES (
	String strTripleDES, 
	byte[] rgbKey
)
public function MACTripleDES (
	strTripleDES : String, 
	rgbKey : byte[]
)
Not applicable.

Parameters

strTripleDES

The name of the TripleDES implementation to use.

rgbKey

The secret key for MACTripleDES encryption.

Exception typeCondition

ArgumentNullException

The rgbKey parameter is a null reference (Nothing in Visual Basic).

CryptographicUnexpectedOperationException

The strTripleDES parameter is not a valid name of a TripleDES implementation.

The strTripleDES parameter is the friendly name of the TripleDES implementation type. The default implementation is System.Security.Cryptography.TripleDES.

The rgbKey parameter must be 16 or 24 bytes in length.

The following code example demonstrates how to create a new MACTripleDES using a random key and the TripleDES name. This code example is part of a larger example provided for the MACTripleDES class.

byte[] key = new byte[24];
RandomNumberGenerator.Create().GetBytes(key);
string tripleDesName = "System.Security.Cryptography.TripleDES";
MACTripleDES macTriple = new MACTripleDES(tripleDesName, key);

ubyte key[] = new ubyte[24];
RandomNumberGenerator.Create().GetBytes(key);
String tripleDesName = "System.Security.Cryptography.TripleDES";
MACTripleDES macTriple = new MACTripleDES(tripleDesName, key);

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0
Show: