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

Microsoft.IdentityModel.Tokens.SymmetricSignatureProvider

Provides signing and verifying operations using a SymmetricSecurityKey and specifying an algorithm.
public static readonly int DefaultMinimumSymmetricKeySizeInBits

This is the minimum SymmetricSecurityKey.KeySize when creating and verifying signatures.

public int MinimumSymmetricKeySizeInBits { get; set; }

Gets or sets the minimum SymmetricSecurityKey.KeySize"/>.

public SymmetricSignatureProvider(SecurityKey key, string algorithm)

Initializes a new instance of the SymmetricSignatureProvider class that uses an SecurityKey to create and / or verify signatures over a array of bytes.

public SymmetricSignatureProvider(SecurityKey key, string algorithm, bool willCreateSignatures)

Initializes a new instance of the SymmetricSignatureProvider class that uses an SecurityKey to create and / or verify signatures over a array of bytes.

protected virtual byte[] GetKeyBytes(SecurityKey key)

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

protected virtual KeyedHashAlgorithm GetKeyedHashAlgorithm(byte[] keyBytes, string algorithm)

Returns a KeyedHashAlgorithm. This method is called just before a cryptographic operation. This provides the opportunity to obtain the KeyedHashAlgorithm from an object pool. If this method is overridden, it is important to override ReleaseKeyedHashAlgorithm if custom releasing of the KeyedHashAlgorithm is desired.

protected virtual void ReleaseKeyedHashAlgorithm(KeyedHashAlgorithm keyedHashAlgorithm)

This method is called just after the cryptographic operation. If GetKeyedHashAlgorithm was overridden this method can be overridden for any custom handling such as returning the KeyedHashAlgorithm to an object pool.

public bool Verify(byte[] input, byte[] signature, int length)

Verifies that a signature created over the 'input' matches the signature. Using SymmetricSecurityKey and 'algorithm' passed to #ctor.