SymmetricKeyWrapProvider.GetSymmetricAlgorithm(SecurityKey, String) Method

Definition

Returns the SymmetricAlgorithm.

protected virtual System.Security.Cryptography.SymmetricAlgorithm GetSymmetricAlgorithm (Microsoft.IdentityModel.Tokens.SecurityKey key, string algorithm);
abstract member GetSymmetricAlgorithm : Microsoft.IdentityModel.Tokens.SecurityKey * string -> System.Security.Cryptography.SymmetricAlgorithm
override this.GetSymmetricAlgorithm : Microsoft.IdentityModel.Tokens.SecurityKey * string -> System.Security.Cryptography.SymmetricAlgorithm
Protected Overridable Function GetSymmetricAlgorithm (key As SecurityKey, algorithm As String) As SymmetricAlgorithm

Parameters

key
SecurityKey

The SecurityKey that will be used for cryptographic operations.

algorithm
String

The encryption algorithm to be used.

Returns

The initialized SymmetricAlgorithm.

Exceptions

Thrown if the SecurityKey cannot be converted to a byte array.

Thrown if the key size doesn't match the algorithm.

Thrown if failed to create a symmetric algorithm with the provided key and algorithm.

Applies to