unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#5592: gnus mml2015 epg: Trying and failing to encrypt email to disabled pgp-key
@ 2010-02-17 20:41 Christian von Roques
  2010-05-07  8:19 ` Daiki Ueno
  0 siblings, 1 reply; 2+ messages in thread
From: Christian von Roques @ 2010-02-17 20:41 UTC (permalink / raw)
  To: 5592

Package: emacs,gnus
Version: 23.1.1
Severity: minor
Tags: patch

"GNU Emacs 23.1.1 (i486-pc-linux-gnu, GTK+ Version 2.12.12) of
2009-10-19 on debian-build.int-office-er.priv, modified by Debian"


When trying to send a pgp-encrypted email to a friend, using gnus,
mml2015, and epg, sending the email fails with the error message:
"Encrypt failed: exit"

My friend has two pgp-keys, of which the first has been disabled from
within "gpg --edit-key friend@example.com".  mml2015 picks this disabled
key, tries to encrypt to it and fails.

I expected mml2015 to choose the second, not disabled, key.

The patch below (relative to revno 99512 of emacs/trunk) adds 'disabled'
to epg-key-capability-alist for disabled keys and uses it in
mml2015-epg-find-usable-key to skip disabled keys.

Note: epg already tries to determine which key is disabled using the 'd'
flag in field 2 of lines from the output of "gpg --list-keys
--with-colons".  But this is not used by mml2015, does not work with
version 1.4.9 of gnupg and according to doc/DETAILS of gnupg-1.4.9 the
'd' flag in field 2 is deprecated and the 'D' in field 12 should be used
instead, which is exactly what my patch is doing.  My changes should be
safe with older versions of gnupg because they just don't put 'D' in
field 12.

	Christian.


=== modified file 'lisp/epg.el'
--- old/lisp/epg.el	2010-01-13 08:35:10 +0000
+++ new/lisp/epg.el	2010-02-17 19:18:09 +0000
@@ -136,9 +136,10 @@
 (defvar epg-key-capablity-alist
   '((?e . encrypt)
     (?s . sign)
     (?c . certify)
-    (?a . authentication)))
+    (?a . authentication)
+    (?D . disabled)))
 
 (defvar epg-new-signature-type-alist
   '((?D . detached)
     (?C . clear)

=== modified file 'lisp/gnus/mml2015.el'
--- old/lisp/gnus/mml2015.el	2010-01-13 08:35:10 +0000
+++ new/lisp/gnus/mml2015.el	2010-02-17 19:18:09 +0000
@@ -1018,8 +1018,9 @@
     (while keys
       (let ((pointer (epg-key-sub-key-list (car keys))))
 	(while pointer
 	  (if (and (memq usage (epg-sub-key-capability (car pointer)))
+		   (not (memq 'disabled (epg-sub-key-capability (car pointer))))
 		   (not (memq (epg-sub-key-validity (car pointer))
 			      '(revoked expired))))
 	      (throw 'found (car keys)))
 	  (setq pointer (cdr pointer))))








^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#5592: gnus mml2015 epg: Trying and failing to encrypt email to disabled pgp-key
  2010-02-17 20:41 bug#5592: gnus mml2015 epg: Trying and failing to encrypt email to disabled pgp-key Christian von Roques
@ 2010-05-07  8:19 ` Daiki Ueno
  0 siblings, 0 replies; 2+ messages in thread
From: Daiki Ueno @ 2010-05-07  8:19 UTC (permalink / raw)
  To: Christian von Roques; +Cc: 5592-close

Christian von Roques <roques@mti.ag> writes:

> The patch below (relative to revno 99512 of emacs/trunk) adds 'disabled'
> to epg-key-capability-alist for disabled keys and uses it in
> mml2015-epg-find-usable-key to skip disabled keys.

Thanks!  I just applied your patch to the trunk.

Regards,
-- 
Daiki Ueno






^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-05-07  8:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-17 20:41 bug#5592: gnus mml2015 epg: Trying and failing to encrypt email to disabled pgp-key Christian von Roques
2010-05-07  8:19 ` Daiki Ueno

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).