aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaiki Ueno2011-01-07 18:28:29 +0900
committerDaiki Ueno2011-01-07 18:28:29 +0900
commitad09474a957f1f6015331f072d612d1263670a5d (patch)
treef637dcf683ce9d56a31fb6984e85137573b7ae64
parent66b7b0fe80885b6357517a78f67189ab6a5dbd68 (diff)
downloademacs-ad09474a957f1f6015331f072d612d1263670a5d.tar.gz
emacs-ad09474a957f1f6015331f072d612d1263670a5d.zip
gnus/mml2015.el: Fix secret key validity check (Bug#7797).
* 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.
-rw-r--r--lisp/gnus/ChangeLog8
-rw-r--r--lisp/gnus/mml2015.el31
2 files changed, 33 insertions, 6 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index 10d2cc4c663..abbddcc49cc 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,11 @@
12011-01-07 Daiki Ueno <ueno@unixuser.org>
2
3 * mml2015.el (epg-sub-key-fingerprint): Autoload.
4 (mml2015-epg-find-usable-secret-key): New function.
5 (mml2015-epg-sign): Use mml2015-epg-find-usable-secret-key instead of
6 mml2015-epg-find-usable-key (Bug#7797).
7 (mml2015-epg-encrypt): Ditto.
8
12011-01-03 Lars Magne Ingebrigtsen <larsi@gnus.org> 92011-01-03 Lars Magne Ingebrigtsen <larsi@gnus.org>
2 10
3 * flow-fill.el (fill-flowed-encode): Do encoding citation-aware. 11 * flow-fill.el (fill-flowed-encode): Do encoding citation-aware.
diff --git a/lisp/gnus/mml2015.el b/lisp/gnus/mml2015.el
index abcb0fda13e..9831b336190 100644
--- a/lisp/gnus/mml2015.el
+++ b/lisp/gnus/mml2015.el
@@ -742,6 +742,7 @@ Whether the passphrase is cached at all is controlled by
742(autoload 'epg-key-sub-key-list "epg") 742(autoload 'epg-key-sub-key-list "epg")
743(autoload 'epg-sub-key-capability "epg") 743(autoload 'epg-sub-key-capability "epg")
744(autoload 'epg-sub-key-validity "epg") 744(autoload 'epg-sub-key-validity "epg")
745(autoload 'epg-sub-key-fingerprint "epg")
745(autoload 'epg-configuration "epg-config") 746(autoload 'epg-configuration "epg-config")
746(autoload 'epg-expand-group "epg-config") 747(autoload 'epg-expand-group "epg-config")
747(autoload 'epa-select-keys "epa") 748(autoload 'epa-select-keys "epa")
@@ -784,6 +785,24 @@ Whether the passphrase is cached at all is controlled by
784 (setq pointer (cdr pointer)))) 785 (setq pointer (cdr pointer))))
785 (setq keys (cdr keys))))) 786 (setq keys (cdr keys)))))
786 787
788;; XXX: since gpg --list-secret-keys does not return validity of each
789;; key, `mml2015-epg-find-usable-key' defined above is not enough for
790;; secret keys. The function `mml2015-epg-find-usable-secret-key'
791;; below looks at appropriate public keys to check usability.
792(defun mml2015-epg-find-usable-secret-key (context name usage)
793 (let ((secret-keys (epg-list-keys context name t))
794 secret-key)
795 (while (and (not secret-key) secret-keys)
796 (if (mml2015-epg-find-usable-key
797 (epg-list-keys context (epg-sub-key-fingerprint
798 (car (epg-key-sub-key-list
799 (car secret-keys)))))
800 usage)
801 (setq secret-key (car secret-keys)
802 secret-keys nil)
803 (setq secret-keys (cdr secret-keys))))
804 secret-key))
805
787(defun mml2015-epg-decrypt (handle ctl) 806(defun mml2015-epg-decrypt (handle ctl)
788 (catch 'error 807 (catch 'error
789 (let ((inhibit-redisplay t) 808 (let ((inhibit-redisplay t)
@@ -960,9 +979,9 @@ If no one is selected, default secret key is used. "
960 (delq nil 979 (delq nil
961 (mapcar 980 (mapcar
962 (lambda (signer) 981 (lambda (signer)
963 (setq signer-key (mml2015-epg-find-usable-key 982 (setq signer-key
964 (epg-list-keys context signer t) 983 (mml2015-epg-find-usable-secret-key
965 'sign)) 984 context signer 'sign))
966 (unless (or signer-key 985 (unless (or signer-key
967 (y-or-n-p 986 (y-or-n-p
968 (format 987 (format
@@ -1081,9 +1100,9 @@ If no one is selected, default secret key is used. "
1081 (delq nil 1100 (delq nil
1082 (mapcar 1101 (mapcar
1083 (lambda (signer) 1102 (lambda (signer)
1084 (setq signer-key (mml2015-epg-find-usable-key 1103 (setq signer-key
1085 (epg-list-keys context signer t) 1104 (mml2015-epg-find-usable-secret-key
1086 'sign)) 1105 context signer 'sign))
1087 (unless (or signer-key 1106 (unless (or signer-key
1088 (y-or-n-p 1107 (y-or-n-p
1089 (format 1108 (format