Editare

Partajați prin


HKDF.DeriveKey Method

Definition

Overloads

DeriveKey(HashAlgorithmName, Byte[], Int32, Byte[], Byte[])

Performs the key derivation HKDF Expand and Extract functions.

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

Performs the key derivation HKDF Expand and Extract functions.

DeriveKey(HashAlgorithmName, Byte[], Int32, Byte[], Byte[])

Source:
HKDF.cs
Source:
HKDF.cs
Source:
HKDF.cs

Performs the key derivation HKDF Expand and Extract functions.

public static byte[] DeriveKey (System.Security.Cryptography.HashAlgorithmName hashAlgorithmName, byte[] ikm, int outputLength, byte[]? salt = default, byte[]? info = default);
static member DeriveKey : System.Security.Cryptography.HashAlgorithmName * byte[] * int * byte[] * byte[] -> byte[]
Public Shared Function DeriveKey (hashAlgorithmName As HashAlgorithmName, ikm As Byte(), outputLength As Integer, Optional salt As Byte() = Nothing, Optional info As Byte() = Nothing) As Byte()

Parameters

hashAlgorithmName
HashAlgorithmName

The hash algorithm used for HMAC operations.

ikm
Byte[]

The input keying material.

outputLength
Int32

The length of the output keying material.

salt
Byte[]

The optional salt value (a non-secret random value). If not provided, it defaults to a byte array of the same length as the output of the specified hash algorithm.

info
Byte[]

The optional context and application specific information.

Returns

Byte[]

The output keying material.

Exceptions

ikmis null.

outputLength is less than 1.

Applies to

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

Source:
HKDF.cs
Source:
HKDF.cs
Source:
HKDF.cs

Performs the key derivation HKDF Expand and Extract functions.

public:
 static void DeriveKey(System::Security::Cryptography::HashAlgorithmName hashAlgorithmName, ReadOnlySpan<System::Byte> ikm, Span<System::Byte> output, ReadOnlySpan<System::Byte> salt, ReadOnlySpan<System::Byte> info);
public static void DeriveKey (System.Security.Cryptography.HashAlgorithmName hashAlgorithmName, ReadOnlySpan<byte> ikm, Span<byte> output, ReadOnlySpan<byte> salt, ReadOnlySpan<byte> info);
static member DeriveKey : System.Security.Cryptography.HashAlgorithmName * ReadOnlySpan<byte> * Span<byte> * ReadOnlySpan<byte> * ReadOnlySpan<byte> -> unit
Public Shared Sub DeriveKey (hashAlgorithmName As HashAlgorithmName, ikm As ReadOnlySpan(Of Byte), output As Span(Of Byte), salt As ReadOnlySpan(Of Byte), info As ReadOnlySpan(Of Byte))

Parameters

hashAlgorithmName
HashAlgorithmName

The hash algorithm used for HMAC operations.

ikm
ReadOnlySpan<Byte>

The input keying material.

output
Span<Byte>

The output buffer that represents output keying material.

salt
ReadOnlySpan<Byte>

The salt value (a non-secret random value).

info
ReadOnlySpan<Byte>

The context and application specific information (can be an empty span).

Exceptions

ikm is empty, or is larger than the maximum allowed length.

Applies to