Back to Insights
Cybersecurity•OpenSSH Just Changed Its Default Key Type to ECDSA NISTP384 – Here's What Every Developer Needs to Do•tutorial•December 5, 2026•15 min read

OpenSSH's New Default: Migrating to ECDSA NISTP384 Without Breaking Your Fleet

OpenSSH changed its default key type to ECDSA NISTP384. Learn why it matters and the exact steps to migrate host keys, user keys, known_hosts, and CI without downtime.

T
Tamiz UddinFull-Stack Engineer

OpenSSH just changed the default key type that ssh-keygen generates from ECDSA NISTP256 to ECDSA NISTP384. If you've been running the same ssh-keygen command in scripts, CI pipelines, or container builds for years, the next key you generate will land on a 384-bit curve — and if you're not paying attention, your next known_hosts mismatch or authorized_keys update will catch you off guard. This guide covers exactly what changed, why OpenSSH made the move, and the step-by-step migration you should run on every host, user, and CI runner before your next deployment breaks.

1. What Actually Changed

Running ssh-keygen with no -t flag has produced an ECDSA key on the NIST P-256 curve (ecdsa-sha2-nistp256) since OpenSSH 7.0. That default has now been bumped to the NIST P-384 curve (ecdsa-sha2-nistp384).

Three things matter about this change:

  • Only newly generated keys are affected. Every existing host key, user key, and CI key keeps working exactly as before. There is no forced rotation.
  • Both user keys and host keys are affected. The new default applies to ssh-keygen (user keys) and to ssh-keygen -A (host key generation on servers).
  • It's a default, not a mandate. You can still generate RSA, Ed25519, or P-256 keys by passing -t explicitly. Nothing was removed from the algorithm list.

The practical difference shows up in three places: the algorithm name in the public key, the reported bit size, and the fingerprint. Here's what the old and new defaults look like:

bash
# Old default (P-256)
ssh-keygen -t ecdsa
# Generates: ecdsa-sha2-nistp256, 256-bit

# New default (P-384)
ssh-keygen
# Generates: ecdsa-sha2-nistp384, 384-bit

# Explicit P-384 (always safe, even on older OpenSSH)
ssh-keygen -t ecdsa -b 384

If you inspect a freshly generated key, the curve size appears in the key listing:

bash
ssh-keygen -lf ~/.ssh/id_ecdsa.pub
# 384 SHA256:AbCdEf... user@host (ECDSA)

The 384 is the tell. If you see 256, you're still on the old default.

2. Why ECDSA NISTP384

The security math

NIST P-384 (the secp384r1 curve) offers roughly 192 bits of symmetric-equivalent security. The previous default, P-256, offers about 128 bits. That's 64 additional bits of headroom against classical cryptanalysis — a substantial margin if you're planning for a long key lifetime or storing keys for decades.

Why not Ed25519?

Ed25519 is an excellent curve — fast, compact (256-bit public keys), and now FIPS 186-5 approved. But it's a fixed-security curve: there is no standard "Ed25519-384" that SSH clients and servers broadly support. If you want more than 128 bits of security margin, Ed25519 gives you no upgrade path. P-384 does.

Why not P-521?

P-521 gives ~256-bit security but is noticeably slower to sign, produces larger keys, and is rejected by a surprising number of embedded and legacy SSH implementations. For SSH's threat model, 192 bits is the sweet spot.

The compliance angle

FIPS 186-5 and NIST SP 800-186 explicitly define P-384 as a "higher security" curve. If your organization operates under FIPS 140-2/140-3, FedRAMP, or a similar regime, moving to P-384 keeps you compliant without the compatibility headaches of P-521.

Comparison table

AlgorithmPublic key sizeSecurity (bits)Signing speedFIPS statusNotes
RSA-30723072 bits~128SlowFIPS 186-4Most compatible, but slow and large
Ed25519256 bits~128Very fastFIPS 186-5Fast, compact, fixed security
ECDSA P-256256 bits~128FastFIPS 186-4Old default
ECDSA P-384384 bits~192FastFIPS 186-4New default
ECDSA P-521521 bits~256SlowerFIPS 186-4Overkill, poor compatibility

Reality check: ECDSA on any curve is not post-quantum resistant. This change is about classical security headroom and compliance, not quantum readiness. OpenSSH is separately adding ML-KEM (Kyber) for key exchange — plan for that as a distinct migration.

3. Prerequisites

