
Public-Key Encryption
With public-key encryption, every person has two matching keys: a public one that everyone is allowed to know, and a private one that only they themselves know. This makes it possible to send secure messages without having agreed on a shared secret beforehand.
With public-key encryption, every person has two keys that are mathematically linked to each other. One key, the public one, anyone may see and use. The other, the private one, is kept strictly to oneself. A message encrypted with the public key can only be made readable again by the private key. That sounds simple, but it is a little mathematical marvel: encrypting and decrypting are two different operations, and one reveals nothing about the other.
Why this principle is what made the internet secure in the first place
Before public-key encryption, there was a fundamental problem: if two people wanted to communicate in an encrypted way, they first had to exchange a shared key over a secure channel. For two friends in the same city, that’s doable. For an online shop with millions of customers worldwide, it’s impossible.
Asymmetric encryption solves this problem completely. You simply publish your public key — anyone is allowed to know it, and that does no harm. Anyone who then wants to send you a secure message needs no prior contact to do so. The public key is enough. Without this principle, no online banking, no HTTPS, and no encrypted email system would work.
The mathematical one-way street behind it
The method relies on computational operations that are easy in one direction but practically unsolvable in the other. A well-known example: multiplying two large prime numbers together takes milliseconds. Breaking the result back down into its two prime factors takes today’s computers millions of years — provided the numbers were chosen large enough. This difference is called a one-way function.
The best-known algorithm built on this principle is called RSA — named after its three inventors Rivest, Shamir, and Adleman, who published it in 1977. RSA is still in use today, albeit with key lengths of at least 2048 bits, since computers have become ever faster over the years.
In practice, large amounts of data are not encrypted directly with RSA, because that would be too slow. Instead, public-key encryption is used only for one tiny step: the secure exchange of a random session key. This much faster session key is then used to encrypt the actual content. In other words, you combine the best of both worlds.
Public-key encryption in everyday life
The padlock symbol in a browser’s address bar stands for HTTPS. Behind it lies a protocol called TLS, which uses public-key encryption whenever a secure connection is established. Every time someone opens a banking website or buys something in an online shop, this key exchange runs in the background — in milliseconds, invisibly.
Digital signatures work on the same principle, just in reverse. Here, a message is encrypted with one’s own private key. Anyone who knows the corresponding public key can verify whether the message truly came from that person and was not altered along the way. Software updates, PDF contracts, and even vaccination certificates are secured in this way.
In the tech world, intense work is currently underway to develop new methods that remain secure even against quantum computers. A quantum computer could solve the prime-factorization problem underlying RSA in a reasonable amount of time, thereby breaking classical public-key systems. The US standards body NIST standardized the first so-called post-quantum-secure algorithms in 2024 — a sign of how seriously the field takes this threat.