Cryptography Fundamentals / Chapter 1 — Before Cryptography (lessons 1–5) / Lesson 1

What Cryptography Protects, and What It Doesn't

Time needed: about 9 min (estimate)

☆ Read later

You can try the opening of this lesson without an account.

What you'll build in this course

In this course you'll break each cipher with your own hands first, then choose the right way to use it. You'll break classical ciphers with frequency analysis and reused keys with XOR, and watch an image's outline survive ECB encryption. Once you know why something breaks, each argument to a library function starts to mean something. In the last chapter, you'll combine these parts into a file-encryption tool.

Map of all 30 lessons

Ch.1 Before cryptography bytes and XOR, randomness, breaking classical ciphers, one-time pad Ch.2 Hashes and MACs SHA-256, HMAC, signed requests, password hashing, HKDF Ch.3 Symmetric ciphers AES, the ECB hole, CBC and CTR, handling nonces, AEAD Ch.4 Public-key crypto discrete logs, Diffie-Hellman, RSA and its pitfalls, signatures Ch.5 TLS and certificates certificate chains, your own CA, reading TLS 1.3, forward secrecy Ch.6 Putting it to use key management, a file-encryption tool, a list of don'ts

Three things cryptography can protect

"Protecting something with cryptography" actually covers three different things. Confidentiality means nobody else can read the contents, integrity means nobody changed it on the way, and authenticity means it really came from who you think. Encryption on its own only gives you confidentiality. To notice tampering you need the MACs from Chapter 2, and to verify the sender you need the signatures from Chapter 4.

What is protected, and with what

Property Example threat Tool (chapter) Confidentiality Someone reads your traffic Encryption (Ch.3, Ch.4) Integrity Someone changes the amount Hashes, MACs (Ch.2) Authenticity Someone impersonates the server MACs, signatures, certificates (Ch.2, Ch.4, Ch.5)

Base64 is not encryption

Let's clear up one common mix-up first. Base64 looks unreadable, but it has no key. With no key, there's no way to tell the intended recipient apart from someone peeking along the way. When you see Base64 in a config file or a token, don't assume it's encrypted.

editor.py

Tab indents. To leave the editor, press Esc, then Tab.

Create a free account to keep reading

With an account you can read the rest of this lesson, take the quiz, and read every free lesson in this course. Lessons you answer correctly are recorded as complete.

Report a problem with this lesson

Log in to send a report.

Keyboard shortcuts

Keys available in a lesson
KeyAction
[ or Alt + ←Go to the previous lesson
] or Alt + →Go to the next lesson
?Open this list
EscClose this list

The keys do not work while the cursor is in a code editor or an input field.