[gnus git] branch master updated: =1= mml2015.el (epg-sub-key-fingerprint): Autoload. (mml2015-epg-find-usable-secret-key): New function. (mml2015-epg-sign): Use mml2015-epg-find-usable-secret-key instead of mml2015-epg-find-usable-key (Bug#7797). (mml2015-epg-encrypt): Ditto.

Katsumi Yamaoka <[email protected]>
Newsgroups gmane.emacs.gnus.cvs
Message-ID <[email protected]>
       via  99fcbbcc7ae5522e7cd21833f8ce2eedc74a1a64 (commit)
      from  8b3a692b73c226167bd1dc8af10031340ca6732a (commit)


- Log -----------------------------------------------------------------
commit 99fcbbcc7ae5522e7cd21833f8ce2eedc74a1a64
Author: Daiki Ueno <[email protected]>
Date:   Fri Jan 7 11:18:20 2011 +0000

    mml2015.el (epg-sub-key-fingerprint): Autoload.
     (mml2015-epg-find-usable-secret-key): New function.
     (mml2015-epg-sign): Use mml2015-epg-find-usable-secret-key instead of mml2015-epg-find-usable-key (Bug#7797).
     (mml2015-epg-encrypt): Ditto.

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index b7ca995..47c7a4a 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,11 @@
+2011-01-07  Daiki Ueno  <[email protected]>
+
+	* mml2015.el (epg-sub-key-fingerprint): Autoload.
+	(mml2015-epg-find-usable-secret-key): New function.
+	(mml2015-epg-sign): Use mml2015-epg-find-usable-secret-key instead of
+	mml2015-epg-find-usable-key (Bug#7797).
+	(mml2015-epg-encrypt): Ditto.
+
 2011-01-05  Katsumi Yamaoka  <[email protected]>
 
 	* dgnushack.el (rot13-string): Fix the way to get the argument.
diff --git a/lisp/mml2015.el b/lisp/mml2015.el
index abcb0fd..9831b33 100644
--- a/lisp/mml2015.el
+++ b/lisp/mml2015.el
@@ -742,6 +742,7 @@ Whether the passphrase is cached at all is controlled by
 (autoload 'epg-key-sub-key-list "epg")
 (autoload 'epg-sub-key-capability "epg")
 (autoload 'epg-sub-key-validity "epg")
+(autoload 'epg-sub-key-fingerprint "epg")
 (autoload 'epg-configuration "epg-config")
 (autoload 'epg-expand-group "epg-config")
 (autoload 'epa-select-keys "epa")
@@ -784,6 +785,24 @@ Whether the passphrase is cached at all is controlled by
 	  (setq pointer (cdr pointer))))
       (setq keys (cdr keys)))))
 
+;; XXX: since gpg --list-secret-keys does not return validity of each
+;; key, `mml2015-epg-find-usable-key' defined above is not enough for
+;; secret keys.  The function `mml2015-epg-find-usable-secret-key'
+;; below looks at appropriate public keys to check usability.
+(defun mml2015-epg-find-usable-secret-key (context name usage)
+  (let ((secret-keys (epg-list-keys context name t))
+	secret-key)
+    (while (and (not secret-key) secret-keys)
+      (if (mml2015-epg-find-usable-key
+	   (epg-list-keys context (epg-sub-key-fingerprint
+				   (car (epg-key-sub-key-list
+					 (car secret-keys)))))
+	   usage)
+	  (setq secret-key (car secret-keys)
+		secret-keys nil)
+	(setq secret-keys (cdr secret-keys))))
+    secret-key))
+
 (defun mml2015-epg-decrypt (handle ctl)
   (catch 'error
     (let ((inhibit-redisplay t)
@@ -960,9 +979,9 @@ If no one is selected, default secret key is used.  "
 		     (delq nil
 			   (mapcar
 			    (lambda (signer)
-			      (setq signer-key (mml2015-epg-find-usable-key
-						(epg-list-keys context signer t)
-						'sign))
+			      (setq signer-key
+				    (mml2015-epg-find-usable-secret-key
+				     context signer 'sign))
 			      (unless (or signer-key
 					  (y-or-n-p
 					   (format
@@ -1081,9 +1100,9 @@ If no one is selected, default secret key is used.  "
 		       (delq nil
 			     (mapcar
 			      (lambda (signer)
-				(setq signer-key (mml2015-epg-find-usable-key
-						  (epg-list-keys context signer t)
-						  'sign))
+				(setq signer-key
+				      (mml2015-epg-find-usable-secret-key
+				       context signer 'sign))
 				(unless (or signer-key
 					    (y-or-n-p
 					     (format

-----------------------------------------------------------------------
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we listed those
revisions in full, above.

Summary of changes:
 lisp/ChangeLog  |    8 ++++++++
 lisp/mml2015.el |   31 +++++++++++++++++++++++++------
 2 files changed, 33 insertions(+), 6 deletions(-)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnus Project".

The branch, master has been updated


hooks/post-receive
-- 
Gnus Project
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.