Expand description
AES-KW key minting (RFC 3394; NIST SP 800-38F’s KW): key-wrap.kw-keys
for the deterministic key-wrapping mode, the Web Cryptography API’s
AES-KW. Read the key-wrap interface’s Security notes first.
Keys minted here drive kw-key.wrap/unwrap. The wrapped form is RFC
3394’s: the input’s length plus 8 bytes, carrying the 64-bit ICV whose
failure unwrap reports as error.authentication-failed.
Input domains:
kw-key.wrap: the serialized input must be a multiple of 8 bytes, at least 16 (RFC 3394 §2; every AES and multiple-of-8 HMAC raw key qualifies). Anything else failserror.invalid-key.- JWK-formatted wrap input (a
to-wrap-input-jwkserialization) is first padded with ASCII spaces (0x20) to a multiple of 8 — the behavior Web Cryptography API engines interoperate on. The JWK contract’s trailing-space tolerance carries the round trip (seeREADME.md, “JWK contract”). No other format is padded. kw-key.unwrap: a wrapped input is a multiple of 8 bytes, at least 24 (the wrapped form of the smallest wrap input). Input outside that domain cannot carry the wire format and failserror.authentication-failed, indistinguishable from an ICV failure.
A FIPS 140-3 approved-mode provider may serve this interface: KW is an SP 800-38F approved mode and draws no IV.
Functions§
- derive_
key - Mint a key from a parameterized derivation (the
aes-gcm.derive-keycontract, minting akw-key). - generate_
key - Generate a fresh random key of the given AES variant. Fails with
error.unsupportedif this implementation does not serve the variant. - import_
key_ jwk - Import an RFC 7517 JSON Web Key as an AES-KW key of the declared
variant. The key must be an
octkey whosealg, if present, names the declared variant ("A128KW"/"A192KW"/"A256KW"); otherwise asaes-gcm.import-key-jwk. - import_
key_ raw - Import raw key material as the declared AES variant (see
aes-gcm.import-key-rawfor the variant-redundancy contract). - unwrap_
key_ jwk - Mint a key from unwrapped key material read as an
octJWK, subject toimport-key-jwk’s contract.inputis consumed. - unwrap_
key_ raw - Mint a key from unwrapped key material read as raw bytes, subject
to
import-key-raw’s contract.inputis consumed; seeaes-gcm.unwrap-key-rawfor the options model.