Skip to Content

SSH keys explained — make your own key pair

A key pair is two matching files. The private key never leaves your PC. The public key is copied to every server you want to log in to. Anyone may see the public key; it only checks signatures, it cannot make them.

The server sends a challenge, your PC signs it with the private key, the server checks the signature with the public key. The private key never crosses the network.
The server sends a challenge, your PC signs it with the private key, the server checks the signature with the public key. The private key never crosses the network.

Which key type?

  • Ed25519 — short, fast, the default choice for anything made in the last ten years. Use this.
  • RSA 4096 — only for very old servers or appliances that do not understand Ed25519.
  • Always set a passphrase. It encrypts the private key file, so a stolen laptop is not a stolen login. Pageant (next lessons) means you type it once a day, not every time.

Option A — Windows built-in OpenSSH (PowerShell)

ssh-keygen -t ed25519 -a 100 -C "you@laptop"

Press Enter to accept C:\Users\you\.ssh\id_ed25519 and type a passphrase twice. Here is the same command on a Linux machine — the output is identical on Windows:

A real ssh-keygen run. The -N
A real ssh-keygen run. The -N "" in this demo creates a key without a passphrase so it could be scripted — leave -N out and you will be asked for one.
The private key is readable only by its owner (-rw-------); the .pub file is the one line you copy to servers. The fingerprint identifies the key without revealing it.
The private key is readable only by its owner (-rw-------); the .pub file is the one line you copy to servers. The fingerprint identifies the key without revealing it.

Option B — PuTTYgen (.ppk for PuTTY and WinSCP)

  1. Start PuTTYgen. Under Parameters choose EdDSA with curve Ed25519.
  2. Click Generate and move the mouse over the blank area until the bar fills.
  3. Type a Key comment (e.g. you@laptop) and a Key passphrase twice.
  4. Save private key → C:\Users\you\.ssh\id_ed25519.ppk.
  5. Copy the whole text box “Public key for pasting into OpenSSH authorized_keys file” — that single line is your public key.

Already have an OpenSSH key? Convert, don't regenerate

  • PuTTYgen → Conversions → Import key → pick id_ed25519 → enter passphrase → Save private key as .ppk.
  • WinSCP does the same automatically: point it at an OpenSSH key and it offers to convert it to .ppk.
  • Going the other way: PuTTYgen → Conversions → Export OpenSSH key.

Rules for the private key

  • Never email it, paste it into chat, or commit it to Git.
  • One key per person per device. Lose the laptop → remove that one public key from the servers.
  • Back the private key up only to an encrypted store (a password manager attachment works well).

Try it — make your key

  1. Create an Ed25519 key with a passphrase using option A or B.
  2. Run ssh-keygen -lf $env:USERPROFILE\.ssh\id_ed25519.pub and write the SHA256 fingerprint down — you will see it again in the server log.
Rating
0 0

There are no comments for now.

to be the first to leave a comment.