#1 必要な部品を集めよう

このガイドで登場するソフトウェアは自由なソフトウェアライセンスに基づいています。そのようなソフトは完全な透明性があり、誰でもコピーができ、自分だけのバーションを作ることもできます。そういう特徴があるため、フリーソフトウェアライセンスのソフト(短くフリーソフト)は(Windowsのような)プロプライエタリソフト、つまりは売っている会社だけが中身を知っているようなソフトよりよほど監視しにくいのです。詳しくはfsf.orgをご覧ください。

GNU/LinuxのオペレーティングシステムはほとんどにあらかじめGnuPGがインストールされているので、ダウンロードする必要はありません。でもGnuPGを設定する前に、デスクトップ用のメールプログラムをインストールしなければならないのです。うまい具合にほとんどのGnu/LinuxのディストリビューションではフリーソフトのThunderbirdというメールプログラムをインストールできます。ブラウザーを使ってもGmailのようなメールアカウントをアクセスできますが、Thunderbirdを始めとするメールプログラムはブラウザーよりも多機能です。

そういうメールプログラムがもうパソコンにインストールされているなら、1.Bに進んでください。

1.A メールプログラムに自分のメールアカウントを設定する(まだ設定済でない場合)

メールプログラムを起動し、ウィザードの指示に従ってメールアカウントを設定してください。

トラブル・シューティング

ウィザードとは何ですか?
ウィザードとは、パソコンで何かを設定するとかインストールするためのウィンドウが順番に表れるようになっているものす。「次へ」のボタンをクリックして、設定をしていきます。
私のメールプログラムではメールアカウントが見つからない、またはメールがダウンロードされません
インターネットを検索する前に、同じメールプログラムを使っている人に正しい設定方法をたずねることをお勧めします。

1.B Enigmail(エニグメール)プラグインをメールプログラムにインストール

メールプログラムのメニューの中から「アドイン」を選択してください。これはたいてい「ツール」というメニューの下にあります。必要な拡張機能を、左側のマークで選択します。すでにEnigmailが表示されていれば、すぐ次のステップは飛ばしてください。

表示されていなければ、上の検索バーを使って Enigmailを検索して、プラグインをインストールしてください。インストールが完了したら、メールプログラムを再起動してください。

トラブル・シューティング

メニューが見つかりません。
メニューが横棒3本で表示されるメールプログラムもたくさんあります。

#2 自分だけの鍵を作る

GnuPGシステムを使うためには、公開鍵と秘密鍵が必要です。合わせてキーペアといいます。どちらの鍵もランダムに生成された文字や数字の長い並びで、あなた専用のものです。そして公開鍵と秘密鍵とは特別な数学的な関数で関連づけられています。

公開鍵は、キーサーバーというオンラインディレクトリーに保存されていて、誰でも取り出すことができます。この点で普通の金物の鍵とはだいぶ違います。あなたに暗号メールを送ろうとする人は、まず公開鍵をダウンロードし、それとGnuPGを使ってあなたへの電子メールを暗号化し、それから送信します。そういう意味でキーサーバーは電話帳のようなものだと思っていただいてよいでしょう。あなたへ暗号化メールを送ろうとする人は、電話番号を調べる代わりにあなたの公開鍵を調べるわけです。

もう片方の秘密鍵は金物の鍵に近い働きをするので、自分のコンピューターにしっかり保存しておくべきものです。GnuPGと自分だけの秘密鍵を使って、送られてきた暗号化メールを解読できます。

2.A 自分専用のキーペアを作る

電子メールプログラムのメニューでOpenPGP→設定ウィザードを選択してください。ウィザードの始めの方のウィンドウに現れる説明は読まなくてもいいですが、後のウィンドウの説明は重要です。

2番目の「サインする」または「署名する」というウィンドウでは、「いいえ、むしろ宛先別のルールによって署名が必要なメールを作成する」を選択してください。

「キーを作る」という名前のウィンドウになるまでは既定(デフォルト)の設定を選んでください。

「キーを作る」という名前のウィンドウでは、なるべく強いパスワードを入力してください。つまり、長さが12文字以上で、数字や句読点や大文字・小文字のどれもが1個以上は使われるのがよいパスワードです。パスワードは忘れないでください。ここでの努力がみんな無駄になってしまいますから。

次の「キーを作る」というウィンドウでは計算が終わるまでちょっと時間がかかります。計算をしている間は映画を見るとかウェブを見るとか、とにかくパソコンを使うほどキーの生成が速く進みます。

「OpenPGP完成」というウィンドウが現れたら「電子証明書作成」を選択して、パソコン内の確実なフォルダに保存してください。それにはホームに「鍵撤回証明書」といったフォルダを作ってそこへ保存することをおすすめします。電子証明書作成でもっと詳しいことに興味があれば5章を参照してください。ウィザードには鍵撤回証明書を外付けのデバイスに保存するように表示が出されますが、その作業はあとにしましょう。

トラブル・シューティング

