We have an app that programatically decrypts gpg files withiout issue. It was moved from a Windows 2003 server to Windows 2008 server.
Now the automated decryption fails. Works fine from the command line but not when the program runs. I’ve tried a variety of different formats:
gpg --yes -output outputfilename --passphrase passphrase -decrypt gpgfilename
echo passphrase|gpg --output outputfilename --batch --passphrase-fd 0 --decrypt gpgfilename
gpg --batch --passphrase-file passphrasefilename --output outputfilename --decrypt gpgfilename
echo passphrase|gpg --yes --batch --passphrase-fd 0 -o outputfile -d o -d gpgfilename
All of them work from the command line, but none of them work when called programatically. No error message or prompt - it just fails.
What am I doing wrong?
Is your application running the command in the correct working directory? Or is the GPG executable in your windows path?
Yes to the application is running the command in the correct working directory. I have a small program with just the decryption command string in the working directory, running it from there to be sure.
Wouldn’t there be a problem running GPG from the command window in the working directory if the GPG executable was not in the windows path?
It is terribly tempting for me to simply say that your problem is because you are trusting Windows. But that (while possibly true) is not very helpful.
My first cut would be to check that it is executing under the same account when automated. If you are using scheduler, the default is to use the system account which may not be appropriate (or not without some extra setup anyway).
Next would be to check what environment is required. It is likely that environment variables, default folder, execution path (PATH int he environment), or some other easily fixed but difficult to detect difference is causing your problem.
I hope that DOES help.
I understand your temptation!
This gives us a clue about where to look next. Thanks for your help.