skip to primary navigationskip to content

Department of Computer Science and Technology

Masters

 

Course pages 2025–26 (working draft)

Cryptography and Protocol Engineering

Principal lecturer: Dr Martin Kleppmann
Additional lecturer: Dr Daniel Hugenroth
Taken by: MPhil ACS, Part III
Code: P79
Term: Lent
Hours: 16 (8 x two-hour sessions)
Format: In-person lectures
Class limit: max. 16 students
Prerequisites: Part II Cryptography or similar, Discrete Mathematics
timetable

Aims

We all use cryptographic protocols every day: whenever we access an https:// website or send a message via WhatsApp or Signal, for example. In this module, students will get hands-on experience of how those protocols are implemented. Students will write their own secure messaging protocol from scratch, and then move on to a cryptographic protocol for private information retrieval (searching for data without revealing what you’re searching for).

Syllabus

This is a practical course. The 2-hour weekly sessions consist of lectures that introduce a topic, along with lab time during which the students can work on their implementations and get help from the lecturers. Along with the details of implementing cryptographic algorithms, this module places a particular emphasis on engineering considerations such as code quality, testing, robustness, and documentation.

The sessions cover the following topics:

  1. Introduction, basic cryptography revision, and environment setup for practicals
  2. Elliptic curve cryptography, X25519: elliptic curve Diffie-Hellman
  3. Standards, RFCs, test vectors, API design, error handling, using types, type state pattern
  4. Ed25519 signature scheme, side-channels, randomness, testing, fuzzing
  5. Protocol security, Dolev-Yao model, authenticated key exchange, forward secrecy, the SIGMA protocol
  6. Measuring performance, serialization, nonces and IVs
  7. Post-quantum cryptography, learning with errors, homomorphic encryption, private information retrieval (PIR)
  8. Randomness II, summary and outlook

For the practicals, students are given a description of an algorithm or protocol (e.g. a research paper or an RFC standards document), and they are required to implement it themselves. A code template in Python is provided, and Python is recommended as the implementation language, but other languages may also be used. For each assignment, students submit their code along with a lab report explaining their approach and the findings from their implementation.

Objectives

On completion of this module, students should:

  • Understand that cryptography is not magic! The mathematics can look intimidating, but this module will show students that they needn’t be afraid of cryptography.
  • Gain appreciation for the complexity and careful implementation of real-world cryptography libraries, and understand why one should prefer vetted implementations.
  • Be familiar with the mathematical notation and concepts commonly used in descriptions of cryptographic protocols, and be able to understand and implement research papers and RFCs in this field.
  • Be comfortable with cryptographic primitives commonly used in protocols, and able to correctly use software libraries that implement them.
  • Have been exposed to ideas and techniques from recent research, which may be useful for their own future research.
  • Have practised technical writing through lab reports.

Assessment

Students will be provided with a code skeleton in Python for getting started. For each assignment, students are required to produce a working implementation of the algorithm discussed in the lectures, and automated tests of its correctness, using Python or another programming language. Here, “working” means that the algorithms are functionally correct, but they need not be production-quality (in particular, no side-channel countermeasures such as constant-time algorithms are required). For some primitives (e.g. symmetric ciphers and hash functions) existing libraries should be used, whereas other cryptographic algorithms will be implemented from scratch. Students should submit their code as a Docker container that runs the tests they have written.

Along with each code submission, students will be asked to submit a lab report of approximately 1,000 words. In the lab report, the students should explain what design decisions they made and why, how they ensured their code is correct, and any findings from the work (e.g. any limitations or trade-offs they found with the protocols). The lab reports provide an opportunity for students to provide critical insights and creativity. For instance, they might compare their implementation with existing real-world implementations that provide additional features and guarantees.

Each of the four lab report and code submissions will be marked, and all four submissions are counted equally. Students may discuss their work with others, but the implementations and lab reports must be individual work.

Recommended reading

Jean-Philippe Aumasson. Serious Cryptography: A Practical Introduction to Modern Encryption (2nd edition). No Starch Press, 2024. — An informal introduction to cryptographic primitives aimed at engineers.

Jonathan Katz and Yehuda Lindell. Introduction to Modern Cryptography (3rd edition). CRC Press, 2020. — A more formal, rigorous treatment of cryptographic algorithms. This book is also used in the Part II Cryptography course.

For the protocols we cover in this course, we are not aware of a suitable textbook; instead we will use research papers, lecture slides, and RFCs as resources, which will be provided at the start of the module.