Sanniv Khare 6 min read

OpenSSH now defaults to P-384: moving your Mac SSH keys

OpenSSH now defaults to P-384: moving your Mac SSH keys

On 3 December 2026 OpenSSH changed the key that ssh-keygen makes when you give it no type: it is now ECDSA on the NIST P-384 curve instead of Ed25519 (commit 5b63da2). The OpenSSH that ships with macOS has not caught up. On our M1 lab Mac (macOS 15.7.3, OpenSSH_9.9p2 with LibreSSL 3.3.6), ssh-keygen with no flags still writes an Ed25519 key, and ssh-keygen -t ecdsa without -b writes a P-256 key, not P-384. If you want the new default on a Mac today, type ssh-keygen -t ecdsa -b 384 and put the new key first in your SSH config. GitHub, GitLab and Bitbucket all advertised P-384 signatures when we connected on 6 December.

Why we did this: our Mac apps Nix and OneClick QuitAll, our client repositories and our Xcode source control all go through SSH keys on studio Macs, and “which key do we make now?” came up the day the change landed. This post covers what the macOS tools do and what the three Git hosts accept; it is not a statement that Ed25519 or P-256 is broken.

What changed in OpenSSH, and what did not

The commit is three lines in ssh-keygen.c: DEFAULT_KEY_TYPE_NAME goes from "ed25519" to "ecdsa", and DEFAULT_BITS_ECDSA from 256 to 384. RSA’s default (3072 bits) stays. It came a day after the NSA advisory that, as CSO Online reported, asks teams to flag elliptic curves other than P-384 or P-521, EdDSA included. That is the NSA’s position and OpenSSH’s choice of default; neither says existing Ed25519 keys stop working, and every server we tried still accepts them.

Two things the commit does not change:

  • Existing keys. Nothing rotates on its own. Your id_ed25519 keeps working.
  • The ssh-keygen on your Mac. The default moves when Apple ships an OpenSSH release that contains the commit. Until then the flags below are what matter.

What ssh-keygen on macOS makes, measured

We generated five throwaway keys on our M1 lab Mac with the system ssh-keygen and recorded what landed on disk.

ssh-keygen key types and sizes on macOS 15.7.3

Real output from our M1 lab Mac; the keys were deleted after the test.

The trap is in the second row. On OpenSSH 9.9, -t ecdsa alone still means 256 bits, because the 384-bit default is part of the same new commit. -b only accepts 256, 384 or 521 for ECDSA; anything else fails with Invalid ECDSA key length: valid lengths are 256, 384 or 521 bits.

The cost of P-384 is size, not speed you will notice: the public key line is 213 characters instead of 89, the private key file 602 bytes instead of 399, and an SSH signature for a Git commit 476 characters instead of 294. Each key took a fraction of a second to generate.

Make a P-384 key on your Mac

Add the new key next to the old one rather than replacing it, so nothing breaks while you update the services that know your old key.

ssh -V
ssh-keygen -t ecdsa -b 384 -C "you@example.com" -f "$HOME/.ssh/id_ecdsa"
ssh-keygen -l -f "$HOME/.ssh/id_ecdsa.pub"

The last command should print 384 SHA256:... (ECDSA). If it prints 256, the -b 384 was lost.

Give the key a passphrase, then add it to the agent and store the passphrase in your keychain, the way GitHub’s macOS steps do for Ed25519:

ssh-add --apple-use-keychain "$HOME/.ssh/id_ecdsa"
ssh-add -l

In our test, ssh-add loaded the P-384 key into an agent and ssh-add -l listed it as 384 SHA256:... (ECDSA). We ran that against a separate agent, without the keychain option, so the lab Mac’s own keychain was left alone.

Order the new key first

With no config, OpenSSH 9.9 tries default key files in this order (from ssh -G on the lab Mac): id_rsa, id_ecdsa, id_ecdsa_sk, id_ed25519, id_ed25519_sk. A key saved as id_ecdsa is therefore offered before id_ed25519 even without a config entry. If you use custom file names, or want only these two keys offered, set the order yourself:

ssh config with the P-384 key listed before the Ed25519 key

