summaryrefslogtreecommitdiff
path: root/lisp/epg.el
diff options
context:
space:
mode:
authorDaiki Ueno <ueno@gnu.org>2013-04-22 13:53:05 +0900
committerDaiki Ueno <ueno@gnu.org>2013-04-22 13:53:05 +0900
commit38cc0210f3bed42829d6cea2dd512a53e581764f (patch)
tree6dd8f8cbce0f661628a3413071f0ff0181bfd0a6 /lisp/epg.el
parent2ebed929d5d4ce7d364afe3f70afaa34357261f1 (diff)
downloademacs-38cc0210f3bed42829d6cea2dd512a53e581764f.tar.gz
epg.el: support pinentry mode added in GnuPG 2.1
* epg.el (epg-context-pinentry-mode): New function. (epg-context-set-pinentry-mode): New function. (epg--start): Pass --pinentry-mode option to gpg command.
Diffstat (limited to 'lisp/epg.el')
-rw-r--r--lisp/epg.el20
1 files changed, 19 insertions, 1 deletions
diff --git a/lisp/epg.el b/lisp/epg.el
index 3f04aa2e07a..c36de7e4624 100644
--- a/lisp/epg.el
+++ b/lisp/epg.el
@@ -195,7 +195,7 @@
cipher-algorithm digest-algorithm compress-algorithm
(list #'epg-passphrase-callback-function)
nil
- nil nil nil nil nil nil)))
+ nil nil nil nil nil nil nil)))
(defun epg-context-protocol (context)
"Return the protocol used within CONTEXT."
@@ -289,6 +289,12 @@ This function is for internal use only."
(signal 'wrong-type-argument (list 'epg-context-p context)))
(aref (cdr context) 14))
+(defun epg-context-pinentry-mode (context)
+ "Return the mode of pinentry invocation."
+ (unless (eq (car-safe context) 'epg-context)
+ (signal 'wrong-type-argument (list 'epg-context-p context)))
+ (aref (cdr context) 15))
+
(defun epg-context-set-protocol (context protocol)
"Set the protocol used within CONTEXT."
(unless (eq (car-safe context) 'epg-context)
@@ -407,6 +413,14 @@ This function is for internal use only."
(signal 'wrong-type-argument (list 'epg-context-p context)))
(aset (cdr context) 14 operation))
+(defun epg-context-set-pinentry-mode (context mode)
+ "Set the mode of pinentry invocation."
+ (unless (eq (car-safe context) 'epg-context)
+ (signal 'wrong-type-argument (list 'epg-context-p context)))
+ (unless (memq mode '(nil ask cancel error loopback))
+ (signal 'epg-error (list "Unknown pinentry mode" mode)))
+ (aset (cdr context) 15 mode))
+
(defun epg-make-signature (status &optional key-id)
"Return a signature object."
(cons 'epg-signature (vector status key-id nil nil nil nil nil nil nil nil
@@ -1152,6 +1166,10 @@ This function is for internal use only."
(if (epg-context-textmode context) '("--textmode"))
(if (epg-context-output-file context)
(list "--output" (epg-context-output-file context)))
+ (if (epg-context-pinentry-mode context)
+ (list "--pinentry-mode"
+ (symbol-name (epg-context-pinentry-mode
+ context))))
args))
(coding-system-for-write 'binary)
(coding-system-for-read 'binary)