Rebex
Products Downloads Buy Support Contact
Show / Hide Table of Contents

HKDF.Extract Method

Namespace: Rebex.Security.Cryptography
Assembly: Rebex.Security.dll (version 7.0.9147)

Extract(HashingAlgorithmId, Byte[], Byte[])

HKDF Extract function according to section 2.2 of RFC 5869.

Declaration
public static byte[] Extract(HashingAlgorithmId hashingAlgorithmId, byte[] ikm, byte[] salt = null)
Parameters
Type Name Description
HashingAlgorithmId hashingAlgorithmId

The hash algorithm for HMAC operations.

Byte[] ikm

A byte array that contains input keying material. This is the 'IKM' parameter from RFC 5869.

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 hashingAlgorithmId. This is the 'salt' parameter from RFC 5869.

Returns
Type Description
Byte[]

A byte array that contains the pseudorandom key (the 'PRK' output from RFC 5869).

Exceptions
Type Condition
ArgumentNullException

The ikm is null.

ArgumentException

The ikm is an empty array, or hashingAlgorithmId is not supported.

Extract(HashingAlgorithmId, ArraySegment<Byte>, ArraySegment<Byte>, ArraySegment<Byte>)

HKDF Extract function according to section 2.2 of RFC 5869.

Declaration
public static int Extract(HashingAlgorithmId hashingAlgorithmId, ArraySegment<byte> ikm, ArraySegment<byte> salt, ArraySegment<byte> prk)
Parameters
Type Name Description
HashingAlgorithmId hashingAlgorithmId

The hash algorithm for HMAC operations.

ArraySegment<Byte> ikm

An ArraySegment<T> that contains input keying material. This is the 'IKM' parameter from RFC 5869.

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 hashingAlgorithmId. This is the 'salt' parameter from RFC 5869.

ArraySegment<Byte> prk

An ArraySegment<T> that will receive the pseudorandom key (the 'PRK' output from RFC 5869). The length of prk must be equal to or greater than the hash size of hashingAlgorithmId.

Returns
Type Description
Int32

The number of bytes written to prk.

Exceptions
Type Condition
ArgumentException

The ikm is empty, or hashingAlgorithmId is not supported.

In This Article
  • Extract(HashingAlgorithmId, Byte[], Byte[])
  • Extract(HashingAlgorithmId, ArraySegment<Byte>, ArraySegment<Byte>, ArraySegment<Byte>)
© REBEX ČR s.r.o. Back to top
Privacy policy
Manage cookies