1. 介绍
您可以在这篇指南中得到什么?
这篇指南假设您对公开金钥密码、加密、以及数位签章很熟悉。如果不是,请先阅读 GnuPG handbook 的第二章。
这篇指南将教导您如何安装 GnuPG、如何建立自己的钥匙对、如何将钥匙加入钥匙炼、如何将公开金钥放至金钥伺服器,以及如何 (签章/加密)/(验证/解密) 您传送/收到的讯息。您也会学到如何将本机电脑的档案加密,让别人不能随意阅读它们的内容。
安装需要的软体
最基本的,您必须先 emerge gnupg,如果您需要有个可以用 GnuPG 的邮件用户端,您可以使用 pine (emerge pinepgp)、mutt (emerge mutt)、 Mozilla/Netscape Mail、evolution (evolution 是以 GNOME 来模仿 Microsoft Outlook 的 MUA)、和 KDE 自己的 KMail (KMail 是 kdenetwork 套件的一部份)。
如果您使用 KDE,那么 Kgpg 应该会很讨人喜爱。这个小程式让您建立钥匙对、汇入 ASCII 钥匙、对汇入的钥匙签名、汇出钥匙、以及其他一些功能 (它没有将钥匙汇入金钥伺服器的功能,不过您会学到怎样从指令模式做这个动作)。
2. 产生您的金钥并且将它加入公开钥匙炼
建立您的金钥
要建立您的金钥,请执行 gpg --gen-key。您第一次执行的时候,它会建立几个目录;再执行一次即可建立钥匙:
代码 2.1: 钥匙产生的过程 |
#gpg --gen-key gpg (GnuPG) 1.0.7; Copyright (C) 2002 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. Please select what kind of key you want: (1) DSA and ElGamal (default) (2) DSA (sign only) (4) ElGamal (sign and encrypt) (5) RSA (sign only) Your selection? 1 |
您可以在这里选择金钥的种类。大部份的使用者会选预设的 DSA 和 ElGamal。然后是金钥的长度,记得数字越大越好,但是不要用超过 2048 bit 的 DSA/ElGamal 金钥。一般来说,1024 对加签/加密 e-mail 已经很够用了。
在长度之后,您要选金钥的保存期限。在这里越小越好,但是一般使用者可以选永不过期或一至二年的期限。
代码 2.2: 选择金钥长度 |
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) 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) 0 Key does not expire at all |
现在您可以输入一些有关个人的资讯。如果您想将公开金钥传送给别人,则您可以在这里使用真正的邮件位置。
代码 2.3: 输入个人资讯 |
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: John Doe Email address: john@nowhere.someplace.flick Comment: The Real John Doe You selected this USER-ID: "John Doe (The Real John Doe) <john@nowhere.someplace.flick>" Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? O You need a Passphrase to protect your secret key. Enter passphrase: |
现在输入两次您的钥匙密码。用个难被破解的密码是个好主意。如果某个人得到了您的私密金钥并且破解了您的密码,他就可以用您的名义签章,而且大家都会认为那真的是您签的名。
然后,GnuPG 会产生您的密码。移动滑鼠或在背景拨放 mp3 可以加速处理过程,因为它们可以制造随机的资料。
发表评论