Skip to main content

Module hmac_sha2

Module hmac_sha2 

Source
Expand description

HMAC key minting (RFC 2104) over the SHA-2 hash family (FIPS 180-4).

Keys minted here drive mac.mac-key.sign and verify. Adding an algorithm touches only an interface like this one: the generic mac surface is closed.

Functions§

derive_key
Mint a key from a parameterized derivation: the derivation runs at length bits and the result is subject to import-key-raw’s contract.
generate_key
Generate a fresh random HMAC key over the declared SHA-2 variant.
import_key_jwk
Import an RFC 7517 JSON Web Key as an HMAC key over the declared SHA-2 variant.
import_key_raw
Import raw key material as an HMAC key over the declared SHA-2 variant.
unwrap_key_jwk
Mint a key from unwrapped key material read as an RFC 7517 JSON Web Key, subject to import-key-jwk’s contract plus the unwrap-path use/key_ops checks (see README.md, “JWK contract”). input is consumed; see unwrap-key-raw for the options model.
unwrap_key_raw
Mint a key from unwrapped key material (see the wrapping interface): input’s bytes are read as raw key material, subject to import-key-raw’s contract. input is consumed.

Type Aliases§

DeriveInput
Error
MacKey
MacKeyOptions
Sha2Variant
UnwrapInput