Before you start, confirm you have:

  • OpenSSH 9.8 or newer on the machine that generates keys. Check with ssh -V.
  • Root or sudo on any server where you rotate host keys.
  • A maintenance window or a documented plan for the known_hosts churn that host key rotation causes.
  • A backup of /etc/ssh (server) and ~/.ssh (client) before touching anything.
  • CI access if you need to update secrets in GitHub Actions, GitLab CI, Jenkins, or similar.
bash
ssh -V
# OpenSSH_9.8p1, OpenSSL 3.0.13

# List supported public key algorithms
ssh -Q key | grep ecdsa
# ecdsa-sha2-nistp256
# ecdsa-sha2-nistp384
# ecdsa-sha2-nistp521

4. Step-by-Step Migration

Step 1 — Generate a P-384 user key

On your workstation or CI runner, generate the new key. Be explicit with -t ecdsa -b 384 so it behaves identically on older OpenSSH versions too.

bash
ssh-keygen -t ecdsa -b 384 -C "you@example.com" -f ~/.ssh/id_ecdsa

Flags explained:

  • -t ecdsa — selects the ECDSA algorithm.
  • -b 384 — sets the curve to NIST P-384.
  • -C — adds a comment (usually your email or host).
  • -f — output file. Using ~/.ssh/id_ecdsa keeps the default filename convention.

Step 2 — Verify the key

bash
ssh-keygen -lf ~/.ssh/id_ecdsa.pub
# 384 SHA256:... you@example.com (ECDSA)

ssh-keygen -E sha256 -lf ~/.ssh/id_ecdsa.pub
# 384 SHA256:... you@example.com (ECDSA)

If you see 384 and ECDSA, you're on P-384. If you see 256, regenerate with the explicit flags.

Step 3 — Push the key to servers

Use ssh-copy-id, or append manually. ssh-copy-id handles permissions and the authorized_keys file for you.

bash
ssh-copy-id -i ~/.ssh/id_ecdsa.pub user@server.example.com

If you prefer manual control:

bash
cat ~/.ssh/id_ecdsa.pub | ssh user@server 'mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys'

Then remove the old public key line from authorized_keys once you've confirmed the new one works.

Step 4 — Rotate host keys on servers

Host key rotation is the disruptive part. When a server's host key changes, every client that holds the old fingerprint in known_hosts will refuse to connect with REMOTE HOST IDENTIFICATION HAS CHANGED. Do this during a maintenance window.

First, back up the current SSH config and keys:

bash
sudo cp -a /etc/ssh /etc/ssh.bak.$(date +%F)

Remove the old ECDSA host key. Note that ssh-keygen -A only generates missing keys — it will not replace an existing one, so you must delete it first:

bash
sudo rm -f /etc/ssh/ssh_host_ecdsa_key /etc/ssh/ssh_host_ecdsa_key.pub

Regenerate with the new default curve:

bash
sudo ssh-keygen -t ecdsa -b 384 -f /etc/ssh/ssh_host_ecdsa_key -N ""

-N "" sets an empty passphrase, which is required for host keys.

Ensure sshd_config references the key:

ini
# /etc/ssh/sshd_config
HostKey /etc/ssh/ssh_host_ecdsa_key

Reload or restart the daemon:

bash
sudo systemctl reload sshd
# or, if reload is unsupported:
sudo systemctl restart sshd

Step 5 — Update client known_hosts

On every client that connects to the server, remove the stale fingerprint and re-accept the new one:

bash
ssh-keygen -R server.example.com
ssh-keyscan -H server.example.com >> ~/.ssh/known_hosts

Or simply reconnect and accept the new fingerprint interactively.

For automated provisioning (Ansible, Terraform, cloud-init), use ssh-keyscan in your bootstrap so the new host key is trusted before the first connection:

bash
ssh-keyscan -H server.example.com >> ~/.ssh/known_hosts

Step 6 — Verify the negotiation

Connect with verbose output and confirm the negotiated host key algorithm:

bash
ssh -v user@server.example.com 2>&1 | grep -i 'host key'
# debug1: Server host key: ecdsa-sha2-nistp384 SHA256:...

You can also force the algorithm to prove the server accepts it:

bash
ssh -o HostKeyAlgorithms=ecdsa-sha2-nistp384 user@server.example.com

CI gotcha: StrictHostKeyChecking

Many CI pipelines disable host key verification with StrictHostKeyChecking=no to avoid known_hosts churn. That's a security anti-pattern, and it's exactly why host key rotation goes unnoticed. After migrating, replace it with ssh-keyscan in the job's setup step so the new host key is trusted explicitly:

