AesCryptoServiceProvider::CreateEncryptor Method (array<Byte>^, array<Byte>^)
Creates a symmetric encryptor object using the specified key and initialization vector (IV).
Assembly: System.Core (in System.Core.dll)
public: virtual ICryptoTransform^ CreateEncryptor( array<unsigned char>^ key, array<unsigned char>^ iv ) override
Parameters
- key
-
Type:
array<System::Byte>^
The secret key to use for the symmetric algorithm.
- iv
-
Type:
array<System::Byte>^
The initialization vector to use for the symmetric algorithm.
| Exception | Condition |
|---|---|
| ArgumentNullException | The key or iv parameter is null. |
| ArgumentException | key is invalid. |
See the code examples in the LegalKeySizes and LegalBlockSizes properties to determine the size of the key and iv parameters.
The following example shows how to use the AesCryptoServiceProvider::CreateEncryptor method to encrypt a message. This code example is part of a larger example provided for the AesCryptoServiceProvider class.
Available since 3.5