automated command line windows bypass passkey prompt

Our automation systems had to be updated to handle higher encryption levels.
We had gnupg 1.4.3 that ran fine at the command line, however I am at a loss on how to get gnupg 2.0.17(gpg4win 2.1.0) to work. No variation I have tried has been able to automatically provide the passkey, and the enter passkey prompt always comes up throwing a monkey wrench into the works…

echo “thepasskey” | gpg2.exe --passphrase-fd 0 -se -r File_Transfer_Services -u “XYZ” “e:\Services\file.txt”

I need some way to encrypt and decrypt a file without user interaction.
My install set is the the install of gpg4win 2.1.0, am I missing something?

I am sticking with the older version until I see a post fixing your problem!

As far as i know the only practical solution is to have no passphrase at all. There might be some means of modifying gpg-agent, but those are difficult (for end user).

Thanks I don’t have the luxury to wait or do blank passkey but appreciate your responses. I’m currently stuck doing the transfer manually - and they need to get back on an automated schedule. I’m working with bank financial data that must use higher encryption than our old version of gpg supported and must have a strong passkey due to company data policies.

Modifying the code is kind of out of my league.

We have done exactly the same thing! I probably import some of your files! I also work in the financial services industry but at the other end, we receive files from banks. Upgraded from version 1.1.3 to latest version. Our automation process keeps bringing up the passphrase entry window. THIS IS A MAJOR PROBLEM. Can a solution to this please be posted ASAP.

I finally found the answer, having no background with using pgp or tools like this was big hindrance.

the build of GPG used in GPG4WIN’s pgp build is either buggy/broken/something and will not accept passkeys.

the GNUPG website does not list another windows options, this is wrong, as they have windows binaries compiled on the ftp server:
ftp://ftp.gnupg.org/gcrypt/binary/
I downloaded the latest binary and installed to a new folder, updated my commands to call that exe and presto! passkey accepted!!

“C:\Program Files (x86)\GNU\GnuPG\gpg.exe” --passphrase “passkey” -se -r RecipientKey -u “MYKEY” -o “c:\Services\CheckFile\ChecksIssued\checkfile.txt.gpg” “c:\Services\CheckFile\ChecksIssued\checkfile.txt”

C:\Users\xyz>“C:\Program Files (x86)\GNU\GnuPG\gpg.exe” -h
gpg (GnuPG) 1.4.13

Hope this helps you folks that are struggling with this like I was, I’ve been at this for weeks.

hi James thanks very much for your reply. Is version 1.4.13 the last version before they jumped up to 2.0…? We tried inserting --batch --yes into the command line which is supposed to stop user interaction i.e. entering passphrase’s but this seems to have stopped files processing altogether… can someone verify whether this option is supposed to work? How can we have automated systems when it prompts us for the passwords???

Hi All ,

Greeting from Singapore.

I met similar issue working on win2k8 environment and i find out that the error was due to the location of physical secret/public key file. It got nothing to do with passphrase.

When you first generate your public key , it will be store in hidden folder in the logon user profile. For my case , i am triggering this script using sap service user. So basically i just copy all the generated key file into my sap service user system profile and it resolve the issue.

hope it help !

Simon