Post-Quantum GitHub SSH

Source: bauer.codes
49 points by pmbauer 5 hours ago on lobsters | 7 comments

Menu

2026-12-04

Tech is in a tizzy over the NSA Post-Quantum Cryptography (PQC) advisory and Matthew “🤡” Prince’s now deleted vagueposting.
But there does seem to be something “there” there unlike the big fat nothing burger Anthropic blundered into literally earlier this week.

Given how frustratingly few details our betters deign to share with the rest of us, Filippo Valsorda has some analysis and details worth considering. Read it. The world probably isn’t ending tomorrow, but it’s worth getting off Ed25519 sooner rather than later.

If, like me, you have this bit in your ~/.gitconfig, you likely interact with GitHub’s git server exclusively via SSH.

[url "git@github.com:"]
    insteadOf = https://github.com/

This step-by-step guide helps you follow Filippo’s recommendations when interacting with GitHub SSH. There are two points of vulnerability here: key exchange and authentication.

vulnerability checks

If you don’t see mlkem… or sntrup…, see key exchange.

# key exchange check
ssh -v -o ControlPath=none -T git@github.com 2>&1 | grep "kex: algorithm"

If you see an Ed25519 key or an RSA key that is less than 3072, see authentication.

# auth check
ssh -v -o ControlPath=none -T git@github.com 2>&1 | grep "Server accepts key"

Alternatively, check your publicly registered keys: https://github.com/$GITHUB_USERNAME.keys

fixing

key exchange

Neither OpenSSH 10.6 nor GitHub offers purely PQC options (ML-KEM/FIPS 203). As of 2026-09-22, GitHub offers mlkem768x25519-sha256, so a hybrid PQC scheme is the best we can do for now — in line with the NSA advisory.

Some systems force potentially vulnerable defaults in /etc/ssh/crypto.conf. If you can’t modify that yourself on a managed laptop, put the following config in ~/.ssh/config.

Host github.com
    KexAlgorithms mlkem768x25519-sha256,sntrup761x25519-sha512

Yes, it’s KexAlgorithms as in “key exchange”.

authentication

As of 2026-12-04, GitHub still suggests Ed25519 when generating new auth keys. That’s probably no longer a good idea, and GitHub doesn’t offer anything PQC for auth. The best we can do for now is use RSA-3072 or P-384.

  1. Generate a new key

    export GH_KEY="$HOME/.ssh/id_ecdsa_github"
    ssh-keygen -t ecdsa -b 384 -f "${GH_KEY}"
    
    # copy to clipboard on mac
    pbcopy < "${GH_KEY}.pub"
    
  2. Register your new public key as an authentication key at https://github.com/settings/keys

  3. Either move your old Ed25519 keys out of ~/.ssh or add IdentityFile and IdentitiesOnly values to ~/.ssh/config for GitHub.

    Host github.com
        KexAlgorithms mlkem768x25519-sha256,sntrup761x25519-sha512
        IdentityFile ~/.ssh/id_ecdsa_github
        IdentitiesOnly yes
    

verified commits

If you use SSH verified commits:

  1. Register your new public key as a signing key at https://github.com/settings/keys

  2. Update your signing key in ~/.gitconfig

    [user]
        signingkey = ~/.ssh/id_ecdsa_github.pub
    [gpg]
        format = ssh
    [commit]
        gpgsign = true
    

validation

You’ll want to clean up any existing ControlPath connections and add your new key to your ssh agent for the new key to be effective for git operations.

export GH_KEY="$HOME/.ssh/id_ecdsa_github"
ssh -O exit git@github.com # if you are using ControlPersist like I do
ssh-add -D                 # if you are using an agent, drop old keys
ssh-add "${GH_KEY}"        # add new key

Then run:

ssh -v -o ControlPath=none -T git@github.com 2>&1 \
| tr -d '\r' \
| awk -v b="$(ssh-keygen -lf "${GH_KEY}.pub" | cut -d' ' -f1)" '
    /kex: algorithm:/ { k = $NF }
    /Server accepts key/ { t = $6 }
    END {
        ok = (k ~ /^(mlkem|sntrup)/ && ((t == "ECDSA" && b >= 384) || (t == "RSA" && b >= 3072)))
        print (ok ? "PASS" : "FAIL"), "kex=" k, "auth=" t "-" b
        exit !ok
    }'

… prints PASS kex=mlkem768x25519-sha256 auth=ECDSA-384 for me.

Related tags:

email comments to paul@bauer.codes

site menu

Back to top