liveBook · Manning

Mode of operation

As explained in Software Security for Developers

A mode of operation defines how a block cipher processes messages longer than a single block and may provide additional security properties.

A mode of operation defines how a block cipher encrypts or decrypts data larger than one block. AES processes fixed 16-byte blocks, so a longer message must be divided, padded when necessary, and processed according to a mode. section 5.2

ECB encrypts each block independently, making repeated plaintext produce repeated ciphertext. That visible pattern can reveal structure and let an attacker substitute known ciphertext without cracking the key. Never use ECB. section 5.2

Repeated HTTP responses

If an encrypted HTTP response repeatedly begins with the 16-byte block “HTTP/1.1 200 OK” plus a newline, ECB produces the same ciphertext block each time. An observer can identify that pattern and manipulate responses by substitution. section 5.2

CBC chains each plaintext block with the previous ciphertext block, hiding repeated patterns. It requires a secret key and a random, one-time IV; the IV may be stored openly, but must not be reused with that key. CBC provides confidentiality only, not integrity or authenticity. section 5.2.1 section 5.7

For new AES encryption, prefer authenticated encryption such as GCM. It combines confidentiality, integrity, and authenticity, using a secret key and random IV to produce ciphertext with an authentication tag that detects tampering. section 5.7

Figure 5.3 ECB mode encrypts each input block independently using the secret key and concatenates the resulting ciphertext. ECB mode is simple but insecure; never use it.
figure

Compare independent ECB blocks with safer chained processing and see why repeated ciphertext exposes plaintext patterns. section 5.2

How Software Security for Developers covers it

How deep it goes
Defines block processing, demonstrates ECB leakage, explains CBC chaining and IVs, and recommends GCM without mathematical proofs.
Examples
Uses a 1,605-byte message, repeated HTTP responses, ECB block diagrams, CBC chaining, and AES-GCM authentication tags.
What it assumes
Assumes only an understanding that AES is a block cipher; teaches block division, padding, modes, IVs, and authenticated encryption.
What you can do after
Configure AES encryption with a nonreused random IV and choose GCM when confidentiality, integrity, and authenticity are required.
How it connects
Connects AES with ECB, CBC, GCM, IVs, nonces, authenticated encryption, confidentiality, integrity, and authenticity.

Also explained in

Compare how 2 books explain mode of operation →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Software Security for Developers. The section links point to the parts of the book it draws on.