Attic › Computer science › Public-key cryptography

Public-key cryptography lets two people communicate secretly without meeting first

Public-key cryptography is a system that uses two separate keys to protect data. A user can share one key with the world to receive secret messages, and keep the other key secret to read them. This allows strangers on the internet to communicate safely without meeting first to agree on a secret code.

Before the mid-1970s, all cipher systems used symmetric-key algorithms, even though cryptography itself dates back more than 2,000 years. In a symmetric system, the sender and the receiver must have the same secret key to lock (encrypt) and unlock (decrypt) a message. This causes a problem: before two people can send a secret message, they must find a safe way to share the key. If an attacker intercepts the key during this key exchange, the attacker can read all their future messages.

Public-key cryptography solves this problem. It gives each user a pair of keys that are connected by mathematics:

1. A public key, which the user shares openly with everyone.

2. A private key, which the user keeps completely secret.

When Alice wants to send a secret message to Bob, she follows three steps:

1. Alice gets Bob's public key from a public directory.

2. She uses Bob's public key to encrypt her message, and sends the encrypted message to Bob over the open internet.

3. Bob uses his private key to decrypt and read the message.

A public key can only lock the data; it cannot unlock the data that it just locked. Even if an attacker has Bob's public key and intercepts the encrypted message, the attacker cannot decrypt the message without Bob's private key.

Fact-checked against Public-key cryptography on Wikipedia

Part of the Computer science syllabus: Cryptography and Computer Security

See it on the timeline of Computer science