Newbie can't get --passphrase option to work
rmcdorm at cobizfinancial.com
Fri May 12 16:15:51 CEST 2017
I was tasked with automating the decryption (and more) of files, so I've written a PowerShell program that does everything I need it to do, except that I can't get the decryption to decrypt without prompting for our passphrase. I'm using a default installation of GnuPG 2.1.19 on Windows 7 (it may go on a Win Server 2012 box for production).
In the program I'm passing the output and input filenames as parameters to a one-line batch file consisting of this command:
echo <mypassphrase>| "C:\Program Files (x86)\gnuPG\bin\gpg.exe" --batch --output %1 --passphrase-fd 0 --decrypt %2
I've also tried the -passphrase-file and -passphrase <mypassphrase> options with the same results: when the program runs I'm prompted to enter the passphrase.
I've done a thorough search for a solution for this, but haven't come up with much: a vague reference to a bug in 2.1.x that may have to do with it, and at the end of my day yesterday I came across someone who used the "--pinentry-mode loopback" option. Interestingly, when I add that to my command, it DOES decrypt one file without prompting me, but then inexplicably stops. (My program logic is fine, as without the -pinentry option, it prompts me once for each file and decrypts each file.) I haven't yet had time to investigate that option; it's my next action but I've literally been working on this for days now and needed to send out a plea for help!
I'm a total GPG newbie here, so, as they say on Reddit "Explain like I'm 5." Thanks!
This e-mail contains confidential information and is intended only for the
individual named. If you are not the named addressee, you should not
disseminate, distribute or copy this e-mail. Please notify the sender
immediately if you have received this e-mail by mistake and delete this
e-mail from your system. E-mail cannot be guaranteed to be secure or
error-free as information could be intercepted, corrupted, lost,
destroyed, arrive late or incomplete, or contain viruses. Neither the
sender nor CoBiz Financial and its subsidiaries accept liability for any
errors or omissions in the contents of this message which arise as a
result of e-mail transmission.
More information about the Gnupg-users