%d is OpenSSH’s token for your home folder, so the file works for any user.

Host github.com gitlab.com bitbucket.org
  IdentityFile %d/.ssh/id_ecdsa
  IdentityFile %d/.ssh/id_ed25519
  IdentitiesOnly yes
  AddKeysToAgent yes
  UseKeychain yes

Leave out UseKeychain if the key has no passphrase, as GitHub’s page notes. Keep the Ed25519 line until every service has the new public key; then remove it.

The default client lists on OpenSSH 9.9 already include P-384: ssh -F none -G github.com shows ecdsa-sha2-nistp384 in both pubkeyacceptedalgorithms and hostkeyalgorithms, so no algorithm settings are needed on the Mac side.

What GitHub, GitLab and Bitbucket accept

We connected to each host with an unregistered P-384 test key and ssh -v, which prints the server-sig-algs list each server advertises before it refuses the key.

SSH key exchange and accepted signature algorithms on GitHub, GitLab and Bitbucket

All three refused the test key, as expected, after offering it: the key type was accepted, the key itself was unknown.

Host P-384 user key Key exchange we got Docs
GitHub ecdsa-sha2-nistp384 advertised sntrup761x25519-sha512 GitHub: new SSH key (shows Ed25519 and RSA commands)
GitLab ecdsa-sha2-nistp384 advertised, plus ssh-mldsa-44, -65, -87 mlkem768x25519-sha256 GitLab: SSH keys (lists ECDSA; ML-DSA not listed yet)
Bitbucket ecdsa-sha2-nistp384 advertised mlkem768x25519-sha256 Bitbucket: SSH keys on macOS (shows Ed25519 only)

So uploading a P-384 public key works on all three today. The key exchange line is a separate matter: it already uses a post-quantum hybrid on every host, whatever your key type. We covered that side in post-quantum SSH on a Mac.

Signing Git commits with the new key

If you sign commits with SSH, point Git at the new public key and add it to the host as a signing key:

git config --global gpg.format ssh
git config --global user.signingkey "$HOME/.ssh/id_ecdsa.pub"

On the lab Mac, ssh-keygen -Y sign -n git with the P-384 key produced a signature that ssh-keygen -Y verify reported as Good "git" signature ... with ECDSA key. Old commits signed with the Ed25519 key stay valid as long as that key remains in your allowed signers list.

What does not move: Secure Enclave SSH keys

Tools that keep SSH keys in the Mac’s Secure Enclave use P-256, because that is the curve the Secure Enclave supports for signing keys: CryptoKit has SecureEnclave.P256 and no P-384 type. We looked at this in detail in P-256 and your Apple app: a 384-bit Secure Enclave key can be created through SecKey on macOS 15.7.3, but Apple’s engineers say not to rely on it. If your SSH key lives in the Secure Enclave, it stays P-256 for now; the choice is between keeping it and moving that machine to a file-based P-384 key protected by a passphrase.

Checklist

  1. ssh -V to see which OpenSSH you run.
  2. ssh-keygen -t ecdsa -b 384, with a passphrase; confirm 384 with ssh-keygen -l.
  3. ssh-add --apple-use-keychain and list the new key first in your SSH config.
  4. Upload the public key to GitHub, GitLab or Bitbucket, and as a signing key if you sign commits.
  5. Test with ssh -T git@github.com, then remove the old key from each service when nothing needs it.

Made by the team behind this post

Apps from our studio

  • Goes with this post

    Nix

    The Mac uninstaller that finds what the Trash leaves behind: caches, logs, derived data and saved states.

    macOS

    Get
  • Goes with this post

    OneClick QuitAll

    Quit every running app in one click. See memory and CPU first.

    macOS · Mac App Store

    Get
  • Cardigami

    Pop-up greeting cards that rise out of the fold on iPhone Duo.

    iPhone · App Store

    Get
  • BMDB.fun

    Your Bollywood world at a glance, with links straight to the OTT app that streams each film.

    Android TV · Web · Mobile

    Get

Need this built? Let’s talk.

We build and run apps for Mac, TV, mobile and the web, and write about what we learn.