Open to everyone Reading, lesson 47 of 100, 2 min read
Symmetric encryption
One key for both directions
In symmetric encryption, the same key encrypts and decrypts. It is fast, so it is used for nearly all bulk data: disks, files, databases and the data inside every HTTPS connection.
plaintext + key -> encrypt -> ciphertext
ciphertext + key -> decrypt -> plaintextThe standard: AES
AES (Advanced Encryption Standard) is the symmetric algorithm used almost everywhere. Keys are 128, 192 or 256 bits long. A 128-bit key has 2^128 possibilities, far too many to try, so attackers go after the key itself or the people and systems around it.
Another modern algorithm you will meet is ChaCha20, often used on phones because it is fast without special hardware.
Modes matter
Block ciphers like AES encrypt fixed-size blocks, and a mode decides how blocks are chained. Old, simple modes (such as ECB) leak patterns: an encrypted picture can still show its outline. Modern systems use authenticated encryption such as AES-GCM or ChaCha20-Poly1305, which both hides the data and detects any tampering.
The hard part: sharing the key
Symmetric encryption has one big problem: both sides need the same secret key. How do you get it to someone safely in the first place? Sending it by email defeats the purpose. The next lesson shows how public-key cryptography solves this.
Key management
- Generate keys with a proper random source, not from a word or a date.
- Store keys apart from the data they protect, ideally in a key management service or a hardware module.
- Limit who and what can use each key.
- Rotate keys (replace them) on a schedule and when someone with access leaves.
- Have a plan for recovery: an encrypted backup whose key is lost is the same as no backup.
Note
Full-disk encryption on your laptop is symmetric encryption. Your password unlocks the real key, which is stored encrypted on the disk.