diff options
author | Daiki Ueno <ueno@gnu.org> | 2014-11-07 15:12:40 +0900 |
---|---|---|
committer | Daiki Ueno <ueno@gnu.org> | 2014-11-07 15:12:40 +0900 |
commit | b912aed95a7c31b14cb7e07c0287b9ce8f7369e0 (patch) | |
tree | ded5d44d12ec1f282d00535d15bf860ad7644eba /lisp/epa.el | |
parent | 135a9f4b5aead507c030fb7e3e8ad13aaa91f403 (diff) | |
download | emacs-b912aed95a7c31b14cb7e07c0287b9ce8f7369e0.tar.gz |
epg: Utilize --pinentry-mode added in GnuPG 2.1
* epa.el (epa-pinentry-mode): New user option.
(epa-sign-file, epa-encrypt-file, epa-decrypt-region)
(epa-sign-region, epa-encrypt-region): Respect epa-pinentry-mode.
* epa-file.el (epa-file-insert-file-contents)
(epa-file-write-region): Respect epa-pinentry-mode.
Diffstat (limited to 'lisp/epa.el')
-rw-r--r-- | lisp/epa.el | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/lisp/epa.el b/lisp/epa.el index 6d20a190d9c..2814716e7a8 100644 --- a/lisp/epa.el +++ b/lisp/epa.el @@ -44,6 +44,25 @@ :type 'integer :group 'epa) +(defcustom epa-pinentry-mode nil + "The pinentry mode. + +GnuPG 2.1 or later has an option to control the behavior of +Pinentry invocation. Possible modes are: `ask', `cancel', +`error', and `loopback'. See the GnuPG manual for the meanings. + +In epa commands, a particularly useful mode is `loopback', which +redirects all Pinentry queries to the caller, so Emacs can query +passphrase through the minibuffer, instead of external Pinentry +program." + :type '(choice (const nil) + (const ask) + (const cancel) + (const error) + (const loopback)) + :group 'epa + :version "25.1") + (defgroup epa-faces nil "Faces for epa-mode." :version "23.1" @@ -764,6 +783,8 @@ If no one is selected, default secret key is used. " #'epa-progress-callback-function (format "Signing %s..." (file-name-nondirectory file)))) + (if epa-pinentry-mode + (setf (epg-context-pinentry-mode context) epa-pinentry-mode)) (message "Signing %s..." (file-name-nondirectory file)) (condition-case error (epg-sign-file context file signature mode) @@ -794,6 +815,8 @@ If no one is selected, symmetric encryption will be performed. "))) #'epa-progress-callback-function (format "Encrypting %s..." (file-name-nondirectory file)))) + (if epa-pinentry-mode + (setf (epg-context-pinentry-mode context) epa-pinentry-mode)) (message "Encrypting %s..." (file-name-nondirectory file)) (condition-case error (epg-encrypt-file context file recipients cipher) @@ -836,6 +859,8 @@ For example: (cons #'epa-progress-callback-function "Decrypting...")) + (if epa-pinentry-mode + (setf (epg-context-pinentry-mode context) epa-pinentry-mode)) (message "Decrypting...") (condition-case error (setq plain (epg-decrypt-string context (buffer-substring start end))) @@ -1042,6 +1067,8 @@ If no one is selected, default secret key is used. " (cons #'epa-progress-callback-function "Signing...")) + (if epa-pinentry-mode + (setf (epg-context-pinentry-mode context) epa-pinentry-mode)) (message "Signing...") (condition-case error (setq signature (epg-sign-string context @@ -1130,6 +1157,8 @@ If no one is selected, symmetric encryption will be performed. ") (cons #'epa-progress-callback-function "Encrypting...")) + (if epa-pinentry-mode + (setf (epg-context-pinentry-mode context) epa-pinentry-mode)) (message "Encrypting...") (condition-case error (setq cipher (epg-encrypt-string context @@ -1298,6 +1327,8 @@ If no one is selected, default public key is exported. "))) ;; (cons ;; #'epa-progress-callback-function ;; "Signing keys...")) +;; (if epa-pinentry-mode +;; (setf (epg-context-pinentry-mode context) epa-pinentry-mode)) ;; (message "Signing keys...") ;; (epg-sign-keys context keys local) ;; (message "Signing keys...done"))) |