This documentation is archived and is not being maintained.

SymmetricAlgorithm.KeySize Property

Gets or sets the size of the secret key used by the symmetric algorithm in bits.

[Visual Basic]
Public Overridable Property KeySize As Integer
public virtual int KeySize {get; set;}
public: __property virtual int get_KeySize();
public: __property virtual void set_KeySize(int);
public function get KeySize() : int;
public function set KeySize(int);

Property Value

The size of the secret key used by the symmetric algorithm.


Exception Type Condition
CryptographicException The key size is not valid.


The valid key sizes are specified by the particular symmetric algorithm implementation and are listed in LegalKeySizes.


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

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