[ホーム]-> [GnuPG]-> [Setting]
[Next][Previous]

GnuPG のインストールと設定 (UNIX 系)


インストール

基本的には gnupg-1.0.1.tar.gz を展開した後に展開したディレクトリに移って

lucy~$ ./configure
lucy~$ make
lucy~$ make install

で終わりです。(lucy~$ の部分はプロンプトです。以下同様。)

また、Linux で Redhat 系のディストリビューションを使っている場合は、中に spec ファイルも用意されているので、これを使ってパッケージを作ってインストールすれば、RPM での管理下に置くことも簡単です。

インストールする前に make check すると、ちゃんと機能するかどうかがテストできます。また、一部の環境では

lucy~$ chmod 4755 /usr/bin/gpg
(gpg の場所は適当に読み換えて下さい)

としないと、

 gpg: Warning: using insecure memory!    

と言われるようです。

メッセージを日本語化する場合、梶木さんが作成された ja.po を利用するとよいでしょう。

また、Linux などでは上で make が通りますが、環境によっては configure の際に適当にオプションをつけないといけないことがあります。 SunOS 4.1.4-JL では

lucy~$ ./configure --disable-dynload 
--with-included-zlib --with-included-gettext --disable-nls

とすると、make や make check が通りました。この辺りのオプションを試してみるといいでしょう。


ユーザの設定

まずは一度 gpg を起動します。

lucy~$ gpg

すると、ホームディレクトリに ~/.gnupg が作られ、その下にオプションファイルなどが作成されます。

次に鍵を作成します。まずは、パスフレーズ の項を読んで、秘密鍵を暗号化するためのパスフレーズを決めておきます。 そして

lucy~$ gpg  --gen-key

とタイプします。 特に日本語化してない場合は次のように進みます。

 gpg (GnuPG) 1.0.1; Copyright (C) 1999 Free Software Foundation, Inc.
 This program comes with ABSOLUTELY NO WARRANTY.
 This is free software, and you are welcome to redistribute it
 under certain conditions. See the file COPYING for details.
 gpg: Warning: using insecure memory!
 gpg: /u/s/matsu/.gnupg/secring.gpg: keyring created
 gpg: /u/s/matsu/.gnupg/pubring.gpg: keyring created
 Please select what kind of key you want:
    (1) DSA and ElGamal (default)
    (2) DSA (sign only)
    (4) ElGamal (sign and encrypt)
 Your selection? 1 [RETURN]
 DSA keypair will have 1024 bits.
 About to generate a new ELG-E keypair.
               minimum keysize is  768 bits
               default keysize is 1024 bits
     highest suggested keysize is 2048 bits
 What keysize do you want? (1024) [RETURN]
 Requested keysize is 1024 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) [RETURN]
 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 Real Name, Comment and Email Address in this form:
     "Heinrich Heine (Der Dichter) <heinrichh@duesseldorf.de>"
 Real name: ←本名を入れる
 Email address: ←メールアドレスを入れる
 Comment: ←適当なコメントを入れる
 You selected this USER-ID:
     "本名 (コメント) <Eメールアドレス>"
 Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? o
 You need a Passphrase to protect your secret key.←パスフレーズを入力
 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.
 ごにゃごにゃ表示される。適当にマウスやキーボードをいじる。
 public and secret key created and signed.

これで、一応準備は整います。キーサーバーに公開鍵を登録する場合は、鍵が盗まれたときに破棄するために、

lucy~$ gpg  --gen-revoke user_id

などとして、その後の指示に従うといいでしょう。USER ID の部分は、長い USER ID を全部入れなくても、本名の苗字とか、名前とか、メールアドレスの @ の前の部分とか、ID とか、もっと簡単な指定方法があります(→ [USER IDの指定])。

以上で基本的な準備は終わりです。

自分の公開鍵の扱い

鍵ペアを生成したら、その内の公開鍵を自分のウェブページで公開するとか、鍵サーバーに登録するとともに、その鍵指紋を日常的にメールに添付するなどします。そうすることで、他の人があなた宛に暗号メールを送ることが可能になりますし、またあなたが自分の書いた文書に署名をした場合には、その公開鍵を使って検証することが可能になります。

公開鍵や鍵指紋を取り出すための具体的なコマンドについては次章で説明します。 書き出しの項や鍵指紋の項などを御覧下さい。


[ホーム]->[GnuPG]->[Setting]
[Next][Previous]