Comparteix a través de


CryptographicOperations.TryHmacData Método

Definición

Intenta calcular el HMAC de los datos.

public:
 static bool TryHmacData(System::Security::Cryptography::HashAlgorithmName hashAlgorithm, ReadOnlySpan<System::Byte> key, ReadOnlySpan<System::Byte> source, Span<System::Byte> destination, [Runtime::InteropServices::Out] int % bytesWritten);
public static bool TryHmacData (System.Security.Cryptography.HashAlgorithmName hashAlgorithm, ReadOnlySpan<byte> key, ReadOnlySpan<byte> source, Span<byte> destination, out int bytesWritten);
static member TryHmacData : System.Security.Cryptography.HashAlgorithmName * ReadOnlySpan<byte> * ReadOnlySpan<byte> * Span<byte> * int -> bool
Public Shared Function TryHmacData (hashAlgorithm As HashAlgorithmName, key As ReadOnlySpan(Of Byte), source As ReadOnlySpan(Of Byte), destination As Span(Of Byte), ByRef bytesWritten As Integer) As Boolean

Parámetros

hashAlgorithm
HashAlgorithmName

Algoritmo usado para calcular el HMAC.

key
ReadOnlySpan<Byte>

Clave secreta. La clave puede tener cualquier longitud.

source
ReadOnlySpan<Byte>

Los datos que se van a calcular el HMAC.

destination
Span<Byte>

Búfer que va a recibir el valor HMAC.

bytesWritten
Int32

Cuando este método devuelve, el número total de bytes escritos en destination.

Devoluciones

false si destination es demasiado pequeño para contener el HMAC calculado, true de lo contrario.

Excepciones

hashAlgorithm tiene un Name que está vacío.

hashAlgorithm tiene un Name que es null.

hashAlgorithm especifica un algoritmo hash no compatible con la plataforma actual.

hashAlgorithm especifica un algoritmo hash desconocido.

Se aplica a