YubiKeyに公開鍵のURLを追加する

投稿日: 更新日:

手順

yubikeyをPCにさして以下のコマンドでyubikeyの編集モードに入ります。

$ gpg --card-edit

adminモードになります。

gpg/card> admin

url と打ってから公開鍵のurlを入力してください。今回はkeybaseを使用します。

gpg/card> url
URL to retrieve public key: https://keybase.io/example/pgp_keys.asc

quit で終了します。

gpg/card> quit

確認

yubikey内の情報を出力した時、URL of public keyのところに設定したurlがあればよいです。

$ gpg --card-status
Reader ...........: Yubico YubiKey OTP FIDO CCID 0
Application ID ...:
Application type .: OpenPGP
Version ..........: 3.4
Manufacturer .....: Yubico
Serial number ....: 00000000
Name of cardholder: [not set]
Language prefs ...: [not set]
Salutation .......:
URL of public key : https://keybase.io/example/pgp_keys.asc
Login data .......: [not set]
Signature PIN ....: not forced
Key attributes ...:
Max. PIN lengths .:
PIN retry counter :
Signature counter :
KDF setting ......:
UIF setting ......:
Signature key ....:
      created ....:
Encryption key....:
      created ....:
Authentication key:
      created ....:
General key info..: [none]

公開鍵を取得する

yubikeyに記録したurlから公開鍵を取得してみます。

編集モードに入ります。

$ gpg --card-edit

fetchで取得してくれます。

gpg/card> fetch
gpg: requesting key from 'https://keybase.io/example/pgp_keys.asc'
gpg: key XXXXXXXX: public key "" imported
gpg: Total number processed: 1
gpg:               imported: 1

quitで終了します。

gpg/card> quit

後は信頼度を設定してください。

$ gpg --edit-key <gpg_key_id> trust quit

確認

以下のコマンドで取得した公開鍵があるかどうか確認できます。

$ gpg -k

書いた人

profile_image

お茶の葉

物理とプログラミングが好きな人