Upraviť

Zdieľať cez


CryptographicOperations.HmacData Method

Definition

Overloads

HmacData(HashAlgorithmName, ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>)

Computes the HMAC of data.

HmacData(HashAlgorithmName, ReadOnlySpan<Byte>, Stream, Span<Byte>)

Computes the HMAC of a stream.

HmacData(HashAlgorithmName, ReadOnlySpan<Byte>, ReadOnlySpan<Byte>)

Computes the HMAC of data.

HmacData(HashAlgorithmName, Byte[], Stream)

Computes the HMAC of a stream.

HmacData(HashAlgorithmName, Byte[], Byte[])

Computes the HMAC of data.

HmacData(HashAlgorithmName, ReadOnlySpan<Byte>, Stream)

Computes the HMAC of a stream.

HmacData(HashAlgorithmName, ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>)

Source:
CryptographicOperations.cs

Computes the HMAC of data.

public:
 static int HmacData(System::Security::Cryptography::HashAlgorithmName hashAlgorithm, ReadOnlySpan<System::Byte> key, ReadOnlySpan<System::Byte> source, Span<System::Byte> destination);
public static int HmacData (System.Security.Cryptography.HashAlgorithmName hashAlgorithm, ReadOnlySpan<byte> key, ReadOnlySpan<byte> source, Span<byte> destination);
static member HmacData : System.Security.Cryptography.HashAlgorithmName * ReadOnlySpan<byte> * ReadOnlySpan<byte> * Span<byte> -> int
Public Shared Function HmacData (hashAlgorithm As HashAlgorithmName, key As ReadOnlySpan(Of Byte), source As ReadOnlySpan(Of Byte), destination As Span(Of Byte)) As Integer

Parameters

hashAlgorithm
HashAlgorithmName

The algorithm used to compute the HMAC.

key
ReadOnlySpan<Byte>

The secret key. The key can be any length.

source
ReadOnlySpan<Byte>

The data to compute the HMAC over.

destination
Span<Byte>

The buffer to receive the HMAC value.

Returns

The total number of bytes written to destination.

Exceptions

The buffer in destination is too small to hold the calculated hash size.

-or-

hashAlgorithm has a Name that is empty.

hashAlgorithm has a Name that is null.

hashAlgorithm specifies a hash algorithm not supported by the current platform.

hashAlgorithm specifies an unknown hash algorithm.

Applies to

HmacData(HashAlgorithmName, ReadOnlySpan<Byte>, Stream, Span<Byte>)

Source:
CryptographicOperations.cs

Computes the HMAC of a stream.

public:
 static int HmacData(System::Security::Cryptography::HashAlgorithmName hashAlgorithm, ReadOnlySpan<System::Byte> key, System::IO::Stream ^ source, Span<System::Byte> destination);
public static int HmacData (System.Security.Cryptography.HashAlgorithmName hashAlgorithm, ReadOnlySpan<byte> key, System.IO.Stream source, Span<byte> destination);
static member HmacData : System.Security.Cryptography.HashAlgorithmName * ReadOnlySpan<byte> * System.IO.Stream * Span<byte> -> int
Public Shared Function HmacData (hashAlgorithm As HashAlgorithmName, key As ReadOnlySpan(Of Byte), source As Stream, destination As Span(Of Byte)) As Integer

Parameters

hashAlgorithm
HashAlgorithmName

The algorithm used to compute the HMAC.

key
ReadOnlySpan<Byte>

The secret key. The key can be any length.

source
Stream

The data to compute the HMAC over.

destination
Span<Byte>

The buffer to receive the HMAC value.

Returns

The total number of bytes written to destination.

Exceptions

source is null.

-or-

hashAlgorithm has a Name that is null.

hashAlgorithm has a Name that is empty.

-or-

source does not support reading.

-or-

The buffer in destination is too small to hold the calculated HMAC size.

hashAlgorithm specifies a hash algorithm not supported by the current platform.

hashAlgorithm specifies an unknown hash algorithm.

Applies to

HmacData(HashAlgorithmName, ReadOnlySpan<Byte>, ReadOnlySpan<Byte>)

Source:
CryptographicOperations.cs

Computes the HMAC of data.

public:
 static cli::array <System::Byte> ^ HmacData(System::Security::Cryptography::HashAlgorithmName hashAlgorithm, ReadOnlySpan<System::Byte> key, ReadOnlySpan<System::Byte> source);
public static byte[] HmacData (System.Security.Cryptography.HashAlgorithmName hashAlgorithm, ReadOnlySpan<byte> key, ReadOnlySpan<byte> source);
static member HmacData : System.Security.Cryptography.HashAlgorithmName * ReadOnlySpan<byte> * ReadOnlySpan<byte> -> byte[]
Public Shared Function HmacData (hashAlgorithm As HashAlgorithmName, key As ReadOnlySpan(Of Byte), source As ReadOnlySpan(Of Byte)) As Byte()

