AesCng.Key AesCng.Key AesCng.Key AesCng.Key Property

定义

获取或设置 AesCng 算法的密钥。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()

属性值

Byte[]

AesCng 算法的密钥。The key for the AesCng algorithm.

注解

如果你已创建AesCng对象使用的现有的保留的密钥,当读取的值时Key属性,将会进行尝试导出密钥。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. 在此情况下,如果键不是可导出,CryptographicException将引发。In this case, if the key is not exportable, a CryptographicException will be thrown.

除此之外,如果您设置的值Key属性,将无法再使用持久化的密钥并且将改为使用临时密钥。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. 如果您需要使用同样,持久化的密钥的新实例AesCng类需要创建。If you need to use the persisted key again, a new instance of AesCng class needs to be created.

适用于