Skip to main content

Module hkdf_sha2

Module hkdf_sha2 

Source
Expand description

HKDF (RFC 5869) over the SHA-2 hash family: the extract-then-expand key derivation function, as the Web Cryptography API serves it.

This interface mints no keys. It mints derive-inputs — parameterized derivations — which the key-minting interfaces’ derive-key functions consume (aes-gcm.derive-key, hmac-sha2.derive-key), and which yield raw output through derivation.derive-input.derive-bits. The ikm resource and its import stay hkdf’s, so one imported secret can parameterize derivations of either hash family.

Functions§

prepare
Parameterize a derivation: HKDF-Extract with salt runs over the material (eagerly, so the returned input retains the PRK rather than the IKM), and info is bound for the expand step at use. An implementation not serving the variant fails error.unsupported (the truncated SHA-2 variants are unserved package-wide, as for hmac-sha2).
prepare_from
Parameterize a derivation whose IKM is another derivation’s output — the chaining step (a future agreement’s shared secret fed to HKDF without transiting the caller).

Type Aliases§

DeriveInput
Error
Ikm
Sha2Variant