Find a course

Module 1: Foundations of CryptographyLesson 1 of 1114 min

What Cryptography Protects

Learn the goals of confidentiality, integrity, authenticity and non-repudiation, the core vocabulary, Kerckhoffs's principle and how attackers are modeled.

Step 1 of 13Learn

A message through hostile territory

When you send a message from your phone, it doesn't travel straight to your friend. It passes through your Wi-Fi router, your internet provider, several backbone networks, perhaps a cloud server in another country, and your friend's provider. Any of those points could, in principle, read the message, copy it, change it or pretend to be you.

Cryptography is the science of protecting information in the presence of adversaries. It lets two parties communicate safely over a channel they don't control, and it lets you store data so that a thief who takes the disk learns nothing useful.

Cryptography used to be the business of generals and diplomats. Today you use it hundreds of times a day without noticing: every HTTPS web page, every messaging app with end-to-end encryption, every contactless card payment, every phone that keeps its storage encrypted, every software update checked for tampering, every password login.

This course explains how those protections work: from classical ciphers and why they broke, through modern symmetric encryption, hash functions and password storage, to the public-key ideas that make secure contact between strangers possible, and finally how it all comes together in HTTPS and messaging apps. You won't need advanced math. A little modular arithmetic, explained from scratch, is all it takes.

Step 2 of 13Diagram

The path a message really takes

Every hop is a place where someone could read, copy or change your message. Tap a hop to see who controls it.

The path a message really takesProcess diagram: Your phone → Wi-Fi router → Internet provider → Backbone networks → App server → Friend's phone.Your phoneWi-Fi routerInternet providerBackbone networksApp serverFriend's phone

Tap a shape with to see more.

Your phone

Encryption should start here, before the message leaves your device.

Wi-Fi router

Whoever runs the network (a café, a hotel, an attacker) sees every packet that passes.

Internet provider

Your ISP routes the traffic and can log or inspect it.

Backbone networks

Traffic crosses several companies and often several countries.

App server

Unless the app uses end-to-end encryption, the company can read the message here.

Friend's phone

The only place the message is supposed to be readable.

Step 3 of 13Learn

Four security goals

Cryptography serves four main goals. It's worth keeping them separate, because a tool that provides one may provide none of the others.

  • Confidentiality: only the intended recipients can read the information. Encryption provides this. If someone intercepts your encrypted message, they see meaningless bytes.
  • Integrity: nobody can change the information without being detected. An attacker who can't read an encrypted payment message might still flip bits in it to change the amount. Integrity checks catch that.
  • Authenticity: you can verify who sent the information. A message that claims to come from your bank should be provably from your bank, not from a scammer.
  • Non-repudiation: the sender can't later deny having sent it. A digital signature on a contract shows that only the holder of a particular private key could have produced it.

Here's why the distinction matters. Encrypting a message gives confidentiality, but on its own it does not guarantee integrity: with some encryption modes, an attacker can predictably alter the decrypted result without knowing the key. A hash posted next to a download gives integrity against accidental corruption, but an attacker who can replace the file can also replace the hash. Real systems combine tools to get all the goals they need, and many real-world failures come from assuming one goal implies another.

Step 4 of 13Practice · Diagram

The four security goals

One protected message, four separate promises. A tool that gives one may give none of the others.

Which goal is the only one that convinces a third party, such as a judge, who sent the message?

Tap the shape that answers the question, then press Check.

The four security goalsParts diagram: A protected message, Confidentiality, Integrity, Authentication, Non-repudiation.A protectedmessageConfidentialityIntegrityAuthenticationNon-repudiation
A protected message
Confidentiality

Only the intended people can read it. Provided by encryption.

Integrity

Any change is detected. Provided by MACs, signatures and authenticated encryption.

Authentication

You know who it really came from. Provided by MACs, signatures and certificates.

Non-repudiation

The sender cannot later deny sending it. Only digital signatures give this to outsiders.

Step 5 of 13Practice · Match the pairs

Match each scenario to the security goal it is mainly about.

