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

HKDF.Expand Method

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

Expand(HashingAlgorithmId, Byte[], Int32, Byte[])

HKDF Expand function according to section 2.3 of RFC 5869.

Declaration
public static byte[] Expand(HashingAlgorithmId hashingAlgorithmId, byte[] prk, int outputLength, byte[] info = null)
Parameters
Type Name Description
HashingAlgorithmId hashingAlgorithmId

The hash algorithm for HMAC operations.

Byte[] prk

A byte array that contains the pseudorandom key (the 'PRK' argument from RFC 5869). Its length must be equal to or greater than the hash size of hashingAlgorithmId. This key is usually computed using the Extract(HashingAlgorithmId, Byte[], Byte[]) method.

Int32 outputLength

The length (in bytes) of the output keying material. This is the 'L' argument from RFC 5869. The value must be between 1 and '255 * hash size of hashingAlgorithmId in bytes'.

Byte[] info

A byte array that contains the context and application-specific information. Can be null. This is the 'info' argument from RFC 5869.

Returns
Type Description
Byte[]

A byte array that contains the output keying material (the 'OKM' output from RFC 5869).

Exceptions
Type Condition
ArgumentNullException

The prk is null.

ArgumentException

The prk has an invalid length, or the outputLength is invalid, or the hashingAlgorithmId is not supported.

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

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

HKDF Expand function according to section 2.3 of RFC 5869.

Declaration
public static void Expand(HashingAlgorithmId hashingAlgorithmId, ArraySegment<byte> prk, ArraySegment<byte> output, ArraySegment<byte> info)
Parameters
Type Name Description
HashingAlgorithmId hashingAlgorithmId

The hash algorithm for HMAC operations.

ArraySegment<Byte> prk

An ArraySegment<T> that contains the pseudorandom key (the 'PRK' argument from RFC 5869). Its length must be equal to or greater than the hash size of hashingAlgorithmId. This key is usually computed using the Extract(HashingAlgorithmId, ArraySegment<Byte>, ArraySegment<Byte>, ArraySegment<Byte>) method.

ArraySegment<Byte> output

An ArraySegment<T> that will receive the output keying material (the 'OKM' output from RFC 5869). The length of the output (the 'L' argument from RFC 5869) must be between 1 and '255 * hash size of hashingAlgorithmId in bytes'.

ArraySegment<Byte> info

An ArraySegment<T> that contains the context and application-specific information. Can be empty ArraySegment<T>. This is the 'info' argument from RFC 5869.

Exceptions
Type Condition
ArgumentException

The prk has an invalid length, or the output has an invalid length, or the hashingAlgorithmId is not supported.

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