參考資料:
gpg(1)
.
/usr/share/doc/gnupg/README.gz
/usr/share/doc/gnupg-doc/GNU_Privacy_Handbook/
中的 GNU
privacy handbook (安裝 gnupg-doc
套件)
# gpg --gen-key # 產生新的 key # gpg --gen-revoke my_user_ID # 產生 my_user_ID 的廢止用 key # 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
檔案處理:
$ gpg [options] command [args] $ gpg {--armor|-a} {--sign|-s} file # 將 file 簽名,存至文字檔 file.asc $ gpg --clearsign file # clear-sign 訊息 $ gpg --clearsign --not-dash-escaped patchfile # clear-sign patchfile $ gpg --verify file # 驗證 clear-signed file $ gpg -o file.sig {-b|--detach-sig} file # 建立 detached 簽章 $ gpg --verify file.sig file # 用 file.sig 驗證 file $ 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 # 解密
Key 管理:
$ gpg --edit-key user_ID # "help",互動式的說明 $ gpg -o file --exports # 將所有的 key 匯出至 file $ gpg --imports file # 匯入 file 中所有的 key $ gpg --send-keys user_ID # 將 user_ID 的 key 傳送到 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 # 取得未知的 keys # 將所有未知的 sigs 更新 key 。
Trust code:
- No ownertrust assigned / not yet calculated. e 計算信任度失敗。 q 計算所需的資訊不足。 n 永不信任這把 key。 m Marginally trusted. f 完全信任 (Fully trusted)。 u 極度信任 (Ultimately trusted)。
下面的命令會將我的 key "A8061F32" 上傳至多個 key servers:
$ 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
在 ~/.muttrc
中加入下列的內容,則如果你在 index 選單中輸入
`S' 的話,將會自動啟動一個低速的 GnuPG。
macro index S ":toggle pgp_verify_sig\n" set pgp_verify_sig=no
將 examples subdirectory
中的
vimgpg
文件的內容加到 ~/.vimrc
就可以自然的執行
GnuPG。
Debian 參考手冊
1.07-2, 週日 四月 11 08:00:07 UTC 2004osamu@debian.org
wctang@csie.nctu.edu.tw