# Anatomy of SSH Keys

How an SSH key pair logs you into a server: a private key stays on your laptop while a public key checks a signed puzzle\.

By Numa

Topic: Computing, AI &amp; Electronics

[Open the interactive Jig](https://ask.jig.com/j/jC0aJcfH9hXn)

## Transcript

### 1. A secret handshake

Your laptop wants to log in to a server, a computer far away that stores and runs things\. SSH is the safe way they talk\. Instead of a password, it can use a matching pair of keys\. Drag to turn the scene and look around\.

SSH stands for Secure Shell\.

### 2. Making a matching pair

A program called ssh\-keygen makes two files at once: a private key and a public key\. They are linked by maths, like a key and the one padlock it fits\. Press Make keys to watch the pair appear\.

A modern Ed25519 key is only 32 bytes, shorter than this sentence\.

### 3. The private key stays home

The private key lives in a hidden folder called \.ssh on your laptop, and it never leaves\. A passphrase, a secret phrase only you know, can lock it like the dial on this box\.

If other people could read the file, SSH refuses to use it\.

### 4. The public key is safe to share

The public key is one short line of text: the key type, a long code and a name tag\. Sharing it is safe\. The server keeps it in a list called authorized\_keys, like hanging your padlock on its door\.

Every Ed25519 public key begins with the same letters: AAAAC3NzaC1lZDI1NTE5\.

### 5. Knock, knock: a puzzle

When you connect, the server makes a fresh puzzle just for this visit and sends it across\. Only the matching private key can answer it\. Press Connect and watch the puzzle travel\.

### 6. Signing, not sending

Your laptop uses the private key to sign the puzzle, like pressing a stamp nobody else owns\. Only the stamped answer travels back\. The private key itself never crosses the wire\.

An Ed25519 signature is 64 bytes\.

### 7. The padlock checks the stamp

The server checks the stamp with your public key\. A public key can check a stamp, but it can never make one\. The match is right, so the lock opens and you are logged in\.

### 8. Why it is so strong

Guessing a private key by trying would take far longer than the age of the universe\. Your laptop also remembers each server's own key in a file called known\_hosts, so it can spot an impostor\. Keep the private key secret and share the public key freely\.

A passphrase cannot be recovered\. If you forget it, make a new key pair\.
