How can I have gpg pause to receive its passphrase, before it starts outputing decrypt to stdout?

B.S. bs27975 at gmail.com
Sun Mar 17 02:26:31 CET 2024


... (Windows 10) [DOS] cmd ... [*NOT* powershell]
... cygwin gpg ...

How can I have gpg pause to receive its passphrase, before it starts
outputing decrypt to stdout?
e.g. gpg -c < secretdata.json.pgp | jq | less
- less is happening before gpg has 'readlined' the passphrase, and
things get ... all confused.
[I don't mind not seeing things (such as the password request) on
stdout, but herein it seems both less and gpg are trying to consume
stdin.]

So if gpg could finish getting its passphrase from 'readline' before
opening stdout (that less then sees to clear the screen and open its
window, and start showing its incoming data), things would be ...
unconfused.

So far:
( gpg.exe -d somefile.gpg | jq.exe ) | less

seems to do it (give gpg time to acquire the passphrase), but the
'()'s involved certainly weren't intuitive.

It there a way for 'gpg -d file.gpg' to finish acquiring the
passphrase (via 'readline') before it starts writing to stdout
(triggering less' screen clearing and stdout watching)?

I have come across '--batch' which seems no help, as it cuts off
stdin, preventing gpg -d from 'readlining' a passphrase.
(There seems a corresponding '--pinentry-mode loopback' to '--batch',
but that doesn't seem in play yet, to that point in the sequence.)



More information about the Gnupg-users mailing list