How can I have gpg pause to receive its passphrase, before it starts outputing decrypt to stdout?
Werner Koch
wk at gnupg.org
Mon Mar 18 14:54:32 CET 2024
On Sat, 16 Mar 2024 21:26, B.S. said:
> ... (Windows 10) [DOS] cmd ... [*NOT* powershell]
> ... cygwin gpg ...
[Do not use a Cygwin build of gpg - this is not supported. Use a
standard build for WIndows.]
> How can I have gpg pause to receive its passphrase, before it starts
> outputing decrypt to stdout?
Due to the way a pipe works there is not much you can do here. Except
for having some kind buffering tool in between. Howeverm if you known
the passphrase, you can pass it to gpg directly using --passphrase-file
and --pinentry-mode=loopback.
> So if gpg could finish getting its passphrase from 'readline' before
> opening stdout (that less then sees to clear the screen and open its
The pipeline is constructed by the shell (cmd.exe) and file descriptors
are given to the programs. There is nothing any of the programs can do
here. In fact when using a pipeline in this way, the next program in
the line should be able to handle the output of the former which means
it will expect valid output.
> So far:
> ( gpg.exe -d somefile.gpg | jq.exe ) | less
You are using a Cygwin version of the standard shell here? In this case
make sure that jq.exe gets its EPIPE from the failed gpg.exe.
You may consider to use gpgme-json as a higher level API to gpg. But of
course it does not work the usual way in a pipe.
Salam-Shalom,
Werner
--
The pioneers of a warless world are the youth that
refuse military service. - A. Einstein
-------------- next part --------------
A non-text attachment was scrubbed...
Name: openpgp-digital-signature.asc
Type: application/pgp-signature
Size: 247 bytes
Desc: not available
URL: <https://lists.gnupg.org/pipermail/gnupg-users/attachments/20240318/5337c941/attachment.sig>
More information about the Gnupg-users
mailing list