Public-key cryptography, also called asymmetric cryptography, solves an old problem: how do two strangers share a secret over a network that anyone can watch?
How it works
Each party makes a pair of keys. The public key can be handed to anyone. The private key never leaves its owner. The two are linked by a math problem that is easy to compute in one direction and, as far as anyone knows, impractical to reverse without the private key.
Think of a mailbox with a slot. Anyone can drop a letter in, but only the person with the key can open it.
Two jobs depend on this pair:
- Encryption and key exchange. You use someone's public key to lock a message, or to agree on a shared secret, and only their private key unlocks it.
- Digital signatures. You sign with your private key, and anyone can check the signature with your public key. That proves who sent something and that it was not altered.
The hard problems underneath
The best known schemes rest on specific math problems. RSA relies on the difficulty of factoring very large numbers. Elliptic curve cryptography relies on the difficulty of the discrete logarithm problem on a curve. Newer schemes use lattice problems.
None of these problems has been proven hard in the strict sense. They are trusted because experts have attacked them for decades without finding a fast method. That is the same shape of claim as P vs NP: we believe some problems are hard, and we have not proven it.
Where you meet it
You use public-key cryptography constantly, mostly without noticing:
- The padlock in your browser: TLS uses it to set up a secure session.
- Signed software updates and code, so your device knows an update is genuine.
- SSH logins, VPNs and single sign-on.
- Certificates that tie a website name to a key.
Public-key methods are slow compared with symmetric ciphers, so in practice they are used briefly at the start of a session to agree on a fast symmetric key, and the bulk data is encrypted with that.
Why it matters to people using AI
Your API keys and access tokens travel over connections protected by public-key cryptography. If a scheme were weakened by a new algorithm or by a large quantum computer, the stored encrypted data and signed records that depend on it would be at risk.
That is why security teams keep an inventory of where each scheme is used and plan for key rotation and algorithm swaps. The ability to change algorithms quickly, sometimes called crypto agility, is cheap insurance.
The replacement schemes designed to resist quantum computers are covered under post-quantum cryptography. A related tool, the zero-knowledge proof, also builds on this kind of math to let you prove something without revealing it.