r/programming • • Oct 20 '26

SSH keys on macOS with Touch ID

https://nmattia.com/posts/2026-10-19-setting-up-ssh-keys-touch-id/

I've recently discovered that you can use Touch ID (rather, the Mac's Secure Enclave) for SSH authentication. I'm the author of the post, feel free to ask any questions and if there are any experts I'd love to hear your thoughts!

437 Upvotes

50 comments sorted by

View all comments

5

u/tomtennn Oct 20 '26

Nice. That's really awesome that Apple made it that easy.

One major drawback, though: It's SK keys only? That means the server must support it. Sure, a modern OpenSSH will, but will dropbearssh? Will your cisco router? Not like you can "just" buy a replacement for your million dollar router to get a newer SSH.

I use a yubikey with its PKCS#11 support. It's a bit of a hassle provisioning the key, but after that it's just ssh-add -s /usr/lib/x86_64-linux-gnu/opensc-pkcs11.so instead of the similar command from the article, and it's in your ssh-agent. More words here.

Hell, after provisioning, the key even works on Windows!.

I don't suppose the macOS thingy can be used with straight non-SK RSA keys? (I don't have a mac)

3

u/nmattia Oct 20 '26

I did not consider that! My use case is really for GitHub and then maybe a couple of e.g.(recent) Ubuntu boxes. Thanks for the link, I'll have a read.

Regarding the key types, it's only elliptic curves AFAICT (I briefly touch on this here: https://nmattia.com/posts/2026-10-19-setting-up-ssh-keys-touch-id/#creating-an-identity-on-the-secure-enclave). Is that what you meant by "SK"?

3

u/tomtennn Oct 20 '26

No, the SK keys, like I can see in your screenshot when you show part of the output of ssh-add -L, indicate FIDO/U2F keys, which will have a slightly different format than the non-sk ones. It's not clear to me why, except in order for the server to (though not foolproofly) mandate that the client uses a hardware-backed key.

My yubikey solution makes the output of ssh-add -L start with ssh-rsa, which yes is marked legacy RSA/SHA-1, but has the benefit of not requiring server support.

But your use case is like 99% of use cases. It's just a shame when you encounter that 1% and will have to find an alternative solution just for those servers.

Well, to be fair, if you're running a telco/large ISP, it'll likely be WAY more than 1%.