gnupg to encrypt files in a batch processes

Tom Strzemieczny
Wed Mar 20 01:09:02 2002

I am new to encryption & gnupg, so please bear with me.  This is my
first posting.

Has anyone used gnupg to encrypt files in a batch processes??
I have a java program which reads files from a mailbox directory, parses

the file for sender, recipient, subject & message, and then sends the
email.   I am modifying this program to optionally sign and/or encrypt
the message portion of the email.  Currently it runs a gpg command on
the command line and reads the resulting stream from standard out.  (I
got this working on Windows 2000 without being prompted for a
passphrase, but when I began testing in Linux this was not the case.)

My problem was that I was being prompted for a passphrase for each email
Is the solution to use the --passphrase-fd option??  Where can I find
documentation on this?

gpg -s -e -o - --batch --yes --passphrase-fd n -r

where TestFileMsg is the message portion of the email to be sent to,  and n is the file descriptor.  What is n
exactly?  What is the format of this file?

Is this the right approach?

Also, I would prefer to use gpgme for this since it is unrestricted by
its back-end.   What are the gpgme commands for this??