Index ¦ Archives ¦ Atom

Resetting a yubikey

Introduction

There might be a time when you'll need to purge a yubikey without access to your gpg stubs (or if you want to avoid importing them). In this case the below method works, even though googling won't reveal at first glance. In short, the procedure involves entering a pin wrong three times in a row and resetting the yubikey, which effectively purges it. There's other methods that work (like loading a new yubikey - an excellent guide is available here ).

The method

Taken from here. I'd recommend using the link directly, however, if it succumbs to link rot the procedure is as follows:

Save the following as yubikey-reset.txt :

/hex
scd serialno
scd apdu 00 20 00 81 08 40 40 40 40 40 40 40 40
scd apdu 00 20 00 81 08 40 40 40 40 40 40 40 40
scd apdu 00 20 00 81 08 40 40 40 40 40 40 40 40
scd apdu 00 20 00 81 08 40 40 40 40 40 40 40 40
scd apdu 00 20 00 83 08 40 40 40 40 40 40 40 40
scd apdu 00 20 00 83 08 40 40 40 40 40 40 40 40
scd apdu 00 20 00 83 08 40 40 40 40 40 40 40 40
scd apdu 00 20 00 83 08 40 40 40 40 40 40 40 40
scd apdu 00 e6 00 00
scd apdu 00 44 00 00
/echo Card has been successfully reset.

Then, run:

gpg-connect-agent -r yubikey-reset.txt

(You might need to Control+C out of the command after it runs) Remove the card and reinsert it again, and gpg --card-status should show that no gpg keys are loaded.

© Bruno Henc. Built using Pelican. Theme by Giulio Fidente on github.