Clone
10
Home
Hatter Jiang edited this page 2023-03-10 22:38:06 +08:00

Import your own key to Yubikey card

ykman piv keys import SLOT private.pem
ykman piv certificates generate SLOT public.pem -s 'O=age-plugin-yubikey,OU=0.3.3,CN=YOU_ID' --valid-days 36500

SLOT - 82, 83, 84, 85, 86, 87, 88, 89, 8a, 8b, 8c, 8d, 8e, 8f, 90, 91, 92, 93, 94, 95
YOU_ID - Your identity

ykman piv keys import help message:

Usage: ykman piv keys import [OPTIONS] SLOT PRIVATE-KEY

  Import a private key from file.

  Write a private key to one of the PIV slots on the YubiKey.

  SLOT         PIV slot of the private key
  PRIVATE-KEY  file containing the private key (use '-' to use stdin)

Options:
  -P, --pin TEXT                  PIN code
  -m, --management-key TEXT       the management key
  --pin-policy [DEFAULT|NEVER|ONCE|ALWAYS]
                                  PIN policy for slot
  --touch-policy [DEFAULT|NEVER|ALWAYS|CACHED]
                                  touch policy for slot
  -p, --password TEXT             password used to decrypt the private key
  -h, --help                      show this message and exit

List Yubikey identities

age-plugin-yubike -i