how do i get gnupg to read the passphrase from standard in

Tom Strzemieczny tstrzem@sesame.com
Tue Mar 26 00:14:01 2002


I need to have gnupgp read the passphrase as standard in.

I want to pipe a passphrase stored in a java BatchMail program into
gnupgp for encrypting files.
I want to do this directly by piping the passphrase into gpg standard
in.

I cannot pass parameters into an echo because this is visible to ps.  I
cannot store the passphrase in a file for security reasons.

Here's what I'm playing with right now:

 encrypt.sh "me@me.com" "recipient@recipient.com" "filename"

where encrypt.sh is:

#! /bin/sh
gpg -s -e -o - --batch --passphrase-fd 0 --default-user $1 --yes
--no-tty -r $2 $3  < -

But i don't want gpg to hook into the standard out of my BatchMail
program, but rather the standard out of the ScriptProcess that executed
the command.   I think I am on the right track but don't have any
difinitive answers yet.  Can someone please help?