From 1414b5b5f7c52215c0b7b5aaac2b657b69802ee4 Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Sun, 19 Feb 2017 10:34:50 -0500 Subject: [PATCH v1] Fix passphrase callback with gpg 2.x (Bug#23619) * lisp/epg.el (epg-context-set-passphrase-callback): Set CONTEXT's pinentry mode to `loopback'. --- lisp/epg.el | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lisp/epg.el b/lisp/epg.el index 587271b000..6b4accf1fe 100644 --- a/lisp/epg.el +++ b/lisp/epg.el @@ -246,16 +246,15 @@ epg-context-set-passphrase-callback The function gets three arguments: the context, the key-id in question, and the callback data (if any). -The callback may not be called if you use GnuPG 2.x, which relies -on the external program called `gpg-agent' for passphrase query. -If you really want to intercept passphrase query, consider -installing GnuPG 1.x _along with_ GnuPG 2.x, which does passphrase -query by itself and Emacs can intercept them." +Also set CONTEXT's pinentry mode to `loopback' (when using GnuPG +2.x, the callback would not be called otherwise)." ;; (declare (obsolete setf "25.1")) (setf (epg-context-passphrase-callback context) (if (functionp passphrase-callback) (list passphrase-callback) - passphrase-callback))) + passphrase-callback)) + (when passphrase-callback + (setf (epg-context-pinentry-mode context) 'loopback))) (defun epg-context-set-progress-callback (context progress-callback) -- 2.11.1