About pinentry usage along with gpg

gpggpg-agentpinentry

Is mandatory to use pinentry with gpg2?

Why is pinentry better over legacy prompt?

Best Answer

Yes, the use of a pinentry program is mandatory with GnuPG 2 and later.

This follows from the updated architecture in use nowadays:

  • GnuPG clients no longer deal with private key material, or with passphrases etc. (as far as possible — as far as I can tell, the only time a passphrase goes through the client is when you change it);
  • to support this, a separate process, the agent, stores private keys; it runs as a user-level daemon, started automatically when a client needs it;
  • the agent, being a daemon, doesn’t have an “owning” terminal, nor does it know how to obtain input from the user;
  • obtaining input from the user is delegated to a pinentry-compatible program of the user’s choice.

The use of a pinentry program ensures that your private key stays confined to the agent (if it knows about it at all of course), without your having to supply the private key and passphrase explicitly to the agent (as happens e.g. with ssh-add). It also ensures that the requests for your passphrase are consistent, regardless of the source of the request (the amount of security that that provides is as usual up for debate).

Related Question