Expand description
AES-CTR key minting (NIST SP 800-38A counter mode, the Web
Cryptography API’s AES-CTR): cipher.cipher-keys for the
unauthenticated mode, served for compatibility with CTR-committed
formats. Read the cipher interface’s Security notes first.
Ciphertext is exactly the plaintext’s length. The per-call iv is the
16-byte initial counter block, and counter-length (required; 1 to
128) is the width in bits of its rightmost, incrementing portion —
WebCrypto’s AesCtrParams. The counter wraps around within that width
without carrying into the fixed portion; a message longer than
2^counter-length blocks fails rather than reuse counter values.
Security:
- Every counter block a key ever consumes must be unique: a repeated block is a two-time pad and forfeits confidentiality outright. Uniqueness spans messages — the caller partitions the counter space across messages via the fixed portion, per SP 800-38A Appendix B.
Functions§
- derive_
key - Mint a key from a parameterized derivation (the
aes-gcm.derive-keycontract, minting acipher-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-CTR key of the declared
variant. The key must be an
octkey whosealg, if present, names the declared variant ("A128CTR"/"A192CTR"/"A256CTR"); 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.