Bewerken

Delen via


AesCng.Key Property

Definition

Gets or sets the key for the AesCng algorithm.

public:
 virtual property cli::array <System::Byte> ^ Key { cli::array <System::Byte> ^ get(); void set(cli::array <System::Byte> ^ value); };
public override byte[] Key { get; set; }
member this.Key : byte[] with get, set
Public Overrides Property Key As Byte()

Property Value

Byte[]

The key for the AesCng algorithm.

Remarks

If you've created the AesCng object using an existing persisted key, when you read the value of the Key property, an attempt to export the key will be made. In this case, if the key is not exportable, a CryptographicException will be thrown.

In addition to that, if you set the value of the Key property, the persisted key will no longer be used and a temporary key will be used instead. If you need to use the persisted key again, a new instance of AesCng class needs to be created.

Applies to