GPG命令速查
密钥生成、导入导出、加密解密、签名验签、密钥服务器与信任、智能卡与 SSH、备份迁移与报错排查等 184 条命令
共 184 条命令 · 11 类场景 · 点击右侧图标可复制
| 命令 / 片段 | 说明 | 复制 |
|---|---|---|
gpg --version | 查看版本、支持的算法与默认密钥目录 | |
gpg --help | 常用参数摘要 | |
gpg --dump-options | 导出全部可用参数,查生僻选项用 | |
apt install gnupg | Debian/Ubuntu 安装 | |
yum install gnupg2 | RHEL/CentOS 系安装,包名是 gnupg2 | |
brew install gnupg pinentry-mac | macOS 安装,pinentry 用于口令弹窗 | |
apt install gnupg2 scdaemon pcscd | 配智能卡时需要 scdaemon 与 pcscd | |
gpgconf --list-dirs | 查看 homedir、socket、配置文件的真实路径 | |
gpg --homedir /data/.gnupg --list-keys | 指定独立密钥目录,多环境隔离 | |
gpg --with-colons --list-keys | 机器可读输出,脚本解析用 | |
gpg --batch --yes | 非交互前缀,覆盖已有文件不询问 | |
GNUPGHOME=/data/.gnupg gpg --list-keys | 用环境变量切换密钥目录,CI 常用 | |
gpg --use-agent | 启用 agent 管理私钥口令缓存 |
| 命令 / 片段 | 说明 | 复制 |
|---|---|---|
gpg --full-generate-key | 交互式生成,可选算法、长度、有效期 | |
gpg --generate-key --expert | 专家模式,可自定义密钥用途组合 | |
gpg --quick-generate-key "Zhang San <zs@example.com>" rsa4096 sign 2y | 一条命令生成签名主密钥,2 年有效 | |
gpg --quick-generate-key "ops@example.com" ed25519 cert 0 | 生成长期有效的认证主密钥,日常只作签发用 | |
gpg --quick-add-key <fpr> cv25519 encr 2y | 为已有主密钥添加加密子密钥 | |
gpg --quick-add-key <fpr> rsa2048 sign 2y | 添加签名子密钥,主密钥尽量离线 | |
gpg --quick-add-key <fpr> ed25519 auth 2y | 添加认证子密钥,用于 SSH 场景 | |
gpg --quick-set-expire <fpr> 3y | 延长主密钥有效期,不必重签 | |
gpg --quick-set-expire <fpr> 3y "*" | 同时延长所有子密钥有效期 | |
gpg --quick-revoke-uid <fpr> "old@example.com" | 作废某个 UID,邮箱不再可用时清理 | |
gpg --quick-set-primary-uid <fpr> "new@example.com" | 切换主 UID,影响默认显示与签名主体 | |
%echo 生成运维密钥
Key-Type: RSA
Key-Length: 4096
Subkey-Type: RSA
Subkey-Length: 4096
Name-Real: Ops Team
Name-Email: ops@example.com
Expire-Date: 2y
Passphrase: ChangeMe123
%commit
%echo done | batch 参数文件,脚本化生成密钥 | |
gpg --batch --generate-key params.txt | 按参数文件生成,CI 与批量部署常用 | |
%no-protection | 参数文件中替代 Passphrase,生成无口令私钥(仅限受限环境) | |
gpg --gen-revoke <fpr> > revoke.asc | 提前生成吊销证书,离线保存,出事才用 | |
建议主密钥只具备 cert 能力 | 日常签名加密交给子密钥,主密钥离线保管 | |
gpg --list-secret-keys --with-keygrip | 查看 keygrip,智能卡与 agent 排障用 |
| 命令 / 片段 | 说明 | 复制 |
|---|---|---|
gpg --list-keys | 列出公钥环,缩写 -k | |
gpg --list-secret-keys | 列出私钥,缩写 -K | |
gpg -K --keyid-format long | 用长 KeyID 显示,避免短 ID 冲突 | |
gpg --fingerprint | 显示完整指纹,核对密钥必须用它 | |
gpg --fingerprint --with-subkey-fingerprint | 连子密钥指纹一起显示 | |
gpg --list-sigs | 查看密钥上的签名关系 | |
gpg --check-sigs | 校验签名有效性,评估密钥可信度 | |
gpg --export -a "zs@example.com" > pub.asc | 导出公钥为 ASCII 文本,便于分发 | |
gpg --export --armor --export-options export-minimal <fpr> | 导出最精简公钥,去掉多余签名 | |
gpg --export-secret-keys -a <fpr> > sec.asc | 导出私钥,务必加密存放并及时删除临时文件 | |
gpg --export-secret-subkeys -a <fpr> > subsec.asc | 只导出子密钥,主密钥继续离线 | |
gpg --import pub.asc | 导入公钥 | |
gpg --import sec.asc | 导入私钥,随后用 -K 确认 | |
gpg --import-options restore --import backup.gpg | 恢复备份时保留原有效期与信任状态 | |
gpg --export-ownertrust > ownertrust.txt | 导出信任数据库,迁移必备 | |
gpg --import-ownertrust ownertrust.txt | 恢复信任设置,否则会出现不信任告警 | |
gpg --delete-keys <fpr> | 删除公钥,需先确认没有依赖 | |
gpg --delete-secret-keys <fpr> | 删除私钥,会二次确认 | |
gpg --delete-secret-and-public-key <fpr> | 公私钥一起删除 | |
gpg --edit-key <fpr> | 进入交互菜单,管理 UID、子密钥、信任 | |
gpg --list-packets pub.asc | 查看报文结构,确认文件是否真的是 OpenPGP 数据 |
| 命令 / 片段 | 说明 | 复制 |
|---|---|---|
gpg -e -r zs@example.com file.tar.gz | 用对方公钥加密,生成 file.tar.gz.gpg | |
gpg --encrypt --recipient <fpr> --armor file.txt | 指定指纹并输出 ASCII 文本,适合贴邮件 | |
gpg -e -r a@example.com -r b@example.com file | 多接收者加密,任一私钥都能解 | |
gpg -e -r <fpr> --throw-keyids file | 隐藏接收者 KeyID,减少元信息泄露 | |
gpg -e -u <my-fpr> -r <peer-fpr> file | 先签名后加密,对方可确认来源 | |
gpg -d file.gpg | 解密并输出到标准输出 | |
gpg -d -o out.txt file.gpg | 解密到指定文件 | |
gpg --decrypt --batch --passphrase-file pass.txt file.gpg | 非交互解密,口令从文件读取 | |
gpg -c file.tar.gz | 对称加密,只用口令,不需要密钥对 | |
gpg -c --cipher-algo AES256 file.tar.gz | 指定 AES-256,兼容性与强度平衡 | |
gpg -c -a file.tar.gz | 对称加密并输出 ASCII,便于传输 | |
gpg -d file.tar.gz.gpg > file.tar.gz | 对称解密,重定向得到原文件 | |
tar czf - /data | gpg -c -o data.tgz.gpg | 打包管道直接加密,不落中间明文 | |
gpg -d data.tgz.gpg | tar xzf - -C /restore | 解密管道直接解包 | |
gpg -e -r <fpr> -z 0 file | 关闭压缩,规避压缩侧信道并加快速度 | |
gpg --list-only --list-packets file.gpg | 只看加密包信息,确认接收者是否正确 | |
gpg -e -r <fpr> --trust-model always file | 跳过信任检查,脚本场景可用但要清楚风险 | |
解密失败先确认自己是接收者 | 用 --list-packets 看 keyid,再核对本地私钥 |
| 命令 / 片段 | 说明 | 复制 |
|---|---|---|
gpg --detach-sign -o file.sig file | 生成独立签名,原文件保持不变 | |
gpg --detach-sign --armor -o file.asc file | ASCII 独立签名,便于随包发布 | |
gpg --verify file.sig file | 用签名与原文件验签,输出 Good signature 即可信 | |
gpg --verify file.asc | 签名与原文件合一时只传一个参数 | |
gpg --clearsign -o msg.asc msg.txt | 明文签名,内容仍可读,适合邮件与公告 | |
gpg --sign -o file.gpg file | 签名并压缩成二进制,接收方需 -d 还原 | |
gpg --sign --armor -o file.asc file | 签名并输出 ASCII 文本 | |
gpg --decrypt file.gpg | 还原签名文件,同时验证签名 | |
gpg --verify --status-fd 1 file.sig file | 输出机器可解析的状态行,脚本判断 GOODSIG | |
gpg --list-packets file.sig | 查看签名包信息与摘要算法 | |
gpg --local-user <fpr> --detach-sign -o file.sig file | 多密钥时显式指定签名密钥 | |
gpg --verify --trust-model always file.sig file | 跳过信任度检查,只验证数学有效性 | |
git config --global user.signingkey <fpr> | 配置 Git 提交签名密钥 | |
git config --global commit.gpgsign true | 开启每次提交自动签名 | |
git log --show-signature -1 | 查看最近一次提交的签名状态 | |
git tag -s v1.0.0 -m "release 1.0.0" | 创建签名标签,发布制品时使用 | |
export GPG_TTY=$(tty) | 解决 git 提交时报 gpg failed to sign the data |
| 命令 / 片段 | 说明 | 复制 |
|---|---|---|
gpg --keyserver hkps://keys.openpgp.org --send-keys <fpr> | 上传公钥,hkps 走 443 端口更易通过防火墙 | |
gpg --keyserver hkps://keys.openpgp.org --recv-keys <keyid> | 按 KeyID 或指纹下载公钥 | |
gpg --keyserver hkps://keys.openpgp.org --search-keys zs@example.com | 按邮箱搜索公钥,注意核对指纹 | |
gpg --refresh-keys | 刷新本地公钥的签名与吊销状态 | |
gpg --locate-keys zs@example.com | 按 WKD/DANE 规则自动定位公钥 | |
gpg --auto-key-locate wkd,dane,keyserver --locate-keys zs@example.com | 指定自动定位顺序 | |
keyserver-options auto-key-retrieve | gpg.conf 配置:验签缺公钥时自动下载 | |
gpg --edit-key <fpr> | 进入交互,输入 trust 设置信任级别 | |
trust 级别 1 未知 / 2 从不 / 3 边缘 / 4 完全 / 5 绝对 | 只有绝对信任的密钥签过的公钥才自动可信 | |
gpg --check-trustdb | 检查信任数据库是否一致 | |
gpg --update-trustdb | 重建信任数据库 | |
gpg --export-ownertrust | 导出信任设置,迁移到新机器必须带上 | |
gpg --sign-key <fpr> | 给他人公钥签名,表达你确认过其身份 | |
指纹必须通过第二通道核对 | 邮件或网页拿到的指纹不可直接信,电话/当面确认最稳 |
| 命令 / 片段 | 说明 | 复制 |
|---|---|---|
gpg --card-status | 查看智能卡内密钥与剩余 PIN 次数 | |
gpg --card-edit | 进入卡管理菜单 | |
admin | 卡管理菜单内开启管理命令 | |
gpg --edit-card | 等价的新命令写法 | |
gpg --card-status --with-keygrip | 查看 keygrip,便于与私钥文件对应 | |
gpg --export-ssh-key <fpr> | 导出可用于 SSH 的公钥 | |
gpg --export-ssh-key -a <fpr> > id_gpg.pub | 保存为 authorized_keys 可用的格式 | |
gpg-agent --daemon | 手动启动 agent,通常由 gpg 自动拉起 | |
gpgconf --kill gpg-agent | 重启 agent 解决缓存口令异常 | |
gpgconf --reload gpg-agent | 重载 agent 配置 | |
gpgconf --kill all | 清理全部组件进程,锁库异常时用 | |
gpg --list-keys --with-keygrip | 配合 private-keys-v1.d 下的文件定位私钥 | |
echo "GETINFO version" | gpg-connect-agent | 直接与 agent 通信,排查协议问题 | |
enable-ssh-support | gpg-agent.conf 配置:开启 SSH 代理能力 | |
ssh-add -L | 查看 agent 提供的 SSH 公钥列表 | |
gpg --card-edit 内执行 passwd | 修改 PIN 或管理员 PIN |
| 命令 / 片段 | 说明 | 复制 |
|---|---|---|
~/.gnupg/ | 默认密钥目录,权限必须是 700 | |
chmod 700 ~/.gnupg && chmod 600 ~/.gnupg/* | 修掉 unsafe permissions 告警 | |
~/.gnupg/pubring.kbx | 公钥环文件(GnuPG 2.x) | |
~/.gnupg/trustdb.gpg | 信任数据库,迁移时要一起带 | |
~/.gnupg/private-keys-v1.d/ | 私钥实际存放目录,按 keygrip 命名 | |
~/.gnupg/gpg.conf | 主配置:密钥显示、算法偏好、自动取公钥 | |
~/.gnupg/gpg-agent.conf | agent 配置:缓存时长、pinentry、SSH 支持 | |
~/.gnupg/sshcontrol | 列出允许 agent 提供的 SSH 密钥 keygrip | |
keyid-format long | gpg.conf:显示长 KeyID | |
with-fingerprint | gpg.conf:列表时显示指纹 | |
personal-cipher-preferences AES256 AES192 | gpg.conf:对称算法偏好顺序 | |
cert-digest-algo SHA256 | gpg.conf:证书签名摘要算法 | |
no-emit-version | gpg.conf:签名不写入版本注释,减少信息泄露 | |
default-preference-list AES256 SHA512 ZLIB BZIP2 ZIP Uncompressed | gpg.conf:新密钥默认算法偏好 | |
gpgconf --list-dirs socketdir | 查看 socket 目录,容器挂载时要注意 | |
gpg --homedir /backup/.gnupg --list-keys | 直接读取备份目录,验证备份是否可用 |
| 命令 / 片段 | 说明 | 复制 |
|---|---|---|
gpg --export-secret-keys --armor <fpr> > backup-secret.asc | 备份私钥,导出后立即加密存储 | |
gpg --export --armor <fpr> > backup-pub.asc | 备份公钥 | |
gpg --export-ownertrust > ownertrust.txt | 备份信任设置,恢复时必带 | |
tar czf gnupg-backup.tgz ~/.gnupg | 整目录打包,含 trustdb 与 agent 配置 | |
gpg -c gnupg-backup.tgz | 备份文件再加一层对称加密 | |
gpg --import backup-secret.asc | 新机器恢复私钥 | |
gpg --import-ownertrust ownertrust.txt | 恢复信任状态,避免 no ultimately trusted keys | |
gpg --list-secret-keys --with-colons | grep "^sec" | 恢复后确认私钥已就位 | |
gpg --batch --import backup-secret.asc | 脚本化导入,避免交互卡住 | |
gpg --gen-revoke <fpr> > revoke.asc | 提前生成吊销证书并离线保存 | |
gpg --import revoke.asc | 导入吊销证书即完成吊销 | |
gpg --keyserver hkps://keys.openpgp.org --send-keys <fpr> | 吊销后上传,让他人刷新即可看到 | |
gpg --delete-secret-keys <fpr> && gpg --delete-keys <fpr> | 彻底清理旧密钥,先确认备份可用 | |
gpg --quick-set-expire <fpr> 2y | 到期前延期,避免签名突然失效 | |
gpg --list-packets backup-secret.asc | grep -i secret | 确认备份文件里确实含私钥 | |
私钥备份至少一份离线介质 | 纸质打印或离线加密盘,避免单点丢失 |
| 命令 / 片段 | 说明 | 复制 |
|---|---|---|
gpg --batch --yes --no-tty --import key.asc | CI 导入密钥的标准前缀 | |
gpg --batch --pinentry-mode loopback --passphrase "$PASS" --import key.asc | 带口令导入,避免弹窗 | |
gpg --batch --pinentry-mode loopback --passphrase-file pass.txt -d secret.gpg | 无交互解密 | |
echo "$PASSPHRASE" | gpg --batch --passphrase-fd 0 -d file.gpg | 用标准输入传口令,避免出现在进程列表 | |
gpg --batch --yes --pinentry-mode loopback --passphrase "$PASS" -c -o out.gpg in.txt | 无交互对称加密 | |
gpg --status-fd 2 --verify file.sig file | 把状态行输出到 stderr,便于脚本捕获 | |
gpg --verify file.sig file && echo OK | 验签失败返回非零,可直接做流水线门禁 | |
gpg --list-keys --with-colons | awk -F: '/^pub/ {print $5}' | 提取全部 KeyID,做批量处理 | |
gpg --quiet --batch --import pub.asc 2>/dev/null | 静默导入,忽略已存在提示 | |
GNUPGHOME=$(mktemp -d) gpg --batch --generate-key params.txt | 临时密钥目录,构建完即丢弃 | |
%no-protection 后可在 CI 无口令使用 | 仅限短期构建密钥,且要限制访问范围 | |
gpg --batch --yes --delete-secret-and-public-key <fpr> | 流水线结束时清理密钥 | |
ansible-vault / sops 可与 GPG 配合 | sops 用 GPG 收件人管理密文,非常适合配置加密 |
| 命令 / 片段 | 说明 | 复制 |
|---|---|---|
gpg: no valid OpenPGP data found | 文件不是密钥,常见于把网页当 asc 下载了 | |
gpg: cannot open /dev/tty | 非交互环境,加 --batch --no-tty 或 loopback | |
gpg: decryption failed: No secret key | 私钥未导入,或不是该报文的接收者 | |
gpg: public key decryption failed: No passphrase given | 缺口令,用 --pinentry-mode loopback 配合 passphrase | |
gpg: WARNING: unsafe permissions on homedir | chmod 700 ~/.gnupg,并检查子文件权限 | |
gpg: keyserver receive failed: No name | keyserver 地址写错或 DNS 失败 | |
gpg: keyserver send failed: Connection refused | 改用 hkps://keys.openpgp.org,走 443 端口 | |
gpg: no ultimately trusted keys found | 未导入 ownertrust 或未设置绝对信任 | |
gpg: there is no assurance this key belongs to the named user | 公钥未获信任,签名或设置 trust 后再用 | |
gpg: signing failed: Inappropriate ioctl for device | 无 tty 环境,设 GPG_TTY 或改 loopback 模式 | |
gpg: cannot lock database | 并发访问或权限问题,gpgconf --kill all 后重试 | |
gpg: CRC error | 文件损坏或传输被截断,重新获取 | |
gpg: invalid packet | 误把 ASCII 当二进制,或文件被编辑器改动 | |
gpg: no default secret key | 多密钥时用 -u 显式指定签名密钥 | |
gpg: agent_genkey failed: No pinentry | 缺 pinentry 程序,安装对应包或改 loopback | |
gpg: can not check signature: No public key | 先 recv-keys 或 import 对方公钥 | |
gpg: BAD signature | 文件被修改或传输损坏,签名无效 | |
gpg: uncompression failed | 压缩算法不支持或数据损坏,换最新版本重试 | |
git 报 gpg failed to sign the data | 设 export GPG_TTY=$(tty),并确认签名密钥存在 | |
gpg: Sorry, we are in batchmode | 批处理缺参数,补 --pinentry-mode loopback 与 passphrase | |
gpg: Note: secret key is NOT protected | 私钥无口令,仅限受限环境,建议改口令 | |
导入后仍提示找不到密钥 | 检查 GNUPGHOME 是否指向了另一个密钥目录 | |
容器内 gpg 卡住不动 | agent 无法启动,挂载 socketdir 或设 GNUPGHOME 到可写目录 |
运维常用组合
gpg --quick-generate-key "张三 <zs@example.com>" rsa4096 cert 2y → --quick-add-key 加密/签名子密钥 → --export -a > pub.asc → --send-keys 上传gpg --recv-keys 对方指纹 → 核对指纹 → gpg -e -r 对方邮箱 file.tar.gz → 通过任意通道发 .gpg 文件gpg --recv-keys 发布者 → gpg --verify pkg.tar.gz.sig pkg.tar.gz → 出现 Good signature 且指纹一致才可信git config user.signingkey 指纹 → git config commit.gpgsign true → export GPG_TTY=$(tty) → git log --show-signature旧机 --export-secret-keys -a > sec.asc 与 --export-ownertrust > trust.txt → 新机 import 两者 → -K 核对 → shred 清理临时文件把私钥放进 Secret → --batch --pinentry-mode loopback --import → echo $PASS | gpg --passphrase-fd 0 -d config.gpg → 用完删除密钥实战要点
1. 主密钥只做认证
主密钥 cert 能力用于签发子密钥,日常签名加密交给子密钥,主密钥可离线保存
2. 指纹必须二次核对
KeyID 可能碰撞、网站可能被替换,只有指纹+第二通道确认才算真正验证
3. 提前生成吊销证书
私钥丢失时若无吊销证书,别人仍会认为该密钥有效,形成长期风险
4. 私钥备份要离线
导出 secret key 后立刻加密存放,临时文件用 shred 清理
5. 有效期别设永久
1-2 年有效期,到期前用 --quick-set-expire 延期,比永久密钥更安全
6. 自动化统一 loopback
CI 与脚本一律加 --batch --pinentry-mode loopback,并用 passphrase-fd 传口令
相关工具
Linux命令速查
文件、文本、权限、进程、网络、磁盘、systemd与防火墙等 Linux 常用命令速查手册
Docker命令速查
镜像、容器、网络、数据卷、Compose、Swarm、清理与排障等 Docker 常用命令速查手册
Nginx命令速查
服务管理、配置指令、反向代理、HTTPS、限流缓存、日志排查等 Nginx 常用命令速查手册
K8S命令速查
集群上下文、Pod调试、工作负载、Service与Ingress、存储、权限、排障等 kubectl 常用命令速查手册
Windows CMD命令速查
文件目录、网络诊断、进程服务、系统信息、用户权限、注册表、批处理等 Windows CMD 常用命令速查手册
systemctl服务管理速查
服务启停、开机自启、unit文件编写、日志查看、定时器、依赖分析与排障等 systemctl 命令速查手册
关于GPG命令速查
在线 GPG(GnuPG)命令速查手册,按安装与版本、密钥生成、查看与导入导出、加密与解密、签名与验签、密钥服务器与信任模型、智能卡与 SSH、配置目录与 gpg.conf、备份迁移与吊销、脚本与 CI 自动化、常见报错与排查等 11 类场景整理 180 余条常用命令与配置片段,每条附中文说明与可直接复制的写法,支持关键词搜索、分类折叠和一键复制,打开网页即可查阅。涵盖 gpg --version 与 --dump-options 与 gpgconf --list-dirs 与 --homedir 与 --with-colons 与 --batch/--yes、--full-generate-key 交互生成与 --quick-generate-key/--quick-add-key 与 --generate-key --expert 与 batch 参数文件 Key-Type/Key-Length/Subkey-Type/Name-Real/Name-Email/Expire-Date/Passphrase/%no-protection/%commit 与 --quick-set-expire 与 --gen-revoke、--list-keys/-k 与 --list-secret-keys/-K 与 --fingerprint 与 --with-subkey-fingerprint 与 --list-sigs 与 --check-sigs 与 --export/-a 与 --export-options export-minimal 与 --export-secret-keys 与 --export-secret-subkeys 与 --import 与 --import-options restore 与 --export-ownertrust/--import-ownertrust 与 --delete-keys/--delete-secret-keys/--delete-secret-and-public-key、-e -r 加密与 --armor 与 --throw-keyids 与 -c 对称加密与 --cipher-algo AES256 与 -d 解密与 --passphrase-file 与 --pinentry-mode loopback 与 tar 管道加解密、--detach-sign 与 --clearsign 与 --verify 与 --status-fd 与 --list-packets 与 git commit.gpgsign/tag -s、keyserver hkps://keys.openpgp.org 的 --send-keys/--recv-keys/--search-keys/--refresh-keys 与 --keyserver-options auto-key-retrieve 与 --edit-key trust 与 --check-trustdb 与 --locate-keys 与 WKD/DANE、--card-status 与 --card-edit 与 --edit-card 与 gpg-agent 与 --export-ssh-key 与 enable-ssh-support/sshcontrol、~/.gnupg 下 gpg.conf/gpg-agent.conf/pubring.kbx/trustdb.gpg/private-keys-v1.d 与 chmod 700 与 gpgconf --kill all,以及 no valid OpenPGP data found、cannot open /dev/tty、decryption failed: No secret key、unsafe permissions on homedir、keyserver receive failed、no ultimately trusted keys found、there is no assurance this key belongs to the named user、signing failed: Inappropriate ioctl for device、cannot lock database、CRC error、no default secret key、agent_genkey failed: No pinentry、can't check signature: No public key、gpg failed to sign the data 等报错排查。适用于代码与制品签名校验、敏感文件加密传输、Git 提交签名、密钥与凭据管理、CI 自动化解密、YubiKey 智能卡与 SSH 认证、密钥备份迁移与合规审计,以及运维与安全工程师面试复习。
核心能力
- 涵盖 gpg --version 与 --dump-options 与 gpgconf --list-dirs 与 --homedir 与 --with-colons 与 --batch/--yes、--full-generate-key 交互生成与 --quick-generate-key/--quick-add-key 与 --generate-key --expert 与 batch 参数文件 Key-Type/Key-Length/Subkey-Type/Name-Real/Name-Email/Expire-Date/Passphrase/%no-protection/%commit 与 --quick-set-expire 与 --gen-revoke、--list-keys/-k 与 --list-secret-keys/-K 与 --fingerprint 与 --with-subkey-fingerprint 与 --list-sigs 与 --check-sigs 与 --export/-a 与 --export-options export-minimal 与 --export-secret-keys 与 --export-secret-subkeys 与 --import 与 --import-options restore 与 --export-ownertrust/--import-ownertrust 与 --delete-keys/--delete-secret-keys/--delete-secret-and-public-key、-e -r 加密与 --armor 与 --throw-keyids 与 -c 对称加密与 --cipher-algo AES256 与 -d 解密与 --passphrase-file 与 --pinentry-mode loopback 与 tar 管道加解密、--detach-sign 与 --clearsign 与 --verify 与 --status-fd 与 --list-packets 与 git commit.gpgsign/tag -s、keyserver hkps://keys.openpgp.org 的 --send-keys/--recv-keys/--search-keys/--refresh-keys 与 --keyserver-options auto-key-retrieve 与 --edit-key trust 与 --check-trustdb 与 --locate-keys 与 WKD/DANE、--card-status 与 --card-edit 与 --edit-card 与 gpg-agent 与 --export-ssh-key 与 enable-ssh-support/sshcontrol、~/.gnupg 下 gpg.conf/gpg-agent.conf/pubring.kbx/trustdb.gpg/private-keys-v1.d 与 chmod 700 与 gpgconf --kill all,以及 no valid OpenPGP data found、cannot open /dev/tty、decryption failed: No secret key、unsafe permissions on homedir、keyserver receive failed、no ultimately trusted keys found、there is no assurance this key belongs to the named user、signing failed: Inappropriate ioctl for device、cannot lock database、CRC error、no default secret key、agent_genkey failed: No pinentry、can't check signature: No public key、gpg failed to sign the data 等报错排查
适用场景
适用于代码与制品签名校验、敏感文件加密传输、Git 提交签名、密钥与凭据管理、CI 自动化解密、YubiKey 智能卡与 SSH 认证、密钥备份迁移与合规审计,以及运维与安全工程师面试复习。GPG命令速查全程在浏览器中完成,无需安装插件,可放心用于日常办公与排障。
常见问题
- GPG命令速查是免费的吗?需要注册或安装吗?
- GPG命令速查完全免费,无需注册、无需下载安装任何软件,用浏览器打开网页即可直接使用,也不限制使用次数。
- GPG命令速查支持哪些功能?
- 涵盖 gpg --version 与 --dump-options 与 gpgconf --list-dirs 与 --homedir 与 --with-colons 与 --batch/--yes、--full-generate-key 交互生成与 --quick-generate-key/--quick-add-key 与 --generate-key --expert 与 batch 参数文件 Key-Type/Key-Length/Subkey-Type/Name-Real/Name-Email/Expire-Date/Passphrase/%no-protection/%commit 与 --quick-set-expire 与 --gen-revoke、--list-keys/-k 与 --list-secret-keys/-K 与 --fingerprint 与 --with-subkey-fingerprint 与 --list-sigs 与 --check-sigs 与 --export/-a 与 --export-options export-minimal 与 --export-secret-keys 与 --export-secret-subkeys 与 --import 与 --import-options restore 与 --export-ownertrust/--import-ownertrust 与 --delete-keys/--delete-secret-keys/--delete-secret-and-public-key、-e -r 加密与 --armor 与 --throw-keyids 与 -c 对称加密与 --cipher-algo AES256 与 -d 解密与 --passphrase-file 与 --pinentry-mode loopback 与 tar 管道加解密、--detach-sign 与 --clearsign 与 --verify 与 --status-fd 与 --list-packets 与 git commit.gpgsign/tag -s、keyserver hkps://keys.openpgp.org 的 --send-keys/--recv-keys/--search-keys/--refresh-keys 与 --keyserver-options auto-key-retrieve 与 --edit-key trust 与 --check-trustdb 与 --locate-keys 与 WKD/DANE、--card-status 与 --card-edit 与 --edit-card 与 gpg-agent 与 --export-ssh-key 与 enable-ssh-support/sshcontrol、~/.gnupg 下 gpg.conf/gpg-agent.conf/pubring.kbx/trustdb.gpg/private-keys-v1.d 与 chmod 700 与 gpgconf --kill all,以及 no valid OpenPGP data found、cannot open /dev/tty、decryption failed: No secret key、unsafe permissions on homedir、keyserver receive failed、no ultimately trusted keys found、there is no assurance this key belongs to the named user、signing failed: Inappropriate ioctl for device、cannot lock database、CRC error、no default secret key、agent_genkey failed: No pinentry、can't check signature: No public key、gpg failed to sign the data 等报错排查。
- GPG命令速查适合哪些场景使用?
- 适用于代码与制品签名校验、敏感文件加密传输、Git 提交签名、密钥与凭据管理、CI 自动化解密、YubiKey 智能卡与 SSH 认证、密钥备份迁移与合规审计,以及运维与安全工程师面试复习。