Share via


AesCng.CreateDecryptor 方法

定义

创建对称解密器对象。

重载

CreateDecryptor()

用当前键和初始化向量 (IV) 创建对称 AES 解密器对象。

CreateDecryptor(Byte[], Byte[])

用指定的密钥和初始化向量 (IV) 创建对称 AES 解密器对象。

CreateDecryptor()

用当前键和初始化向量 (IV) 创建对称 AES 解密器对象。

public:
 override System::Security::Cryptography::ICryptoTransform ^ CreateDecryptor();
public override System.Security.Cryptography.ICryptoTransform CreateDecryptor ();
override this.CreateDecryptor : unit -> System.Security.Cryptography.ICryptoTransform
Public Overrides Function CreateDecryptor () As ICryptoTransform

返回

对称 AES 解密器对象。

例外

.NET 6 及更高版本:选择 CFB128 模式并保留密钥。

注解

此方法解密使用具有相同签名的 CreateEncryptor() 重载创建的加密消息。

适用于

CreateDecryptor(Byte[], Byte[])

Source:
Cng.NotSupported.cs
Source:
Cng.NotSupported.cs
Source:
Cng.NotSupported.cs

用指定的密钥和初始化向量 (IV) 创建对称 AES 解密器对象。

public:
 override System::Security::Cryptography::ICryptoTransform ^ CreateDecryptor(cli::array <System::Byte> ^ rgbKey, cli::array <System::Byte> ^ rgbIV);
public override System.Security.Cryptography.ICryptoTransform CreateDecryptor (byte[] rgbKey, byte[]? rgbIV);
public override System.Security.Cryptography.ICryptoTransform CreateDecryptor (byte[] rgbKey, byte[] rgbIV);
override this.CreateDecryptor : byte[] * byte[] -> System.Security.Cryptography.ICryptoTransform
Public Overrides Function CreateDecryptor (rgbKey As Byte(), rgbIV As Byte()) As ICryptoTransform

参数

rgbKey
Byte[]

用于 AES 算法的密钥。 密钥大小必须为 128、192 或 256 位。

rgbIV
Byte[]

用于 AES 算法的初始化向量。

返回

对称 AES 解密器对象。

例外

rgbKeynull

rgbKey 的大小对于此算法无效。

- 或 -

rgbIV 的大小与此算法的块大小不匹配。

rgbKey 是此算法的已知弱密钥,不能使用。

- 或 -

rgbIVnull

注解

此方法解密使用具有相同签名的 CreateEncryptor(Byte[], Byte[]) 重载创建的加密消息。

注意

如果已使用现有的持久化密钥创建了 AesCng 对象,并且想要在解密消息时使用该密钥,则需要设置 IV 属性,然后改为调用无 CreateDecryptor() 参数重载;否则,使用此方法将创建由 rgbKey 参数指定的临时密钥。

适用于