AES-128-XTS
The tweakable disk-encryption mode of IEEE 1619 and NIST SP 800-38E
About AES-128-XTS
AES-128-XTS is one of 2 AES-XTS variants in the NextSSL registry, a block cipher mode of operation. It uses a 32-byte (256-bit) key, a 16-byte nonce and a 16-byte (128-bit) block. Its registry entry cites IEEE 1619-2018 and NIST SP 800-38E. It is also known as aes128-xts. NextSSL lists it in the standard tier and exposes it through the safe API.
Overview
XTS is a tweakable block cipher mode designed for encrypting data on storage devices, where each sector must be encrypted in place without expanding its size. It is standardised in IEEE 1619 and approved by NIST in SP 800-38E.
XTS uses two AES keys. The first encrypts the sector number to create a tweak; the tweak is multiplied by successive powers of α in GF(2^128) to give a distinct mask for each 16-byte block in the sector. Each block is XORed with its mask, encrypted with the second key, and XORed with the mask again (the XEX construction). Sectors whose length is not a multiple of 16 bytes are handled with ciphertext stealing.
NextSSL includes AES-128-XTS and AES-256-XTS, which use 256-bit and 512-bit combined keys. XTS is used by BitLocker, FileVault 2, LUKS/dm-crypt, VeraCrypt and self-encrypting drives. XTS keeps sector size unchanged, which is essential for block devices. It is also standardised for self-encrypting drives through the TCG Opal specifications, and is the most widely deployed storage encryption mode.
History
2007–2018AES-XTS published
Specified in NIST SP 800-38E
Specified in IEEE 1619-2018
How it works
- Encrypt the sector number with key 2 to get the tweak
- Multiply the tweak by α for each successive block
- XOR mask, encrypt with key 1, XOR mask again
- Use ciphertext stealing for a partial last block
Security notes
XTS provides confidentiality but not integrity: an attacker with write access can replace blocks with earlier versions or randomise them. Because it is deterministic per sector and position, it reveals when the same data is written to the same location. The two keys must be different.
Typical uses
Sizes
| Field | Bytes | Meaning |
|---|---|---|
| key | 32 | Secret key |
| nonce | 16 | 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-128-xts", None, key, iv, data)[0]
pt = ns.call("blockmode_decrypt", "aes-128-xts", None, key, iv, ct)[0]
nextssl_blockmode_encrypt("aes-128-xts", 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-128-xts", &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-XTS variants
1Similar names
Looking for something else?More block cipher modes
All 20Frequently asked questions
What is AES-128-XTS?
AES-128-XTS is a block mode in the AES-XTS family. XTS is a tweakable block cipher mode designed for encrypting data on storage devices, where each sector must be encrypted in place without expanding its size. It is also known as aes128-xts.
What are the AES-128-XTS sizes?
In NextSSL, AES-128-XTS uses: key 32 bytes, nonce 16 bytes, block 16 bytes.
Who designed AES-128-XTS and when?
AES-128-XTS belongs to the AES-XTS family, first published in 2007. Its origin: IEEE 1619; NIST SP 800-38E.
Which standards define AES-128-XTS?
AES-128-XTS is referenced by IEEE 1619-2018, NIST SP 800-38E. It is specified in a FIPS standard.
Is AES-128-XTS safe to use?
AES-128-XTS is in the standard tier. Standardised and sound. Reachable from the safe API. It can be called from the safe API.
What other AES-XTS variants are there?
NextSSL also registers aes-256-xts in the AES-XTS family.