SSH Key Converter
Operator: Abdulla Al Fahad. How tools are built and checked
SSH keys come in too many wrappers. ssh-keygen writes -----BEGIN OPENSSH PRIVATE KEY-----, a cloud console wants PEM, PuTTY and WinSCP want a .ppk, and an old server wants the public half as an RFC 4716 block. Changing the wrapper means decrypting the key and encrypting it again the way the target format expects, so the converter implements the key derivation and ciphers each format uses.
It reads OpenSSH keys encrypted with bcrypt (the key derivation OpenSSH has used since version 6.5), PEM PKCS#1, SEC1 and PKCS#8 keys, legacy OpenSSL-encrypted PEM, and PuTTY .ppk versions 2 and 3, for RSA, Ed25519 and ECDSA on P-256, P-384 and P-521.
Key features
- Output as an OpenSSH private key (aes256-ctr, aes256-gcm, chacha20-poly1305 or aes128-ctr with a bcrypt cost you choose), PEM PKCS#8 or PKCS#1/SEC1, and PuTTY .ppk v2 or v3 with Argon2
- Passphrase change in one step: read with the old passphrase, write with the new one, or none
- Public key output as an authorized_keys line, an RFC 4716 block (its Comment header wrapped at 72 bytes as the RFC asks), PEM SubjectPublicKeyInfo or RSA PKCS#1; an authorized_keys line that starts with options such as command="..." is read too
- SHA-256 and MD5 fingerprints in the form ssh-keygen prints them
- Integrity checks on every private key read: check integers, authentication tags, the .ppk MAC, and a test that the key material is consistent
- Every converted file is read back and must produce the same public key before it is offered
Which cipher and key derivation each format uses
An OpenSSH private key file is a base64 body with the magic openssh-key-v1, a cipher name, a key-derivation name, a public key blob and an encrypted section. For an encrypted key the passphrase goes through bcrypt_pbkdf with a 16-byte salt and the stored round count (16 by default) to give a cipher key and IV. Inside the decrypted section two identical 32-bit check integers come first; if they differ, the passphrase was wrong. With the GCM and ChaCha20-Poly1305 ciphers an authentication tag is checked instead, and padding of 1, 2, 3 and so on is verified at the end.
PuTTY .ppk version 3 derives its keys with Argon2 (the id, i or d variant) from a salt, a memory size in KiB, a pass count and a number of lanes, producing 80 bytes: a 32-byte AES-256-CBC key, a 16-byte IV and a 32-byte MAC key. The Private-MAC is an HMAC-SHA-256 over the algorithm, encryption type, comment, public blob and the decrypted private blob. Version 2 derives its key with two SHA-1 hashes and uses HMAC-SHA-1. An unencrypted version 3 file uses an empty MAC key.
PEM has three layers of history. PKCS#1 (BEGIN RSA PRIVATE KEY) and SEC1 (BEGIN EC PRIVATE KEY) are single-algorithm structures; PKCS#8 (BEGIN PRIVATE KEY) wraps any algorithm. OpenSSL's old encrypted PEM adds Proc-Type and DEK-Info headers and derives its key with one round of MD5, which this page can read but does not write. Encrypted PKCS#8 is written with PBKDF2-HMAC-SHA-256 at 200,000 iterations and AES-256-CBC.
OpenSSH, PEM and PuTTY store the same numbers in different orders and encodings. RSA needs the modulus, both exponents, both primes and the coefficient q^-1 mod p; PKCS#1 also stores d mod (p-1) and d mod (q-1), which the page recomputes. An Ed25519 key is a 32-byte seed from which the public key is derived.
How it works
bcrypt_pbkdf is implemented in the page on top of a Blowfish whose starting tables are computed from the hexadecimal digits of pi when first needed. The Argon2 step uses the hash-wasm library, loaded only when a .ppk v3 file is read or written. Argon2 runs in a background worker, and Cancel terminates it, so even a large setting leaves the page responsive. Settings are capped at 1,000 bcrypt rounds, 256 MiB, 64 passes and 16 lanes, because a .ppk file states its own parameters and a hostile one could otherwise ask for minutes of work. PuTTYgen's default is 8 MiB, about 13 passes and 1 lane, so the memory cap is 32 times that, the pass cap about 5 times and the lane cap 16 times; the worst accepted file is roughly 16 GiB of Argon2 block work, seconds to a few tens of seconds in WebAssembly.
After decryption the key is cross-checked: for RSA the primes must multiply to the modulus and e times d must be 1 modulo the group order, for Ed25519 the public key re-derived from the seed must equal the stored one, and for ECDSA the page imports the scalar and point together through WebCrypto, which rejects a mismatch. Only then is the key shown as read.
On output the file is parsed again with the same passphrase. If the public key that comes out differs from the one that went in, nothing is offered for download.
Common use cases
- A developer on Windows has an ssh-keygen key and needs a .ppk for PuTTY: choose PuTTY v3, set a passphrase and download id_ed25519.ppk.
- A CI engineer is handed a PuTTY key for a deployment account and converts it to an OpenSSH private key so a Linux runner can use it.
- An administrator wants to retire a weak passphrase: read the key with the old one and write it with a new passphrase and 32 bcrypt rounds.
How to use this tool
- Drop a key file or paste it; enter its passphrase if it has one, then choose Read key.
- Check the key type, the SHA-256 fingerprint and the list of checks that passed.
- Pick an output format. For a private format type a new passphrase, or leave it empty for no encryption.
- Set the cipher and bcrypt rounds (OpenSSH) or Argon2 settings (.ppk v3) if you want something other than the defaults, then press Convert.
- Download the file or copy the text; use Clear everything when you are done.
- Take the public-key formats from the same dropdown for authorized_keys, RFC 4716 or PEM.
Example
The bundled Ed25519 key (a throwaway made from a fixed seed, comment deploy@build-runner), converted to PuTTY .ppk version 3
-----BEGIN OPENSSH PRIVATE KEY----- (unencrypted)Public key line, fingerprint and the .ppk header
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHVcTLklbKfNxKz9xs/u2oSQF+W5+VFOmRkb1n4LDUJ2 deploy@build-runner
SHA256:DpJCol0kbxpYFxHOHFL3RmZA6dY9Nwx4jAzBDnYMQ20
PuTTY-User-Key-File-3: ssh-ed25519 / Encryption: none / Private-Lines: 1Edge cases to watch
A .ppk written here follows the published PuTTY file layout and is checked by reading it back in this page, but it has not been verified against PuTTYgen itself. Open the converted file in PuTTY or Pageant before relying on it.
The PKCS#1 and SEC1 forms are written without encryption. Use PKCS#8, OpenSSH or PuTTY when a passphrase is needed.
Version 2 .ppk files protect the key with a fast SHA-1 derivation that a modern GPU can try billions of times a second; use version 3 for anything new.
A large Argon2 setting (256 MiB with 64 passes is the most the page accepts) can take tens of seconds. The page stays usable and Cancel stops it, but the key is not read until the work finishes.
- Raise the bcrypt rounds to 32 for a key that protects something valuable: each extra doubling doubles the time an attacker needs per guess, and also the time you wait here.
- ssh-keygen -l -E md5 -f key.pub prints the same MD5 fingerprint format that some older systems and consoles still show, so the two can be compared directly.
Common errors and how to fix them
- "The passphrase is wrong (the decrypted check integers do not match)."
- OpenSSH decrypted the section but did not get two equal check integers, which is what a wrong passphrase produces. Check for trailing spaces and the keyboard layout.
- "The passphrase is wrong, or the file was altered (the Private-MAC does not match)."
- A .ppk file's MAC covers its comment, public key and private data, so an edited comment fails too. Re-export from PuTTYgen if you changed the file by hand.
- "DSA keys (ssh-dss) are not supported"
- OpenSSH turned DSA off by default in version 7.0. Generate an Ed25519 or ECDSA key instead.
- "The EC private key carries no public point"
- Some tools write a SEC1 key without its public half. Run openssl ec -in key.pem -out key-with-point.pem and open that file.
Best practices
- Delete the key from the page with Clear everything, and from your clipboard, after converting; neither is stored, but the text stays in the open tab until you do.
- Keep a key in the format its main consumer needs and derive the others when required, instead of storing copies in every format.
- Compare the SHA-256 fingerprint before and after converting; it must not change.
What ssh-keygen and OpenSSL accept
The reader covers keys written by OpenSSH 10.2's ssh-keygen in these combinations: RSA 2048, Ed25519 and ECDSA P-256, P-384 and P-521, each plain and with a passphrase; the aes128-cbc, aes192-ctr, aes256-gcm and chacha20-poly1305 ciphers; and PEM PKCS#1, SEC1 and PKCS#8 for RSA and ECDSA, plain and encrypted, plus Ed25519 PKCS#8 from openssl genpkey. Each yields the public key ssh-keygen shows, and a wrong passphrase is refused.
In the other direction, private keys written here are read by ssh-keygen -y and openssl pkey; the RFC 4716 form, the SPKI form of RSA and ECDSA keys and the PKCS#1 form of RSA keys import with ssh-keygen -i; and SHA-256 and MD5 fingerprints match ssh-keygen -l. PuTTY .ppk files are the one output with no external reference check, as the pitfalls say.
Frequently asked questions
Is the key sent anywhere?
No. The conversion uses the browser's WebCrypto and a WebAssembly Argon2 that is downloaded with the page code. Nothing is stored, and nothing is sent after the page has loaded.
Why does the converter refuse to write an encrypted PKCS#1 file?
The old encrypted PEM format derives its key from your passphrase with a single round of MD5. Writing new files in it would produce keys that are cheap to attack, so the page reads that format but offers PKCS#8, OpenSSH or PuTTY for encrypted output.
Will the public key line match what ssh-keygen -y prints?
Yes for the key type and base64 body; the comment can differ, because it is stored only in some formats. PEM keys carry no comment, so the field starts empty and you can type one.
How do I use the result with PuTTY?
Save the .ppk, open Pageant or PuTTY's Connection, SSH, Auth, Credentials page and select it. PuTTY asks for the passphrase when it loads an encrypted file.
Which output do I paste into a server's authorized_keys file?
The public key line: choose "Public key: OpenSSH line", which gives ssh-ed25519 or ssh-rsa followed by the base64 body and the comment. The private formats are for your own machine, never for the server.