Seth Michael Larson: How to find and upgrade SSH and PGP keys using P-256, ED25519, and Curve25519

Wait 5 sec.

Probably the strongest evidence that there exists an expensive breakof 256-bit elliptic curves arrived yesterday, Google announced thatroot and intermediate CA certificates (read: "long-lived") that usedthe ECDSA P-256 curve would not be accepted after March 17, 2027.This is ~100 days (a very short timespan for anything that affects "all CAs")and would affect ~25% of all web traffic, which is not something one would do for no reason.Speaking of long-lived keys, SSH and PGP keys are similar to root and intermediate CAcertificates in that way. I don't think this is a "drop everything and do this now"situation, but the timeline of "next three months" seems prudent.Here's how to find keys that you should upgradeon your system:ssh-add -L | grep -E '^[^ ]*(nistp256|25519)' | grep -vE '^[^ ]*ml-?dsa'This command finds P-256, ED25519, and Curve25519 keys that are registered withyour SSH agent. The same is true for PGP keys, if you have those on your system:gpg -k --keyid-format long | grep -E '^(pub|sub|sec|ssb)[#>]? +[^/ ]*(25519|256)' | grep -viE 'ky[0-9]|dil[0-9]|ml-?kem|ml-?dsa'Here's what running these commands returns on my computer as of this morning:ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINzmaKr8fHsDNPeht128GMbA+fe53pjYbPgS0V8dhjfK SSHSeems that my PGP key is using RSA-4096 which is not a concern for today.Okay, so let's upgrade the SSH key now. Unfortunately I'm not able to generatequantum-safe SSH keys yet (ssh -Q key | grep -i mldsa is empty), Ubuntu 26.04.1 ships10.2p1 and support is in OpenSSH 10.4.I don't think GitHub supports ML-DSA yet, but I hesitate toeven write it down that they don't as support will likely be prioritized? If GitHub supportsssh-mldsa44-ed25519 at the time you're reading this then use ssh-keygen -t mldsa44-ed25519 ..., otherwise proceed with P-348.You can generate a P-348 elliptic curve SSH key like so:ssh-keygen -t ecdsa -b 384 -C '(comment)' (...options for encryption like '-a 100')After you generate the file locally, register the SSH key with your passwordmanagerand remove the files from your filesystem. Funnily enough, this is how Idiscovered that Bitwarden only supports ED25519 and RSA SSH keys. It pains me to say thathaving an RSA-4096 key is probably a decent stop-gap at this point until youcan upgrade to a quantum-safe algorithm.For hardware-based SSH keys my understanding isthat support is not uniform, so consult with the documentation for the specifichardware key you own and generate new keys if needed.After you've generated and tested using your new key then don't forget to unregisteryour now unused key with services and removing the key from your SSH agent, computer, etc.Thank you to William Woodruff for reviewing this document prior to publication.Thanks for reading ♥ I would love to hear your thoughts! Contact me via Mastodon, Bluesky, or email. Browse the blog archive. Check out my blogroll.