Compartilhar via


CryptoProviderFactory.CreateKeyedHashAlgorithm(Byte[], String) Method

Definition

Creates a KeyedHashAlgorithm instance for a specific keyed hash algorithm.

public virtual System.Security.Cryptography.KeyedHashAlgorithm CreateKeyedHashAlgorithm (byte[] keyBytes, string algorithm);
abstract member CreateKeyedHashAlgorithm : byte[] * string -> System.Security.Cryptography.KeyedHashAlgorithm
override this.CreateKeyedHashAlgorithm : byte[] * string -> System.Security.Cryptography.KeyedHashAlgorithm
Public Overridable Function CreateKeyedHashAlgorithm (keyBytes As Byte(), algorithm As String) As KeyedHashAlgorithm

Parameters

keyBytes
Byte[]

The bytes to use as the key for the keyed hash.

algorithm
String

The name of the keyed hash algorithm to create.

Returns

A KeyedHashAlgorithm instance that corresponds to the specified algorithm.

Exceptions

Thrown if algorithm is null or empty.

Thrown if Create(String, Object[]) returns a type that is not assignable to KeyedHashAlgorithm.

Thrown if algorithm is not supported.

Remarks

Once done with the KeyedHashAlgorithm, call ReleaseHashAlgorithm(HashAlgorithm).

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

Applies to