all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Christian von Roques <roques@mti.ag>
To: 5592@debbugs.gnu.org
Subject: bug#5592: gnus mml2015 epg: Trying and failing to encrypt email to disabled pgp-key
Date: Wed, 17 Feb 2010 16:41:00 -0400	[thread overview]
Message-ID: <87r5ojd28z.fsf@pepper.mti.ag> (raw)

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))))








             reply	other threads:[~2010-02-17 20:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-17 20:41 Christian von Roques [this message]
2010-05-07  8:19 ` bug#5592: gnus mml2015 epg: Trying and failing to encrypt email to disabled pgp-key Daiki Ueno

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r5ojd28z.fsf@pepper.mti.ag \
    --to=roques@mti.ag \
    --cc=5592@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.