革命性GPG密钥管理:pinentry-touchid让macOS Touch ID秒解密码难题

革命性GPG密钥管理:pinentry-touchid让macOS Touch ID秒解密码难题

革命性GPG密钥管理:pinentry-touchid让macOS Touch ID秒解密码难题

【免费下载链接】pinentry-touchidCustom GPG pinentry program for macOS that allows using Touch ID for fetching the password from the macOS keychain.项目地址: https://gitcode.com/gh_mirrors/pi/pinentry-touchid

pinentry-touchid是一款专为macOS设计的自定义GPG密码输入程序,它允许用户利用Touch ID从macOS钥匙串中获取密码,彻底改变了传统GPG密钥的管理方式,让密码验证过程变得前所未有的快捷与安全。

🌟 亲眼见证Touch ID带来的便捷

🚀 工作原理大揭秘

pinentry-touchid与gpg-agent协同工作,通过以下规则提供密码:

  • 当钥匙串中找不到给定密钥的密码条目时,程序会回退到pinentry-mac程序获取密码。建议在对话框中取消勾选“保存到钥匙串”选项,以增强安全性。
  • 一旦找到密码条目,用户将看到Touch ID对话框,成功认证后,存储在钥匙串中的密码将返回给gpg-agent。
  • 若找到密码条目但在Touch ID成功认证后,该条目并非由pinentry-touchid程序“拥有”,则会显示常规密码输入框。这是macOS钥匙串强制执行的额外步骤。在该对话框中输入密码后点击“始终允许”,pinentry-touchid就能在无需额外输入密码的情况下访问密码条目,同时密码访问仍受Touch ID保护。

📥 简单三步完成安装

1️⃣ 安装前提条件

确保已安装以下工具:

  • gnupg
  • pinentry-mac

可通过运行echo GETPIN | pinentry命令检查是否能看到pinentry-mac的GUI提示。若未看到,可使用brew install pinentry-mac安装,并通过alias pinentry='pinentry-mac'设置别名。

2️⃣ Homebrew安装(推荐)

执行以下命令:

$ brew tap jorgelbg/tap $ brew install pinentry-touchid

Homebrew会显示后续步骤,包括修复符号链接、配置gpg-agent.conf文件、重新加载gpg-agent以及禁用pinentry-mac的“保存到钥匙串”选项等。

3️⃣ 手动安装
  • 从发布页面下载pinentry-touchid二进制文件。
  • ~/.gnupg/gpg-agent.conf中添加或替换pinentry-program /usr/local/bin/pinentry-touchid(可替换为二进制文件的实际存储路径)。
  • 运行pinentry-touchid -check检查默认PIN程序配置,若有错误可执行pinentry-touchid -fix自动修复符号链接。

🔑 手动添加GPG密钥密码到钥匙串

首先执行security find-generic-password -s 'GnuPG'检查pinentry-mac是否已使用钥匙串。若出现错误,需先配置pinentry-mac:

$ defaults write org.gpgtools.common UseKeychain -bool yes

确保~/.gnupg/gpg-agent.conf中的pinentry-program指向pinentry-mac,然后重启GPG Agent:

$ gpgconf --kill gpg-agent

使用echo 1234 | gpg -as -命令,在弹出的提示中勾选“保存到钥匙串”,并在可能出现的登录密码提示中选择“始终允许”。之后再次执行security find-generic-password -s 'GnuPG'应能看到钥匙串条目。

接着更新gpg-agent.conf,将pinentry-program指向pinentry-touchid的完整路径,重启GPG Agent,并建议执行defaults write org.gpgtools.common DisableKeychain -bool yes禁用pinentry-mac的钥匙串存储选项。

⚠️ 免责声明

本项目不会将密码/PIN存储在设备的安全飞地中,而是使用pinentry-mac(若可用)的普通钥匙串条目,或创建新的钥匙串条目。

✅ 已测试设备和系统版本

pinentry-touchid已在以下设备和macOS版本组合上测试通过:

  • MacBook Pro (15-inch, 2018),macOS Catalina - 10.15.7
  • MacBook Pro (15-inch, 2018),macOS Big Sur - 11.4, 11.5.0, 11.5.1
  • MacBook Pro (16-inch, Late 2019),macOS Big Sur - 11.4, 11.5.1
  • MacBook Pro (16-inch, Late 2021),macOS Monterey - 12.2

通过pinentry-touchid,macOS用户可以告别繁琐的密码输入,享受Touch ID带来的快速、安全的GPG密钥管理体验,让每一次密码验证都变得轻松高效。

【免费下载链接】pinentry-touchidCustom GPG pinentry program for macOS that allows using Touch ID for fetching the password from the macOS keychain.项目地址: https://gitcode.com/gh_mirrors/pi/pinentry-touchid

创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考