1-min guide

Public-key cryptography and digital signatures

Public-key cryptography uses a pair of two keys for different jobs. “Whose” key and “which” key to use is the crux — on exams and on the job.

Reading time: about 1 min

More in the 5-min version →

In the game, this was passing notes in classPlay “Secret Notes in Class”

In the gameIn real IT
You and your friendTwo people exchanging messages
Share set (padlock and stamp sample)Public key
Own set (key and stamp)Private key
Lock with a padlock / open with the keyEncrypt / decrypt
Stamp / check against the sampleSign / verify a signature
Kids in betweenEavesdropper
ABSend a secret: lock with B’s public keyOnly B’s private key can open itABSign: sign with A’s private keyB checks with A’s public keyPublic key = a padlock anyone can have · Private key = the owner’s only key
Encrypt with the receiver’s public key; sign with the sender’s private key

The public key is a padlock, the private key is the key

A public key is like a “padlock” you can hand to anyone. It can lock, but it can’t unlock. The private key is the one “key” that opens that padlock, and only its owner holds it. The two are a pair: whatever one locks, only the other can open.

To send a secret: “the other person’s public key”

If A sends B a secret, A locks it with B’s public key (padlock) and sends it. Even if someone peeks on the way, only B, who holds the private key, can open it.

To sign: “your own private key”

A digital signature proves “the sender really sent it” and “it wasn’t altered on the way.” It only means something if only the sender could have made it, so you sign with the private key only you hold, and everyone checks it with the public key they all have.

Summary
  • Encrypt with the receiver’s public key; decrypt with the receiver’s private key
  • Sign with the sender’s private key; verify with the sender’s public key
  • Never give your private key to anyone
Go further: 5-min deep divePublic keys in depth: certificates, certificate authorities and HTTPSWhat exactly gets signed? Does that public key really belong to that person? Digital certificates, certificate authorities, and how HTTPS uses them.Read the 5-min version →