IAuthenticatedEncryptor.Encrypt Method

Definition

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

Byte[]

The ciphertext blob, including authentication tag.

Remarks

All cryptography-related exceptions should be homogenized to CryptographicException.

Applies to