---
title: "Auditing P-256 and Curve25519 Keys Across SSH, PGP, JWT, and Kubernetes (Plus OpenSSH PQC)"
description: "A 5-minute production audit for P-256 and Curve25519 keys across SSH, PGP, JWT (ES256), and Kubernetes cert-manager, plus enabling OpenSSH mlkem768x25519-sha256 and planning P-384 rotation."
author: Aleksei Aleinikov
date: 2026-12-05
lang: en
tags: [post-quantum-cryptography, p-256, openssh-pqc, cert-manager, kubernetes-security, cloud-security, zero-trust]
canonical: https://www.alekseialeinikov.com/en/blog/topics/security/audit-p256-curve25519-keys-ssh-kubernetes-jwt-pqc-guide
source: alekseialeinikov.com
---

# Auditing P-256 and Curve25519 Keys Across SSH, PGP, JWT, and Kubernetes (Plus OpenSSH PQC)

Every infrastructure team eventually gets hit by the same cryptographic surprise: someone asks *"Where are we still using `P-256` or `Curve25519`?"* — and nobody has an inventory.

Between **CNSA 2.0** migration deadlines, **Google Chrome's announced March 2027 distrust of ECDSA P-256 root CAs**, and renewed urgency around **Store Now, Decrypt Later (SNDL)** traffic harvesting, 256-bit elliptic curves are under a microscope. Most checklists stop at "upgrade HTTPS." In real production environments, `P-256` and `Curve25519` live quietly in four places attackers and auditors actually care about: **SSH (`authorized_keys` and `sshd`), PGP/Git signing, JWT (`ES256`), and Kubernetes PKI (`cert-manager` and `kubeconfig`)**.

