← Module 06 · Security & Encryption

Symmetric vs Asymmetric Encryption

Two fundamentally different ways to keep data secret, and why almost every real system, including the one securing this page, ends up using both together.

Two kinds of drop-box

Imagine two different kinds of secure drop-box. The first kind has one identical key that both locks and unlocks it: whoever holds a copy of that exact key can put something in or take something out. That's symmetric encryption. The same key both encrypts and decrypts, so both sides need an identical copy of it, and getting that copy to the other side safely in the first place is the entire hard problem.

The second kind works differently. Anyone can walk up and snap the box's lock shut using a key that's published publicly, but only the one person holding the matching private key can ever open it again. That's asymmetric encryption: two mathematically related keys, a public one anyone can use to lock, and a private one only the owner holds to unlock.

SYMMETRIC ASYMMETRIC ALICE BOB KEY KEY locked and unlocked with the identical key ALICE BOB BOB'S PUBLIC KEY BOB'S PRIVATE KEY locked with one key, only opens with the other
Left: the same key travels both directions. Right: the key that locks the message (Bob's public key) is never the key that unlocks it (Bob's private key), and Bob never has to share that private key with anyone.

Symmetric encryption

Algorithms like AES (Advanced Encryption Standard), commonly used with a 128-bit or 256-bit key, are fast enough to encrypt large amounts of data with almost no performance cost. The problem it doesn't solve is getting that one shared key to the other party in the first place: send it over the same insecure channel you're trying to protect, and anyone watching that channel gets the key too.

Asymmetric encryption

Algorithms like RSA and ECC (Elliptic Curve Cryptography) solve exactly that problem: a public key can be handed out completely openly, since it's only useful for locking, not unlocking. Nobody needs a shared secret arranged in advance. The trade-off is speed: the math involved is far more computationally expensive than symmetric encryption, which makes it impractical for encrypting large amounts of data directly.

SymmetricAsymmetric
Keys usedOne shared keyA public/private key pair
SpeedFastMuch slower
Main problemNeeds a secure way to share the key firstSolved: the public key needs no secrecy at all
Common algorithmsAES, ChaCha20RSA, ECC, DSA
Typical useBulk data encryptionKey exchange, digital signatures, certificates
WHY REAL SYSTEMS USE BOTH TOGETHER

Almost nothing uses one or the other alone. The common pattern, called hybrid encryption, uses slow asymmetric encryption only to securely exchange a fast symmetric session key, then switches to that symmetric key for the actual bulk data. This is exactly what the TLS/SSL Handshake, covered next, does for every HTTPS connection on the internet.