emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r118306: epg: Utilize --pinentry-mode added in GnuPG


From: Daiki Ueno
Subject: [Emacs-diffs] trunk r118306: epg: Utilize --pinentry-mode added in GnuPG 2.1
Date: Fri, 07 Nov 2014 06:13:27 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 118306
revision-id: address@hidden
parent: address@hidden
committer: Daiki Ueno <address@hidden>
branch nick: trunk
timestamp: Fri 2014-11-07 15:12:40 +0900
message:
  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.
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/epa-file.el               epafile.el-20091113204419-o5vbwnq5f7feedwu-8554
  lisp/epa.el                    epa.el-20091113204419-o5vbwnq5f7feedwu-8557
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2014-11-07 02:31:12 +0000
+++ b/lisp/ChangeLog    2014-11-07 06:12:40 +0000
@@ -1,5 +1,13 @@
 2014-11-07  Daiki Ueno  <address@hidden>
 
+       * 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.
+
+2014-11-07  Daiki Ueno  <address@hidden>
+
        * epg.el (epg--list-keys-1): Ignore fields after the 15th field
        (bug#18979).  Reported by Hideki Saito.
 

=== modified file 'lisp/epa-file.el'
--- a/lisp/epa-file.el  2014-11-06 03:04:22 +0000
+++ b/lisp/epa-file.el  2014-11-07 06:12:40 +0000
@@ -144,6 +144,8 @@
      context
      (cons #'epa-progress-callback-function
           (format "Decrypting %s" file)))
+    (if epa-pinentry-mode
+       (setf (epg-context-pinentry-mode context) epa-pinentry-mode))
     (unwind-protect
        (progn
          (if replace
@@ -231,6 +233,8 @@
      (cons #'epa-progress-callback-function
           (format "Encrypting %s" file)))
     (setf (epg-context-armor context) epa-armor)
+    (if epa-pinentry-mode
+       (setf (epg-context-pinentry-mode context) epa-pinentry-mode))
     (condition-case error
        (setq string
              (epg-encrypt-string

=== modified file 'lisp/epa.el'
--- a/lisp/epa.el       2014-11-06 03:04:22 +0000
+++ b/lisp/epa.el       2014-11-07 06:12:40 +0000
@@ -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 @@
           #'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 @@
           #'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 @@
            (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 @@
            (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 @@
            (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 @@
 ;;          (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")))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]