yaml
- name: Trust new host key
  run: |
    ssh-keyscan -H $HOST >> ~/.ssh/known_hosts

Then keep StrictHostKeyChecking=yes.

Step 7 — Update ssh-agent and CI

If you use ssh-agent, clear and re-add your keys:

bash
ssh-add -D
ssh-add ~/.ssh/id_ecdsa
ssh-add -l

For CI/CD, update the stored private keys:

  • GitHub Actions: update the SSH_PRIVATE_KEY secret.
  • GitLab CI: update the SSH_PRIVATE_KEY variable.
  • Jenkins: update the credential in Credentials > SSH.
  • Ansible: update the ansible_ssh_private_key_file path or the vaulted key.

Then re-run a job to confirm the new key authenticates.

5. Edge Cases and Gotchas

Legacy clients

Old OpenSSH (< 7.0), ancient PuTTY, and some embedded firmware may not list ecdsa-sha2-nistp384. If you must support them, keep a fallback host key (e.g., Ed25519 or RSA) enabled on the server and let the client negotiate what it supports.

FIDO/U2F hardware keys

If you use hardware security keys, note that sk-ecdsa-sha2-nistp384@openssh.com is a valid algorithm. Regenerate your FIDO keys with:

bash
ssh-keygen -t ecdsa-sk -b 384

Automation that hardcodes key types

Scripts that explicitly pass -t rsa -b 2048 or -t ecdsa -b 256 will silently keep generating old-format keys. Audit your build scripts, Dockerfiles, and CI workflows for hardcoded -t flags and decide whether each should move to P-384.

known_hosts hashing

If you have HashKnownHosts yes set, ssh-keygen -R still works correctly because it hashes the hostname before matching. Don't try to hand-edit the file.

Multiple host keys and negotiation order

If your server still has RSA or Ed25519 host keys, the client may negotiate a different algorithm than P-384. Pin it on the client side:

ini
# ~/.ssh/config
Host server.example.com
    HostKeyAlgorithms ecdsa-sha2-nistp384

Cloud provider fingerprints

Providers like AWS EC2 display the host key fingerprint in the console or instance metadata. After rotation, update your records or your monitoring/audit tooling will flag a mismatch.

Post-quantum is a separate problem

Do not mistake this for quantum readiness. P-384 is still vulnerable to Shor's algorithm. Track OpenSSH's ML-KEM (Kyber) key exchange work and plan a separate migration when it stabilizes.

6. Production Best Practices

  • Make the algorithm explicit. Don't rely on the default. Set HostKey /etc/ssh/ssh_host_ecdsa_key in sshd_config and HostKeyAlgorithms ecdsa-sha2-nistp384 in ~/.ssh/config so behavior is deterministic across OpenSSH versions.
  • Increase KDF rounds. Use ssh-keygen -t ecdsa -b 384 -a 100 to raise the key derivation function cost for the private key file.
  • Schedule host key rotation. Rotate host keys on a regular cadence (e.g., every 90 days) using config management. Because host key rotation causes known_hosts churn, use ssh-keyscan in your provisioning step to pre-trust new keys.
  • Disable weak algorithms. Harden sshd_config with KexAlgorithms, MACs, and HostKeyAlgorithms directives that only allow modern, audited primitives.
  • Use SSH certificates for fleets. For large infrastructure, sign host and user keys with a CA (ssh-keygen -s) so you can rotate keys without touching every client's known_hosts. This is the single biggest operational win for key rotation.
  • Audit key types. Run ssh-keygen -lf on every key in your inventory and flag anything below 384-bit ECDSA or 3072-bit RSA.

For a deeper dive on SSH hardening and automation, see Tamiz's Insights and the tamiz.pro engineering archive.

Frequently Asked Questions

Will my existing keys break?

No. OpenSSH only changed the default for newly generated keys. Existing host keys, user keys, and CI keys continue to work and authenticate normally. You only need to migrate if you want the stronger curve.

How do I tell if my key is P-384?

Run ssh-keygen -lf ~/.ssh/id_ecdsa.pub. If the output starts with 384, you're on P-384. If it starts with 256, you're on the old default. The algorithm name in the public key also reads ecdsa-sha2-nistp384.

Should I just use Ed25519 instead?

It depends. Ed25519 is faster and more compact, but it's fixed at ~128-bit security. If you need FIPS compliance or a larger security margin, P-384 is the better choice. If you value speed and simplicity and 128 bits is enough for your threat model, Ed25519 is still an excellent option.

Is this a post-quant