Partilhar via


CryptoProviderFactory.CreateAuthenticatedEncryptionProvider Method

Definition

Creates an instance of AuthenticatedEncryptionProvider for a specific key and algorithm.

public virtual Microsoft.IdentityModel.Tokens.AuthenticatedEncryptionProvider CreateAuthenticatedEncryptionProvider (Microsoft.IdentityModel.Tokens.SecurityKey key, string algorithm);
abstract member CreateAuthenticatedEncryptionProvider : Microsoft.IdentityModel.Tokens.SecurityKey * string -> Microsoft.IdentityModel.Tokens.AuthenticatedEncryptionProvider
override this.CreateAuthenticatedEncryptionProvider : Microsoft.IdentityModel.Tokens.SecurityKey * string -> Microsoft.IdentityModel.Tokens.AuthenticatedEncryptionProvider
Public Overridable Function CreateAuthenticatedEncryptionProvider (key As SecurityKey, algorithm As String) As AuthenticatedEncryptionProvider

Parameters

key
SecurityKey

The SecurityKey to use.

algorithm
String

The algorithm to use.

Returns

An instance of AuthenticatedEncryptionProvider.

Exceptions

Thrown if algorithm is null or empty.

Thrown if the combination of key and algorithm is not supported.

Thrown if the type returned by Create(String, Object[]) is not assignable to KeyWrapProvider.

Remarks

If CustomCryptoProvider is set and IsSupportedAlgorithm(String, Object[]) returns true, Create(String, Object[]) is called to obtain the AuthenticatedEncryptionProvider.

Once done with the KeyWrapProvider, call ReleaseKeyWrapProvider(KeyWrapProvider).

Applies to