this is a extra element for clear the floated element
GnuPG使用手册
  • 12/31
  • 2008
基础知识 | Linux 4328 次查看
  参考资源:

  * gpg(1).

  * /usr/share/doc/gnupg/README.gz

  * GNU privacy handbook in /usr/share/doc/gnupg-doc/GNU_Privacy_Handbook/ (install gnupg-doc package)

  14.1 安装GnuPG

  # gpg --gen-key # 生成新key

  # gpg --gen-revoke my_user_ID # generate revoke key for my_user_ID

  # host -l pgp.net | grep www|less # 查找pgp keyservers

  目前,好的keyservers有:

  keyserver wwwkeys.eu.pgp.net

  keyserver wwwkeys.pgp.net

  必须注意不能创建2个以上的sub-keys,如果这样做了,pgp.net上的keyservers会废除(corrupt)你的key。使用新版的gnupg(>1.2.1-2)来处理这些废subkeys。参阅http://fortytwo.ch/gpg/subkeys。

  同样,在$HOME/.gnupg/options中只能指定一个keyserver。

  所以下面的配置将无法工作:

  keyserver search.keyserver.net

  keyserver pgp.ai.mit.edu

  14.2 使用GnuPG

  文件处理:

  $ gpg [options] command [args]

  $ gpg {--armor|-a} {--sign|-s} file # sign file into a text file.asc

  $ gpg --clearsign file # clear-sign message

  $ gpg --clearsign --not-dash-escaped patchfile # clear-sign patchfile

  $ gpg --verify file # verify clear-signed file

  $ gpg -o file.sig {-b|--detach-sig} file # create detached signature

  $ gpg --verify file.sig file # verify file with file.sig

  $ gpg -o crypt_file {--recipient|-r} name {--encrypt|-e} file

  # public-key encryption intended for name

  $ gpg -o crypt_file {--symmetric|-c} file # 对称加密

  $ gpg -o file --decrypt crypt_file # 解密

  14.3 管理GnuPG

  Key管理:

  $ gpg --edit-key user_ID # "help"获得帮助,交互式

  $ gpg -o file --exports # 将所有keys导出到file

  $ gpg --imports file # 从file导出所有keys

  $ gpg --send-keys user_ID # 将user_ID发送给keyserver

  $ gpg --recv-keys user_ID # 从keyserver接收user_ID的key

  $ gpg --list-keys user_ID # 列出user_ID的key

  $ gpg --list-sigs user_ID # 列出user_ID的sig.

  $ gpg --check-sigs user_ID # 检查user_ID的sig.

  $ gpg --fingerprint user_ID # 检查user_ID的fingerprint

  $ gpg --list-sigs | grep '^sig' | grep '[User id not found]' \

  | awk '{print $2}' | sort -u | xargs gpg --recv-keys # get unknown keys

  # 更新所有未知sigs.

  Trust代码:

  - 没指定任何ownertrust/还没进行计算。

  e Trust计算失败。

  q 没有足够的信息进行计算。

  n 该key不可信。

  m 最低限度的可信。

  f 完全可信。

  u 绝对可信。

  下面的操作将我的key“A8061F32”上载到多路keyserver:

  $ for xx in us es cz de dk uk ch net.uk earth.net.uk; \

  $ do gpg --keyserver wwwkeys.$xx.pgp.net --send-keys A8061F32; done

  14.4 在应用程序中使用GnuPG

  14.4.1 在Mutt中使用GnuPG

  在~/.muttrc中加入下列内容,将会自动启动一个低速的GnuPG,在index菜单输入`S'即可使用它。

  macro index S ":toggle pgp_verify_sig\n"

  set pgp_verify_sig=no

  14.4.2 在Vim中使用GnuPG

  将examples subdirectory下的vimgpg文件的内容加入到~/.vimrc就可以运行GnuPG了。