Post-quantum crypto in MacOS SSH

tl;dr: Find the config snippet below and paste it into ~/.ssh/config.

On December 2, the NSA advised rushing the transition to post-quantum cryptography, essentially ASAP. After a day or so of speculation, Google confirmed that the ECC curve P-256 was broken, saying they will un-trust it in Chrome after March 2027. If you are using ECC P-256, you should assume that an adversary can record your traffic now and then decrypt it in the next couple of years.

To implement these new recommendations, we’ve internally made some changes to Instrumental ID’s infrastructure, including updating our self-hosted GitLab server to use P-384 certificates and post-quantum key exchange for TLS and SSH.

Since many of our employees use Macbooks, we needed to ensure that employees SSH-ing to our servers (and GitHub and other destinations) would default to safe algorithms. This post details our findings.

MacOS defaults to FIPS algorithms with P-256 in the highest position. This is no longer a secure default. End users should create (or update) a ~/.ssh/config file in their home directory that lists this setting.

KexAlgorithms ^mlkem768x25519-sha256,sntrup761x25519-sha512,sntrup761x25519-sha512@openssh.com

The ^ indicates that these values should be moved to the front of the system-level list. The server will use the first item in the client’s algorithm list that it also supports.

mlkem768x25519-sha256 is the NIST one. It combines ML-KEM, the NIST post-quantum standard (FIPS 203), with classical X25519. The connection stays safe as long as either half holds. The other two are variants of NTRU algorithms recognized by older and newer versions of OpenSSH.

Since the user directory configuration takes precedence, your ssh and git executions will automatically use these improved settings on the next run.

Scroll to Top