AesCng.CreateDecryptor 方法
定义
创建对称解密器对象。Creates a symmetric decryptor object.
重载
| CreateDecryptor() |
用当前键和初始化向量 (IV) 创建对称 AES 解密器对象。Creates a symmetric AES decryptor object with the current key and initialization vector (IV). |
| CreateDecryptor(Byte[], Byte[]) |
用指定的密钥和初始化向量 (IV) 创建对称 AES 解密器对象。Creates a symmetric AES decryptor object with the specified key and initialization vector (IV). |
CreateDecryptor()
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 解密器对象。A symmetric AES decryptor object.
注解
此方法对使用具有相同签名的重载创建的加密消息 CreateEncryptor() 进行解密。This method decrypts an encrypted message created using the CreateEncryptor() overload with the same signature.
适用于
CreateDecryptor(Byte[], Byte[])
用指定的密钥和初始化向量 (IV) 创建对称 AES 解密器对象。Creates a symmetric AES decryptor object with the specified key and initialization vector (IV).
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 算法的密钥。The secret key to use for the AES algorithm. 密钥大小必须为 128、192 或 256 位。The key size must be 128, 192, or 256 bits.
- rgbIV
- Byte[]
用于 AES 算法的初始化向量。The initialization vector to use for the AES algorithm.
返回
对称 AES 解密器对象。A symmetric AES decryptor object.
例外
rgbKey 为 null。rgbKey is null.
rgbKey 的大小对于此算法无效。rgbKey is not a valid size for this algorithm.
- 或 --or-
rgbIV 的大小与此算法的块大小不匹配。rgbIV size does not match the block size for this algorithm.
rgbKey 是此算法的已知弱密钥,不能使用。rgbKey is a known weak key for this algorithm and cannot be used.
- 或 --or-
rgbIV 为 null。rgbIV is null.
注解
此方法对使用具有相同签名的重载创建的加密消息 CreateEncryptor(Byte[], Byte[]) 进行解密。This method decrypts an encrypted message created using the CreateEncryptor(Byte[], Byte[]) overload with the same signature.
备注
如果已 AesCng 使用现有的持久化密钥创建了对象,并且想要在解密消息时使用该密钥,则需要设置 IV 属性,然后改为调用无参数 CreateDecryptor() 重载; 否则,使用此方法将创建参数指定的临时密钥 rgbKey 。If you've created the AesCng object using an existing persisted key and you want to make use of that key when decrypting the message, you want to set the IV property and then call the parameterless CreateDecryptor() overload instead; otherwise, using this method will create an ephemeral key as specified by the rgbKey parameter.