Expand description
HMAC key minting (RFC 2104) over SHA-1 (FIPS 180-4), for interoperability with SHA-1-committed constructions — RFC 6238 TOTP, WPA2’s handshake PRF, and their contemporaries.
Security:
- HMAC-SHA-1 is not affected by SHA-1’s collision breaks: HMAC’s
security rests on the compression function’s PRF property, which
stands. The construction is sound; only its hash is
hygiene-stale. Prefer
hmac-sha2in new designs. - No SHA-1 digest is ever exposed here (the hash runs inside the
construction); bare SHA-1 digests exist in this package only through
sha1-checked.
Keys report algorithm-hash "SHA-1"; every other contract —
key-length policy, length semantics (the block size, 512 bits, when
none), JWK handling (alg "HS1") — is hmac-sha2’s, minus the
variant parameter.
Functions§
- derive_
key - Mint a key from a parameterized derivation. See
hmac-sha2.derive-key. - generate_
key - Generate a fresh random HMAC-SHA-1 key. See
hmac-sha2.generate-keyfor thelengthcontract;nonemeans SHA-1’s block size, 512 bits. - import_
key_ jwk - Import an RFC 7517 JSON Web Key as an HMAC-SHA-1 key (
alg, when present, must be"HS1"). Seehmac-sha2.import-key-jwk. - import_
key_ raw - Import raw key material as an HMAC-SHA-1 key. See
hmac-sha2.import-key-rawfor the key-length contract. - unwrap_
key_ jwk - Mint a key from unwrapped key material read as an RFC 7517 JSON
Web Key. See
hmac-sha2.unwrap-key-jwk. - unwrap_
key_ raw - Mint a key from unwrapped key material read as raw bytes. See
hmac-sha2.unwrap-key-raw.