Yubikey #
Unlock the PIN (defaults to 123456) with the PUK: Personal Unlock Key (defaults to 12345678):
# entered the wrong pin three times? Try
ykman piv access unblock-pin
ykman opengpg access unblock-pin
# ...you get the idea. Check the result with:
ykman openpgp info
Or start fresh over
# delete opengpg from yubikey and reset pin/puk counters
ykman openpgp reset
# KEYID is going to be the main key id (not the keyid of subkeys). The
# following command may require a password.
gpg --export-secret-keys --armor KEYID > /tmp/file_backup.txt
# sanity check what has been exported
gpg --show-keys /tmp/file_backup.txt
# 2. Transfer the key to the yubikey (move not copy, because copy impossible)
# edit the key in expert mode so you can skip entering `admin`
gpg --expert --edit-key KEYID