Block mode family

AES Key Wrap

The NIST and RFC 3394/5649 modes for encrypting and authenticating cryptographic keys

standard 2 variants NIST SP 800-38F; RFC 3394; RFC 5649

Overview

AES Key Wrap (KW) and Key Wrap with Padding (KWP) are deterministic authenticated-encryption modes designed specifically for protecting cryptographic keys. They are defined in NIST SP 800-38F, RFC 3394 and RFC 5649.

KW treats the key to be wrapped as a sequence of 64-bit blocks with a 64-bit integrity check value. It runs six passes over the blocks; each step encrypts the integrity register together with one block using AES and XORs a step counter into the result. On unwrapping, the integrity value must match the expected constant, so tampering is detected. KWP adds a length indicator and padding so keys of any byte length can be wrapped.

NextSSL includes AES-KW and AES-KWP. Key wrap is used in CMS, JOSE/JWE, PKCS #11, cloud key-management services and hardware security modules. KWP can wrap keys of any length from one byte. Both modes produce output 8 bytes longer than the input, carrying the integrity check value. Unwrapping fails cleanly on any modification.

History

2001–2012
  1. AES Key Wrap published

  2. AES key wrap specified in RFC 3394

  3. Padded variant in RFC 5649

  4. KW and KWP approved in NIST SP 800-38F

Security notes

KW and KWP are secure deterministic authenticated encryption for high-entropy keys, and need no nonce. They are slow and not intended for general data. Because they are deterministic, wrapping the same key twice produces the same output.

Typical uses

Wrapping data-encryption keys under a key-encryption keyJWE and CMS key transportHSM and KMS key export

Variants in NextSSL

2
AlgorithmTierSizes (bytes)StandardsAPI
AES-KW
aes-kw
standard FIPS key 16–32 · nonce 0 · block 16 NIST SP 800-38F, RFC 3394 safe
AES-KWP
aes-kwp
standard FIPS key 16–32 · nonce 0 · block 16 NIST SP 800-38F, RFC 5649 safe

Frequently asked questions

Which AES Key Wrap variants does NextSSL include?

NextSSL registers 2 AES Key Wrap variants: aes-kw, aes-kwp.