sebastiencs / pinentry-emacs

a pinentry for gpg that uses emacsclient to prompt for the passphrase.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pinentry-emacs

Put it somewhere, make it executable, tell gpg to use it as the pinentry program.

One way to do this is adding the line

pinentry-program /path/to/where/you/put/pinentry-emacs

to the file ~/.gnupg/gpg-agent.conf.

Make sure you restart gpg-agent and GPG_AGENT_INFO is set correctly inside Emacs!

If your Emacs hangs, you might have to C-g, then you’ll get asked, then you may have to restart the action. Your passphrase will be cached for some time.

Emacs

Add this to .emacs.d/init.el or similar:

(defun pinentry-emacs (desc prompt ok error)
  (let ((str (read-passwd (concat (replace-regexp-in-string "%22" "\"" (replace-regexp-in-string "%0A" "\n" desc)) prompt ": "))))
    str))

Sometimes your `.emacs` file has errors, or the emacs `pinentry` thing simply doesn’t work. In that case, this script falls back to using `lukspinentry` to get the password (which falls back onto gui/tty pinentry).

This is probably totally insecure, and your passphrase may be leaked! Use at your own risk!

About

a pinentry for gpg that uses emacsclient to prompt for the passphrase.

License:GNU General Public License v3.0


Languages

Language:Perl 67.3%Language:Shell 32.7%