SymmetricAlgorithm.Key 属性

定义

获取或设置对称算法的密钥。

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

属性值

Byte[]

用于对称算法的密钥。

例外

尝试将密钥设置为 null

密钥大小无效。

注解

密钥用于加密和解密。 要成功使用对称算法,密钥必须只有发送方和接收方知道。 有效密钥大小由特定的对称算法实现指定,并在属性中列出 LegalKeySizes

如果使用此属性 null ,则 GenerateKey 调用方法来创建新的随机值。

适用于

另请参阅