OpenPGPメニューが見つかりません。
メニューが横棒3本で表示されメールプログラムもたくさんあります。OpenPGPが「ツール」というメニューの中に入っていることもあります。
ウィザードに「GnuPGが見つからない」と表示されました。
いつもインストールに使うプログラムを起動して、GnuPGを検索して、インストールしてください。インストールしたらOpenPGP→設定ウィザードを選択して、Enigmailの設定ウィザードを再起動してください。

2.B 公開鍵をキーサーバーにアップロードする

メールプログラムのメニューでOpenPGP→キー管理を選択してください。

生成した公開鍵を右クリックして、「公開鍵をキーサーバーにアップロード」を選んでください。ポップアップ表示される既定(デフォルト)のキーサーバーをそのまま使いましょう。

これであなたへ暗号化されたメールを送ろうとする人が、あなたの公開鍵をインターネットからダウンロードできるようになりました。アップロードするときにキーサーバーがいくつか表示されていてその中から選択できるのですが、実はどれも互いにコピーをとっています。つまりどのキーサーバーへアップロードしても同じ結果になるのです。ただ、公開鍵をアップロードすると他のサーバーへコピーされるまでに数時間かかる場合もあります。

トラブル・シューティング

実行中のバー表示が最後までいかない
まずアップロードのポップアップを閉じ、インターネットに接続していることを再確認した上で、もう一度開始させます。それでもだめだったら、違うキーサーバーを選択してください。
私のキーがリストにありません。
「デフォルトのキーを表示」をチェックしてください。

GnuPGとかOpenPGPとは?

プログラムの名前がGnuPGですが、メールプログラムのメニューにはOpenPGPと表示されます。紛らわしいのですが、おおざっぱにはGnuPG、GPG、GNU Privacy Guard、OpenPGP、PGPはどれも似たようなものです。もちろん正確にはそれぞれ別のものです。

#3 暗号化を使ってみましょう!

「Edward」という名前のプログラムにメールを送って、暗号化の使い方を練習してみましょう。次の説明は本物の人間にメールするときのステップとほぼ同じやり方ですが、違う部分だけはそのように書いてあります。

3.A Edwardに公開鍵を送る

だれか人にメールするときは、このステップは不要です。電子メールプログラムのメニューでOpenPGP→キー管理を選択してください。表示されるリストに自分の鍵が表示されるはずです。そのキーを右クリックして、コンテキストメニューの「電子メールで公開鍵を送る」を選択してください。新規作成ボタンを押したときと同様に新しいメールの作成ウィンドウが開きます。

宛先フィールドに「edward-ja@fsf.org」と入力します。メールの件名フイールドと本文にもそれぞれ何か一言を書いて、メールを送信してください。

Edwardから自動返信が届くまで1分から3分ぐらいかかることもあります。待っている間、下記の「GnuPGを上手く使う」のセクションを見てもいいでしょう。Edwardから返事が届いたら、次のステップに進みましょう。ここからは人間にメールを送るときと同じ手順です。

3.B テストの暗号化メールを送信

電子メールのプログラムで「edward-ja@fsf.org」に宛てたメールを新規作成してください。件名を「暗号化テスト」とか、そんなものにして、メールの本文にも何か適当な内容を書きます。まだ送信しないでください。

新規作成ウィンドウの右下の鍵のアイコンをクリックします。そのアイコンが黄色に変わっているはずです。このアイコンをクリックすると、前のステップでダウンロードした公開鍵を使ってEnigmailにメールを暗号化させます。

鍵アイコンのとなりに鉛筆アイコンがあります。これはメールに特別な、唯一の署名を添付するためのものです。この署名はあなたの秘密鍵から生成されますが、暗号化とはまだ別なものです。このガイドではまだ使わないことにします。

では、送信をクリックしてください。すると「宛先が無効か、信頼できないか、見つかりません。」というポップアップが開きます。

Edwardへのメールを暗号化するためにはEdwardの公開鍵が必要だったのです。ではEnigmailを使って公開鍵をダウンロードしましょう。「まだダウンロードしていない鍵をダウンロードする」をクリックするとポップアップが開きますから、既定(デフォルト)のキーサーバーを選んでください。キーが表示されたら、最初の(キーIDの4C11BBB2の)キーにチェックを付けて、OKを選択してください。次のポップアップもOKをクリックしてください。

「宛先が無効か、信頼できないか、見つかりません。」というポップアップに戻ってきたはずです。そこでEdwardのキーを選択し、OKをクリックします。もしメッセージが自動的に送信されなければ、送信をクリックしてください。

トラブル・シューティング

EnigmailでEdwardの公開鍵が見つかりません。
クリックした後で表示されたポップアップを全部閉じてください。インターネットに接続していることを再確認して、もう一回試みてください。それでもだめだったら、別のキーサーバーを選んでダウンロードしてみてください。

注意: セキュリティーのヒント

メールを暗号化しても、メールの件名は暗号化されません。そこにはプライベートな情報を入力しないほうがいいのです。宛先も、発信人のアドレスも暗号化されませんので、監視システムに読まれる可能性があります。添付文書を送るときには、それも暗号化するかどうかがたずねられます。

