summary: decrypt stdin with passphrase in

Wed Jun 25 22:33:02 2003

A great answer to this problem is Named Pipes.
UNIX systems tend to have "mknod" and/or "mkfifo" programs that can be
used to create Named Pipes.
Named Pipes (aka "FIFO"'s) look like files or size 0 bytes of type "p" (as
opposed to "-" or "d").

Write to the file via redirection (or even by using "cp") and the writing
process will go into a wait state until another process tries to read from
that file.
Then the waiting/writing process's output goes straight into the reading
Thanks go to Steve Butler.
His script (once trimmed of a typo :-)  ) works quite nicely!
(I added the line to remove the named pipes at the end.)

rm /tmp/my_phrase /tmp/my_file
mknod /tmp/my_phrase p
mknod /tmp/my_file p
cat my_gpg_file > /tmp/my_file &
echo 'passphrase' > /tmp/my_phrase &
gpg --homedir $gnupg_home --passphrase-fd=3 --no-tty --decrypt \
  3< /tmp/my_phrase 1< /tmp/my_file
rm /tmp/my_phrase /tmp/my_file