← 返回 CLI 目录 抓取的
GnuPG
$ gpg 基金会 高风险 GnuPG Project · 安全扫描与密钥管理 · GPL-3.0 · macos / linux / windows
gpg 深度嵌入在 Linux 包校验、提交签名与传统 OpenPGP 流程中。然而其有状态的 ~/.gnupg/ 密钥库、后台 gpg-agent 及图形/终端 pinentry 弹窗极易导致无头 Agent 阻塞,除非显式配置 --batch --yes --pinentry-mode loopback。
FCRS-1.0 综合评分
70 /100
可用但有局限
高置信度 (实测)
零摩擦安装命令
brew install gnupg CLI vs MCP 选型建议 仅 CLI 可用
密码学密钥环与签名校验必须严格留在本地 gpg 执行,严禁通过 MCP 代理私钥操作。
Agent 友好度体检单
本地探针实测证据 — 原生 JSON 输出
— 字段裁剪
✓ 无头非交互
— 支持 Dry-Run
— 只读模式开关
— 支持 NO_COLOR
— 自省/Schema 发现
— 官方 SKILL.md
实测版本
gpg (GnuPG) 2.5.21
冷启动耗时
679 ms
退出码 (help / 非法参数)
0 / 2
NO_COLOR 无色码污染 / 无 TTY 不挂起
Yes / Safe
抓取的 --help 摘要
gpg (GnuPG) 2.5.21
libgcrypt 1.12.2
Copyright (C) 2026 g10 Code GmbH
License GNU GPL-3.0-or-later <https://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Home: /Users/pcyan/.gnupg
Supported algorithms:
Pubkey: RSA, Kyber, ELG, DSA, ECDH, ECDSA, EDDSA
Cipher: IDEA, 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH,
CAMELLIA128, CAMELLIA192, CAMELLIA256
Hash: SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224
Compression: Uncompressed, ZIP, ZLIB, BZIP2
Syntax: gpg [options] [files]
Sign, check, encrypt or decrypt
Default operation depends on the input data
Commands:
-s, --sign make a signature
--clear-sign make a clear text signature
-b, --detach-sign make a detached signature
-e, --encrypt encrypt data
-c, --symmetric encryption only with symmetric cipher
-d, --decrypt decrypt data (default)
--verify verify a signature
-k, --list-keys list keys
--list-signatures list keys and signatures
--check-signatures list and check key signatures
--fingerprint list keys and fingerprints
-K, --list-secret-keys list secret keys
--generate-key generate a new key pair
--quick-generate-key quickly generate a new key pair
--quick-add-uid quickly add a new user-id
--quick-revoke-uid quickly revoke a user-id
--quick-set-expire quickly set a new expiration date
--full-generate-key full featured key pair generation
--generate-revocation generate a revocation certificate
--delete-keys remove keys from the public keyring
--delete-secret-keys remove keys from the secret keyring
--quick-sign-key quickly sign a key
--quick-lsign-key quickly sign a key locally
--quick-tsign-key quickly sign a key with a trust signature
--quick-revoke-sig quickly revoke a key signature
--sign-key sign a key
--lsign-key sign a key locally
--edit-key sign or edit a key
--change-passphrase change a passphrase
--export FCRS-1.0 六维评分拆解
Agent 友好度 14 / 25
不支持 --json(需解析 --with-colons),且若未调优 --batch 与 gpg-agent,极易因 pinentry 弹窗导致无头 Shell 卡死。
- Requires
--batchand--with-colons; prone topinentryhangs
安全与权限边界 16 / 25
有状态的 ~/.gnupg 同时管理低风险公钥验签与高风险私钥导出、删除和明文解密。
- Single keyring manages both public verify and destructive secret key ops
安装与运行摩擦 12 / 15
Linux 常见且支持 brew install gnupg,但各系统上的 gpg-agent 套接字和 pinentry 行为差异明显。
- Cross-platform packages with OS-specific
pinentryquirks
能力覆盖与边际价值 11 / 15
校验开源签名不可或缺,但新建自动化工作流用 age 或 cosign 体验好得多。
- Standard OpenPGP interoperability; heavy ergonomics
维护与来源背书 9 / 10
长期由 GnuPG 基金级团队维护,GPL-3.0 开源。
- Decades-long upstream maintenance
文档与可验证性 8 / 10
官方参考手册与 man 手册极其详尽,但参数体系庞杂晦涩。
- Detailed documentation at gnupg.org/documentation
安全边界、鉴权与放权指南
鉴权方式
本地配置文件 系统钥匙串
凭证存储位置
公私钥环、信任库(trustdb)与 agent 套接字保存在 ~/.gnupg/,口令短语缓存在 gpg-agent 中。
潜在副作用
只读查询 本地写入 远端写入 破坏性删除
费用与配额提示
100% 免费开源(GPL-3.0)。
可复制到 CLAUDE.md / AGENTS.md 的安全护栏
# GnuPG (gpg) Agent Rules - ALWAYS pass `--batch` (and `--pinentry-mode loopback` if non-interactive passphrase is needed) so `pinentry` never hangs waiting for a GUI/TTY prompt. - Never run `--export-secret-keys`, `--delete-secret-keys`, or decrypt secrets directly to stdout.
Agent 高频安全命令配方
只读查询(安全推荐)
以冒号分隔的机器可读格式列出公钥
gpg --batch --with-colons --list-keys
输出稳定的冒号分隔密钥记录,不触发交互提示。
只读校验发布包的分离式签名
gpg --batch --verify release.tar.gz.asc release.tar.gz
对照已导入公钥验证压缩包真实性。
核心优势
- + 校验开源软件
.asc/.sig发布签名的行业通用标准。 - +
--with-colons提供稳定、版本兼容的机器可读密钥环输出。
注意事项与踩坑点
- ! 交互式
pinentry对话框在无头 Agent 终端中经常挂起或失败。 - ! 有状态的
~/.gnupg/与gpg-agent机制比age更脆弱、更难排错。
已验证兼容的 Agent 宿主
Claude Code Codex CLI Gemini CLI