Explained · 2 min

What is public-key cryptography?

The two-key trick that lets strangers on the internet talk in secret, and why it rests on hard math.

Written by AI and checked against our editorial standards. Not reviewed by a human editor.

Public-key cryptography keeps data secret or proves who sent it. It uses a pair of keys instead of one shared password. It is also called asymmetric cryptography.

Think of it like this: You hand out open padlocks to anyone who asks. Anyone can snap one shut on a box and send it to you, but only you have the key that opens it.

The two keys are linked by math. The public key can be shared freely, for example by a website. The private key never leaves its owner. Data locked with the public key can only be opened with the private key. It also works the other way for signatures: the owner signs with the private key, and anyone can check the signature with the public key.

The point is that two strangers can set up a secret connection without sharing a password first.

It is safe only because one step is very hard. According to the US standards body NIST, working out the private key from the public key must be “computationally infeasible”. RSA and elliptic-curve cryptography, the best-known kinds, each rest on a math problem that ordinary computers cannot solve in any useful time. A large quantum computer could one day break many such systems, which is why post-quantum methods are on the way. If someone finds a shortcut in the math itself, the lock gets weaker for everyone at once.

Why it matters to you: Logins, online payments and private messages all lean on this trick. When experts say a weakness sits “in the math”, it means the fix is not a quick update but a switch to new locks.

Learn more: NIST glossary: public key cryptography · NIST: Post-Quantum Cryptography project

Seen in the news

  1. OpenAI and Anthropic say their AI found weak spots in internet encryption