Home > Back-end >  How To Change password/passphrase prompt text of GPG
How To Change password/passphrase prompt text of GPG

Time:03-24

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

CodePudding user response:

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'
  • Related