如何更改 GPG 的密码/密码提示文本

发布于 2025-01-16 15:58:13 字数 309 浏览 2 评论 0原文

在 GPG 中,当我们进行加密时

 gpg --cipher-algo AES256 --symmetric ./.abcd.csv

,它会打开一个提示

输入密码

我们也可以更改它

输入 xyz 的密码:

< img src="https://i.sstatic.net/94Jlx.jpg" alt="在此处输入图像描述">

in GPG while we are doing encryption

 gpg --cipher-algo AES256 --symmetric ./.abcd.csv

It open a prompt

Enter Passphrase

Can we change that too

Enter Passphrase for xyz:

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

入怼 2025-01-23 15:58:13

gpg PIN 输入由外部程序或设备处理,因此没有通用方法来控制 PIN 的提示,除非您强制 gpg 进入批处理模式,并且强制 PIN 输入循环回调用者脚本,以便您可以完全控制它。

请注意,这存在安全问题,因为在控制 PIN 条目的同时,您还要对所有安全性负责,而 shell 脚本是处理 PIN 等秘密数据的最不安全的环境。

以下是控制 PIN 提示的方法。
(使用此功能之前请了解安全问题)

read -r -s -p 'Enter Passphrase for xyz: ' secret
gpg \
  --cipher-algo AES256 \
  --pinentry-mode loopback \
  --batch \
  --passphrase "$secret" \
  --symmetric \
  ./.abcd.csv
printf '\n'

The gpg PIN entry is handled by an external program or device, so there is no universal mean to control the prompt of a PIN, unless you force gpg into batch mode, and force PIN entry to loop back to the caller script, so you have full control of it.

Note that this is of questionable security, because while taking control of the pin entry, you are also responsible for all the security, and a shell script is the least secure environment to handle secret data like a PIN.

Here it is how you would control the PIN prompt.
(Know the security concerns before using this):

read -r -s -p 'Enter Passphrase for xyz: ' secret
gpg \
  --cipher-algo AES256 \
  --pinentry-mode loopback \
  --batch \
  --passphrase "$secret" \
  --symmetric \
  ./.abcd.csv
printf '\n'
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文