This documentation is archived and is not being maintained.

DES.Key Property

Gets or sets the secret key for the Data Encryption Standard (DES) algorithm.

[Visual Basic]
Overrides Public Property Key As Byte ()
public override byte[] Key {get; set;}
public: __property unsigned char get_Key();
public: __property void set_Key(unsigned char __gc[]);
public override function get Key() : Byte[];
public override function set Key(Byte[]);

Property Value

The secret key for the DES algorithm.


Exception Type Condition
ArgumentNullException An attempt is made to set the key to a null reference (Nothing in Visual Basic).
ArgumentException An attempt is made to set a key whose length is not equal to BlockSizeValue.
CryptographicException An attempt is made to set a weak key (see IsWeakKey) or a semi-weak key (see IsSemiWeakKey).


If this property is a null reference (Nothing in Visual Basic) when it is used, GenerateKey is called to create a new random value.

The length of the key must be equal to BlockSizeValue.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

DES Class | DES Members | System.Security.Cryptography Namespace | Cryptographic Services