logoalt Hacker News

Magicrafter13 • today at 7:19 PM • 4 replies • view on HN

What is the practical/security difference between

`ssh-keygen -t ed25519-sk -O resident -O no-touch-required -O application="ssh:nameyourkey" -f ~/.ssh/id_ed25519-sk`

and

`ssh-keygen -t ed25519-sk -f ~/.ssh/id_ed25519-sk`

?

The latter is what I always do. It creates a file that is useless without my yubikey being present, but is it not actually resident on the key?


Replies

ramblurr • today at 7:48 PM

Your 2nd one is non-resident, the secret key material is encrypted in that sk file. But it is encrypted with a master key that is only inside your yk. So you need both your sk handle file and the yk to use it. This has the benefit of not consuming the limited number of memory slots in a yk.

In the first one the handle file that's created, can be recovered from the yk key itself, that's what resident is.

Having the only practical difference between the two is that, with the first one, you (or someone else) only needs the yk to use the credential. But in the latter case, one needs the yk and the handle file.

sidneythekidney • today at 7:39 PM

Resident keys have their "metadata" stored on the yubikey, in an exportable way. This means using the same ssh-key on a different computer is as easy as plugging in the yubikey and typing ssh-keygen -K. With a non-resident key you’d have to copy the "privatekey", which contains the metadata needed to use the key, to the other computer first.

The downside with resident keys is that someone stealing the yubikey can see what resident keys are on it, and then possibly use those keys (if they aren’t protected). Newer firmware comes with ways to protect against this, but you’d have to enable it.

[1] has more details

1: https://developers.yubico.com/SSH/Securing_SSH_with_FIDO2.ht...

palata • today at 7:41 PM

The first one sets "no-touch-required" and not the second one, is that expected?

Anyway, resident key means that you can extract the public key from the yubikey. Say someone steals your Yubikey Fido2 PIN and your Yubikey, they have everything.

Non-resident key means that the attacker needs to get that "useless" file you describe, too. And if you lose it, then you can't use the key anymore.

Another difference is that a resident key takes space on the Yubikey, so you can't have infinitely many. Whereas you can have infinitely many "useless" files.