デバイス上でのOpenPGP鍵生成¶
Compatible Nitrokeys |
|||||||
|---|---|---|---|---|---|---|---|
✓ active |
⨯ inactive |
⨯ inactive |
✓ active |
⨯ inactive |
✓ active |
✓ active |
⨯ inactive |
以下の説明では、Nitrokey上で直接OpenPGPキーを生成する方法を説明します。これは、GnuPGのコマンドラインインターフェイスを使用して行われます。そのため、お使いのシステムにGnuPGがインストールされている必要があります。Windows用の最新のGnuPGバージョンは`こちら<https://www.gpg4win.org/>`_、MacOS用の最新バージョンは`こちら<https://gpgtools.org/>`_で見つけることができます。Linuxシステムのユーザは、パッケージマネージャの助けを借りてGnuPGをインストールしてください。
注釈
These instructions are based on GnuPG version 2.2.6 or higher. Some Linux Distributions have an older version installed. In this case please choose a different method as listed here or install a newer version if possible.
キー・ジェネレーション¶
The following descriptions explain the basic key generation on-device via GnuPG's command line interface. The default behaviour is to generate RSA keys of 2048 bit size. If you want to change the key algorithm and length, have a look at the next section first.
コマンドラインを開き、``gpg2 --card-edit``と入力します。
To open the Windows command line please push the Windows-key and R-key. Now type cmd.exe in the text field and hit enter. To open a Terminal on macOS or GNU/Linux please use the application search (e.g. spotlight on macOS).
> gpg2 --card-edit
Reader ...........: 20A0:4108:0000320E0000000000000000:0
Application ID ...: D27600012401020100050000320E0000
Version ..........: 2.1
Manufacturer .....: ZeitControl
Serial number ....: 0000320E
Name of cardholder: [not set]
Language prefs ...: de
Sex ..............: unspecified
URL of public key : [not set]
Login data .......: [not set]
Signature PIN ....: forced
Key attributes ...: rsa2048 rsa2048 rsa2048
Max. PIN lengths .: 32 32 32
PIN retry counter : 3 0 3
Signature counter : 0
Signature key ....: [none]
Encryption key....: [none]
Authentication key: [none]
General key info..: [none]
gpg/card>
これであなたはGnuPGの対話型インターフェースに入りました。``admin``で管理コマンドを有効にし、その後``generate``で鍵の生成を開始してください。
gpg/card> admin
Admin commands are allowed
gpg/card> generate
Make off-card backup of encryption key? (Y/n) n
Please note that the factory settings of the PINs are
PIN = '123456' Admin PIN = '12345678'
You should change them using the command --change-pin
Please specify how long the key should be valid.
0 = key does not expire
<n> = key expires in n days
<n>w = key expires in n weeks
<n>m = key expires in n months
<n>y = key expires in n years
Key is valid for? (0)
Key does not expire at all
Is this correct? (y/N) y
GnuPG needs to construct a user ID to identify your key.
Real name: Jane Doe
Email address: jane@example.com
Comment:
You selected this USER-ID:
"Jane Doe <jane@doecom>"
Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? O
gpg: key 817E149CA002B92F marked as ultimately trusted
gpg: revocation certificate stored as '/home/nitrokey//.gnupg/openpgp-revocs.d/E62F445E8BB4B5085C031F5381
7E149CA002B92F.rev'
public and secret key created and signed.
gpg/card>
</jane@doe.com></n></n></n></n>
**この「バックアップ」では、暗号化キーのみが保存され、署名キーや認証キーは保存されません。この「バックアップ」は、暗号化キーのみを保存し、署名キーや認証キーは保存しません。デバイスを紛失した場合、キーセット全体を復元することはできません。つまり、一方では完全なバックアップではなく (必要であれば、`この説明書 <openpgp-keygen-backup.html>`_を使用してください)、他方では、誰か他の人があなたの暗号化キーを手に入れることができるというリスクがあります。デバイス上で鍵を生成する利点は、鍵が安全に保管されていることを確認できることです。そのため、このハーフバックアップは省略することをお勧めします。
これで、当サイトに掲載されている`さまざまなアプリケーション<https://www.nitrokey.com/documentation/applications>`_に使用できる完全なキーセットがデバイスに備わったことになります。``quit``と入力してエンターキーを押すと終了します。
Change Key Attributes¶
このセクションでは、キーアトリビュートの変更について説明します。デフォルトの値を使用したい場合は、次のセクションに進んでください。
コマンドラインを開き、``gpg2 --card-edit --expert``と入力します。
> gpg2 --card-edit --expert
Reader ...........: 20A0:4108:0000320E0000000000000000:0
Application ID ...: D27600012401020100050000320E0000
Version ..........: 2.1
Manufacturer .....: ZeitControl
Serial number ....: 0000320E
Name of cardholder: [not set]
Language prefs ...: de
Sex ..............: unspecified
URL of public key : [not set]
Login data .......: [not set]
Signature PIN ....: forced
Key attributes ...: rsa2048 rsa2048 rsa2048
Max. PIN lengths .: 32 32 32
PIN retry counter : 3 0 3
Signature counter : 0
Signature key ....: [none]
Encryption key....: [none]
Authentication key: [none]
General key info..: [none]
これであなたはGnuPGのインタラクティブなインターフェイスに入りました。上の「鍵の属性」欄を見ると、デフォルト値のrsa2048が設定されているのがわかります。これを変更するには、``admin``で管理コマンドを起動し、その後``key-attr``で鍵の属性を変更してください。
gpg/card> admin
Admin commands are allowed
gpg/card> key-attr
Changing card key attribute for: Signature key
Please select what kind of key you want:
(1) RSA
(2) ECC
Your selection? 1
What keysize do you want? (2048) 4096
The card will now be re-configured to generate a key of 4096 bits
Changing card key attribute for: Encryption key
Please select what kind of key you want:
(1) RSA
(2) ECC
Your selection? 1
What keysize do you want? (2048) 4096
The card will now be re-configured to generate a key of 4096 bits
Changing card key attribute for: Authentication key
Please select what kind of key you want:
(1) RSA
(2) ECC
Your selection? 1
What keysize do you want? (2048) 4096
The card will now be re-configured to generate a key of 4096 bits
各キー(つまり、署名キー、暗号化キー、認証キー)の属性を選択することができます。ほとんどの人は、すべてのキーに同じ属性を使うでしょう。list と入力すると、結果が表示されます(「鍵の属性」フィールドに rsa4096 と表示されているのを見てください)。
gpg/card> list
Reader ...........: 20A0:4108:0000320E0000000000000000:0
Application ID ...: D27600012401020100050000320E0000
Version ..........: 2.1
Manufacturer .....: ZeitControl
Serial number ....: 0000320E
Name of cardholder: [not set]
Language prefs ...: de
Sex ..............: unspecified
URL of public key : [not set]
Login data .......: [not set]
Signature PIN ....: forced
Key attributes ...: rsa4096 rsa4096 rsa4096
Max. PIN lengths .: 32 32 32
PIN retry counter : 3 0 3
Signature counter : 0
Signature key ....: [none]
Encryption key....: [none]
Authentication key: [none]
General key info..: [none]
``quit``と入力してエンターキーを押して終了するか、そのまま前のセクションに進み、先ほど設定したキー属性を持つキーを実際に生成します。
次の表は、どのアルゴリズムがどのデバイスで使用できるかを示しています。
Algorithm |
スタート |
Pro + Storage |
Pro 2 + Storage 2 |
|---|---|---|---|
rsa1024 |
✓ |
✓ |
|
rsa2048 |
✓ |
✓ |
✓ |
rsa3072 |
✓ |
✓ |
|
rsa4096 |
✓ |
✓ |
|
カーブ25519(ECC) |
✓ |
||
NIST(ECC) |
✓ |
✓ |
|
ブレインプール(ECC) |
✓ |
||
secp256k1 |
✓ |
公開鍵のエクスポートと鍵サーバの利用¶
お使いのシステムで鍵を生成した後、すぐにNitrokeyを使い始めることができますが、Nitrokeyを使用したいすべてのシステムで公開鍵をインポートする必要があります。そのための準備として、2つの選択肢があります。公開鍵を好きな場所に保存して別のシステムで使用するか、Webページ/鍵サーバに公開鍵を保存するかです。
公開鍵ファイルの生成¶
公開鍵のシンプルなファイルを取得するには、``gpg2 --armor --export keyID > pubkey.asc``を使用すればよいでしょう。フィンガープリントを "keyID "として使用するか(``gpg -K``を参照してください)、または単に識別子として電子メールアドレスを使用してください。
You can carry this file with you or send it to anyone who you like. This file is not secret at all. If you want to use the Nitrokey on another system, you first import this public key via gpg2 --import pubkey.asc and then types gpg2 --card-status so that the system knows where to look for this key. That's all.
公開鍵のアップロード¶
公開鍵ファイルを持ち歩きたくない場合は、keyserverにアップロードすることができます。これは、``gpg --keyserver search.keyserver.net --send-key keyID``と入力することで行うことができます。別のマシンを使っている場合は、``gpg --keyserver search.keyserver.net --recv-key keyID``を使ってインポートすることができます。
Another possibility is to change the URL setting on your card.
Run gpg --card-edit again and first set the URL where the key is situated (e.g. on the keyserver or on your webpage etc.) via the url command.
From now on you can import the key on another system by just using the fetch command within the gpg --card-edit environment.