The crypto toolbox — symmetric, public-key, hash, signature
Distinguish symmetric encryption, public-key encryption, hashes, and digital signatures by what each solves, and see why TLS is a hybrid scheme.
Line up the four tools by what each solves
Chapter 1 established that TLS is a combination of three guarantees. This chapter opens the four tools that deliver them. Textbooks tend to start from how each tool works; this course starts every time from "what goes wrong in a world without it."
| Tool | Problem it solves | Guarantee it serves |
|---|---|---|
| Symmetric encryption | Encrypt lots of data, fast | Confidentiality |
| Public-key encryption | Share a key with someone you have never met | Confidentiality (its entrance) |
| Hash | Notice when content has been altered | Integrity |
| Digital signature | Confirm "the real owner produced this" | Authenticity |
Symmetric encryption — fast, but how do you hand over the key?
Symmetric ciphers (such as AES) encrypt and decrypt with the same key. They are very fast and suited to protecting bulk traffic — in TLS, it is essentially symmetric encryption that protects your data.
The one weakness: how do you get that key to the other side safely? E-mail the key and it gets eavesdropped; if you had a wiretap-proof channel, you would not need encryption in the first place. This is the key-distribution problem. Worse, you need a key per communicating pair, so the key count grows with the square of the head count.
Public-key encryption — split the key into "lock" and "unlock"
Public-key cryptography uses a matched pair — a public key and a private key. What the public key encrypts, only the matching private key can decrypt.
This transforms key distribution: each party publishes a "padlock," and anyone can start a secret conversation with them — no shared secret needed in advance. The catch is that public-key operations are orders of magnitude slower than symmetric ones, so encrypting all traffic this way is impractical.
TLS's answer — the hybrid scheme: use public-key techniques to establish a shared symmetric key (Chapter 3's key agreement), then protect the body with fast symmetric encryption. The slow tool for one instant; the fast tool for the main event.
The hybrid division of labor. The TLS 1.3 handshake in Chapter 5 is the procedure that finishes that "one instant" in a single round trip.
Practice 2-1 — Count the key-distribution problem
Confirm the limits of symmetric keys, and how public keys change the picture, by working the numbers.
Q1. A group of 10 people all want to communicate secretly with each of the other 9 using symmetric encryption, one distinct key per pair. How many keys are needed in total?
The number of pairs is 10 × 9 ÷ 2 = 45. For n people it is n(n−1)/2 — growing with the square of the head count. And every pair still needs a safe way to hand over that first key. This is the key-distribution problem, which public-key cryptography reduced to 'each person publishes one public key.'
Q2. Using public-key encryption, you want to send a message that only A can read. Which key do you encrypt with?
What is encrypted with A's public key can be decrypted only with A's matching private key. Public keys may be known to everyone, so no secret needs to be exchanged in advance. "Lock with the public key, open with the private key" — internalize this direction.
Hashes — taking a fingerprint of the content
A hash function (such as SHA-256) turns input of any length into a fixed-length value, one-way. Three properties together make it usable as a fingerprint:
- Same input → always the same output. Usable for comparison
- Even one different bit → a completely different output. The smallest tampering breaks the match
- The input cannot be computed back from the output. The fingerprint does not reveal the body
But note: sending a hash along with the data does not by itself detect tampering — an attacker who rewrites the body can simply recompute and replace the hash. Real protocols therefore mix a key into the hash: a fingerprint only the key holders can produce. That is a MAC (message authentication code), and TLS uses it in the form of authenticated encryption (AEAD), which performs encryption and tamper detection as one operation (it returns in Chapter 5).
Digital signatures — proof that the owner produced it
The key pair also works in the opposite direction: sign with the private key, verify with the public key. Since only the owner holds the private key, a successful verification says "the private-key holder approved exactly this content, and it has not changed since."
| Encryption (confidentiality) | Signature (authenticity) | |
|---|---|---|
| Producer uses | The peer's public key | Their own private key |
| Receiver uses | Their own private key | The peer's public key |
| Protects | Content from being read | Author identity and content integrity |
Signatures carry the rest of this course: Chapter 4's certificate is "a CA's signature over a domain owner's public key," and in Chapter 5's handshake the server proves possession of its private key with a signature.
Practice 2-2 — Don't mix up the tools
Each of the four tools answers a different question. Check which tool solves what.
Q3. TLS encrypts the traffic body with symmetric encryption rather than public-key encryption. The main reason is:
Public-key operations cost vastly more computation than symmetric ones and are unsuited to bulk traffic. So TLS takes the hybrid approach: use public-key techniques to establish the hard-to-share symmetric key, then protect the body with fast symmetric encryption. It is not about strength, and key sharing is the symmetric side's weakness, not its strength.
Q4. Which of these is not a property of a cryptographic hash function?
A hash is a one-way digest, not encryption. Precisely because the input cannot be recovered from the output, hashes work for tamper detection and password storage. "Hash = cannot be decrypted; encryption = can be decrypted with the key" — this distinction pays off constantly in real conversations.
Q5. When verifying a digital signature, which key does the verifier use?
Signatures are created with the private key and verified with the matching public key — the reverse direction from encryption. "Only the private-key holder can create it; anyone can verify it" — this property becomes the foundation of certificates in Chapter 4.
What to take from this chapter
- Symmetric encryption is fast but stuck with key distribution — n(n−1)/2 keys for n people, pairwise
- Public-key encryption solves distribution but is slow; TLS runs a hybrid of the two
- A hash is a one-way fingerprint; only with a key mixed in (MAC / AEAD) does it detect tampering
- Signatures: created with the private key, verified with the public key — the reverse direction from encryption
Next we hand-compute "creating a shared key with someone you have never met." Verify with your own hands that public-key techniques are not magic.