メールの新規作成ウィンドウで、書き始める前に鍵アイコンをクリックしておくのがよいでしょう。そうせずに書き始めると、暗号化されないままで第三者も読める状態の下書きがメールサーバーに保存されてしまうかもしれないからです。

Step 3.c Receive a response

When Adele receives your email, she will use her private key to decrypt it, then fetch your public key from a keyserver and use it to encrypt a response to you.

Since you encrypted this email with Adele's public key, Adele's private key is required to decrypt it. Adele is the only one with her private key, so no one except her — not even you — can decrypt it.

It may take two or three minutes for Adele to respond. In the meantime, you might want to skip ahead and check out the Use it Well section of this guide.

When you receive Adele's email and open it, Enigmail will automatically detect that it is encrypted with your public key, and then it will use your private key to decrypt it.

Notice the bar that Enigmail shows you above the message, with information about the status of Adele's key.

#4 Learn the Web of Trust

Email encryption is a powerful technology, but it has a weakness; it requires a way to verify that a person's public key is actually theirs. Otherwise, there would be no way to stop an attacker from making an email address with your friend's name, creating keys to go with it and impersonating your friend. That's why the free software programmers that developed email encryption created keysigning and the Web of Trust.

When you sign someone's key, you are publicly saying that you trust that it does belong to them and not an impostor. People who use your public key can see the number of signatures it has. Once you've used GnuPG for a long time, you may have hundreds of signatures. The Web of Trust is the constellation of all GnuPG users, connected to each other by chains of trust expressed through signatures, forming a giant network. The more signatures a key has, and the more signatures its signers' keys have, the more trustworthy that key is.

People's public keys are usually identified by their key fingerprint, which is a string of digits like DD878C06E8C2BEDDD4A440D3E573346992AB3FF7 (for Adele's key). You can see the fingerprint for your public key, and other public keys saved on your computer, by going to OpenPGP → Key Management in your email program's menu, then right clicking on the key and choosing Key Properties. It's good practice to share your fingerprint wherever you share your email address, so that so that people can double-check that they have the correct public key when they download yours from a keyserver.

You may also see public keys referred to by their key ID, which is simply the last 8 digits of the fingerprint, like 92AB3FF7 for Adele. The key ID is visible directly from the Key Management Window. This key ID is like a person's first name (it is a useful shorthand but may not be unique to a given key), whereas the fingerprint actually identifies the key uniquely without the possibility of confusion. If you only have the key ID, you can still look up the key (as well as its fingerprint), like you did in Step 3, but if multiple options appear, you'll need the fingerprint of the person to whom are trying to communicate to verify which one to use.

Step 4.a Sign a key

In your email program's menu, go to OpenPGP → Key Management.

Right click on Adele's public key and select Sign Key from the context menu.

In the window that pops up, select "I will not answer" and click OK.

In your email program's menu, go to OpenPGP → Key Management → Keyserver → Upload Public Keys and hit OK.

You've just effectively said "I trust that Adele's public key actually belongs to Adele." This doesn't mean much because Adele isn't a real person, but it's good practice.

Important: check people's identification before signing their keys

Before signing a real person's key, always make sure it actually belongs to them, and that they are who they say they are. Ask them to show you their ID (unless you trust them very highly) and their public key fingerprint -- not just the shorter public key ID, which could refer to another key as well. In Enigmail, answer honestly in the window that pops up and asks "How carefully have you verified that the key you are about to sign actually belongs to the person(s) named above?".

#5 Use it well

Everyone uses GnuPG a little differently, but it's important to follow some basic practices to keep your email secure. Not following them, you risk the privacy of the people you communicate with, as well as your own, and damage the Web of Trust.

When should I encrypt?

The more you can encrypt your messages, the better. If you only encrypt emails occasionally, each encrypted message could raise a red flag for surveillance systems. If all or most of your email is encrypted, people doing surveillance won't know where to start.

That's not to say that only encrypting some of your email isn't helpful -- it's a great start and it makes bulk surveillance more difficult.

Important: Be wary of invalid keys

GnuPG makes email safer, but it's still important to watch out for invalid keys, which might have fallen into the wrong hands. Email encrypted with invalid keys might be readable by surveillance programs.

In your email program, go back to the second email that Adele sent you. Because Adele encrypted it with your public key, it will have a message from OpenPGP at the top, which most likely says "OpenPGP: Part of this message encrypted."

When using GnuPG, make a habit of glancing at that bar. The program will warn you there if you get an email encrypted with a key that can't be trusted.

Copy your revocation certificate to somewhere safe

Remember when you created your keys and saved the revocation certificate that GnuPG made? It's time to copy that certificate onto the safest digital storage that you have -- the ideal thing is a flash drive, disk, or hard drive stored in a safe place in your home.

If your private key ever gets lost or stolen, you'll need this certificate file to let people know that you are no longer using that keypair.

Important: act swiftly if someone gets your private key

If you lose your private key or someone else gets ahold of it (say, by stealing or cracking your computer), it's important to revoke it immediately before someone else uses it to read your encrypted email. This guide doesn't cover how to revoke a key, but you can follow the instructions on the GnuPG site. After you're done revoking, send an email to everyone with whom you usually use your key to make sure they know.