nDiki : gnupg-w32
GnuPG の Windows 版
インストール方法 (1.4.0a)
- http://www.gnupg.org/ から、gnupg-w32cli-1.4.0a.zip をダウンロードする。
- ZIP アーカイブを展開する。
- gpg.exe、gpgv.exe、gpgkeys_ldap.exe を PATH の通ったディレクトリにコピーする。
- c:\gnupg ディレクトリを作成する。
捕捉
簡単な使い方
鍵ペアの作成
gpg --gen-key
を実行する。
C:\>gpg --gen-key
gpg (GnuPG) 1.4.0; Copyright (C) 2004 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: keyring `c:/gnupg\secring.gpg' created
gpg: keyring `c:/gnupg\pubring.gpg' created
Please select what kind of key you want:
(1) DSA and Elgamal (default)
(2) DSA (sign only)
(5) RSA (sign only)
Your selection? <-- リターンキー
DSA keypair will have 1024 bits.
ELG-E keys may be between 1024 and 4096 bits long.
What keysize do you want? (2048) <-- リターンキー
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) <-- リターンキー
Key does not expire at all
Is this correct? (y/N) y <-- 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: GnuPG Taro <-- 名前を入力してリターンキー
Email address: gnupg.taro@example.example <-- メールアドレスを入力してリターンキー
Comment: <-- コメントを入力してリターンキー。必要がなければ何も入力しないでリターンキー
You selected this USER-ID:
"GnuPG Taro <gnupg.taro@example.example>"
Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? O <-- 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.
+++++.++++++++++.+++++.+++++..++++++++++.+++++.++++++++++++++++++++.++++++++++..
+++++++++++++++.++++++++++++++++++++...++++++++++++++++++++++++++++++...........
..............................................+++++
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.
++++++++++..+++++++++++++++...++++++++++++++++++++.+++++++++++++++.+++++++++++++
++++++++++++++++++++++.++++++++++++++++++++.++++++++++++++++++++.+++++.+++++>+++
++.+++++.>+++++.................................................................
................................................................................
......................+++++^^^^
gpg: c:/gnupg\trustdb.gpg: trustdb created
gpg: key F795F021 marked as ultimately trusted
public and secret key created and signed.
gpg: checking the trustdb
gpg: 3 marginal(s) needed, 1 complete(s) needed, PGP trust model
gpg: depth: 0 valid: 1 signed: 0 trust: 0-, 0q, 0n, 0m, 0f, 1u
pub 1024D/F795F021 2005-02-02
Key fingerprint = E997 95AA ACEC 518B D4AC 661E 65CD E224 F795 F021
uid GnuPG Taro <gnupg.taro@example.example>
sub 2048g/CC09A839 2005-02-02
これで鍵ペアが生成された。
自分の公開鍵をテキストファイルに書き出す
gpg --export --armor gnupg.taro@example.example > key.asc
gnupg.taro@example.example の部分は自分のメールアドレス。 key.asc に自分の公開鍵が書き出される。
これをGnuPGでやりとりする他の人に送ってキーリングに登録してもらう。
fingerprint を確認する
C:\>gpg --fingerprint gnupg.taro@example.example
pub 1024D/F795F021 2005-02-02
Key fingerprint = E997 95AA ACEC 518B D4AC 661E 65CD E224 F795 F021
uid GnuPG Taro <gnupg.taro@example.example>
sub 2048g/CC09A839 2005-02-02
gnupg.taro@example.example の部分は自分のメールアドレス。 Key fingerprint = の後の数字とアルファベットの列が fingerprint。
公開鍵を送った方法とは別の方法で、キーリングに登録してもらう人に伝えるのが良い。
ファイルに電子署名する
test.txt に電子署名をする場合は
gpg --sign --output test.txt.gpg test.txt
とする。実行するとパスフレーズの入力を求められるので、正しく入力する。 成功すると test.txt.gpg というファイルが作成される。
電子署名を検証する
先に自分で作成した test.txt.gpg を検証してみるには、
C:\tmp>gpg --verify test.txt.gpg gpg: Signature made 02/02/05 10:58:45 東京 (標準時) using DSA key ID F795F021 gpg: Good signature from "GnuPG Taro <gnupg.taro@example.example>"
とする。正しく署名されていれば、Good signature from……と出力される。
自分の公開鍵で暗号化されているファイルを復号化する
他の人から送られてきた暗号化されているファイル encrypted.txt.gpg を復号化する場合
C:\>gpg --decrypt encrypted.txt.gpg
You need a passphrase to unlock the secret key for
user: "GnuPG Taro <gnupg.taro@example.example>"
2048-bit ELG-E key, ID CC09A839, created 2005-02-02 (main key ID F795F021)
Enter passphrase: <-- ここでパスフレーズを入力する
gpg: encrypted with 2048-bit ELG-E key, ID CC09A839, created 2005-02-02
"GnuPG Taro <gnupg.taro@example.example>"
.... ここに復号化された内容が出力される。
ファイルに保存したい場合は --output オプションを使って
gpg --output encrypted.txt --decrypt encrypted.txt.gpg
とするかリダイレクトを使って
gpg --decrypt encrypted.txt.gpg > encrypted.txt
とする。
スポンサード リンク
2005年2月2日 (水)
■ GnuPG の布教失敗

