using verify over stdin

David Shaw dshaw@jabberwocky.com
Wed Nov 6 03:18:01 2002


On Tue, Nov 05, 2002 at 05:24:32PM -0800, Justin Karneges wrote:
> > > So how do you read the passphrase "on-demand" ?  Or is this just not
> > > possible?
> > >
> > > I don't want to prompt the user unless the status says "NEED_PASSPHRASE".
> >
> > Use --command-fd.  When you get status NEED_PASSPHRASE, send the
> > passphrase on the command-fd.
> 
> Hmm, unless I'm doing something else wrong, this appears not to work.
> 
> Here is an sample command I send from my application:
> 
> gpg --batch --enable-special-filenames --status-fd 12 --command-fd 9 --armor 
> --decrypt
> 
> Next I pass the encrypted block across stdin.
> 
> I then get NEED_PASSPHRASE and BAD_PASSPHRASE immediately on
> status-fd.  The pipe for command-fd is available (it is the exact
> same code as passphrase, I just changed the flag to "--command-fd"
> instead), but it seems like gpg does not wait for me to write to it.
> I tried putting the passphrase into the pipe before sending the
> encrypted block, but no good.  Is there something else I should
> know?

Remove the --batch from that command line.  You also don't need
--enable-special-filenames unless you are actually using the special
filenames.

David

-- 
   David Shaw  |  dshaw@jabberwocky.com  |  WWW http://www.jabberwocky.com/
+---------------------------------------------------------------------------+
   "There are two major products that come out of Berkeley: LSD and UNIX.
      We don't believe this to be a coincidence." - Jeremy S. Anderson