Verifying Passphrase in GPG
Hi all,
I've written a script which creates an encrypted file from a plain text file using the following string: Code:
gpg --passphrase supersecretpassword --cipher-algo AES256 --symmetric ~/password.txt Code:
gpg --batch --yes --passphrase supersecretpassword -o password.txt -d password.gpg &> /dev/null My problem here as that I want the script to throw an error when the entered passprhase (i.e the passphrase is entered manually) is wrong. I have no idea how I could get gpg to do the following: Code:
if [ passphrase is wrong ] Thanks |
Hi,
the did you check the exit code? Ie the value of $? after running gpg? Eg Code:
gpg --batch --yes .... PS. As an aside, from the gpg man page: Code:
--passphrase string |
Thank you very much Evo2! It worked! :D
|
Hi,
Quote:
However please note that what you are doing is quite insecure: any process running on your system will be able to see your passphrase. It is usually better to use something like gpg-agent or whatever keyring manager your desktop environment uses. Cheers, Evo2. |
Quote:
Cheers |
All times are GMT -5. The time now is 11:48 PM. |