CSE4303 Introduction to Computer Security (Lecture 8)
Block ciphers
- Operate on PT one block at a time
- Use same key for multiple blocks (with caveats)
- Chaining modes intertwine successive blocks of CT (or not)
Security abstraction
View cipher as a Pseudo-Random Permutation (PRP)
Background: Pseudo-Random Function (PRF)
Defined over :
Such that there exists an efficient algorithm to evaluate .
Let:
- = set of all functions from to
Intuition:
A PRF is secure if a random function in is indistinguishable from a random function in .
Adversarial game:
- Challenger samples
- Or samples
- Adversary queries oracle with
- Receives either or
- Must distinguish
Goal: adversary’s advantage negligible
PRP Definition
Defined over :
Such that:
- Efficient deterministic algorithm to evaluate
- is one-to-one
- Efficient inversion algorithm exists
i.e., a PRF that is an invertible one-to-one mapping from message space to message space
Secure PRP
Let be all permutations on .
Intuition:
A PRP is secure if a random permutation in is indistinguishable from a random element of:
Adversarial game:
- Challenger samples
- Or
- Adversary queries
- Receives either or
- Must distinguish
Goal: negligible advantage
Block cipher constructions
Feistel network
Given:
Build invertible function:
Let input be split into .
Round :
Invertibility
Thus Feistel is invertible regardless of whether is invertible.
Luby–Rackoff Theorem (1985)
If is a secure PRF, then 3-round Feistel is a secure PRP.
DES (Data Encryption Standard) — 1976
- 16-round Feistel network
- 64-bit block size
- 56-bit key
- Round functions:
Round function uses:
- S-box (substitution box) — non-linear
- P-box (permutation box)
To invert: use keys in reverse order.
Problem: 56-bit keyspace too small today (brute-force feasible).
Substitution–Permutation Network (SPN)
Rounds of:
- Substitution (S-box layer)
- Permutation (P-layer)
- XOR with round key
All layers invertible.
AES (Advanced Encryption Standard) — 2000
- 10 substitution-permutation rounds (128-bit key version)
- 128-bit block size
Each round includes:
- ByteSub (1-byte S-box)
- ShiftRows
- MixColumns
- AddRoundKey
Key sizes:
- 128-bit
- 192-bit
- 256-bit
Currently de facto standard symmetric-key cipher (e.g. TLS/SSL).
Block cipher modes
Challenge
Encrypt PTs longer than one block using same key while maintaining security.
ECB (Electronic Codebook)
Encrypt blocks independently:
Problem:
If , then:
Not semantically secure.
Formal non-security argument
Two-block challenge:
- Adversary submits:
- If , output 0; else 1
Advantage = 1
CPA model (Chosen Plaintext Attack)
Attacker:
- Sees many PT/CT pairs under same key
- Can submit arbitrary PTs
Definition:
Must be negligible.
ECB fails CPA security.
Moral
If same secret key is used multiple times, given same PT twice, encryption must produce different CT outputs.
Secure block modes
Idea
Augment key with:
- Per-block nonce
- Or chaining data from prior blocks
CBC (Cipher Block Chaining)
IV must be random/unpredictable.
CFB (Cipher Feedback)
Uses previous ciphertext as input feedback into block cipher.
OFB (Output Feedback)
Can pre-compute keystream.
Acts like stream cipher.
CTR (Counter Mode)
Encryption and decryption parallelizable.
Nonce must be unique.
GCM (Galois Counter Mode)
- Most popular (“AES-GCM”)
- Provides authenticated encryption
- Confidentiality + integrity
Nonce-based semantic security
Encryption:
Adversarial experiment:
- Challenger picks
- Adversary submits and nonce
- Receives
- Nonces must be distinct
Definition:
In practice:
- CBC: IV must be random
- CTR/GCM: nonce must be unique but not necessarily random
Symmetric Encryption Summary
Stream Ciphers
- Rely on secure PRG
- No key re-use
- Fast
- Low memory
- Less robust
- No built-in integrity
Block Ciphers
- Rely on secure PRP
- Allow key re-use across blocks (secure mode required)
- Provide authenticated encryption in some modes (e.g. GCM)
- Slower
- Higher memory
- More robust
- Used in most practical secure systems (e.g. TLS)