[gpg]Re: decrypt stdin with passphrase in

Robert qg7l80202@sneakemail.com
Wed Jun 25 16:49:01 2003


John Sheridan [21/06/2003]:
>
>> Hi Joseph, can you show me the syntax of doing this? I tried this
>before:
>
>> 
>
>> cat file.gpg | gpg --homedir $gnupg_home --passphrase-fd 0 --no-tty
>--decrypt 2>&- <<EOF
>
>> mypassphrase
>
>> EOF
>
>> 
>
>> But it probably means cat file.gpg and mypassphrase are sharing
>
>> stdin, that's why it doesn't work. I don't know how to make this go
>
>> in via another file descriptor.

"Nomen Nescio nobody-at-dizum.com |gpg|" <j3o8hh16pt0t@sneakemail.com>
wrote:
>
>(assuming a bourne shell here)
>
>echo "mypassphrase" > passfile
>gpg --homedir $gnupg_home --passphrase-fd=3 --no-tty --decrypt \
>	3<passfile <file.gpg && rm -f passfile

I think this would also work, and have the nice effect of not writing that
passphrase to disk:
cat > file.gpg ; # <-- this will dump the stdin to file.gpg
echo "mypassphrase" | gpg --homedir $gnuph_home --passphrase-fd=0 --no-tty
--decrypt \
	file.gpg  &&  rm -f file.gpg

Now, what I'd REALLY like to find is a way to do this without writing
either the passphrase OR the encrypted block of text to disk...
My problem seems to be that I can't pipe anything FROM any stream except
stdout and I can't pipe TO any stream except stdin.
Any ideas? Anyone?