using --status-fd
Timo Schulz
twoaday@freakmail.de
Sun Jan 20 20:59:01 2002
On Sun Jan 20 2002; 18:56, Sven-S. Porst wrote:
> GOOD_PASSPHRASE, gpg may still send a '[GNUPG:] GET_BOOL
> untrusted_key.override' message if I am encrypting to unsigned keys - so
> I don't see a reliable condition that I can use to trigger the dumping of
> the message and closing the input.
I don't know what kind of program it is, but in any case you need to
send the message to another FD (or stdin). Then it's easy, you write
the entire message to this FD and then you watch for status messages
on the other FD (the one for the status). In the case the status needs
an answer, you send it to the FD you've chosen for command-fd.
> I had expected to see some kind of GET_MESSAGE command on status-fd as a
> trigger but that doesn't seem to exist so I suspect my approach may be
> completely wrong. I hope the problem I have is more clear this time.
I understand your problem, but when you work with pipes it should
be easy. First you send the message and the other pipes are only status
pipes for GPG messages/answers. In the case an answer is needed, GPG
blocks until you send the data. Here is another example:
gpg -a -r foo --status-fd=2 --command-fd=0 --output - --
Now gpg reads from stdin and writes to stdout the used FD's
are (stdin=0, stdout=1, stderr=2)
[GNUPG:] BEGIN_ENCRYPTION
>> data from stdin
<< armored ciphertext
[GNUPG:] END_ENCRYPTION
BTW, GPGME might be a good solution for your problem.
Timo