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.The keys are generated inside CanoKey and never leave the card in plain form.
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 the retry counters are exhausted and you have forgotten the Admin PIN, the OpenPGP applet can be reset from the CanoKey Console. This restores the factory defaults listed in PIN and Touch Policies and removes all keys stored in the OpenPGP applet.