Key Takeaways
- Encrypt with the recipient's public key; only their private key can open it
- Signatures run in reverse: sign with your private key, anyone can verify with your public key
- NIST finalized post-quantum replacements (FIPS 203, 204, 205) in August 2024
How do you send a secret to someone you've never met, while strangers are watching?
Imagine whispering your bank password to someone across a crowded room. Everyone can hear the conversation, but somehow nobody else can understand it. That is essentially the problem the internet faces every second. Your browser has never met your bank's server. Neither knows the other personally. Yet they need to exchange sensitive information over networks that other people might be watching.
The solution is one of the great mathematical ideas of the 20th century: public-key encryption. And its cleverest trick? You can give everyone the tools to lock a message without giving anyone the ability to unlock it.
Two keys, two very different jobs
Every participant generates a mathematically linked pair of keys:
- A public key, which can be shared with the entire world.
- A private key, which stays secret and is never transmitted.
The US standards body NIST describes the relationship through one crucial property: knowing the public key makes it computationally infeasible to work out the private key. That pair supports two different operations:
1. Keeping messages secret. Anyone can use your public key to encrypt a message — but only your private key can decrypt it. Think of your public key as an open padlock you hand out to thousands of people: anyone can snap that padlock shut on a box containing a message, but only you have the key that opens it.
2. Proving who sent something. Digital signatures work in the opposite direction. You sign data using your private key; anyone with your public key can verify that signature. A valid signature establishes that the data was signed by the holder of the corresponding private key and has not been altered — it does not hide the message. Think of it as a wax seal: everyone can inspect the seal, but only the private key holder could have made it.
The handshake that shares a secret without sending it
Public-key operations are slow, so modern systems generally use them to establish a shared secret or protect a symmetric encryption key. That shared key then handles the actual conversation using faster encryption such as AES.
One classic technique is Diffie–Hellman. Each person chooses a private secret number, combines it mathematically with agreed public values, sends the resulting mixture to the other person, then combines the received mixture with their own private number. Both arrive at the identical shared secret — which was never transmitted. An eavesdropper can see the exchanged mixtures, but working backwards to recover the private numbers is computationally difficult; that relies on the discrete logarithm problem.
Modern implementations can also generate fresh, temporary keys for individual sessions. This provides forward secrecy: even if a long-term private key is compromised later, previously recorded sessions can remain protected. One important catch: Diffie–Hellman alone does not establish who you are communicating with. Without authentication, an attacker could intercept the exchange — real systems combine key agreement with authentication to prevent this.
RSA vs elliptic curves: two different mathematical locks
Two major families of public-key cryptography rest on different hard problems. RSA relies on the difficulty of factoring the product of two enormous secret prime numbers; its keys typically need 2,048–3,072 bits. Elliptic-curve cryptography relies on a different mathematical problem involving points on elliptic curves, and achieves comparable security with much shorter keys — NIST guidance equates a 256-bit elliptic-curve key with roughly a 3,072-bit RSA key. That size difference is why elliptic curves are attractive for resource-constrained devices such as phones and chip cards.
You encounter public-key cryptography every day: browser security (certificates and signatures authenticate websites while key agreement establishes session keys), end-to-end encrypted messaging, digitally signed software updates, SSH logins, tap-to-pay cards. You might never see the mathematics, but it is working behind the scenes.
The quantum threat — and the replacements, already finished
A sufficiently capable quantum computer could break RSA, Diffie–Hellman and elliptic-curve cryptography alike. None exists yet — but waiting until one arrives could be too late. Attackers can collect encrypted information today and attempt to decrypt it years later, once the technology exists. This is known as harvest now, decrypt later — a serious concern for information that must remain confidential for decades.
That is why cryptographers prepared replacements in advance. On August 13, 2024, NIST finalized and published its first three post-quantum cryptography standards. These are not experimental drafts; they are finalized standards:
- FIPS 203 (ML-KEM): a key-encapsulation mechanism for establishing shared secrets and protecting general encryption.
- FIPS 204 (ML-DSA): the primary standardized post-quantum digital signature scheme.
- FIPS 205 (SLH-DSA): a hash-based signature scheme providing an alternative on different mathematical foundations.
NIST urges organizations to begin integrating these standards now, because replacing cryptographic systems across entire organizations takes years. The challenge is not simply inventing stronger mathematics — it is moving the world's digital infrastructure to new foundations before the existing ones become vulnerable.
The Twikup Take
Public-key cryptography solved an extraordinary problem: letting strangers exchange secrets and verify identities without first sharing a secret password. Its genius lies in the asymmetry — everyone can have the public key, but only the private key holder controls the corresponding secret. The internet was built on mathematics that made trust possible. Now that mathematics is being rebuilt for a world where quantum computers could change the rules.
Image: Illustrative image.
