For general OpenPGP and GnuPG usage, please refer to the GNU Privacy Handbook. This page summarizes the most common card operations with gpg.
With CanoKey connected, run:
gpg --card-status
This shows card information such as the serial number, the keys stored in the SIG / DEC / AUT slots, and the current retry counters.
Enter the interactive card administration mode:
gpg --card-edit
Inside the card edit prompt:
admin to enable administrative commands (the Admin PIN is required for most of them).generate to generate a new key pair on the card. Firmware version 2.0.0 and later support generating RSA3072 / RSA4096 keys on the card; on earlier firmware, generate these keys on the computer and import them instead.passwd to change the PIN, Admin PIN, or Reset Code.gpg --card-edit.admin, then generate.Choose No at the off-card backup prompt to generate all keys inside CanoKey. If you create a backup, GnuPG generates the encryption key on the computer, saves a backup there, and imports the key into CanoKey.
If you already have a GnuPG key pair, you can move its subkeys onto the card with keytocard:
gpg --edit-key <KEYID> with the private key available on the computer.key <N> (for example key 1), then type keytocard and choose the target slot (signature, encryption, or authentication).save.keytocard moves the private key to the card; the local copy is replaced by a stub pointing to the card. Make a backup of the private key beforehand if you want to keep an off-card copy.
If you have exhausted the OpenPGP Admin PIN retries, you can use the device Admin PIN to reset OpenPGP from CanoKey Console. This restores the factory defaults listed in PIN and Touch Policies and removes all keys stored in the OpenPGP applet.