% tar zxvf gnupg-1.0.6.tar.gz % cd gnupg-1.0.6 % ./configure % cp config.status /usr/local/logs/config/gnupg-1.0.6 % make >& /usr/local/logs/make/gnupg-1.0.6 # make install >& /usr/local/logs/install/gnupg-1.0.6試しに以下のようにコマンドを入力してみます。
% gpg --version gpg (GnuPG) 1.0.6 Copyright (C) 2001 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. Home: ~/.gnupg サポートしているアルゴリズム: Cipher: 3DES, CAST5, BLOWFISH, RIJNDAEL, RIJNDAEL192, RIJNDAEL256, TWOFISH Pubkey: RSA, RSA-E, RSA-S, ELG-E, DSA, ELG Hash: MD5, SHA1, RIPEMD160暗号化、署名、ハッシュで使うことができるアルゴリズムが表示されました。
% tar zxvf pgpdump-0.12.tar.gz % cd pgpdump-0.12 % ./configure % cp config.status /usr/local/logs/config/pgpdump-0.12 % make >& /usr/local/logs/make/pgpdump-0.12 # make install >& /usr/local/logs/install/pgpdump-0.12これでインストールは終了です。
% gpg --gen-key gpg (GnuPG) 1.0.6; Copyright (C) 2001 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: 警告: やばいメモリーを使用しています! gpg: /home/yuji/.gnupg: 辞書ができました gpg: /home/yuji/.gnupg/options: 新しいオプション・ファイルができました gpg: オプション・ファイルを読み直すよう、GnuPGを再起動してください上記のコマンドを実行すると、ホームディレクトリに
.gnupgというディレクトリが作成されます。鍵を作成するためには、再度、同じコマンドを実行します。
% gpg --gen-key gpg (GnuPG) 1.0.6; Copyright (C) 2001 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: 警告: やばいメモリーを使用しています! gpg: /home/yuji/.gnupg/secring.gpg: 鍵輪ができました gpg: /home/yuji/.gnupg/pubring.gpg: 鍵輪ができました すきな鍵の種類を選択してください: (1) DSAとElGamal (既定) (2) DSA (署名のみ) (4) ElGamal (署名と暗号化) どれにしますか?デフォルトで1を選びます。
DSA鍵対は1024ビットになります。
新しいELG-E鍵対を生成します。
最小の鍵長は 768 ビット
既定の鍵長は 1024 ビット
最大の推奨鍵長は 2048 ビット
どの鍵長にしますか? (1024)
1024を選びます。
要求された鍵長は1024ビット
鍵の期限を決めてください。
0 = 無期限
= 有効期限 n 日間
w = 有効期限 n 週間
m = 有効期限 n か月間
y = 有効期限 n 年間
鍵の有効期間は? (0)
0(無期限)を選びます。
鍵は無期限です これでいいですか (y/n)? yyを選びます。
あなたの鍵を同定するためにユーザーIDが必要です。
このソフトは本名、コメント、電子メール・アドレスから
次の書式でユーザーIDを構成します:
"Heinrich Heine (Der Dichter) "
例えば、以下のように入力します。
本名: Test User
電子メール・アドレス: test@ykondou.org
コメント: for gnupg test
次のユーザーIDを設定しました:
"Test User (for gnupg test) "
名前(N)、コメント(C)、電子メール(E)の変更、またはOK(O)か終了(Q)? o
問題なければoを入力します。
秘密鍵を保護するためにパスフレーズがいります。 パスフレーズを入力:パスフレーズを入力します。忘れないように気をつけましょう。
パスフレーズを再入力:再度、パスフレーズを入力します。間違えないように気をつけましょう。
今から長い乱数を生成します。キーボードを打つとか、マウスを動かす とか、ディスクにアクセスするとかの他のことをすると、乱数生成子で 乱雑さの大きないい乱数を生成しやすくなるので、お勧めします。 ++++++++++++++++++++++++++++++.+++++++++++++++.+++++.+++++++++++++++++++++++++++ ++++++++..++++++++++...+++++.+++++..++++++++++.+++++.+++++.++++++++++.>.+++++... .......................................>+++++................................... ................................................................................ ........................................................................+++++ 十分な長さの乱数が得られません。OSがもっと乱雑さを収集 できるよう、何かしてください! (あと300バイトいります) 今から長い乱数を生成します。キーボードを打つとか、マウスを動かす とか、ディスクにアクセスするとかの他のことをすると、乱数生成子で 乱雑さの大きないい乱数を生成しやすくなるので、お勧めします。ネットワークにアクセスしたり、いろいろやって乱数を生成させます。
.+++++.++++++++++++++++++++++++++++++++++++++++++++++++++.++++++++++..++++++++++ +++++++++++++++.+++++.+++++.++++++++++.++++++++++++++++++++>+++++.....>+++++.... ........................................<+++++............>+++++................ .+++++^^^ 公開鍵と秘密鍵を作り、署名しました。
% pgpdump ~/.gnupg/pubring.gpg
Old: Public Key Packet(tag 6)(418 bytes)
Ver 4 - new
Public key creation time - Mon Oct 1 22:45:03 JST 2001
Pub alg - DSA Digital Signature Standard(pub 17)
DSA p(1024 bits) - ...
DSA q(160 bits) - ...
DSA g(1024 bits) - ...
DSA y(1021 bits) - ...
Old: User ID Packet(tag 13)(45 bytes)
User ID - Test User (for gnupg test)
Old: Signature Packet(tag 2)(87 bytes)
Ver 4 - new
Sig type - Positive certification of a User ID and Public Key packet(0x13).
Pub alg - DSA Digital Signature Standard(pub 17)
Hash alg - SHA1(hash 2)
Hashed Sub: signature creation time(sub 2)(4 bytes)
Time - Mon Oct 1 22:45:03 JST 2001
Hashed Sub: preferred symmetric algorithms(sub 11)(4 bytes)
Sym alg - AES with 128-bit key(sym 7)
Sym alg - Twofish with 256-bit key(sym 10)
Sym alg - CAST5(sym 3)
Sym alg - Blowfish(sym 4)
Hashed Sub: preferred hash algorithms(sub 21)(2 bytes)
Hash alg - RIPEMD160(hash 3)
Hash alg - SHA1(hash 2)
Hashed Sub: preferred compression algorithms(sub 22)(2 bytes)
Comp alg - ZLIB (comp 2)
Comp alg - ZIP (comp 1)
Hashed Sub: key server preferences(sub 23)(1 bytes)
Flag - No-modify
Sub: issuer key ID(sub 16)(8 bytes)
Key ID - 0d 9a 03 8e 4f 4c cf 17
Hash left 2 bytes - 69 cc
DSA r(158 bits) - ...
DSA s(158 bits) - ...
-> hash(160 bits)
Old: Public Subkey Packet(tag 14)(269 bytes)
Ver 4 - new
Public key creation time - Mon Oct 1 22:45:11 JST 2001
Pub alg - ElGamal Encrypt-Only(pub 16)
ElGamal p(1024 bits) - ...
ElGamal g(3 bits) - ...
ElGamal y(1023 bits) - ...
Old: Signature Packet(tag 2)(70 bytes)
Ver 4 - new
Sig type - Subkey Binding Signature(0x18).
Pub alg - DSA Digital Signature Standard(pub 17)
Hash alg - SHA1(hash 2)
Hashed Sub: signature creation time(sub 2)(4 bytes)
Time - Mon Oct 1 22:45:11 JST 2001
Sub: issuer key ID(sub 16)(8 bytes)
Key ID - 0d 9a 03 8e 4f 4c cf 17
Hash left 2 bytes - d6 94
DSA r(159 bits) - ...
DSA s(160 bits) - ...
-> hash(160 bits)
次に秘密鍵を確認します。
% pgpdump ~/.gnupg/secring.gpg
Old: Secret Key Packet(tag 5)(463 bytes)
Ver 4 - new
Public key creation time - Mon Oct 1 22:45:03 JST 2001
Pub alg - DSA Digital Signature Standard(pub 17)
DSA p(1024 bits) - ...
DSA q(160 bits) - ...
DSA g(1024 bits) - ...
DSA y(1021 bits) - ...
Sym alg - CAST5(sym 3)
String-to-key(s2k 3):
Hash alg - SHA1(hash 2)
Salt - 97 45 bc c4 29 05 41 80
Count - 65536(coded count 96)
IV - 03 3b 93 55 d6 f1 f1 7b
Encrypted DSA x
Encrypted checksum
New: Private(tag 61)(38 bytes)
Private - ...
New: Private(tag 61)(38 bytes)
Private - ...
New: Private(tag 61)(38 bytes)
Private - ...
Old: User ID Packet(tag 13)(45 bytes)
User ID - Test User (for gnupg test)
Old: Signature Packet(tag 2)(87 bytes)
Ver 4 - new
Sig type - Positive certification of a User ID and Public Key packet(0x13).
Pub alg - DSA Digital Signature Standard(pub 17)
Hash alg - SHA1(hash 2)
Hashed Sub: signature creation time(sub 2)(4 bytes)
Time - Mon Oct 1 22:45:03 JST 2001
Hashed Sub: preferred symmetric algorithms(sub 11)(4 bytes)
Sym alg - AES with 128-bit key(sym 7)
Sym alg - Twofish with 256-bit key(sym 10)
Sym alg - CAST5(sym 3)
Sym alg - Blowfish(sym 4)
Hashed Sub: preferred hash algorithms(sub 21)(2 bytes)
Hash alg - RIPEMD160(hash 3)
Hash alg - SHA1(hash 2)
Hashed Sub: preferred compression algorithms(sub 22)(2 bytes)
Comp alg - ZLIB (comp 2)
Comp alg - ZIP (comp 1)
Hashed Sub: key server preferences(sub 23)(1 bytes)
Flag - No-modify
Sub: issuer key ID(sub 16)(8 bytes)
Key ID - 0d 9a 03 8e 4f 4c cf 17
Hash left 2 bytes - 69 cc
DSA r(158 bits) - ...
DSA s(153 bits) - ...
-> hash(160 bits)
Old: Secret Subkey Packet(tag 7)(326 bytes)
Ver 4 - new
Public key creation time - Mon Oct 1 22:45:11 JST 2001
Pub alg - ElGamal Encrypt-Only(pub 16)
ElGamal p(1024 bits) - ...
ElGamal g(3 bits) - ...
ElGamal y(1023 bits) - ...
Sym alg - CAST5(sym 3)
String-to-key(s2k 3):
Hash alg - SHA1(hash 2)
Salt - 97 45 bc c4 29 05 41 80
Count - 65536(coded count 96)
IV - 66 7c 5e 23 97 a2 de db
Encrypted ElGamal x
Encrypted checksum
New: Private(tag 61)(38 bytes)
Private - ...
New: Private(tag 61)(38 bytes)
Private - ...
New: Private(tag 61)(38 bytes)
Private - ...
New: Private(tag 61)(38 bytes)
Private - ...
New: Private(tag 61)(38 bytes)
Private - ...
Old: Signature Packet(tag 2)(70 bytes)
Ver 4 - new
Sig type - Subkey Binding Signature(0x18).
Pub alg - DSA Digital Signature Standard(pub 17)
Hash alg - SHA1(hash 2)
Hashed Sub: signature creation time(sub 2)(4 bytes)
Time - Mon Oct 1 22:45:11 JST 2001
Sub: issuer key ID(sub 16)(8 bytes)
Key ID - 0d 9a 03 8e 4f 4c cf 17
Hash left 2 bytes - d6 94
DSA r(158 bits) - ...
DSA s(159 bits) - ...
-> hash(160 bits)
.mewに以下の設定を追加します。
(setq mew-prog-pgp "gpg")
メールを書き終わったらメニューバーからMew/Draft->PGP->PGP Signを選ぶか、C-c C-sを入力すると、ミニバッファにEnter pass phrase (GNUPG):と表示されるので、ここでパスフレーズを入力します。
パスフレーズが正しければ署名が付加されてqueueに移動します。ここでC-c C-cと入力すると、メールが送信されます。
メールを書き終わったらメニューバーからMew/Draft->PGP->PGP Encryptを選ぶか、C-c C-eを入力すると、ミニバッファにEnter pass phrase (GNUPG):と表示されるので、ここでパスフレーズを入力します。
パスフレーズが正しければ署名が付加されてqueueに移動します。ここでC-c C-cと入力すると、メールが送信されます。