1

I need to figure out how to decrypt from command line without gpg asking a popup to enter passphrase, I want to define that in the command line?

is it possible without having to create a batch file

please help

6
  • I presume its Linux you are trying to do this on?
    – mt025
    Aug 17, 2016 at 19:53
  • no, this is windows
    – RollRoll
    Aug 17, 2016 at 19:55
  • 1
    Look here: superuser.com/questions/89914/how-to-extract-a-gpg-file 2nd answer.
    – mt025
    Aug 17, 2016 at 19:56
  • @mt025, just FYI, each individual post has a link. Click the Share button next to the post and you can copy the URL.
    – fixer1234
    Aug 18, 2016 at 1:32
  • 1
    I don't see at all how the Q&A proposed by @DavidPostill as duplicate answers this question, voting to reopen. I'm sure we have some matching duplicate somewhere, but the proposed one isn't.
    – Jens Erat
    Aug 23, 2016 at 9:09

1 Answer 1

0

Whether GnuPG asks on the command line or in a GUI prompt depends on whether gpg-agent is used, and which pinentry implementation is chosen. Sadly, there is no easy way to configure GnuPG to use a command-line prompt when used on the command line, and a GUI prompt otherwise as I already discussed in "GnuPG pinentry depending on GUI presence". Additionally, I'm not sure whether a command-line-only-pinentry implementation is available for Windows.

If you use GnuPG 1, you can simply choose --no-use-agent to drop back to the command line. If you're using GnuPG 2.0, you need to provide the extra --batch parameter, GnuPG 2.1 requires using gpg-agent and you will have to drop back to workarounds like the ones proposed in the link above.

Another workaround is to use gpg-preset-passphrase before calling gpg to preset the passphrase to gpg-agent, but you need to configure gpg-agent appropriately and it seems gpg-preset-passphrase is not available under Windows, but the same can be achieved by running gpg-connect-agent. This might be viable when writing scripts, but does not seem a reasonable thing to use for day-to-day command line usage.

All in all, you might be better of configuring gpg-agent to cache the passphrase for a while and accept you're queried on the GUI from time to time.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .