CryptographicOperations.HmacData Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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.
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.
Returns
The total number of bytes written to destination
.
Exceptions
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
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
The HMAC of the data.
Exceptions
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
The HMAC of the data.
Exceptions
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
The HMAC of the data.
Exceptions
hashAlgorithm
specifies a hash algorithm not supported by the current platform.
hashAlgorithm
specifies an unknown hash algorithm.