<PackageReference Include="Microsoft.IdentityModel.Tokens" Version="8.21.0" />

Microsoft.IdentityModel.Tokens.AuthenticatedEncryptionProvider

Provides authenticated encryption and decryption services.
public string Algorithm { get; }

Gets the encryption algorithm that is being used.

public string Context { get; set; }

Gets or sets a user context for a AuthenticatedEncryptionProvider.

public SecurityKey Key { get; }

Gets the SecurityKey that is being used.

public AuthenticatedEncryptionProvider(SecurityKey key, string algorithm)

Initializes a new instance of the AuthenticatedEncryptionProvider class used for encryption and decryption.

public virtual byte[] Decrypt(byte[] ciphertext, byte[] authenticatedData, byte[] iv, byte[] authenticationTag)

Decrypts ciphertext into plaintext.

public void Dispose()

Calls Dispose and SuppressFinalize

protected virtual void Dispose(bool disposing)

Releases managed resources.

public virtual AuthenticatedEncryptionResult Encrypt(byte[] plaintext, byte[] authenticatedData)

Encrypts the specified plaintext.

public virtual AuthenticatedEncryptionResult Encrypt(byte[] plaintext, byte[] authenticatedData, byte[] iv)

Encrypts the specified plaintext.

protected virtual byte[] GetKeyBytes(SecurityKey key)

Called to obtain the byte[] needed to create a KeyedHashAlgorithm.

protected virtual bool IsSupportedAlgorithm(SecurityKey key, string algorithm)

Checks if the key/algorithm pair is supported.

protected virtual void ValidateKeySize(SecurityKey key, string algorithm)

Checks that the key has sufficient length.