HKDF.derive

ubyte[] derive(const(ubyte)[] secret, const(ubyte)[] salt, size_t length)

Derives a key of the specified length using the standard KDF interface.

This method performs both Extract and Expand steps. The 'salt' parameter is used as the salt for Extract. The 'info' parameter for Expand is assumed to be empty (null).

Parameters

secretThe input keying material (IKM).
saltThe salt (optional, but recommended).
lengthThe desired length of the output keying material (OKM).

Returns

The derived key bytes.
ubyte[] derive(const(ubyte)[] secret, const(ubyte)[] salt, size_t length, KDFParams params)

Derives a key using the given parameters.

Uses params.info as the context information for the Expand step. If params.info is null, the behavior is identical to the basic derive overload.

Parameters

secretThe input keying material (IKM).
saltThe salt (optional, but recommended).
lengthThe desired length of the output keying material (OKM).
paramsAlgorithm-specific parameters. Only info is used.

Returns

The derived key bytes.
ubyte[] derive(const(ubyte)[] secret, const(ubyte)[] salt, const(ubyte)[] info, size_t length)

Derives a key with context information.

Parameters

secretThe input keying material (IKM).
saltThe salt (optional).
infoContext and application specific information (optional).
lengthThe desired length of the output keying material (OKM).

Returns

The derived key bytes.