1 Introduction
1.1 Historic ciphers
1.2 Terminology used throughout the book
I Secret key cryptography
2 Encryption
2.1 Introduction
2.2 Shannon ciphers and perfect security
2.2.1 Definition of a Shannon cipher
2.2.2 Perfect security
2.2.3 The bad news
2.3 Computational ciphers and semantic security
2.3.1 Definition of a computational cipher
2.3.2 Definition of semantic security
2.3.3 Connections to weaker notions of security
2.3.4 Consequences of semantic security
2.3.5 Bit guessing: an alternative characterization of semantic security
2.4 Mathematical details
2.4.1 Negligible, super-poly, and poly-bounded functions
2.4.2 Computational ciphers: the formalities
2.4.3 Efficient adversaries and attack games
2.4.4 Semantic security: the formalities
2.5 A fun application: anonymous routing
2.6 Notes
2.7 Exercises
3 Stream ciphers
3.1 Pseudo-random generators
3.1.1 Definition of a pseudo-random generator
3.1.2 Mathematical details
3.2 Stream ciphers: encryption with a PRG
3.3 Stream cipher limitations: attacks on the one time pad
3.3.1 The two-time pad is insecure
3.3.2 The one-time pad is malleable
3.4 Composing PRGs
3.4.1 A parallel construction
3.4.2 A sequential construction: the Blum-Micali method
3.4.3 Mathematical details
3.5 The next bit test
3.6 Case study: the Salsa and ChaCha PRGs
3.7 Case study: linear generators
3.7.1 An example cryptanalysis: linear congruential generators
3.7.2 The subset sum generator
3.8 Case study: cryptanalysis of the DVD encryption system
3.9 Case study: cryptanalysis of the RC4 stream cipher
3.9.1 Security of RC4
3.10 Generating random bits in practice
3.11 A broader perspective: computational indistinguishability
3.11.1 Mathematical details
3.12 A fun application: coin flipping and commitments
3.13 Notes
3.14 Exercises
4 Block ciphers
4.1 Block ciphers: basic definitions and properties
4.1.1 Some implications of security
4.1.2 Efficient implementation of random permutations
4.1.3 Strongly secure block ciphers
4.1.4 Using a block cipher directly for encryption
4.1.5 Mathematical details
4.2 Constructing block ciphers in practice
4.2.1 Case study: DES
4.2.2 Exhaustive search on DES: the DES challenges
4.2.3 Strengthening ciphers against exhaustive search: the 3E construction
4.2.4 Case study: AES
4.3 Sophisticated attacks on block ciphers
4.3.1 Algorithmic attacks
4.3.2 Side-channel attacks
4.3.3 Fault-injection attacks on AES
4.3.4 Quantum exhaustive search attacks
4.4 Pseudo-random functions: basic definitions and properties
4.4.1 Definitions
4.4.2 Efficient implementation of random functions
4.4.3 When is a secure block cipher a secure PRF?
4.4.4 Constructing PRGs from PRFs
4.4.5 Mathematical details
4.5 Constructing block ciphers from PRFs
4.6 The tree construction: from PRGs to PRFs
4.6.1 Variable length tree construction
4.7 The ideal cipher model
4.7.1 Formal definitions
4.7.2 Exhaustive search in the ideal cipher model
4.7.3 The Even-Mansour block cipher and the EX construction
4.7.4 Proof of the Even-Mansour and EX theorems
4.8 Fun application: comparing information without revealing it
4.9 Notes
4.10 Exercises
5 Chosen Plaintext Attack
5.1 Introduction
5.2 Security against multi-key attacks
5.3 Semantic security against chosen plaintext attack
5.4 Building CPA secure ciphers
5.4.1 A generic hybrid construction
5.4.2 Counter mode
5.4.3 CBC mode
5.4.4 Case study: CBC padding in TLS 1.0
5.4.5 Concrete parameters and a comparison of counter and CBC modes
5.5 Nonce-based encryption
5.5.1 Nonce-based generic hybrid encryption
5.5.2 Nonce-based Counter mode
5.5.3 Nonce-based CBC mode
5.6 A fun application: revocation schemes
5.7 Notes
5.8 Exercises
6 Message integrity
6.1 Definition of a message authentication code
6.1.1 Mathematical details
6.2 MAC verification queries do not help the attacker
6.3 Constructing MACs from PRFs
6.4 Prefix-free PRFs for long messages
6.4.1 The CBC prefix-free secure PRF
6.4.2 The cascade prefix-free secure PRF
6.4.3 Extension attacks: CBC and cascade are insecure MACs
6.5 From prefix-free secure PRF to fully secure PRF (method 1): encrypted PRF
6.5.1 ECBC and NMAC: MACs for variable length inputs
6.6 From prefix-free secure PRF to fully secure PRF (method 2): prefix-free encodings
6.6.1 Prefix free encodings
6.7 From prefix-free secure PRF to fully secure PRF (method 3): CMAC
6.8 Converting a block-wise PRF to bit-wise PRF
6.9 Case study: ANSI CBC-MAC
6.10 Case study: CMAC
6.11 PMAC: a parallel MAC
6.12 A fun application: searching on encrypted data
6.13 Notes
6.14 Exercises
7 Message integrity from universal hashing
7.1 Universal hash functions (UHFs)
7.1.1 Multi-query UHFs
7.1.2 Mathematical details
7.2 Constructing UHFs
7.2.1 Construction 1: UHFs using polynomials
7.2.2 Construction 2: CBC and cascade are computational UHFs
7.2.3 Construction 3: a parallel UHF from a small PRF
7.3 PRF-UHF composition: constructing MACs using UHFs
7.3.1 Using PRF-UHF composition: ECBC and NMAC security
7.3.2 Using PRF-UHF composition with polynomial UHFs
7.3.3 Using PRF-UHF composition: PMAC0 security
7.4 The Carter-Wegman MAC
7.4.1 Using Carter-Wegman with polynomial UHFs
7.5 Nonce-based MACs
7.5.1 Secure nonce-based MACs
7.6 Unconditionally secure one-time MACs
7.6.1 Pairwise unpredictable functions
7.6.2 Building unpredictable functions
7.6.3 From PUFs to unconditionally secure one-time MACs
7.7 A fun application: timing attacks
7.8 Notes
7.9 Exercises
8 Message integrity from collision resistant hashing
8.1 Definition of collision resistant hashing
8.1.1 Mathematical details
8.2 Building a MAC for large messages
8.3 Birthday attacks on collision resistant hash functions
8.4 The Merkle-Damgård paradigm
8.4.1 Joux's attack
8.5 Building Compression Functions
8.5.1 A simple but inefficient compression function
8.5.2 Davies-Meyer compression functions
8.5.3 Collision resistance of Davies-Meyer
8.6 Case study: SHA-256
8.6.1 Other Merkle-Damgård hash functions
8.7 Case study: HMAC
8.7.1 Security of two-key nest
8.7.2 The HMAC standard
8.7.3 Davies-Meyer is a secure PRF in the ideal cipher model
8.8 The Sponge Construction and SHA3
8.8.1 The sponge construction
8.8.2 Case study: SHA3, SHAKE256, and SHAKE512
8.9 Key derivation and the random oracle model
8.9.1 The key derivation problem
8.9.2 Random oracles: a useful heuristic
8.9.3 Random oracles: safe modes of operation
8.9.4 The leftover hash lemma
8.9.5 Case study: HKDF
8.10 Security without collision resistance
8.10.1 Second preimage resistance
8.10.2 Randomized hash functions: target collision resistance
8.10.3 TCR from 2nd-preimage resistance
8.10.4 Using target collision resistance
8.11 A fun application: commitment schemes
8.12 Notes
8.13 Exercises
9 Authenticated Encryption
9.1 Authenticated encryption: definitions
9.2 Chosen ciphertext attacks
9.2.1 Chosen ciphertext attacks: a motivating example
9.2.2 Chosen ciphertext attacks: definition
9.2.3 Authenticated encryption implies chosen ciphertext security
9.3 Encryption as an abstract interface
9.4 Authenticated encryption ciphers from generic composition
9.4.1 Encrypt-then-MAC
9.4.2 MAC-then-encrypt is not generally secure: padding oracle attacks on SSL
9.4.3 More padding oracle attacks.
9.4.4 Secure instances of MAC-then-encrypt
9.4.5 Encrypt-then-MAC or MAC-then-encrypt?
9.5 Nonce-based authenticated encryption with associated data
9.6 Case study: Galois counter mode (GCM)
9.7 Case study: the TLS 1.3 record protocol
9.8 Case study: an attack on non-atomic decryption in SSH
9.9 Case study: 802.11b WEP, a badly broken system
9.10 Case study: IPsec
9.11 A fun application: private information retrieval
9.12 Notes
9.13 Exercises
II Public key cryptography
10 Public key tools
10.1 A toy problem: anonymous key exchange
10.2 Trapdoor function schemes
10.2.1 Key exchange using a one-way trapdoor function scheme
10.3 A trapdoor function scheme based on RSA
10.3.1 Key exchange based on the RSA assumption
10.3.2 Mathematical details
10.4 Trapdoor function-pair schemes
10.4.1 Key exchange using an unpredictable trapdoor function-pair scheme
10.5 A trapdoor function-pair scheme based on discrete logarithms
10.5.1 Key exchange based on the CDH and DDH assumptions
10.5.2 Mathematical details
10.5.3 Decision Diffie-Hellman
10.6 Attacks on the anonymous Diffie-Hellman protocol
10.7 Merkle puzzles: a partial solution to key exchange using block ciphers
10.8 Collision resistant hash functions from number-theoretic primitves
10.8.1 The representation problem
10.9 Notes
10.10 Chapter summary
10.11 Exercises
11 Public key encryption
11.1 Introduction
11.1.1 Two further examples
11.2 Security against eavesdropping
11.2.1 Mathematical details
11.3 Encryption based on trapdoor function schemes and RSA
11.3.1 Instatiating ETF with RSA
11.4 ElGamal encryption
11.4.1 ElGamal and random oracles
11.4.2 ElGamal and secure key derivation functions
11.5 Implications of semantic security
11.5.1 Semantic security against chosen plaintext attack
11.5.2 Encryption as an abstract service
12 Chosen ciphertext secure public key encryption
12.1 Introduction
12.2 CCA secure encryption from trapdoor function schemes and RSA
12.2.1 Instatiating ETF with RSA
12.3 Implications of CCA security
12.3.1 CCA security against chosen plaintext attack
12.3.2 Encryption as an abstract service
12.4 CCA secure ElGamal encryption
12.4.1 CCA security for basic ElGamal encryption
12.4.2 Twin ElGamal encryption
12.4.3 CCA security without random oracles
12.5 CCA security via a generic transformation
12.5.1 Instantiation with ElGamal
12.5.2 Instantiation with a trapdoor function scheme
12.6 OAEP+
12.6.1 Instantiating OAEP+ with RSA
12.7 Case study: PKCS1 version 1.5
12.8 Case study: PGP
12.9 Case study: P1363
12.9.1 Case study:
12.10 Chapter Summary
12.11 Exercises
13 Digital signatures
13.1 Definition of a digital signature
13.1.1 Secure signatures
13.1.2 Mathematical details
13.1.3 Security against multi-key attacks
13.2 Extending the message space with collision resistance
13.2.1 Extending the message space using TCR functions
13.3 Repeated one-way functions: a simple lemma
13.4 Signatures from trapdoor functions: the full domain hash
13.4.1 Signatures based on the RSA trapdoor function
13.4.2 Security of RSA-FDH
13.4.3 A tight security proof in the random oracle model
13.4.4 Case study: PKCS1 v1.5
13.5 Signatures secure without random oracles
13.5.1 The basic GHR signature system
13.5.2 The strong RSA assumption
13.5.3 Security of the basic GHR system
13.5.4 Chameleon hashing
13.5.5 The full GHR signature system
13.6 Signcryption: combining signatures and encryption
13.7 Case study: legal aspects of digital signatures
13.8 Further topics
13.9 Notes
13.10 Chapter summary
13.11 Exercises
14 Fast signatures from one-way functions
14.1 Lamport signatures
14.1.1 A general Lamport framework
14.1.2 Optimized Lamport
14.2 HORS signatures: Lamport in the random oracle model
14.2.1 Merkle-HORS: reducing the public key size
14.3 Comparing one-time signatures
14.4 Applications of one-time signatures
14.4.1 Online/offline signatures from one-time signatures
14.4.2 Authenticating streamed data with one-time signatures
14.5 Merkle stateless signatures: many-time signatures from one-time signatures
14.5.1 Extending the number of signatures from a q-time signature
14.5.2 The complete Merkle stateless signature system
14.5.3 Stateful Merkle signatures
14.5.4 Comparing Merkle constructions
14.6 Notes
14.7 Chapter summary
14.8 Exercises
15 Analysis of number theoretic assumptions
15.1 How reasonable are the factoring and RSA assumptions?
15.1.1 Quadratic resudousity assumption
15.2 How reasonable are the DL and CDH assumptions?
15.2.1 The Baby step giant step algorithm
15.2.2 The Pohlig-Hellman algorithm
15.2.3 Information leakage
15.2.4 Random self-reducibility
15.3 Discrete log in Zp*
15.3.1 The number field sieve
15.3.2 Discrete-log records in Zp*
15.4 How reasonable is decision Diffie-Hellman?
15.5 Quantum attacks on number theoretic problems
15.6 Side channel attacks
15.7 Notes
15.8 Chapter summary
15.9 Exercises
16 Elliptic curve cryptography and pairings
16.1 The group of points of an elliptic curve
16.2 Pairings
16.3 Signature schemes from pairings
16.4 Advanced encryption schemes from pairings
16.4.1 Identity based encryption
16.4.2 Attribute based encryption
17 Lattice based cryptography
17.1 Integer lattices
17.2 Hard problems on lattices
17.2.1 The SIS problem
17.2.2 The learning with errors (LWE) problem
17.3 Signatures from lattice problems
17.4 Public-key encryption using lattices
III Protocols
18 Identification protocols
18.1 Definitions
18.2 Password protocols: security against direct attacks
18.2.1 Weak passwords and dictionary attacks
18.2.2 Preventing dictionary attacks: salts, peppers, and slow hashing
18.2.3 More password management issues
18.2.4 Case study: UNIX and Windows passwords
18.3 One time passwords: security against eavesdropping
18.3.1 The SecurID system
18.3.2 The S/key system
18.4 Challenge-response: security against active attacks
18.4.1 Challenge-response protocols
18.4.2 Concurrent attacks versus sequential attacks
18.5 Notes
18.6 Chapter summary
18.7 Exercises
19 Signatures from identification protocols
19.1 Schnorr's identification protocol
19.2 Honest verifier zero knowledge and security against eavesdropping
19.3 The Guillou-Quisquater identification protocol
19.4 From identification protocols to signatures
19.4.1 -protocols
19.4.2 Signature construction
19.4.3 The Schnorr signature scheme
19.4.4 The GQ signature scheme
19.5 Secure against active attacks: OR proofs
19.6 Okamoto's identification protocol
19.7 Case study: the digital signature standard (DSS)
19.7.1 Comparing signature schemes
19.8 Notes
19.9 Chapter summary
19.10 Exercises
20 Authenticated Key Exchange
20.1 Introduction
20.2 Identification and AKE
20.3 An encryption-based protocol
20.3.1 Insecure variations
20.3.2 Summary
20.4 Forward secrecy and an ephemeral encryption-based protocol
20.4.1 Insecure variations
20.5 Formal definitions
20.6 Security of protocol EBKE
20.7 Security of protocol EEBKE
20.8 Explicit key confirmation
20.9 Identity protection
20.9.1 Insecure variations
20.10 One-sided authenticated key exchange
20.10.1 One-sided authenticated variants of protocols EBKE and EEBKE
20.10.2 Real-world security: phishing attacks
20.11 Password authenticated key exchange
20.11.1 Protocol PAKE0
20.11.2 Protocol PAKE1
20.11.3 Protocol PAKE2
20.11.4 Protocol PAKE2+
20.11.5 Explicit key confirmation
20.11.6 Generic protection against server compromise
20.11.7 Phishing again
20.12 Case studies
20.12.1 SSL
20.12.2 IKE2
20.13 Further topics
20.14 Notes
20.15 Chapter Summary
20.16 Exercises
21 Key establishment with online Trusted Third Parties
21.1 A key exchange protocol with an online TTP
21.2 Insecure variations of protocol OnlineTTP
21.3 Security proof for protocol OnlineTTP
21.4 Case study: Kerberos V5
21.5 Offline TTP vs. Online TTP
21.6 Notes
21.7 Chapter summary
21.8 Exercises
22 Two-party and multi-party secure computation
22.1 Yao's two party protocol
22.2 Multi-party secure computation
IV Appendices
A Basic number theory
A.1 Cyclic groups
A.2 Arithmetic modulo primes
A.2.1 Basic concepts
A.2.2 Structure of Zp*
A.2.3 Quadratic residues
A.2.4 Computing in Zp
A.2.5 Summary: arithmetic modulo primes
A.3 Arithmetic modulo composites
B Basic probability theory
B.1 Birthday Paradox
B.1.1 More collision bounds
B.1.2 A simple distinguisher
C Basic complexity theory
D Probabilistic algorithms