Engineer – Ciphers and Codes – Prove It!

Prove It: The Math Behind the Padlock

Five sessions on the ideas inside every secure login. This page builds the math: one-time pads, agreeing on a key in public, and public and private keys. Later you will put them to work in signatures that can prove your identity in secure login to servers using SSH, and in passkeys.

BIG IDEA

Modern cryptography rests on problems that are easy one way and hard the other. A pair of keys, one public and one private, lets strangers share secrets and prove who they are.

THE PRE-SESSION PUZZLE

Recently you probably signed in to some remote server over Wi-Fi that anyone nearby could record. You never met that server or whispered it a secret. If you used your face, your face never left your phone.

So what did the server check?

TRY FIRST TO PREDICT THE SOLUTION: 

Sketch how you think a passkey sign-in works:

  • boxes,
  • arrows,
  • what gets sent.

Keep the sketch. You’ll redraw it at the end of Session 5.

Project 1: Bits, XOR and the One-Time Pad

XOR a message with random bits and it turns to noise. XOR it again with the same bits and it comes back. Used once, it can’t be broken.

Project 2: Sharing a Secret in Public: Diffie–Hellman

Two people agree on a secret number while everyone listens, using math that’s easy forward and hard backward.

Project 3: A Lock Anyone Can Close: RSA

One key locks and a different key unlocks. Publish the locking key; keep the unlocking key to yourself.

 

Keys in Practice: Signatures, SSH and Passkeys

Projects 4 and 5 turn the math above into the logins students use every day: digital signatures, then key-based sign-in to a club Raspberry Pi and a passkey sign-in on a phone.

BIG IDEA
A password is a secret you tell the server.
 
A private key is a secret you never tell anyone: you prove you hold it by signing a fresh challenge.
PUBLIC KEY
Share it with anyone
  • Locks messages only you can open
  • Checks signatures that only you could make
  • Lives on servers: authorized_keys, a site’s account record
PRIVATE KEY
Share it with no one. Never leaves your device
  • Opens messages locked with your public key
  • Makes signatures
  • Lives in ~/.ssh/id_ed25519, or a phone’s secure hardware

Project 4: Fingerprints and Signatures

A hash is a short fingerprint of any message. Run the fingerprint through your private key and you’ve signed it.

 

Project 5: Keys in Practice: SSH and passkey logins

Meeting A logs into a club Raspberry Pi with a key pair instead of a password. Meeting B signs in with a passkey and pits three kinds of login against six kinds of attack.