AuthenticatedEncryptionProvider.Encrypt Method

Definition

Overloads

Encrypt(Byte[], Byte[])

Encrypts the specified plaintext.

Encrypt(Byte[], Byte[], Byte[])

Encrypts the specified plaintext.

Encrypt(Byte[], Byte[])

Encrypts the specified plaintext.

public virtual Microsoft.IdentityModel.Tokens.AuthenticatedEncryptionResult Encrypt (byte[] plaintext, byte[] authenticatedData);
abstract member Encrypt : byte[] * byte[] -> Microsoft.IdentityModel.Tokens.AuthenticatedEncryptionResult
override this.Encrypt : byte[] * byte[] -> Microsoft.IdentityModel.Tokens.AuthenticatedEncryptionResult
Public Overridable Function Encrypt (plaintext As Byte(), authenticatedData As Byte()) As AuthenticatedEncryptionResult

Parameters

plaintext
Byte[]

The data to be encrypted.

authenticatedData
Byte[]

Will be combined with the initialization vector and ciphertext to create an authentication tag.

Returns

A AuthenticatedEncryptionResult the containing ciphertext, initialization vector, the and authentication tag.

Exceptions

Thrown if authenticatedData is null or empty.

Thrown if AES crypto operation threw. See inner exception for details.

Thrown if the internal SignatureProvider is disposed.

Applies to

Encrypt(Byte[], Byte[], Byte[])

Encrypts the specified plaintext.

public virtual Microsoft.IdentityModel.Tokens.AuthenticatedEncryptionResult Encrypt (byte[] plaintext, byte[] authenticatedData, byte[] iv);
abstract member Encrypt : byte[] * byte[] * byte[] -> Microsoft.IdentityModel.Tokens.AuthenticatedEncryptionResult
override this.Encrypt : byte[] * byte[] * byte[] -> Microsoft.IdentityModel.Tokens.AuthenticatedEncryptionResult
Public Overridable Function Encrypt (plaintext As Byte(), authenticatedData As Byte(), iv As Byte()) As AuthenticatedEncryptionResult

Parameters

plaintext
Byte[]

The data to be encrypted.

authenticatedData
Byte[]

Will be combined with the initialization vector and ciphertext to create an authentication tag.

iv
Byte[]

The initialization vector to be used with the encryption algorithm.

Returns

A AuthenticatedEncryptionResult containing the ciphertext, initialization vector, and the authentication tag.

Exceptions

Thrown if authenticatedData is null or empty.

Thrown if AES crypto operation threw. See inner exception for details.

Thrown if the internal SignatureProvider is disposed.

Applies to