Generates a symmetric key for use with the DES or Triple-DES algorithms. This function will always return a key that is not considered weak by TripleDES.IsWeakKey().
Namespace: Microsoft.IdentityModel
Assembly: Microsoft.IdentityModel (in microsoft.identitymodel.dll)

Usage

Visual Basic
Dim keySizeInBits As Integer
Dim returnValue As Byte()

returnValue = KeyGenerator.GenerateDESKey(keySizeInBits)

Syntax

Visual Basic
Public Shared Function GenerateDESKey ( _
		keySizeInBits As Integer _
) As Byte()
C#
public static byte[] GenerateDESKey (
		int keySizeInBits
)
C++
public:
static array<unsigned char>^ GenerateDESKey (
		int keySizeInBits
)
J#
public static byte[] GenerateDESKey (
		int keySizeInBits
)
JScript
public static function GenerateDESKey (
		keySizeInBits : int
) : byte[]

Parameters

keySizeInBits

The key size in bits.

Return Value

The symmetric key.

Exceptions

Exception type Condition

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Platforms

Development Platforms

Windows Server 2003, Windows Vista

Target Platforms

Windows Server 2008, Windows Vista, Not tested on Windows XP

See Also