If you already read [Post-Quantum Encryption in Practice: ML-KEM, TLS 1.3, and Why Origins Lag Behind Browsers](https://www.alekseialeinikov.com/en/blog/topics/security/post-quantum-encryption-ml-kem-tls-guide), you have the HTTPS/TLS layer covered. This guide is the missing half: **a 5-minute copy-paste audit for the rest of your stack**, plus the exact fixes that actually make your cryptography resilient without breaking production.

![P-256 and Curve25519 Infrastructure Audit cover: OpenSSH mlkem768x25519-sha256 and P-384 rotation](https://media.alekseialeinikov.com/security/b4e8c12f9a31/cover-1200.40e3b7b68561adb1.webp)

## What Actually Needs Replacing (and What Already Holds)

Before running commands, separate **three completely different cryptographic layers** so you do not waste weeks migrating things that are not broken:

1. **Symmetric encryption and hashes (`AES-256-GCM`, `ChaCha20-Poly1305`, `SHA-256`, `SHA-3`):** Already resilient. Even against a fault-tolerant quantum computer running Grover's algorithm, 256-bit symmetric keys keep ~128 bits of security. **Leave these alone.**
2. **Key Exchange (`KEX` in SSH and TLS):** **Priority 1.** Any classical key exchange (`ecdh-sha2-nistp256`, `curve25519-sha256`) recorded today can be decrypted retroactively later. Hybrid post-quantum KEX (`mlkem768x25519-sha256` in OpenSSH, `X25519MLKEM768` in TLS 1.3) guarantees security never drops below *either* X25519 or ML-KEM-768.
3. **Signatures and Certificates (`SSH keys`, `PGP`, `JWT ES256`, `cert-manager`):** **Priority 2.** Signatures cannot be forged retroactively on past sessions, so authentication does not suffer from SNDL in the same way. However, long-lived CA/signing keys and browser/compliance rules (such as CNSA 2.0's `P-384` / `RSA-4096` baseline and Chrome's P-256 CA distrust) mean you should inventory and phase out `P-256` (`secp256r1`) systematically.

![Before vs after cryptographic flow: classical 256-bit key exchange exposes recorded traffic to Store Now Decrypt Later, while hybrid ML-KEM and P-384 protect SSH, JWT, and Kubernetes](https://media.alekseialeinikov.com/security/b4e8c12f9a31/pqc-audit-four-layers-1200.ba89fc801a4dc646.webp)

## Run the 10-Second All-in-One Audit Script

Want a quick inventory before diving into each layer? Paste this read-only snippet into your terminal to flag `P-256` keys and check your current Kubernetes context:

```bash
echo "=== 1. Local SSH keys ==="
for f in ~/.ssh/*.pub; do [ -f "$f" ] && printf "%-38s %s\n" "$f" "$(awk '{print $1}' "$f")"; done
echo "=== 2. GPG keys (19=ECDSA, 18=ECDH, 22=EdDSA) ==="
gpg --list-keys --with-colons 2>/dev/null | awk -F: '$1~/^(pub|sub)$/{print $1, $3"b", "algo:"$4, "curve:"$17, $5}'
echo "=== 3. Kubernetes cert-manager ECDSA/RSA ==="
kubectl get certificates -A -o json 2>/dev/null | jq -r '.items[] | [.metadata.namespace,.metadata.name,(.spec.privateKey.algorithm//"default"),(.spec.privateKey.size//"default")] | @tsv'
```

---

## Layer 1: 5-Minute SSH Audit & OpenSSH Hybrid PQC

SSH has two distinct cryptographic surfaces: the **session key exchange (`KexAlgorithms`)** and the **user/host identity keys**.

### Audit your local keys, `authorized_keys`, and live handshakes

Run these three checks on your workstation and bastion/production hosts:

```bash
# 1. Inspect your local SSH public keys
for f in ~/.ssh/*.pub; do
  [ -f "$f" ] && printf "%-38s %s\n" "$f" "$(awk '{print $1}' "$f")"
done

# 2. Scan server authorized_keys for P-256 (ecdsa-sha2-nistp256) and Ed25519
grep -rnE 'ecdsa-sha2-nistp256|ssh-ed25519' /home/*/.ssh/authorized_keys /root/.ssh/authorized_keys 2>/dev/null

# 3. Check what KEX your live SSH session actually negotiates
ssh -vv -o BatchMode=yes user@your-host true 2>&1 | grep -i "kex: algorithm"
```

What the output tells you:
- **`mlkem768x25519-sha256`** (default in OpenSSH 10.0, supported in 9.9+) or **`sntrup761x25519-sha512`**: Your SSH transport already negotiates hybrid post-quantum key exchange.
- **`curve25519-sha256`** or **`ecdh-sha2-nistp256`**: Classical KEX only — your SSH traffic is vulnerable to Store Now, Decrypt Later.
- **`ecdsa-sha2-nistp256`** in `authorized_keys` or `/etc/ssh/ssh_host_*_key.pub`: Legacy NIST P-256 key. Replace user and host keys with `ed25519` (`ssh-keygen -t ed25519`) or `ecdsa-sha2-nistp384` (`ssh-keygen -t ecdsa -b 384`) depending on compliance policy.

### Check and enforce `KexAlgorithms` on servers

```bash
# Verify what sshd currently advertises
sudo sshd -T | grep -E '^(kexalgorithms|hostkeyalgorithms)'
```

Once OpenSSH 9.9+ or 10.0+ is installed, prioritize hybrid ML-KEM explicitly in `/etc/ssh/sshd_config` (and `~/.ssh/config`) so old `Include` drop-ins never silently downgrade you:

```sshconfig
# /etc/ssh/sshd_config (server) or ~/.ssh/config (client)
KexAlgorithms mlkem768x25519-sha256,sntrup761x25519-sha512,curve25519-sha256
```

**Watch out for legacy appliances:** Older managed switches, IPMI interfaces, and embedded jump boxes sometimes drop connections when receiving larger post-quantum KEX packets. Do **not** weaken your global config — scope an exception to that specific host in `~/.ssh/config`:

```sshconfig
Host legacy-oob-switch.internal
    KexAlgorithms curve25519-sha256,diffie-hellman-group16-sha512
```

---

## Layer 2: PGP & Git Commit Signing Audit

Developer workstations often hold 5-year-old GPG keys created with `nistp256` or `cv25519` subkeys that still sign release tags and Debian/RPM packages.

```bash
# List all public keys and subkeys with algorithm codes (19 = ECDSA, 18 = ECDH, 22 = EdDSA)
gpg --list-keys --with-colons | awk -F: '
  $1 ~ /^(pub|sub)$/ { printf "%-4s bits:%-4s algo:%-2s curve:%-12s created:%s id:%s\n", $1, $3, $4, $17, $6, $5 }
'

# Check what Git is configured to sign commits with
git config --global --get-regexp 'gpg|user\.signingkey'
```

If you see `nistp256` on long-lived release-signing or encryption keys:
- **For Git commits:** Switching `gpg.format` to `ssh` with an `ed25519` key (`git config --global gpg.format ssh`) eliminates GPG keyring sprawl, and works cleanly with GitHub/GitLab commit verification.
- **For PGP encryption/artifacts:** Generate a `P-384` (`nistp384`) or `RSA-4096` keypair for compliance regimes aligned with CNSA 2.0, and revoke/expire the old `nistp256` subkey rather than leaving it valid indefinitely.

---

## Layer 3: JWT (`ES256`) & OIDC Zero-Downtime Rotation

In APIs and OIDC identity providers, **`ES256`** means ECDSA using **P-256** (`secp256r1`). You can inspect any live token's `alg` and `kid` header locally without sending secrets to a third party using the [JWT Analyzer](https://www.alekseialeinikov.com/en/tools/jwt-analyzer/).

### Audit your JWKS and issuers in 30 seconds

```bash
# Inspect algorithms and key IDs exposed by your OIDC / auth server
curl -s https://auth.example.com/.well-known/jwks.json | jq '.keys[] | {kid, kty, crv, alg, use}'
```

Look for `"crv": "P-256"` or `"alg": "ES256"`.

### How to rotate `ES256` to `ES384` (`P-384`) without logging anyone out

Never swap the signing key in place — every active access token will instantly fail signature verification (`401`). Use a three-step **dual-`kid` overlap**:

1. **Publish both keys in JWKS:** Keep the existing `ES256` public key (`kid: "key-256-old"`) and add the new `ES384` (`crv: "P-384"`) public key (`kid: "key-384-new"`). Verify downstream microservices refresh their JWKS cache.
2. **Flip token issuance to `ES384`:** New tokens carry `"alg": "ES384"` and `"kid": "key-384-new"`. Existing `ES256` tokens continue to validate against `key-256-old`.
3. **Retire the old key:** After `max(access_token_ttl) + 5m` clock skew, remove `key-256-old` from JWKS and revoke its private key in your secret store.

If your auth stack pulls signing keys from a cloud vault into Kubernetes, keep those private keys out of Git and automate rotation with [External Secrets Operator](https://www.alekseialeinikov.com/en/blog/topics/devops/external-secrets-operator-kubernetes-secrets-manager-guide).

---

## Layer 4: Kubernetes PKI (`cert-manager` & `kubeconfig`)

Kubernetes clusters quietly default to `P-256` (`ECDSA 256`) or `RSA 2048` in two places: **`cert-manager` `Certificate` manifests** and **cluster client certificates (`kubeconfig`, `etcd`, `apiserver`)**.

### Audit your cluster in one command

```bash
# 1. Find cert-manager Certificates using ECDSA 256 or RSA 2048
kubectl get certificates -A -o json | jq -r '
  .items[] |
  [
    .metadata.namespace,
    .metadata.name,
    (.spec.privateKey.algorithm // "RSA-default"),
    (.spec.privateKey.size // "default")
  ] | @tsv
'

# 2. Check the curve/key size of your current kubeconfig client certificate
kubectl config view --raw -o jsonpath='{.users[0].user.client-certificate-data}' \
  | base64 -d | openssl x509 -noout -text | grep -E 'Public Key Algorithm|ASN1 OID|Public-Key'
```

### Upgrading `cert-manager` to `P-384` safely

In `cert-manager`, `spec.privateKey` controls the generated key pair. Upgrade `size: 256` to `size: 384` (and set `rotationPolicy: Always` so renewals actually rotate the underlying private key instead of reusing the old P-256 key):

```yaml
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
  name: api-gateway-tls
  namespace: ingress
spec:
  secretName: api-gateway-tls
  issuerRef:
    name: letsencrypt-prod
    kind: ClusterIssuer
  dnsNames:
    - api.example.com
  privateKey:
    algorithm: ECDSA
    size: 384
    rotationPolicy: Always
```

For public HTTPS termination on GKE or Nginx, pair upgraded certificates with hybrid post-quantum key exchange (`X25519MLKEM768`) at the gateway/ingress layer as covered in [GKE Gateway API vs Ingress](https://www.alekseialeinikov.com/en/blog/topics/cloud/gke-gateway-api-vs-ingress-2026) and [Post-Quantum Encryption in Practice](https://www.alekseialeinikov.com/en/blog/topics/security/post-quantum-encryption-ml-kem-tls-guide).

---

## Common Pitfalls: OpenSSH Warnings and WireGuard `Curve25519`

Two practical questions come up immediately once engineers run this audit on real fleets:

- **`"WARNING: connection is not using a post quantum key exchange"` in OpenSSH 10+:** You upgraded your laptop, but production servers on Ubuntu 22.04 (`OpenSSH 8.9`) or 24.04 (`OpenSSH 9.6`) still lack `mlkem768x25519-sha256`. Note that OpenSSH 9.0+ already supports `sntrup761x25519-sha512` (the earlier hybrid PQC KEX), so Ubuntu 24.04 servers can negotiate post-quantum KEX today if `KexAlgorithms` on the server isn't pinned to classical-only algorithms. For legacy hosts you cannot upgrade yet, silence the warning per-host (`WarnWeakCrypto no-pq-kex`) rather than globally.
- **What about WireGuard tunnels using `Curve25519`?** WireGuard uses `Curve25519` for handshake key exchange, which is why operators worry about recorded VPN traffic. The built-in fix already exists in standard WireGuard: configure a **256-bit symmetric `PresharedKey` (`wg genpsk`)** per peer (or automate PSK rotation with tools like Rosenpass). Mixing a symmetric PSK into the WireGuard Noise handshake protects tunnel traffic against quantum Store Now, Decrypt Later without changing the protocol.

---

## Decision Matrix: What to Upgrade Now vs. Defer

![Priority quadrant plotting migration effort vs Store Now Decrypt Later and CA distrust urgency across SSH, TLS, JWT, and Kubernetes](https://media.alekseialeinikov.com/security/b4e8c12f9a31/pqc-kex-vs-signatures-matrix-1200.02bfcf8d51c379e5.webp)

| Layer | Legacy / Exposed Target | Recommended Target | Urgency |
|---|---|---|---|
| **SSH Key Exchange** | `curve25519-sha256`, `ecdh-sha2-nistp256` | `mlkem768x25519-sha256` (OpenSSH 9.9+/10.0) | **Immediate** (SNDL risk) |
| **HTTPS / TLS 1.3 KEX** | Classical `X25519`, `P-256` ECDHE | `X25519MLKEM768:X25519` (OpenSSL 3.5+) | **Immediate** (SNDL risk) |
| **SSH Host & User Keys** | `ecdsa-sha2-nistp256`, `ssh-rsa` (SHA-1) | `ssh-ed25519` or `P-384` / `RSA-4096`; track `ML-DSA` | **High** (rotate inventory) |
| **JWT / OIDC Signing** | `ES256` (`P-256`) | `ES384` (`P-384`) via dual-`kid` JWKS overlap | **Medium-High** (policy/compliance) |
| **Kubernetes `cert-manager`** | `ECDSA size: 256` / `rotationPolicy: Never` | `ECDSA size: 384` + `rotationPolicy: Always` | **High** (before CA deadlines) |
| **Symmetric & Hashes** | `AES-256-GCM`, `ChaCha20-Poly1305`, `SHA-256` | Keep as-is | **No change needed** |

## The Bottom Line

Reliable encryption is not about chasing every headline — it is about knowing **which layer protects recorded traffic today** and **which layer holds long-lived identities**. Turn on **`mlkem768x25519-sha256`** in OpenSSH and **`X25519MLKEM768`** on your TLS edge first, run the 5-minute audit across `authorized_keys`, `gpg`, `JWKS`, and `cert-manager`, and schedule clean rotations off `P-256` to `P-384` / `Ed25519` before CA distrust and compliance deadlines force an emergency cutover.