仕事で本社にパスワードを伝えるなければならなくなった。 メールで送るのはもちんまずいので、暗号化(必要ならば電子署名も)しなければ。
ちょうど以前 NaneyOrgWiki に GnuPG の Windows 版 (gnupg-w32) の簡単な使い方を書いたことがあった。1.2.0 の時に書いたものだったので最新の 1.4.0a で、動作確認・出力等の再ドキュメント化などをする。
で、あとちょっとまとめたらその文書のポインタを本社の担当に送って鍵ペアをまずは作成してもらって……ふとMewでメールをチェックすると……別のスタッフがパスワードをメーリングリストに流しているんやないけー。
タッチの差で間にあわなかったか。
- Linux 母艦ノート PC を使わずに仕事ができるかチャレンジ (2007-08-20)
- Mew と SSH (2004-04-23)
- Linux で入力して Windows で参照できるパスワード管理ツール ... (2006-12-31)
- Mew と GnuPG (2005-11-18)
- 普通の人向けに svnserve を立ち上げるか (2005-07-26)
■よく検索されるキーワード
perl(62) torrent(54) linux(48) 提案書(47) windows(43) 書き方(41) 使い方(29) アジェンダ(26) x31(25) 充電式カイロ(25) cvs(22) インストール(20) サンプル(20) thinkpad(19) アジェンダとは(19) f-01a(18) wiki(17) c#(16) 感想(16) カイロ(16) usb(16) java(16) 秋葉原(15) debian(15) ヨドバシカメラ(15) subversion(15) 壁紙(15) 作り方(15) 静電気(14) apache(14) グッズ(14) デロンギ(13) フリー(13) sh-01a(13) ganttproject(13) 修理(13) ssh(12) svn(12) ヨドバシ(12) truecrypt(12) ダイソー(11) 手帳(11) activeperl(11) ubuntu(11) ほぼ日手帳(11) firefox(10) mew(10) mp980(10) ドラマ(10) 日本語(10) n-01a(10) google(10) tc-1(10) 評判(10) ツール(10) djunit(9) cgi(9) 動画(9) mp3(9) オイルヒーター(9) docomo(9) rcs(9) 除去(9) centos(9) メモリ(9) エネループ(9) 設定(9) p-01a(9) tortoisesvn(9) 無印(8) ケース(8) 口コミ(8) ミノルタ(8) メール(8) インストーラ(8) 会議(8) xampp(8) 加湿器(8) af(7) 値段(7)■注目キーワード
購入 買った 発売日 フリー 無料 価格 値段 作り方 選び方 使い方 方法 設定 サンプル ダウンロード 限定 在庫 予約 穴場 比較 検証 レビュー 感想 評価 評判 使用感 使ってみた 口コミ 噂 最新 MP3 動画 意味 お薦め お勧め おすすめ 便利 Blog ブログ mixi 修理 デザインProcess Time: 15.475659s / load averages: 0.33, 0.20, 0.17
nDiki by WATANABE Yoshimasa (profile)
Powered by DiKicker
Base theme by Nana (for tDiary)



スポンサード リンク