Early Preview

This is currently very much a preview. Please feel free to try things out, but don't be upset if anything is not yet working. Feedback is welcome over on our GitHub Dicussions page.

class Microsoft.​IdentityModel.​Tokens.​AuthenticatedEncryptionProvider

Assembly: Microsoft.IdentityModel.Tokens

Inheritance: object → AuthenticatedEncryptionProvider

Implemented Interfaces

Provides authenticated encryption and decryption services.

Properties

public string
Algorithm
Gets the encryption algorithm that is being used.
public string
Context
Gets or sets a user context for a <see cref="T:Microsoft.IdentityModel.Tokens.AuthenticatedEncryptionProvider" /> .
Remarks This is null by default. This can be used by applications for extensibility scenarios.
public SecurityKey
Key
Gets the <see cref="T:Microsoft.IdentityModel.Tokens.SecurityKey" /> that is being used.

Methods

Encrypt​(byte[] plaintext, byte[] authenticatedData)
Encrypts the specified plaintext.
Returns A <see cref="T:Microsoft.IdentityModel.Tokens.AuthenticatedEncryptionResult" /> the containing ciphertext, initialization vector, the and authentication tag.
plaintext The data to be encrypted.
authenticatedData Will be combined with the initialization vector and ciphertext to create an authentication tag.
Encrypt​(byte[] plaintext, byte[] authenticatedData, byte[] iv)
Encrypts the specified plaintext.
Returns A <see cref="T:Microsoft.IdentityModel.Tokens.AuthenticatedEncryptionResult" /> containing the ciphertext, initialization vector, and the authentication tag.
plaintext The data to be encrypted.
authenticatedData Will be combined with the initialization vector and ciphertext to create an authentication tag.
iv The initialization vector to be used with the encryption algorithm.
public byte[]
Decrypt​(byte[] ciphertext, byte[] authenticatedData, byte[] iv, byte[] authenticationTag)
Decrypts ciphertext into plaintext.
Returns The decrypted ciphertext.
ciphertext The encrypted text to be decrypted.
authenticatedData The authenticate data that is used in verification.
iv The initialization vector used when creating the ciphertext.
authenticationTag The authentication tag that was created during the encyption.
public void
Dispose​()
Calls <see cref="M:Microsoft.IdentityModel.Tokens.AuthenticatedEncryptionProvider.Dispose(System.Boolean)" /> and <see cref="M:System.GC.SuppressFinalize(System.Object)" />
protected void
Dispose​(bool disposing)
Releases managed resources.
disposing true, if called from Dispose(), false, if invoked inside a finalizer.
protected bool
IsSupportedAlgorithm​(SecurityKey key, string algorithm)
Checks if the key/algorithm pair is supported.
Returns <see langword="true" /> if the key/algorithm pair is supported.
key The <see cref="T:Microsoft.IdentityModel.Tokens.SecurityKey" /> .
algorithm The algorithm to check.
protected byte[]
GetKeyBytes​(SecurityKey key)
Called to obtain the byte[] needed to create a <see cref="T:System.Security.Cryptography.KeyedHashAlgorithm" /> .
Returns <see cref="T:System.Byte" /> [] that is used to populated the KeyedHashAlgorithm.
key The <see cref="T:Microsoft.IdentityModel.Tokens.SecurityKey" /> that will be used to obtain the byte[].
Remarks <see cref="T:Microsoft.IdentityModel.Tokens.SymmetricSecurityKey" /> and <see cref="T:Microsoft.IdentityModel.Tokens.JsonWebKey" /> are supported. <para>For a <see cref="T:Microsoft.IdentityModel.Tokens.SymmetricSecurityKey" />, <see cref="P:Microsoft.IdentityModel.Tokens.SymmetricSecurityKey.Key" /> is returned</para> <para>For a <see cref="T:Microsoft.IdentityModel.Tokens.JsonWebKey" />, <see cref="M:Microsoft.IdentityModel.Tokens.Base64UrlEncoder.DecodeBytes(System.String)" /> is called with <see cref="P:Microsoft.IdentityModel.Tokens.JsonWebKey.K" /> if <see cref="P:Microsoft.IdentityModel.Tokens.JsonWebKey.Kty" /> == JsonWebAlgorithmsKeyTypes.Octet.</para>
protected void
ValidateKeySize​(SecurityKey key, string algorithm)
Checks that the key has sufficient length.
key The <see cref="T:Microsoft.IdentityModel.Tokens.SecurityKey" /> that contains bytes.
algorithm The encryption algorithm to be used.
public bool
Equals​(object obj)
Inherited from object
protected void
Finalize​()
Inherited from object
public int
GetHashCode​()
Inherited from object
GetType​()
Inherited from object
protected object
MemberwiseClone​()
Inherited from object
public string
ToString​()
Inherited from object