Hkdf

class Hkdf(crypto: CryptoBackend, val algorithm: HashAlgorithm)(source)

HKDF (RFC 5869) built on CryptoBackend.hmac.

Extract and Expand are exposed separately: OSCORE (RFC 8613 §3.2.1) uses both, while EDHOC_KDF (RFC 9528 §4.1.2) calls Expand directly on PRKs that come from its own Extract steps.

Constructors

Link copied to clipboard
constructor(crypto: CryptoBackend, algorithm: HashAlgorithm)

Properties

Link copied to clipboard

Functions

Link copied to clipboard
suspend fun derive(salt: ByteArray, ikm: ByteArray, info: ByteArray, length: Int): ByteArray
Link copied to clipboard
suspend fun expand(prk: ByteArray, info: ByteArray, length: Int): ByteArray

HKDF-Expand to length bytes, at most 255 * HashLen.

Link copied to clipboard
suspend fun extract(salt: ByteArray, ikm: ByteArray): ByteArray

HKDF-Extract. An empty salt means a string of HashLen zero bytes (RFC 5869 §2.2).