diff options
| author | Daiki Ueno | 2013-04-22 13:53:05 +0900 |
|---|---|---|
| committer | Daiki Ueno | 2013-04-22 13:53:05 +0900 |
| commit | 38cc0210f3bed42829d6cea2dd512a53e581764f (patch) | |
| tree | 6dd8f8cbce0f661628a3413071f0ff0181bfd0a6 | |
| parent | 2ebed929d5d4ce7d364afe3f70afaa34357261f1 (diff) | |
| download | emacs-38cc0210f3bed42829d6cea2dd512a53e581764f.tar.gz emacs-38cc0210f3bed42829d6cea2dd512a53e581764f.zip | |
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.
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/epg.el | 20 |
2 files changed, 25 insertions, 1 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 5dc33bd804f..9c3be36984b 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2013-04-22 Daiki Ueno <ueno@gnu.org> | ||
| 2 | |||
| 3 | * epg.el (epg-context-pinentry-mode): New function. | ||
| 4 | (epg-context-set-pinentry-mode): New function. | ||
| 5 | (epg--start): Pass --pinentry-mode option to gpg command. | ||
| 6 | |||
| 1 | 2013-04-21 Xue Fuqiao <xfq.free@gmail.com> | 7 | 2013-04-21 Xue Fuqiao <xfq.free@gmail.com> |
| 2 | 8 | ||
| 3 | * comint.el: (comint-dynamic-complete-functions, comint-mode-map): | 9 | * comint.el: (comint-dynamic-complete-functions, comint-mode-map): |
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 @@ | |||
| 195 | cipher-algorithm digest-algorithm compress-algorithm | 195 | cipher-algorithm digest-algorithm compress-algorithm |
| 196 | (list #'epg-passphrase-callback-function) | 196 | (list #'epg-passphrase-callback-function) |
| 197 | nil | 197 | nil |
| 198 | nil nil nil nil nil nil))) | 198 | nil nil nil nil nil nil nil))) |
| 199 | 199 | ||
| 200 | (defun epg-context-protocol (context) | 200 | (defun epg-context-protocol (context) |
| 201 | "Return the protocol used within CONTEXT." | 201 | "Return the protocol used within CONTEXT." |
| @@ -289,6 +289,12 @@ This function is for internal use only." | |||
| 289 | (signal 'wrong-type-argument (list 'epg-context-p context))) | 289 | (signal 'wrong-type-argument (list 'epg-context-p context))) |
| 290 | (aref (cdr context) 14)) | 290 | (aref (cdr context) 14)) |
| 291 | 291 | ||
| 292 | (defun epg-context-pinentry-mode (context) | ||
| 293 | "Return the mode of pinentry invocation." | ||
| 294 | (unless (eq (car-safe context) 'epg-context) | ||
| 295 | (signal 'wrong-type-argument (list 'epg-context-p context))) | ||
| 296 | (aref (cdr context) 15)) | ||
| 297 | |||
| 292 | (defun epg-context-set-protocol (context protocol) | 298 | (defun epg-context-set-protocol (context protocol) |
| 293 | "Set the protocol used within CONTEXT." | 299 | "Set the protocol used within CONTEXT." |
| 294 | (unless (eq (car-safe context) 'epg-context) | 300 | (unless (eq (car-safe context) 'epg-context) |
| @@ -407,6 +413,14 @@ This function is for internal use only." | |||
| 407 | (signal 'wrong-type-argument (list 'epg-context-p context))) | 413 | (signal 'wrong-type-argument (list 'epg-context-p context))) |
| 408 | (aset (cdr context) 14 operation)) | 414 | (aset (cdr context) 14 operation)) |
| 409 | 415 | ||
| 416 | (defun epg-context-set-pinentry-mode (context mode) | ||
| 417 | "Set the mode of pinentry invocation." | ||
| 418 | (unless (eq (car-safe context) 'epg-context) | ||
| 419 | (signal 'wrong-type-argument (list 'epg-context-p context))) | ||
| 420 | (unless (memq mode '(nil ask cancel error loopback)) | ||
| 421 | (signal 'epg-error (list "Unknown pinentry mode" mode))) | ||
| 422 | (aset (cdr context) 15 mode)) | ||
| 423 | |||
| 410 | (defun epg-make-signature (status &optional key-id) | 424 | (defun epg-make-signature (status &optional key-id) |
| 411 | "Return a signature object." | 425 | "Return a signature object." |
| 412 | (cons 'epg-signature (vector status key-id nil nil nil nil nil nil nil nil | 426 | (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." | |||
| 1152 | (if (epg-context-textmode context) '("--textmode")) | 1166 | (if (epg-context-textmode context) '("--textmode")) |
| 1153 | (if (epg-context-output-file context) | 1167 | (if (epg-context-output-file context) |
| 1154 | (list "--output" (epg-context-output-file context))) | 1168 | (list "--output" (epg-context-output-file context))) |
| 1169 | (if (epg-context-pinentry-mode context) | ||
| 1170 | (list "--pinentry-mode" | ||
| 1171 | (symbol-name (epg-context-pinentry-mode | ||
| 1172 | context)))) | ||
| 1155 | args)) | 1173 | args)) |
| 1156 | (coding-system-for-write 'binary) | 1174 | (coding-system-for-write 'binary) |
| 1157 | (coding-system-for-read 'binary) | 1175 | (coding-system-for-read 'binary) |