Parameters

hashAlgorithm
HashAlgorithmName

The algorithm used to compute the HMAC.

key
ReadOnlySpan<Byte>

The secret key. The key can be any length.

source
ReadOnlySpan<Byte>

The data to compute the HMAC over.

Returns

Byte[]

The HMAC of the data.

Exceptions

hashAlgorithm has a Name that is null.

hashAlgorithm has a Name that is empty.

hashAlgorithm specifies a hash algorithm not supported by the current platform.

hashAlgorithm specifies an unknown hash algorithm.

Applies to

HmacData(HashAlgorithmName, Byte[], Stream)

Source:
CryptographicOperations.cs

Computes the HMAC of a stream.

public:
 static cli::array <System::Byte> ^ HmacData(System::Security::Cryptography::HashAlgorithmName hashAlgorithm, cli::array <System::Byte> ^ key, System::IO::Stream ^ source);
public static byte[] HmacData (System.Security.Cryptography.HashAlgorithmName hashAlgorithm, byte[] key, System.IO.Stream source);
static member HmacData : System.Security.Cryptography.HashAlgorithmName * byte[] * System.IO.Stream -> byte[]
Public Shared Function HmacData (hashAlgorithm As HashAlgorithmName, key As Byte(), source As Stream) As Byte()

Parameters

hashAlgorithm
HashAlgorithmName

The algorithm used to compute the HMAC.

key
Byte[]

The secret key. The key can be any length.

source
Stream

The data to compute the HMAC over.

Returns

Byte[]

The HMAC of the data.

Exceptions

key or source is null.

-or-

hashAlgorithm has a Name that is null.

hashAlgorithm has a Name that is empty.

-or-

source does not support reading.

hashAlgorithm specifies a hash algorithm not supported by the current platform.

hashAlgorithm specifies an unknown hash algorithm.

Applies to

HmacData(HashAlgorithmName, Byte[], Byte[])

Source:
CryptographicOperations.cs

Computes the HMAC of data.

public:
 static cli::array <System::Byte> ^ HmacData(System::Security::Cryptography::HashAlgorithmName hashAlgorithm, cli::array <System::Byte> ^ key, cli::array <System::Byte> ^ source);
public static byte[] HmacData (System.Security.Cryptography.HashAlgorithmName hashAlgorithm, byte[] key, byte[] source);
static member HmacData : System.Security.Cryptography.HashAlgorithmName * byte[] * byte[] -> byte[]
Public Shared Function HmacData (hashAlgorithm As HashAlgorithmName, key As Byte(), source As Byte()) As Byte()

Parameters

hashAlgorithm
HashAlgorithmName

The algorithm used to compute the HMAC.

key
Byte[]

The secret key. The key can be any length.

source
Byte[]

The data to compute the HMAC over.

Returns

Byte[]

The HMAC of the data.

Exceptions

key or source is null.

-or-

hashAlgorithm has a Name that is null.

hashAlgorithm has a Name that is empty.

hashAlgorithm specifies a hash algorithm not supported by the current platform.

hashAlgorithm specifies an unknown hash algorithm.

Applies to

HmacData(HashAlgorithmName, ReadOnlySpan<Byte>, Stream)

Source:
CryptographicOperations.cs

Computes the HMAC of a stream.

public:
 static cli::array <System::Byte> ^ HmacData(System::Security::Cryptography::HashAlgorithmName hashAlgorithm, ReadOnlySpan<System::Byte> key, System::IO::Stream ^ source);
public static byte[] HmacData (System.Security.Cryptography.HashAlgorithmName hashAlgorithm, ReadOnlySpan<byte> key, System.IO.Stream source);
static member HmacData : System.Security.Cryptography.HashAlgorithmName * ReadOnlySpan<byte> * System.IO.Stream -> byte[]
Public Shared Function HmacData (hashAlgorithm As HashAlgorithmName, key As ReadOnlySpan(Of Byte), source As Stream) As Byte()

Parameters

hashAlgorithm
HashAlgorithmName

The algorithm used to compute the HMAC.

key
ReadOnlySpan<Byte>

The secret key. The key can be any length.

source
Stream

The data to compute the HMAC over.

Returns

Byte[]

The HMAC of the data.

Exceptions

source is null.

-or-

hashAlgorithm has a Name that is null.

hashAlgorithm has a Name that is empty.

-or-

source does not support reading.

hashAlgorithm specifies a hash algorithm not supported by the current platform.

hashAlgorithm specifies an unknown hash algorithm.

Applies to