IAuthenticatedEncryptor.Encrypt Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Encrypts and tamper-proofs a piece of data.
public:
cli::array <System::Byte> ^ Encrypt(ArraySegment<System::Byte> plaintext, ArraySegment<System::Byte> additionalAuthenticatedData);
public byte[] Encrypt (ArraySegment<byte> plaintext, ArraySegment<byte> additionalAuthenticatedData);
abstract member Encrypt : ArraySegment<byte> * ArraySegment<byte> -> byte[]
Public Function Encrypt (plaintext As ArraySegment(Of Byte), additionalAuthenticatedData As ArraySegment(Of Byte)) As Byte()
Parameters
- plaintext
- ArraySegment<Byte>
The plaintext to encrypt. This input may be zero bytes in length.
- additionalAuthenticatedData
- ArraySegment<Byte>
A piece of data which will not be included in the returned ciphertext but which will still be covered by the authentication tag. This input may be zero bytes in length. The same AAD must be specified in the corresponding call to Decrypt.
Returns
The ciphertext blob, including authentication tag.
Remarks
All cryptography-related exceptions should be homogenized to CryptographicException.