Tap an answer, then tap the place where it belongs (or drag it there).

  1. A thief steals a laptop but can't read its encrypted disk
  2. A bank detects that a transfer amount was altered in transit
  3. Your browser verifies that a site really belongs to your bank
  4. A signer can't later claim they never signed a contract

Step 6 of 13Learn

The vocabulary

Cryptographers use a small set of precise terms:

  • Plaintext: the original readable data.
  • Ciphertext: the scrambled result after encryption.
  • Cipher: the algorithm that turns plaintext into ciphertext and back.
  • Key: a secret value that controls the cipher. The same cipher with different keys produces completely different ciphertexts.
  • Encryption and decryption: the two directions of the transformation.
  • Cryptanalysis: the study of breaking ciphers.

Security discussions also use a cast of characters. Alice and Bob want to communicate. Eve is an eavesdropper who can read traffic but not change it, a passive attacker. Mallory is an active attacker who can intercept, modify, replay and inject messages.

Three terms are often confused, and the confusion causes real breaches:

  • Encoding, such as Base64 or hexadecimal, changes the format of data so it can travel through systems that expect text. It uses no key, and anyone can reverse it. It provides no security.
  • Encryption uses a key. Without the key, the ciphertext should reveal nothing about the plaintext except perhaps its length.
  • Hashing produces a fixed-size fingerprint and is designed to be one-way: there is no key and no way to reverse it.

Security audits regularly find passwords protected with Base64. Anyone who recognizes the format can decode them in a second.

Step 7 of 13Flashcards

Core vocabulary

Tap a card to flip it.

Step 8 of 13Practice · Sort into groups

Sort each technique by what it actually is.

Tap an item, then tap its group (or drag it there).

Step 9 of 13Learn

Kerckhoffs's principle

In 1883, the Dutch cryptographer Auguste Kerckhoffs set out design rules for military ciphers. The most famous one is now known as Kerckhoffs's principle:

A cryptosystem should be secure even if everything about the system, except the key, is public knowledge.

The information theorist Claude Shannon later put it more bluntly: the enemy knows the system.

Why insist on this? Because algorithms leak. They are embedded in software that can be reverse-engineered, in devices that can be captured, and in the heads of employees who change jobs. If your security depends on keeping the algorithm secret, one leak breaks every message ever sent with it, and you must redesign everything. If security depends only on the key, a leak means changing one key.

Public algorithms have a second advantage: scrutiny. AES, SHA-256 and the algorithms in HTTPS were published and attacked by cryptographers worldwide for years before being trusted. Secret, homemade algorithms, sometimes called security through obscurity, have a long record of being broken soon after someone looks closely. Proprietary ciphers in DVD copy protection, early mobile phone networks and some car key fobs were all broken once researchers studied them.

The practical rule follows directly: use standard, well-studied algorithms and keep your keys secret.

Step 10 of 13Practice · True or false

According to Kerckhoffs's principle, a well-designed cipher remains secure even if attackers know exactly how the algorithm works.

Step 11 of 13Note

Step 12 of 13Practice · Diagram

Attacker models, from weakest to strongest

A modern cipher must survive the attacker at the top. Each level gives the attacker everything below it, plus more.

Which attacker model is the strongest, the one modern ciphers are designed to withstand?

Tap the shape that answers the question, then press Check.

Attacker models, from weakest to strongestPyramid diagram: Ciphertext-only, Known plaintext, Chosen plaintext, Chosen ciphertext.Ciphertext-onlyKnown plaintextChosen plaintextChosen ciphertext
Ciphertext-only

The attacker only has intercepted ciphertexts.

Known plaintext

The attacker also knows some plaintext–ciphertext pairs, such as a standard email header.

Chosen plaintext

The attacker can get plaintexts of their choice encrypted.

Chosen ciphertext

The attacker can also get chosen ciphertexts decrypted (except the target). AEAD ciphers are built to resist this.

Step 13 of 13Practice · What would you do?

What would you do?

A startup proudly tells investors its app is secure because it uses a secret encryption algorithm invented by its founder, which no outsiders have seen. As a security adviser, what do you say?