Asymmetric Cryptography ยท 3.1

๐Ÿ’ก The Public/Private Key Breakthrough

The 1976 idea that made secure internet commerce possibleโฑ ~3 min

๐Ÿ“ฎPublic key = padlock on your front door; private key = your key

Imagine you want to receive secret messages. You put an unlocked padlock outside your door โ€” anyone can pick it up, snap it shut around their message box, and mail it to you. Only you have the key to open that padlock. You never gave anyone your key, yet they sent you something only you can open. The padlock is your public key. The key to open it is your private key.

๐Ÿ‘ฉAlicesender๐Ÿ”’Ciphertext๐Ÿ‘จBobreceiver๐Ÿ”“ Bob's PUBLIC keyanyone can have this๐Ÿ”‘ Bob's PRIVATE keyonly Bob has thisencrypt with publicdecrypt with privateTwo different keys: what the public key locks, ONLY the private key can unlock
Asymmetric encryption: encrypt with the public key, decrypt with the private key

The Revolutionary Idea: Two Mathematically Linked Keys

In 1976, Whitfield Diffie and Martin Hellman published 'New Directions in Cryptography,' introducing the concept of public-key cryptography. The insight: generate two mathematically related keys such that:

  • โ€ขWhat one key encrypts, only the other key can decrypt
  • โ€ขKnowing the public key makes it computationally infeasible to derive the private key
  • โ€ขThe public key can be broadcast to the world without compromising security
  • โ€ขNo prior shared secret is needed โ€” two strangers can communicate securely on first contact

Two Modes: Encryption vs Signing

OperationWho Uses Which KeyPurpose
EncryptionSender uses recipient's PUBLIC key to encrypt; recipient uses their PRIVATE key to decryptOnly the recipient can read the message
Digital SignatureSender uses their own PRIVATE key to sign; anyone uses sender's PUBLIC key to verifyProves the message came from the sender and wasn't modified
โ˜… FactIn practice, asymmetric encryption is rarely used to encrypt large data directly โ€” it's too slow. Instead, it's used to encrypt a small symmetric key (the 'session key'), which then encrypts the actual data. This hybrid approach is how TLS, PGP, and Signal all work.

The Mathematical Hard Problems

Asymmetric cryptography relies on mathematical problems that are easy to compute one way but computationally infeasible to reverse:

AlgorithmHard ProblemEasy DirectionHard Direction
RSAInteger factorizationMultiply two large primes: p ร— q = nFactor n back into p and q
Diffie-HellmanDiscrete logarithmCompute g^x mod p given g, x, pFind x given g, g^x mod p, p
ECCElliptic curve discrete logMultiply a point P by integer k: kร—PFind k given P and kร—P
๐Ÿ”’ SecurityThese problems are believed to be hard, but not proven to be. If P=NP (one of the Millennium Prize Problems), all of asymmetric cryptography could collapse. In practice, no efficient algorithm has been found for any of these in 50+ years of active research โ€” though Shor's algorithm on a quantum computer would break RSA and DH.
๐Ÿง Quick Checkfirst try = +5 XP

To send Bob a secret message, you encrypt withโ€ฆ

โญ 0 XP๐Ÿ”ฅ 0 days