1

Using GnuPG one can symmetrically encrypt a file using:

gpg -c --cipher-algo TWOFISH --digest-algo SHA512 secret.txt 

and decrypt using:

gpg -d -o secret.txt secret.txt.gpg 

After running these commands a window pops up and asks for the password. I would like to run these commands out of a program using golangs 'exec' or pythons 'os.system'. How do I suppress this window and pass the password via command line? I couldn't find something like a --password option in the man pages.

Stein
  • 113
  • As far as I know, the window is created by the pinetry program. If you uninstall it you'll have a dialog directly in the shell. –  Jan 19 '15 at 08:57

1 Answers1

3

You have some choices:

echo "aqw" | gpg --batch --passphrase-fd 0 -d -o output.txt secret.txt.gpg

or

gpg --batch --passphrase "aqw" -d -o output.txt secret.txt.gpg

or

gpg --batch --passphrase-file passphrase.txt -d -o output.txt secret.txt.gpg

(if you don't want to write your passphrase into the commandline)