Skip to main content
โ† Back to Espionage & Intelligence samples
๐Ÿ”Espionage & Intelligenceยท20 minยทSample Lesson

Public Key Cryptography: The Math That Protects Your Secrets

Right now, your browser is using a cryptographic system invented in 1977 to protect your passwords, credit card numbers, and messages. Every time you see https in a web address, a technique called public key cryptography is shielding your data from eavesdroppers. Before 1976, this kind of security was mathematically impossible โ€” two parties communicating over a wiretapped line had no way to share a secret without first meeting in person. Whitfield Diffie and Martin Hellman solved that problem in a landmark 1976 paper, and the world of espionage, banking, and privacy was never the same.

What You'll Learn

- Explain the key exchange problem and why it stumped cryptographers for 2,000 years - Describe how public key cryptography uses mathematically paired keys to encrypt and decrypt messages - Walk through the core logic of RSA encryption using prime numbers - Analyze how public key cryptography is used in intelligence and cybersecurity today

The Fundamental Problem: Sharing a Secret Over a Tapped Line

Traditional cryptography โ€” going back to Julius Caesar's cipher in 44 BCE โ€” required a shared secret key. Caesar shifted each letter three positions: A becomes D, B becomes E, C becomes F. The receiver needed to know the number three to decrypt. But how did Caesar securely send that secret number to his generals? Only by courier, in person, or through another secure channel. For 2,000 years this was the unsolvable problem: you need a secure channel to establish a secure channel. During World War II, German navy Enigma operators required physical codebooks distributed to every U-boat โ€” a massive logistical operation. When an Allied ship captured a codebook in 1941, the entire Atlantic U-boat communication network was compromised. In the intelligence world, key distribution was a constant vulnerability. Every spy had to receive their codebook through a courier, creating a chain of human links that could be broken. A solution that let strangers exchange secrets over a monitored line without any prior contact seemed like a mathematical impossibility.

How Public Key Cryptography Works

In 1976, Whitfield Diffie and Martin Hellman published New Directions in Cryptography, introducing an idea that seemed almost magical: what if you could have two mathematically linked keys โ€” one public, one private โ€” where encrypting with one can only be decrypted with the other? Here is how it works: First, you generate a key pair: a public key (which you share with the world) and a private key (which you never share with anyone). Second, if Alice wants to send Bob a secret message, she encrypts it using Bob's public key. Third, only Bob's private key can decrypt a message encrypted with Bob's public key. Fourth, even Alice cannot decrypt her own message after encrypting it โ€” she does not have Bob's private key. Fifth, an eavesdropper can see Bob's public key and see the encrypted message but cannot decrypt it without Bob's private key. The result: two strangers who have never met can exchange secrets securely over a monitored channel. No courier required.

RSA: The Math Behind the Magic

In 1977, Ron Rivest, Adi Shamir, and Leonard Adleman implemented public key cryptography using a one-way mathematical function based on prime numbers. The core idea: multiplying two large prime numbers together is easy. Finding those two prime numbers from their product is incredibly hard. Multiplying 13 times 17 gives 221 in a fraction of a second. But if someone hands you the number 3,337 and asks which two primes multiply to produce it (the answer is 47 times 71), it takes real effort. Now imagine primes with 300 digits each. Their product has 600 digits. The best classical algorithms would take millions of years to factor it. Modern RSA uses key lengths of 2048 or 4096 bits. Breaking 2048-bit RSA by brute force with classical computers would take longer than the current age of the universe. That computational asymmetry โ€” easy to multiply, impossibly slow to factor โ€” is the mathematical lock securing your HTTPS connections right now. A classified detail: British intelligence agency GCHQ's mathematician Clifford Cocks independently invented RSA in 1973 โ€” four years before the American team. It was classified top secret until 1997.

The Quantum Threat to RSA

RSA's security relies on classical computers taking impossibly long to factor large numbers. Quantum computers, using Shor's algorithm published in 1994, could theoretically factor 2048-bit RSA keys in hours rather than millions of years. Intelligence agencies worldwide are racing to develop post-quantum cryptography โ€” new mathematical problems that even quantum computers cannot easily solve. The NSA announced in 2022 that it is transitioning all classified systems to post-quantum algorithms by 2035.

Public Key Cryptography in Espionage and Cybersecurity

Public key cryptography transformed both intelligence and everyday security in fundamental ways. Digital signatures let a spy or official sign a message with their private key. Anyone can verify the signature using the sender's public key, confirming the message is authentic and unaltered. This prevents adversaries from inserting fake orders into a communication network. Every secure HTTPS web connection uses a hybrid approach: public key cryptography to securely exchange a symmetric session key, then faster symmetric encryption for the actual data. The padlock icon in your browser represents this system operating in real time for every page you load. End-to-end encrypted apps like Signal use elliptic curve cryptography โ€” a more efficient variant of public key crypto โ€” so that even Signal's own servers cannot read your messages. Modern state intelligence agencies collect vast quantities of encrypted internet traffic, gambling on future quantum computers or mathematical breakthroughs to eventually decrypt it. This harvest-now, decrypt-later strategy is a documented practice of multiple agencies โ€” which is precisely why post-quantum cryptography is urgent even before quantum computers capable of breaking RSA are actually built.

Match each cryptographic concept with its correct description.

Terms

Public key
Private key
RSA
Digital signature
Shor's algorithm

Definitions

A message signed with a private key, verifiable by anyone using the matching public key
Encryption system using the mathematical difficulty of factoring large prime-number products
Shared openly with everyone โ€” used to encrypt messages sent to you
Kept permanently secret โ€” the only key that can decrypt messages encrypted with your public key
A quantum computing algorithm that could break RSA by factoring large numbers efficiently

Drag terms onto their definitions, or click a term then click a definition to match.

โ“

Why is the difficulty of factoring large numbers the basis for RSA security?

โ“

In the Alice-Bob-Eve scenario, why can Eve NOT decrypt Bob's messages even though she can see Bob's public key?

๐ŸŽฏ

Simulate a Diffie-Hellman Key Exchange

Work with a partner across a monitored channel โ€” pass all notes through a third person who reads everything. Use this simplified Diffie-Hellman exchange with small numbers: (1) Publicly agree on two numbers: prime p equals 23 and base g equals 5. (2) Each of you secretly choose a private number โ€” Alice picks 6, Bob picks 15 โ€” but keep these completely secret. (3) Alice computes her public value: 5 to the power 6, divided by 23, take the remainder. Bob computes 5 to the power 15, divided by 23, take the remainder. Exchange only these public values. (4) Alice takes Bob's public value and raises it to her private number mod 23. Bob does the same with Alice's public value and his private number. Both of you should get the same result without ever sharing your private numbers. Write: what did the eavesdropper see, what would they need to crack it, and why does this protocol work even though all computation happens in public?

Flashcards โ€” click each card to reveal the answer

Want to keep learning?

Sign up for free to access the full curriculum โ€” all subjects, all ages.

Start Learning Free