1 year ago

#195014

test-img

luochen1990

How to move my current using ssh key into Yubikey?

I'm using Yubikey 5 NFC and want to move my openssh key into it so that I can authenticate for ssh login via this Yubikey.

Maybe you will suggest to generate a new gpg keypair for Yubikey and use the gpg-agent instead of ssh-agent to authenticate. But I still want to move my current ssh private key into Yubikey because this way I don't have to edit authorized_keys everywhere.

I tried to do this following this article:

https://www.mvps.net/docs/how-to-add-your-existing-ssh-key-to-yubikey-via-openpgp/

which suggest to use pem2openpgp from monkeysphere to translate my ssh key into gpg key and somehow write this translated gpg key into Yubikey (via keytocard command of gpg).

But after all these done. I find that the fingerprint of my ssh key is changed, this is confirmed by following command:

$ ssh-keygen -lf ~/.ssh/id_rsa.pub
$ ssh-add -l

And the fact that the fingerprint changed makes using my current ssh key meaningless -- I still need to edit authorized_keys everywhere to make the "new public key" work.

So is there any other way which can write my old ssh key into Yubikey and keep the old key's fingerprint?

ssh

gnupg

yubikey

0 Answers

Your Answer

Accepted video resources