Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

AesCng::CreateDecryptor Method (array<Byte>^, array<Byte>^)

 

Creates a symmetric AES decryptor object with the specified key and initialization vector (IV).

Namespace:   System.Security.Cryptography
Assembly:  System.Core (in System.Core.dll)

public:
virtual ICryptoTransform^ CreateDecryptor(
	array<unsigned char>^ rgbKey,
	array<unsigned char>^ rgbIV
) override

Parameters

rgbKey
Type: array<System::Byte>^

The secret key to use for the AES algorithm. The key size must be 128, 192, or 256 bits.

rgbIV
Type: array<System::Byte>^

The initialization vector to use for the AES algorithm.

Return Value

Type: System.Security.Cryptography::ICryptoTransform^

A symmetric AES decryptor object.

Exception Condition
ArgumentNullException

rgbKey is null.

ArgumentException

rgbKey is not a valid size for this algorithm.

-or-

rgbIV size does not match the block size for this algorithm.

CryptographicException

rgbKey is a known weak key for this algorithm and cannot be used.

-or-

rgbIV is null.

This method decrypts an encrypted message created using the CreateEncryptor(array<Byte>^, array<Byte>^) overload with the same signature.

System_CAPS_noteNote

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.

.NET Framework
Available since 4.6.2
Return to top
Show:
© 2017 Microsoft