AES-CBC is a block-cipher mode that encrypts each plaintext block together with the previous ciphertext block. This chaining hides repeated patterns that would remain visible with ECB mode. CBC provides confidentiality only; it does not provide integrity or authenticity, so tampering can go undetected. section 5.2 section 5.2.1 section 5.7
Use CBC with these operational requirements:
- Provide an AES secret key and a random 128-bit initialization vector (IV). section 5.2.1
- Use a different IV for every encryption with the same key; the IV may be stored in cleartext beside the ciphertext. section 5.2.1
- Do not select CBC merely because an application says AES-256; the operating mode determines important security properties. section 5.2
- Prefer authenticated encryption such as AES-GCM when integrity and authenticity are required. section 5.7
Encrypting two files
If two files are encrypted with the same AES key, generate a fresh IV for each operation. CBC combines the IV with the first plaintext block, then feeds each ciphertext block into the next encryption step. A repeated plaintext can therefore produce different ciphertext when its IV changes. section 5.2.1
Figure 5.4 CBC takes the output of one block and feeds it into the next. The net result is that even if you encrypt the same data multiple times, the ciphertext looks random. An attacker can’t determine patterns in the underlying data by looking for patterns in the ciphertext.
Trace how each ciphertext block feeds the next block and how chaining conceals repeated plaintext patterns. section 5.2.1


