AES-128-CBC
Cipher Block Chaining with AES: confidentiality only; needs a random IV and a separate MAC
About AES-128-CBC
AES-128-CBC is one of 3 AES-CBC variants in the NextSSL registry, a block cipher mode of operation. It uses a 16-byte (128-bit) key, a 16-byte nonce and a 16-byte (128-bit) block. It takes the parameter padding (default none). Its registry entry cites NIST SP 800-38A. It is also known as aes128-cbc. NextSSL lists it in the standard tier and exposes it through the safe API.
Overview
CBC (Cipher Block Chaining) is a classic block cipher mode defined in NIST SP 800-38A. Each plaintext block is XORed with the previous ciphertext block before encryption, so identical blocks encrypt differently. It provides confidentiality but no integrity.
The first block is XORed with an initialisation vector (IV), and each later block with the preceding ciphertext block, before AES encryption. Decryption reverses the process and can run in parallel, but encryption is inherently sequential. Messages must be padded to a multiple of 16 bytes, usually with PKCS #7 padding.
NextSSL includes AES-128-CBC, AES-192-CBC and AES-256-CBC. CBC was the dominant mode in TLS up to 1.2 and remains common in file formats and legacy protocols. Ciphertext length always grows by at least one block of padding. In TLS 1.3, CBC cipher suites were removed entirely in favour of AEAD modes, and new protocols should follow the same approach.
History
1980–2001ECB, CBC, CFB and OFB defined for DES in FIPS 81
Carried over to AES in NIST SP 800-38A
How it works
- Generate a random 16-byte IV
- Pad the plaintext to a multiple of 16 bytes
- XOR each block with the previous ciphertext (or IV) and encrypt
- Send IV and ciphertext, and authenticate both separately
Security notes
CBC requires an unpredictable IV; predictable IVs enabled the BEAST attack on TLS 1.0. Without authentication, CBC with padding is vulnerable to padding-oracle attacks such as Lucky Thirteen and POODLE, which can decrypt traffic. Always combine CBC with a MAC in encrypt-then-MAC order, or prefer an AEAD mode such as AES-GCM.
Typical uses
Sizes
| Field | Bytes | Meaning |
|---|---|---|
| key | 16 | Secret key |
| nonce | 16 | Nonce / IV |
| block | 16 | Block |
Parameters
| Name | Type | Range | Default | Required |
|---|---|---|---|---|
| padding | enum | 0 – | none | no |
Parameters are passed as a string, for example nextssl_mac("hmac", "hash=sha512", …). Omitted parameters take their declared default.
Use it
from nextssl_demo import NextSSL
ns = NextSSL() # safe API: safe and standard tiers
ct = ns.call("blockmode_encrypt", "aes-128-cbc", None, key, iv, data)[0]
pt = ns.call("blockmode_decrypt", "aes-128-cbc", None, key, iv, ct)[0]
nextssl_blockmode_encrypt("aes-128-cbc", 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-cbc", &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-CBC variants
2Similar names
Looking for something else?More block cipher modes
All 20Frequently asked questions
What is AES-128-CBC?
AES-128-CBC is a block mode in the AES-CBC family. CBC (Cipher Block Chaining) is a classic block cipher mode defined in NIST SP 800-38A. It is also known as aes128-cbc.
What are the AES-128-CBC sizes?
In NextSSL, AES-128-CBC uses: key 16 bytes, nonce 16 bytes, block 16 bytes.
Who designed AES-128-CBC and when?
AES-128-CBC belongs to the AES-CBC family, first published in 1980. Its origin: NIST SP 800-38A.
Which standards define AES-128-CBC?
AES-128-CBC is referenced by NIST SP 800-38A. It is specified in a FIPS standard.
Is AES-128-CBC safe to use?
AES-128-CBC is in the standard tier. Standardised and sound. Reachable from the safe API. It can be called from the safe API.
What other AES-CBC variants are there?
NextSSL also registers aes-192-cbc, aes-256-cbc in the AES-CBC family.
Related families
Counter-mode AES with a GHASH polynomial MAC; the default AEAD of TLS and IPsec
AESThe Advanced Encryption Standard: the world's default 128-bit block cipher
HMAC_DRBGNIST SP 800-90A deterministic random bit generator built on HMAC
HMACThe standard way to build a MAC from a cryptographic hash (RFC 2104, FIPS 198-1)
AES-CTRCounter mode: turns AES into a fast, parallel stream cipher