AES-KW
The NIST and RFC 3394/5649 modes for encrypting and authenticating cryptographic keys
About AES-KW
AES-KW is one of 2 AES Key Wrap variants in the NextSSL registry, a block cipher mode of operation. It uses a 16–32-byte key and a 16-byte (128-bit) block. Its registry entry cites NIST SP 800-38F and RFC 3394. It is also known as aes-key-wrap and kw. NextSSL lists it in the standard tier and exposes it through the safe API.
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–2012AES Key Wrap published
AES key wrap specified in RFC 3394
Padded variant in RFC 5649
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
Sizes
| Field | Bytes | Meaning |
|---|---|---|
| key | 16 – 32 | Secret key |
| nonce | 0 | Nonce / IV |
| block | 16 | Block |
Use it
from nextssl_demo import NextSSL
ns = NextSSL() # safe API: safe and standard tiers
ct = ns.call("blockmode_encrypt", "aes-kw", None, key, iv, data)[0]
pt = ns.call("blockmode_decrypt", "aes-kw", None, key, iv, ct)[0]
nextssl_blockmode_encrypt("aes-kw", NULL, key, iv, data, out);
use nextssl_core::Params;
use nextssl_registry::{self as reg, Policy};
let alg = reg::new_blockmode_in(reg::all(), Policy::Safe, "aes-kw", &Params::new())?;
let ct = alg.encrypt(&key, &iv, &data)?;
Calls follow the NextSSL C ABI and its language bindings. Buffer sizes are validated against the sizes above.
Other AES Key Wrap variants
1Similar names
Looking for something else?More block cipher modes
All 20Frequently asked questions
What is AES-KW?
AES-KW is a block mode in the AES Key Wrap family. AES Key Wrap (KW) and Key Wrap with Padding (KWP) are deterministic authenticated-encryption modes designed specifically for protecting cryptographic keys. It is also known as aes-key-wrap, kw.
What are the AES-KW sizes?
In NextSSL, AES-KW uses: key 16 to 32 bytes, nonce 0 bytes, block 16 bytes.
Who designed AES-KW and when?
AES-KW belongs to the AES Key Wrap family, first published in 2001. Its origin: NIST SP 800-38F; RFC 3394; RFC 5649.
Which standards define AES-KW?
AES-KW is referenced by NIST SP 800-38F, RFC 3394. It is specified in a FIPS standard.
Is AES-KW safe to use?
AES-KW is in the standard tier. Standardised and sound. Reachable from the safe API. It can be called from the safe API.
What other AES Key Wrap variants are there?
NextSSL also registers aes-kwp in the AES Key Wrap family.