Fedora Core 500の技
Valid XHTML 1.0!
正当なCSSです!

TOP > Linux > Fedoraの技 > 101-200 > 172

gpgで鍵を作るには

自分のメールに署名を付けるためなどで専用の鍵を作成するには"--gen-key"オプションを利用します。通常は初期設定値のまま進んで作成すればいいでしょう。秘密鍵と公開鍵の2つが作成されます。公開鍵は人に見せる目的で作りますが、秘密鍵は人に渡してはいけません。

$ gpg --gen-key
〜略〜
Please select what kind of key you want:
(1) DSA and Elgamal (default)
(2) DSA (sign only)
(5) RSA (sign only)
Your selection? そのままEnterで進む
DSA keypair will have 1024 bits.
ELG-E keys may be between 1024 and 4096 bits long.
What keysize do you want? (2048) そのままEnterで進む
Requested keysize is 2048 bits
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) そのままEnterで進む
Key does not expire at all
Is this correct? (y/N) yで進む

You need a user ID to identify your key; the software constructs the user ID
from the Real Name, Comment and Email Address in this form:
"Heinrich Heine (Der Dichter) <heinrichh@duesseldorf.de>"

Real name: John Lennon 名前を記述
Email address: john@fedora500.jp メールアドレスを記述
Comment: Hello! コメントを記述(なしも可)
You selected this USER-ID:
"John Lennon <john@fedora500.jp>"

Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? Oで進む
You need a Passphrase to protect your secret key.

Enter passphrase: パスフレーズを入力(スペースも利用可)
Repeat passphrase: 再入力

We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.
+++++.+++++++++++++++.++++++++++.+++++++++++++++.+++++++++++++++.++++++++++
...+++++.+++++++++++++++.+++++++++++++++.+++++++++++++++++++++++++>++++
+.+++++......................+++++

Not enough random bytes available. Please do some other work to give
the OS a chance to collect more entropy! (Need XXX more bytes)

ここで止まる場合は414を参照

〜略〜
uid      John Lennon (Hello!) <john@fedora500.jp>
sub 2048g/13496A9C 2005-09-09

完成

作成された鍵は"--list-keys"オプションで確認することが出来ます。

$ gpg --list-keys
/home/john/.gnupg/pubring.gpg
------------------------------
pub 1024D/1D93E17F 2005-09-09
uid      John Lennon (Hello!) <john@fedora500.jp>
sub 2048g/13496A9C 2005-09-09

2005-12-03 作成