AesCng.Key 属性

定义

获取或设置 AesCng 算法的密钥。

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 算法的密钥。

注解

如果已使用现有的持久化键创建了 AesCng 对象,则读取 Key 属性值时,将尝试导出密钥。 在这种情况下,如果密钥不可导出,将引发一个 CryptographicException

此外,如果设置 Key 属性值,将不再使用持久化键,而是使用临时键。 如果需要再次使用持久化密钥,则需要创建类的新实例 AesCng

适用于