Skip to main content

Module hkdf

Module hkdf 

Source
Expand description

HKDF (RFC 5869) input keying material: the hash-independent half of the HKDF surface. The ikm resource minted here parameterizes derivations through the per-hash prepare interfaces (hkdf-sha2, hkdf-sha1), so one imported secret serves either hash family.

Security:

  • No operation returns an ikm’s bytes, under any grant: WebCrypto’s forced non-extractability on HKDF base keys, made structural.
  • The implementation holds imported IKM in memory for the resource’s construction-to-drop lifetime; that window is the secret’s exposure to memory side channels. Import late, drop early. Dropping releases (and, in scrubbing implementations, zeroizes) it.

Structs§

Ikm
Input keying material: consumable only by prepare, never readable. Usage grants are fixed at import and copied to every input prepared from it.

Functions§

import_ikm
Import input keying material. Empty material is accepted (RFC 5869 permits it, and the Web Cryptography API serves it), but an implementation enforcing a security policy MAY reject degenerate material with error.invalid-key, as on hmac-sha2.import-key-raw. Fails error.not-permitted if options grants nothing, per the package-wide options contract.
unwrap_ikm
Mint input keying material from unwrapped bytes (see the wrapping interface), subject to import-ikm’s contract: a KDF secret can arrive under a wrapping key and parameterize derivations without its bytes ever being observable. Like import-ikm, this is not a format choice — the bytes are the material. input is consumed.

Type Aliases§

DeriveOptions
Error
UnwrapInput