HKDF.DeriveKey Method
Namespace: Rebex.Security.Cryptography
Assembly: Rebex.Security.dll (version 7.0.9083)
DeriveKey(HashingAlgorithmId, Byte[], Int32, Byte[], Byte[])
Derives the output keying material using the Extract-and-Expand key derivation function (HKDF).
Declaration
public static byte[] DeriveKey(HashingAlgorithmId hashingAlgorithmId, byte[] ikm, int outputLength, byte[] salt = null, byte[] info = null)
Parameters
Type | Name | Description |
---|---|---|
HashingAlgorithmId | hashingAlgorithmId | The hash algorithm for HMAC operations. |
Byte[] | ikm | A byte array that contains the input keying material. |
Int32 | outputLength | The length in bytes of the output keying material.
The value must be between 1 and '255 * hash size of |
Byte[] | salt | A byte array that contains the salt. When null or empty salt is specified,
this method will use a zero-filled salt with size equal to the hash size of |
Byte[] | info | A byte array that contains the context and application-specific information. Can be null. |
Returns
Type | Description |
---|---|
Byte[] | A byte array that contains the output keying material. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | The |
ArgumentException | The |
DeriveKey(HashingAlgorithmId, ArraySegment<Byte>, ArraySegment<Byte>, ArraySegment<Byte>, ArraySegment<Byte>)
Derives the output keying material using the Extract-and-Expand key derivation function (HKDF).
Declaration
public static void DeriveKey(HashingAlgorithmId hashingAlgorithmId, ArraySegment<byte> ikm, ArraySegment<byte> output, ArraySegment<byte> salt, ArraySegment<byte> info)
Parameters
Type | Name | Description |
---|---|---|
HashingAlgorithmId | hashingAlgorithmId | The hash algorithm for HMAC operations. |
ArraySegment<Byte> | ikm | An ArraySegment<T> that contains the input keying material. |
ArraySegment<Byte> | output | An ArraySegment<T> that will receive the output keying material.
The length of the |
ArraySegment<Byte> | salt | An ArraySegment<T> that contains the salt. When an empty salt is specified,
this method will use a zero-filled salt with size equal to the hash size of |
ArraySegment<Byte> | info | An ArraySegment<T> that contains the context and application-specific information. Can be empty. |
Exceptions
Type | Condition |
---|---|
ArgumentException | The |