Gpg4win 2.2.1 not able to decrypt files from UNIX gpg


I am encrypting the files on my unix system using the gpg utility with the command :-

→ echo test | gpg --batch --cipher-algo AES256 -c --passphrase-fd 0 /tmp/testnew

The file is encrypted succesfully with a little warning :-
can’t connect to `/home/.gnupg/S.gpg-agent’: No such file or directory

→ But when i transfer it to my windows server 2003 R2 where i have gpg4win 2.2.1 installed and try to decrypt i am having following error :-

C:\Documents and Settings\tansyj\Desktop\gpg>echo test | gpg --batch --passphrase-fd 0 -o testfile.txt -d testfile1.gpg

gpg: 3DES encrypted data
gpg: encrypted with 1 passphrase
gpg: decryption failed: Bad session key

The same file i am able to decrypt on Windows 2003 server and my Windows 7 also with the same gpg4win version.

Can anyone suggest what could be the issue.


echo includes line endings. So on unix your passphrase is “test\n” and on windows it is “test\r\n”

Note, to avoid such problems use a pinentry?
If you need a batch file, you can secure your system and use a private certificate without passphrase.

Thanks for your response, i did it another way and worked. Rather than echo password | gpg “decrypt syntax”

i used → gpg “decrypt syntax” < password.txt

and for line breaks i used the unix2dos.exe .

I am not aware about the pinentry program, will read about the same.