tldr/pages.zh/common/gpg.md

38 lines
1001 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

# gpg
> GNU Privacy Guard.
> 请参阅 `gpg2` 了解 GNU Privacy Guard 2.
> 更多信息:<https://gnupg.org>.
- 交互地创建 GPG 公钥和私钥:
`gpg --full-generate-key`
- 不加密,仅对 `doc.txt` 进行签名(生成 `doc.txt.asc`,格式为 ASCII 码形式):
`gpg --clearsign {{doc.txt}}`
- 为接收者 alice@example.com 和 bob@example.com 签名并加密 `doc.txt`(生成 `doc.txt.gpg`
`gpg --encrypt --sign --recipient {{alice@example.com}} --recipient {{bob@example.com}} {{doc.txt}}`
- 只用密码加密 `doc.txt`(生成 `doc.txt.gpg`
`gpg --symmetric {{doc.txt}}`
- 解密 `doc.txt.gpg`(输出到标准输出):
`gpg --decrypt {{doc.txt.gpg}}`
- 导入一个公钥:
`gpg --import {{public.gpg}}`
- 导出 alice@example.com 的公钥(输出到标准输出):
`gpg --export --armor {{alice@example.com}}`
- 导出 alice@example.com 的私钥(输出到标准输出):
`gpg --export-secret-keys --armor {{alice@example.com}}`