all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#7797: 24.0.50; [EasyPG/Gnus] always pick up the first key from `gpg --list-key $SENDER`
@ 2011-01-06 23:30 Luca Capello
  2011-01-07  2:04 ` Daiki Ueno
  0 siblings, 1 reply; 13+ messages in thread
From: Luca Capello @ 2011-01-06 23:30 UTC (permalink / raw)
  To: 7797; +Cc: rfrancoise

[-- Attachment #1: Type: text/plain, Size: 14163 bytes --]

Hi there!

Since more than a month, now, actually since the upgrade from the Debian
package emacs-snapshot 1:20101116-1 to 1:20101120-1 (which I did on
2010-11-23 at 14:50 +0100), EasyPG is not working anymore with Gnus.  I
am sorry for the delay in this bug report, but I did not find the time
before to debug it and switched back to PGG instead.

BTW, now that the emacs-snapshot package is no more updated, I will go
back to the Debian emacs23 package.  If you need me to test something,
please say so and I could even compile a Git snapshot, if needed.

This bug can be reproduced with the following minimal ~/.emacs:
--8<---------------cut here---------------start------------->8---
(setq debug-on-error t)
(setq epg-debug t)
(add-hook 'gnus-message-setup-hook 'epa-mail-mode)
(add-hook 'gnus-message-setup-hook 'mml-secure-message-sign-pgpmime)
(setq gnus-select-method '(nnnil))
--8<---------------cut here---------------end--------------->8---

Here the debug error, which unfortunately is useless:
=====
Debugger entered--Lisp error: (error "Sign failed: ((exit))")
  signal(error ("Sign failed: ((exit))"))
  byte-code("[...]" [mml2015-epg-secret-key-id-list error password-cache-remove signal] 4)
  mml2015-epg-sign((part (sign . "pgpmime") (tag-location . 271) (contents . "test\n")))
  mml2015-sign((part (sign . "pgpmime") (tag-location . 271) (contents . "test\n")))
  mml-pgpmime-sign-buffer((part (sign . "pgpmime") (tag-location . 271) (contents . "test\n")))
  mml-generate-mime-1((part (sign . "pgpmime") (tag-location . 271) (contents . "test\n")))
  mml-generate-mime()
  message-encode-message-body()
  message-send-mail(nil)
  message-send-via-mail(nil)
  message-send(nil)
  message-send-and-exit(nil)
  call-interactively(message-send-and-exit nil nil)
=====

Thanks to the ` *epg-debug*' buffer, the problem is clear:
=====
/usr/bin/gpg --no-tty --status-fd 1 --yes --command-fd 0 --armor \
 --textmode --output /tmp/epg-output5441TZj --detach-sign \
 -u 8D3867D89DDB992B
gpg: skipped "8D3867D89DDB992B": unusable secret key
gpg: signing failed: unusable secret key
=====

What the hell?  Why EasyPG is specyfing a key and not relying on my
~/.gnupg/gpg.conf, which is *correct*?
=====
luca@gismo:~$ gpg --version
gpg (GnuPG) 1.4.10
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Home: ~/.gnupg
Supported algorithms:
Pubkey: RSA, RSA-E, RSA-S, ELG-E, DSA
Cipher: 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH, CAMELLIA128, 
        CAMELLIA192, CAMELLIA256
Hash: MD5, SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224
Compression: Uncompressed, ZIP, ZLIB, BZIP2

luca@gismo:~$ gpg --list-key luca@pca.it
pub   1024D/9DDB992B 2007-06-08 [revoked: 2010-01-01]
uid                  Luca Capello <luca@pca.it>
uid                  Luca Capello <gismo@debian.org>

pub   1024D/6D742669 2003-11-09 [revoked: 2005-07-22]
uid                  Luca Capello <luca@pca.it>
uid                  Luca Capello <gismo@member.fsf.org>
uid                  Luca Capello <luca.capello@gmail.com>
uid                  Luca Capello <luca.capello@zoo.unige.ch>
uid                  Luca Capello <lucacapello@users.sourceforge.net>
uid                  Luca Capello <luca.capello@frontiers-in-genetics.org>
uid                  Luca Capello <gismo@innerloop.it>
uid                  Luca Capello <lcapello@common-lisp.net>
uid                  Luca Capello <gismo@debian.org>

pub   4096R/E397832F 2009-07-01
uid                  Luca Capello <luca@pca.it>
uid                  Luca Capello <gismo@debian.org>
sub   4096R/3BE9F36D 2009-07-01
sub   4096R/2BB95F4B 2009-07-01

luca@gismo:~$ cat ~/.gnupg/gpg.conf
personal-digest-preferences SHA512
cert-digest-algo SHA512
default-preference-list SHA512 SHA384 SHA256 SHA224 AES256 AES192 AES CAST5 ZLIB BZIP2 ZIP Uncompressed

hidden-encrypt-to 3BE9F36D!
hidden-encrypt-to 2BB95F4B!
default-recipient 3BE9F36D!
default-recipient 2BB95F4B!
default-key E397832F

list-options show-sig-expire

display-charset UTF-8
trust-model auto

keyserver hkps://keys.indymedia.org
keyserver-options ca-cert-file=/etc/ssl/certs/cacert.org.pem

luca@gismo:~$ 
=====

FYI, I do not know why the order of the --list-key option is that one
(the three secret keys are there as well), but it is still the same with
GnuPG-2.

I looked into the Git repository and I found the faulty commit:

  commit 9515b7dbfaa1e68fb72c323a45120f77362c7324
  Author: Daniel Dehennin <daniel.dehennin@baby-gnu.org>
  Date:   Tue Nov 16 23:05:02 2010 +0000

    mml2015-epg-sign: Use From header.

    mml2015.el (mml2015-epg-sign): New variable 'sender' is
     (message-options-get 'message-sender) and append it to mml2015-signers.
     If mm-sign-option is not 'guided, mml2015-signers and sender sign the mail.

What is the reason of this change?  If I want to sign with another key,
independent of the From header, I should be able to do so,
*automatically*, thus without any extra choice when sending the email.
My ~/.gnupg/gpg.conf allows that, EasyPG/Gnus does not.

Obviously, even setting `mml2015-signers' does not solve the problem:
because now EasyPG tries to sign with two keys.  The debug error is the
same as above (useless), again the ` *epg-debug*' buffer contains the
answer:
=====
/usr/bin/gpg --no-tty --status-fd 1 --yes --command-fd 0 --armor \
 --textmode --output /tmp/epg-output5441Qsz --detach-sign \
 -u 8D3867D89DDB992B -u 06EAA066E397832F
[GNUPG:] USERID_HINT D91D57A03BE9F36D Luca Capello <luca@pca.it>
[GNUPG:] NEED_PASSPHRASE D91D57A03BE9F36D 06EAA066E397832F 1 0
[GNUPG:] GET_HIDDEN passphrase.enter
[GNUPG:] GOT_IT
[GNUPG:] GOOD_PASSPHRASE
gpg: skipped "8D3867D89DDB992B": unusable secret key
gpg: signing failed: unusable secret key
=====

FTR, if I go back to the `mml2015-sign' version before the commit above,
everything is fine.  Please note, however, the output in the `
*epg-debug*' buffer:
=====
/usr/bin/gpg --no-tty --status-fd 1 --yes --command-fd 0 --armor \
 --textmode --output /tmp/epg-output5441cKP --detach-sign
[GNUPG:] USERID_HINT D91D57A03BE9F36D Luca Capello <luca@pca.it>
[GNUPG:] NEED_PASSPHRASE D91D57A03BE9F36D 06EAA066E397832F 1 0
[GNUPG:] GET_HIDDEN passphrase.enter
[GNUPG:] GOT_IT
[GNUPG:] GOOD_PASSPHRASE
[GNUPG:] BEGIN_SIGNING
[GNUPG:] SIG_CREATED D 1 10 01 1294352394 139121880F512EC2E6A464D3D91D57A03BE9F36D
/usr/bin/gpg --no-tty --status-fd 1 --yes --command-fd 0 --armor \
 --textmode --output /tmp/epg-output5441pUV --detach-sign
[GNUPG:] USERID_HINT D91D57A03BE9F36D Luca Capello <luca@pca.it>
[GNUPG:] NEED_PASSPHRASE D91D57A03BE9F36D 06EAA066E397832F 1 0
[GNUPG:] GET_HIDDEN passphrase.enter
[GNUPG:] GOT_IT
[GNUPG:] GOOD_PASSPHRASE
[GNUPG:] BEGIN_SIGNING
[GNUPG:] SIG_CREATED D 1 10 01 1294352397 139121880F512EC2E6A464D3D91D57A03BE9F36D
=====

The GnuPG invocation will respect my ~/.gnupg/gpg.conf (which is, again,
the expected behavior), given that there is no -u option specified.

Thx, bye,
Gismo / Luca

If Emacs crashed, and you have the Emacs process in the gdb debugger,
please include the output from the following gdb commands:
    `bt full' and `xbacktrace'.
For information about debugging Emacs, please read the file
/usr/share/emacs/24.0.50/etc/DEBUG.


In GNU Emacs 24.0.50.1 (x86_64-pc-linux-gnu, GTK+ Version 2.20.1)
 of 2010-12-13 on elegiac, modified by Debian
 (emacs-snapshot package, version 1:20101212-2)
configured using `configure  '--build' 'x86_64-linux-gnu' '--host' \
 'x86_64-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' \
 '--libexecdir=/usr/lib' '--localstatedir=/var' '--infodir=/usr/share/info' \
 '--mandir=/usr/share/man' '--with-pop=yes' \
 '--enable-locallisppath=/etc/emacs-snapshot:/etc/emacs:\
  /usr/local/share/emacs/24.0.50/site-lisp:/usr/local/share/emacs/site-lisp: \
  /usr/share/emacs/24.0.50/site-lisp:/usr/share/emacs/site-lisp' \
 '--without-compress-info' '--with-x=yes' '--with-x-toolkit=gtk' \
 '--with-imagemagick=yes' 'build_alias=x86_64-linux-gnu' \
 'host_alias=x86_64-linux-gnu' 'CFLAGS=-DDEBIAN -DSITELOAD_PURESIZE_EXTRA=5000 \
 -g -O2' 'LDFLAGS=-g -Wl,--as-needed' 'CPPFLAGS=''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Message

Minor modes in effect:
  epa-mail-mode: t
  gnus-message-citation-mode: t
  mml-mode: t
  gpm-mouse-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t
  abbrev-mode: t

Recent input:
ESC x g n u s RET m l u c a @ l o c a l h o s t C-n 
t e s t C-n C-n C-n C-n C-n t e s t RET C-c C-c y q 
ESC x r e p o r t - e m TAB RET

Recent messages:
Opening nnfolder server on archive...done
Reading active file from archive via nnfolder...done
No new newsgroups
Checking new news...done
Setting up drafts group
Warning: Setting up drafts group
Address `luca@localhost' might be bogus.  Continue? (y or n)  y
Sending...
Entering debugger...
Back to top level.

Load-path shadows:
/usr/share/emacs/24.0.50/site-lisp/auctex/tex-fold hides /usr/share/emacs/site-lisp/auctex/tex-fold
/usr/share/emacs/24.0.50/site-lisp/auctex/tex-jp hides /usr/share/emacs/site-lisp/auctex/tex-jp
/usr/share/emacs/24.0.50/site-lisp/auctex/tex-font hides /usr/share/emacs/site-lisp/auctex/tex-font
/usr/share/emacs/24.0.50/site-lisp/auctex/texmathp hides /usr/share/emacs/site-lisp/auctex/texmathp
/usr/share/emacs/24.0.50/site-lisp/auctex/toolbar-x hides /usr/share/emacs/site-lisp/auctex/toolbar-x
/usr/share/emacs/24.0.50/site-lisp/auctex/tex-buf hides /usr/share/emacs/site-lisp/auctex/tex-buf
/usr/share/emacs/24.0.50/site-lisp/auctex/tex-info hides /usr/share/emacs/site-lisp/auctex/tex-info
/usr/share/emacs/24.0.50/site-lisp/auctex/tex-mik hides /usr/share/emacs/site-lisp/auctex/tex-mik
/usr/share/emacs/24.0.50/site-lisp/auctex/context-nl hides /usr/share/emacs/site-lisp/auctex/context-nl
/usr/share/emacs/24.0.50/site-lisp/auctex/tex-fptex hides /usr/share/emacs/site-lisp/auctex/tex-fptex
/usr/share/emacs/24.0.50/site-lisp/auctex/multi-prompt hides /usr/share/emacs/site-lisp/auctex/multi-prompt
/usr/share/emacs/24.0.50/site-lisp/auctex/tex-style hides /usr/share/emacs/site-lisp/auctex/tex-style
/usr/share/emacs/24.0.50/site-lisp/auctex/font-latex hides /usr/share/emacs/site-lisp/auctex/font-latex
/usr/share/emacs/24.0.50/site-lisp/auctex/bib-cite hides /usr/share/emacs/site-lisp/auctex/bib-cite
/usr/share/emacs/24.0.50/site-lisp/auctex/tex hides /usr/share/emacs/site-lisp/auctex/tex
/usr/share/emacs/24.0.50/site-lisp/auctex/context hides /usr/share/emacs/site-lisp/auctex/context
/usr/share/emacs/24.0.50/site-lisp/auctex/tex-bar hides /usr/share/emacs/site-lisp/auctex/tex-bar
/usr/share/emacs/24.0.50/site-lisp/auctex/latex hides /usr/share/emacs/site-lisp/auctex/latex
/usr/share/emacs/24.0.50/site-lisp/auctex/context-en hides /usr/share/emacs/site-lisp/auctex/context-en
/usr/share/emacs-snapshot/site-lisp/psgml/psgml hides /usr/share/emacs/site-lisp/psgml/psgml
/usr/share/emacs-snapshot/site-lisp/psgml/psgml-other hides /usr/share/emacs/site-lisp/psgml/psgml-other
/usr/share/emacs-snapshot/site-lisp/psgml/psgml-init hides /usr/share/emacs/site-lisp/psgml/psgml-init
/usr/share/emacs-snapshot/site-lisp/psgml/psgml-sysdep hides /usr/share/emacs/site-lisp/psgml/psgml-sysdep
/usr/share/emacs-snapshot/site-lisp/psgml/psgml-html hides /usr/share/emacs/site-lisp/psgml/psgml-html
/usr/share/emacs/24.0.50/site-lisp/debian-startup hides /usr/share/emacs/site-lisp/debian-startup
/usr/local/share/emacs/site-lisp/fortune hides /usr/share/emacs/24.0.50/lisp/play/fortune
/usr/share/emacs-snapshot/site-lisp/emms/tq hides /usr/share/emacs/24.0.50/lisp/emacs-lisp/tq

Features:
(shadow emacsbug help-mode view debug mail-extr sort epa-mail epa
derived epg gnus-cite nnfolder nndraft nnmh nnnil gnus-agent gnus-srvr
gnus-score score-mode nnvirtual gnus-msg gnus-art mm-uu mml2015
epg-config mm-view smime password-cache dig mailcap nntp proto-stream
starttls tls gnus-cache nnir gnus-sum macroexp nnoo gnus-group time-date
gnus-undo nnmail mail-source format-spec gnus-start gnus-spec gnus-int
gnus-range message sendmail regexp-opt rfc822 mml easymenu mml-sec
mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045
ietf-drums mailabbrev gmm-utils mailheader gnus-win gnus gnus-ems
nnheader gnus-util mail-utils mm-util mail-prsvr wid-edit t-mouse
planner-autoloads debian-el debian-el-loaddefs w3m-load psgml-init
muse-autoloads emms-auto emacs-goodies-el emacs-goodies-custom
emacs-goodies-loaddefs easy-mmode dpkg-dev-el dpkg-dev-el-loaddefs
bbdb-autoloads preview-latex tex-site auto-loads tooltip ediff-hook
vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image
fringe lisp-mode register page menu-bar rfn-eshadow timer select
scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cham
georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese hebrew greek romanian slovak czech european ethiopic
indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple
abbrev loaddefs button minibuffer faces cus-face files text-properties
overlay md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote make-network-process dbusbind
dynamic-setting font-render-setting move-toolbar gtk x-toolkit x
multi-tty emacs)

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

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

* bug#7797: 24.0.50; [EasyPG/Gnus] always pick up the first key from `gpg --list-key $SENDER`
  2011-01-06 23:30 bug#7797: 24.0.50; [EasyPG/Gnus] always pick up the first key from `gpg --list-key $SENDER` Luca Capello
@ 2011-01-07  2:04 ` Daiki Ueno
  2011-01-07  9:34   ` Daiki Ueno
  0 siblings, 1 reply; 13+ messages in thread
From: Daiki Ueno @ 2011-01-07  2:04 UTC (permalink / raw)
  To: Luca Capello; +Cc: 7797, rfrancoise

Hi,

Luca Capello <luca@pca.it> writes:

> gpg: skipped "8D3867D89DDB992B": unusable secret key
> gpg: signing failed: unusable secret key

You may want to try the patch I posted last month:
http://lists.gnu.org/archive/html/emacs-devel/2010-12/msg00624.html

Although this patch is a workaround, I'm going to push it for the time
being.

> I looked into the Git repository and I found the faulty commit:
>
>     mml2015-epg-sign: Use From header.
>
> What is the reason of this change?  If I want to sign with another key,
> independent of the From header, I should be able to do so,
> *automatically*, thus without any extra choice when sending the email.
> My ~/.gnupg/gpg.conf allows that, EasyPG/Gnus does not.

Quite a few users expect that Gnus/GPG pick a key matching the From
header automatically - me too, I use different keys at work and home :)

Regards,
-- 
Daiki Ueno





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

* bug#7797: 24.0.50; [EasyPG/Gnus] always pick up the first key from `gpg --list-key $SENDER`
  2011-01-07  2:04 ` Daiki Ueno
@ 2011-01-07  9:34   ` Daiki Ueno
  2011-01-07 10:17     ` Luca Capello
  0 siblings, 1 reply; 13+ messages in thread
From: Daiki Ueno @ 2011-01-07  9:34 UTC (permalink / raw)
  To: Luca Capello; +Cc: 7797-done, rfrancoise

Daiki Ueno <ueno@unixuser.org> writes:

> Luca Capello <luca@pca.it> writes:
>
>> gpg: skipped "8D3867D89DDB992B": unusable secret key
>> gpg: signing failed: unusable secret key
>
> You may want to try the patch I posted last month:
> http://lists.gnu.org/archive/html/emacs-devel/2010-12/msg00624.html
>
> Although this patch is a workaround, I'm going to push it for the time
> being.

OK, I fixed this in a better way (r102771).

My test case is:

$ mv .gnupg .gnupg.bak
$ gpg --gen-key # create a key foo@example.com
$ gpg --gen-key # create a key bar@example.com
$ gpg --gen-key # create a key baz@example.com
$ gpg --edit-key foo@example.com # revoke foo@example.com
$ gpg --delete-secret-key bar@example.com

(mml2015-epg-find-usable-secret-key
  (epg-make-context 'OpenPGP) "foo@example.com" 'sign)
=> nil
(mml2015-epg-find-usable-secret-key
  (epg-make-context 'OpenPGP) "bar@example.com" 'sign)
=> nil
(mml2015-epg-find-usable-secret-key
  (epg-make-context 'OpenPGP) "baz@example.com" 'sign)
=> (epg-key . ...)

Regards,
-- 
Daiki Ueno





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

* bug#7797: 24.0.50; [EasyPG/Gnus] always pick up the first key from `gpg --list-key $SENDER`
  2011-01-07  9:34   ` Daiki Ueno
@ 2011-01-07 10:17     ` Luca Capello
  2011-01-07 13:18       ` Daiki Ueno
                         ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Luca Capello @ 2011-01-07 10:17 UTC (permalink / raw)
  To: Daiki Ueno; +Cc: 7797, Ashish SHUKLA, Daniel Dehennin, rfrancoise

[-- Attachment #1: Type: text/plain, Size: 3761 bytes --]

reopen 7797
thanks

Hi Daiki!

On Fri, 07 Jan 2011 10:34:59 +0100, Daiki Ueno wrote:
> Daiki Ueno <ueno@unixuser.org> writes:
>
>> Luca Capello <luca@pca.it> writes:
>>
>>> gpg: skipped "8D3867D89DDB992B": unusable secret key
>>> gpg: signing failed: unusable secret key
>>
>> You may want to try the patch I posted last month:
>> http://lists.gnu.org/archive/html/emacs-devel/2010-12/msg00624.html

Thank you for the link, I was quite disappointed no one reported it on
the GNU BTS.  I added both Ashish and Daniel to the cc:, discussion
requested below.

>> Although this patch is a workaround, I'm going to push it for the time
>> being.
>
> OK, I fixed this in a better way (r102771).

Please, can you post it here, so I do not have to download the bzr
repository?  The Savannah bzr repository is disabled
<http://bzr.savannah.gnu.org/lh/emacs> and the Launhpad one
<http://bazaar.launchpad.net/~vcs-imports/emacs/trunk/files> does not
have it yet.

> My test case is:
>
> $ mv .gnupg .gnupg.bak
> $ gpg --gen-key # create a key foo@example.com
> $ gpg --gen-key # create a key bar@example.com
> $ gpg --gen-key # create a key baz@example.com
> $ gpg --edit-key foo@example.com # revoke foo@example.com
> $ gpg --delete-secret-key bar@example.com
>
> (mml2015-epg-find-usable-secret-key
>   (epg-make-context 'OpenPGP) "foo@example.com" 'sign)
> => nil
> (mml2015-epg-find-usable-secret-key
>   (epg-make-context 'OpenPGP) "bar@example.com" 'sign)
> => nil
> (mml2015-epg-find-usable-secret-key
>   (epg-make-context 'OpenPGP) "baz@example.com" 'sign)
> => (epg-key . ...)

I am sorry, but I still think this is not the correct solution, thus I
reopened the bug (control server bcc:ed).  I think the cases should be
the following, which I have (sort of) explained in my first post and it
is similar to Ashish's one at:

  <http://lists.gnu.org/archive/html/emacs-devel/2010-12/msg00612.html>

1) by default, EasyPG does not pass any key-id to GnuPG, simply relying
   on ~/.gnupg/gpg.conf.  After all, GnuPG configuration is done there,
   and *by default* all the other programs working with GnuPG should
   obey that configuration.

   And this is how I read `mm-sign-option':

     Option how to create signed parts.
     nil, use the default keys without asking;
     `guided', let you select signing keys from the menu.

   However, `mm-encrypt-option' contains the real behavior according to
   the code:

     Option of creating encrypted parts.
     nil, use the first public-key matching the "From:" header as the
      recipient;
     `guided', ask user to select recipient keys from the menu.
   
2) if `mml2015-signers' is set, it overrides point 1.

   BTW1, the documentation for that variable should be corrected: AFAIK
   you can set it to multiple keys, which means that the documentation
   should read "A list of your own key ID(s)...", note the plural.

   BTW2, this variable is not mentioned in any file in the doc/ folder,
   which is another bug.

3) introduce a new `mml2015-use-from-address' variable:
   - if set, it then acts like the way you explain above.
   - if not set, nothing changes WRT to points 1 and 2.

4) introduce also a new `mml2015-default-user-id' variable, which, if
   set, overrides *everything* from the above, similar to
   `pgg-default-user-id' reported by Ashish at the link above.

I would have wanted to reply only after having implemented my solution,
but since I am quite busy right now (and I will be for the whole next
week as well), it is better to put here my ideas *now*.  For this
reason, I have probably missed something of the whole situation, thus
please forgive me.

Thx, bye,
Gismo / Luca

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

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

* bug#7797: 24.0.50; [EasyPG/Gnus] always pick up the first key from `gpg --list-key $SENDER`
  2011-01-07 10:17     ` Luca Capello
@ 2011-01-07 13:18       ` Daiki Ueno
  2011-01-07 17:29       ` bug#7797: Configure the use of from header for epg signing Daniel Dehennin
       [not found]       ` <877heghbc2.fsf@hati.baby-gnu.org>
  2 siblings, 0 replies; 13+ messages in thread
From: Daiki Ueno @ 2011-01-07 13:18 UTC (permalink / raw)
  To: Luca Capello; +Cc: 7797, Ashish SHUKLA, Daniel Dehennin, rfrancoise

Luca Capello <luca@pca.it> writes:

> Please, can you post it here, so I do not have to download the bzr
> repository?  The Savannah bzr repository is disabled
> <http://bzr.savannah.gnu.org/lh/emacs> and the Launhpad one
> <http://bazaar.launchpad.net/~vcs-imports/emacs/trunk/files> does not
> have it yet.

Looks git mirror is up to date:

http://git.sv.gnu.org/cgit/emacs.git/commit/?id=3d51f602

> I am sorry, but I still think this is not the correct solution, thus I
> reopened the bug (control server bcc:ed).  I think the cases should be
> the following, which I have (sort of) explained in my first post and it
> is similar to Ashish's one at:
>
>   <http://lists.gnu.org/archive/html/emacs-devel/2010-12/msg00612.html>

I think there are 2 separate issues:

(1) Gnus now picks signing keys from "From:" header by default. Which is
    an incompatible behavior change from the previous versions.

(2) mml2015-epg-find-usable-key, a function used to determine whether a
    key is usable for signing, has a bug.

I fixed (2) as r102771 and you are talking about (1).  

> I would have wanted to reply only after having implemented my solution,
> but since I am quite busy right now (and I will be for the whole next
> week as well), it is better to put here my ideas *now*.

Well, probably you could first try the patch for (2) and then propose
improvement ideas for (1) I think :-)

Regards,
-- 
Daiki Ueno





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

* bug#7797: Configure the use of from header for epg signing.
  2011-01-07 10:17     ` Luca Capello
  2011-01-07 13:18       ` Daiki Ueno
@ 2011-01-07 17:29       ` Daniel Dehennin
       [not found]       ` <877heghbc2.fsf@hati.baby-gnu.org>
  2 siblings, 0 replies; 13+ messages in thread
From: Daniel Dehennin @ 2011-01-07 17:29 UTC (permalink / raw)
  To: ding; +Cc: 7797, Ashish SHUKLA, Daiki Ueno, rfrancoise, Luca Capello

[-- Attachment #1: Type: text/plain, Size: 2330 bytes --]


Here is a patch to make the use of from header conditional, this solve
issue 1 in [1].

It can be fetched from my Gnus git repository [2].

I do not update the Changelog to avoid conflict, I think changelog can
be automatically handled by hook when Lars pull in its branch ;-)

This patch is tested by me.

Regards.

* lisp/mml2015.el (mml2015-use-from-address): New variable for optional
  from header use.
  (mml2015-epg-sign): Use it.
  (mml2015-epg-encrypt): Ditto.
---
 lisp/mml2015.el |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/lisp/mml2015.el b/lisp/mml2015.el
index 9831b33..dde8a08 100644
--- a/lisp/mml2015.el
+++ b/lisp/mml2015.el
@@ -121,6 +121,12 @@ Whether the passphrase is cached at all is controlled by
   :group 'mime-security
   :type '(repeat (string :tag "Key ID")))
 
+(defcustom mml2015-use-from-address nil
+  "If t, use from header mail address before mml2015-signers when
+signing."
+  :group 'mime-security
+  :type 'boolean)
+
 (defcustom mml2015-encrypt-to-self nil
   "If t, add your own key ID to recipient list when encryption."
   :group 'mime-security
@@ -960,7 +966,8 @@ Whether the passphrase is cached at all is controlled by
   (let* ((inhibit-redisplay t)
 	 (context (epg-make-context))
 	 (boundary (mml-compute-boundary cont))
-	 (sender (message-options-get 'message-sender))
+	 (sender (if mml2015-use-from-address
+		     (message-options-get 'message-sender)))
 	 signer-key
 	 (signers
 	  (or (message-options-get 'mml2015-epg-signers)
@@ -1035,7 +1042,8 @@ If no one is selected, default secret key is used.  "
   (let ((inhibit-redisplay t)
 	(context (epg-make-context))
 	(config (epg-configuration))
-	(sender (message-options-get 'message-sender))
+	 (sender (if mml2015-use-from-address
+		     (message-options-get 'message-sender)))
 	(recipients (message-options-get 'mml2015-epg-recipients))
 	cipher signers
 	(boundary (mml-compute-boundary cont))
-- 
1.7.2.3



Footnotes: 
[1]  http://lists.gnu.org/archive/html/bug-gnu-emacs/2011-01/msg00207.html

[2]  http://www.baby-gnu.org/~nebu/archives/gnus/gnus.git/ dad/mml2015-epg-use-from-to-sign-if-configured

-- 
Daniel Dehennin
Récupérer ma clef GPG:
gpg --keyserver pgp.mit.edu --recv-keys 0x6A2540D1

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

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

* bug#7797: Configure the use of from header for epg signing.
       [not found]       ` <877heghbc2.fsf@hati.baby-gnu.org>
@ 2011-01-16 20:32         ` Luca Capello
  2011-01-16 20:52         ` Daniel Dehennin
       [not found]         ` <87aaj0wozw.fsf@hati.baby-gnu.org>
  2 siblings, 0 replies; 13+ messages in thread
From: Luca Capello @ 2011-01-16 20:32 UTC (permalink / raw)
  To: Daniel Dehennin; +Cc: 7797, Ashish SHUKLA, Daiki Ueno, rfrancoise, ding

[-- Attachment #1: Type: text/plain, Size: 4330 bytes --]

Hi there!

On Fri, 07 Jan 2011 14:18:41 +0100, Daiki Ueno wrote:
> Luca Capello <luca@pca.it> writes:
>> Please, can you post it here, so I do not have to download the bzr
>> repository?  The Savannah bzr repository is disabled
>> <http://bzr.savannah.gnu.org/lh/emacs> and the Launhpad one
>> <http://bazaar.launchpad.net/~vcs-imports/emacs/trunk/files> does not
>> have it yet.
>
> Looks git mirror is up to date:
>
> http://git.sv.gnu.org/cgit/emacs.git/commit/?id=3d51f602

It was not at the time of my writing and looking around on the Internet
I was not sure if the Git repository is automatically updated (and when)
or not.

>> I am sorry, but I still think this is not the correct solution, thus I
>> reopened the bug (control server bcc:ed).  I think the cases should be
>> the following, which I have (sort of) explained in my first post and it
>> is similar to Ashish's one at:
>>
>>   <http://lists.gnu.org/archive/html/emacs-devel/2010-12/msg00612.html>
>
> I think there are 2 separate issues:
>
> (1) Gnus now picks signing keys from "From:" header by default. Which is
>     an incompatible behavior change from the previous versions.
>
> (2) mml2015-epg-find-usable-key, a function used to determine whether a
>     key is usable for signing, has a bug.
>
> I fixed (2) as r102771 and you are talking about (1).  

Exactly, but I do not understand the need for (2), since as I wrote in
my previous reply (point 1) IMHO by default EasyPG should do nothing WRT
GnuPG and which keys should be used, especially given that the error
message is useless without a non-nil `epg-debug':

  Message-ID: <87r5cpow4q.fsf@gismo.pca.it>
  URL: <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=7797#16>

Nevertheless, now that things went back to normality (read below), I do
not care such a lot about that.

>> I would have wanted to reply only after having implemented my solution,
>> but since I am quite busy right now (and I will be for the whole next
>> week as well), it is better to put here my ideas *now*.
>
> Well, probably you could first try the patch for (2) and then propose
> improvement ideas for (1) I think :-)

FWIW, your patch for (2) works perfectly (adapted to the
lisp/gnus/mml2015.el local copy I have), tested on both my working
environment and the fresh setup I used to report the bug.

On Fri, 07 Jan 2011 18:29:01 +0100, Daniel Dehennin wrote:
> Here is a patch to make the use of from header conditional, this solve
> issue 1 in [1].
>
> It can be fetched from my Gnus git repository [2].
>
> I do not update the Changelog to avoid conflict, I think changelog can
> be automatically handled by hook when Lars pull in its branch ;-)
>
> This patch is tested by me.

And tested by me as well, *without* Daiki's patch applied, for both
signing...
=====
/usr/bin/gpg --no-tty --status-fd 1 --yes --command-fd 0 --armor --textmode \
--output /tmp/epg-output3395dRp --detach-sign -u 8D3867D89DDB992B
gpg: skipped "8D3867D89DDB992B": unusable secret key
gpg: signing failed: unusable secret key

[patch applied]

/usr/bin/gpg --no-tty --status-fd 1 --yes --command-fd 0 --armor --textmode \
--output /tmp/epg-output3395qbv --detach-sign
[GNUPG:] USERID_HINT D91D57A03BE9F36D Luca Capello <luca@pca.it>
=====

...and encryption to my Debian address:
=====
/usr/bin/gpg --no-tty --status-fd 1 --yes --command-fd 0 --armor --textmode \
 --output /tmp/epg-output355543E --always-trust --encrypt --sign -u 8D3867D89DDB992B -r 06EAA066E397832F
gpg: skipped "8D3867D89DDB992B": unusable secret key
gpg: [stdin]: sign+encrypt failed: unusable secret key

[patch applied]

/usr/bin/gpg --no-tty --status-fd 1 --yes --command-fd 0 --armor --textmode \
 --output /tmp/epg-output3555FCL --always-trust --encrypt --sign -r 06EAA066E397832F
[GNUPG:] USERID_HINT D91D57A03BE9F36D Luca Capello <luca@pca.it>
=====

> @@ -1035,7 +1042,8 @@ If no one is selected, default secret key is used.  "
>    (let ((inhibit-redisplay t)
>  	(context (epg-make-context))
>  	(config (epg-configuration))
> -	(sender (message-options-get 'message-sender))
> +	 (sender (if mml2015-use-from-address
> +		     (message-options-get 'message-sender)))

There are extra spaces before the parenthesis here ;-)

Thx, bye,
Gismo / Luca

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

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

* bug#7797: Configure the use of from header for epg signing.
       [not found]       ` <877heghbc2.fsf@hati.baby-gnu.org>
  2011-01-16 20:32         ` Luca Capello
@ 2011-01-16 20:52         ` Daniel Dehennin
       [not found]         ` <87aaj0wozw.fsf@hati.baby-gnu.org>
  2 siblings, 0 replies; 13+ messages in thread
From: Daniel Dehennin @ 2011-01-16 20:52 UTC (permalink / raw)
  To: ding; +Cc: 7797, Ashish SHUKLA, Daiki Ueno, rfrancoise, Luca Capello

[-- Attachment #1: Type: text/plain, Size: 1835 bytes --]


Here is a fixed patch.

Regards.

* lisp/mml2015.el (mml2015-use-from-address): New variable for optional
  from header use.
  (mml2015-epg-sign): Use it.
  (mml2015-epg-encrypt): Ditto.
---
 lisp/mml2015.el |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/lisp/mml2015.el b/lisp/mml2015.el
index 9831b33..762eb95 100644
--- a/lisp/mml2015.el
+++ b/lisp/mml2015.el
@@ -121,6 +121,12 @@ Whether the passphrase is cached at all is controlled by
   :group 'mime-security
   :type '(repeat (string :tag "Key ID")))
 
+(defcustom mml2015-use-from-address nil
+  "If t, use from header mail address before mml2015-signers when
+signing."
+  :group 'mime-security
+  :type 'boolean)
+
 (defcustom mml2015-encrypt-to-self nil
   "If t, add your own key ID to recipient list when encryption."
   :group 'mime-security
@@ -960,7 +966,8 @@ Whether the passphrase is cached at all is controlled by
   (let* ((inhibit-redisplay t)
 	 (context (epg-make-context))
 	 (boundary (mml-compute-boundary cont))
-	 (sender (message-options-get 'message-sender))
+	 (sender (if mml2015-use-from-address
+		     (message-options-get 'message-sender)))
 	 signer-key
 	 (signers
 	  (or (message-options-get 'mml2015-epg-signers)
@@ -1035,7 +1042,8 @@ If no one is selected, default secret key is used.  "
   (let ((inhibit-redisplay t)
 	(context (epg-make-context))
 	(config (epg-configuration))
-	(sender (message-options-get 'message-sender))
+	(sender (if mml2015-use-from-address
+		    (message-options-get 'message-sender)))
 	(recipients (message-options-get 'mml2015-epg-recipients))
 	cipher signers
 	(boundary (mml-compute-boundary cont))
-- 
1.7.2.3


-- 
Daniel Dehennin
Récupérer ma clef GPG:
gpg --keyserver pgp.mit.edu --recv-keys 0x6A2540D1

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

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

* bug#7797: Configure the use of from header for epg signing.
       [not found]         ` <87aaj0wozw.fsf@hati.baby-gnu.org>
@ 2011-01-22 18:51           ` Lars Ingebrigtsen
       [not found]           ` <87sjwku5zp.fsf@gnus.org>
  1 sibling, 0 replies; 13+ messages in thread
From: Lars Ingebrigtsen @ 2011-01-22 18:51 UTC (permalink / raw)
  To: Daniel Dehennin
  Cc: Daiki Ueno, 7797, ding, rfrancoise, Ashish SHUKLA, Luca Capello

Daniel Dehennin <daniel.dehennin@baby-gnu.org> writes:

> Here is a fixed patch.

I'm not familiar with the signing code, but the patch looks fine to me.
Should I just apply it?

-- 
(domestic pets only, the antidote for overdose, milk.)
  larsi@gnus.org * Lars Magne Ingebrigtsen





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

* bug#7797: Configure the use of from header for epg signing.
       [not found]           ` <87sjwku5zp.fsf@gnus.org>
@ 2011-01-24  3:09             ` Daiki Ueno
       [not found]             ` <m3lj2byp3x.fsf-ueno@unixuser.org>
  1 sibling, 0 replies; 13+ messages in thread
From: Daiki Ueno @ 2011-01-24  3:09 UTC (permalink / raw)
  To: Lars Ingebrigtsen
  Cc: Daniel Dehennin, 7797, ding, rfrancoise, Ashish SHUKLA,
	Luca Capello

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Daniel Dehennin <daniel.dehennin@baby-gnu.org> writes:
>
>> Here is a fixed patch.
>
> I'm not familiar with the signing code, but the patch looks fine to me.
> Should I just apply it?

It looks good to me.  Since I'm thinking of another tweak related to
signing, I'll apply this patch soon unless anyone objects.

Regards,
-- 
Daiki Ueno





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

* bug#7797: Configure the use of from header for epg signing.
       [not found]             ` <m3lj2byp3x.fsf-ueno@unixuser.org>
@ 2011-01-27 17:18               ` Julien Danjou
       [not found]               ` <sa3bp32464t.fsf@cigue.easter-eggs.fr>
  1 sibling, 0 replies; 13+ messages in thread
From: Julien Danjou @ 2011-01-27 17:18 UTC (permalink / raw)
  To: Daiki Ueno
  Cc: Daniel Dehennin, 7797, ding, Luca Capello, rfrancoise,
	Ashish SHUKLA, Lars Ingebrigtsen

[-- Attachment #1: Type: text/plain, Size: 335 bytes --]

> It looks good to me.  Since I'm thinking of another tweak related to
> signing, I'll apply this patch soon unless anyone objects.

Sorry, I got bitten by this today and fixed it without seeing this
thread before. I've just fixed the same way Daniel did, so no harm done.
:)

-- 
Julien Danjou
❱ http://julien.danjou.info

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

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

* bug#7797: Configure the use of from header for epg signing.
       [not found]               ` <sa3bp32464t.fsf@cigue.easter-eggs.fr>
@ 2011-01-28  1:08                 ` Daiki Ueno
       [not found]                 ` <m362t9dedj.fsf-ueno@unixuser.org>
  1 sibling, 0 replies; 13+ messages in thread
From: Daiki Ueno @ 2011-01-28  1:08 UTC (permalink / raw)
  To: Lars Ingebrigtsen
  Cc: Daniel Dehennin, 7797, ding, rfrancoise, Ashish SHUKLA,
	Luca Capello

Julien Danjou <julien@danjou.info> writes:

>> It looks good to me.  Since I'm thinking of another tweak related to
>> signing, I'll apply this patch soon unless anyone objects.
>
> Sorry, I got bitten by this today and fixed it without seeing this
> thread before. I've just fixed the same way Daniel did, so no harm done.
> :)

Cool, thanks :) I just installed another tweak now (commit 5999faac),
which implements Luca's suggestion #2 at:

http://debbugs.gnu.org/cgi/bugreport.cgi?bug=7797#16

Testing would be appreciated.

Regards,
-- 
Daiki Ueno





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

* bug#7797: Configure the use of from header for epg signing.
       [not found]                 ` <m362t9dedj.fsf-ueno@unixuser.org>
@ 2011-02-09 12:03                   ` Luca Capello
  0 siblings, 0 replies; 13+ messages in thread
From: Luca Capello @ 2011-02-09 12:03 UTC (permalink / raw)
  To: 7797
  Cc: Daniel Dehennin, Daiki Ueno, ding, rfrancoise, Lars Ingebrigtsen,
	Ashish SHUKLA

[-- Attachment #1: Type: text/plain, Size: 2554 bytes --]

Hi there!

I am sorry for being late, preparing/attending FOSDEM got all my time.

On Fri, 28 Jan 2011 02:08:08 +0100, Daiki Ueno wrote:
> Julien Danjou <julien@danjou.info> writes:
>
>>> It looks good to me.  Since I'm thinking of another tweak related to
>>> signing, I'll apply this patch soon unless anyone objects.
>>
>> Sorry, I got bitten by this today and fixed it without seeing this
>> thread before. I've just fixed the same way Daniel did, so no harm done.
>> :)
>
> Cool, thanks :) I just installed another tweak now (commit 5999faac),
> which implements Luca's suggestion #2 at:
>
> http://debbugs.gnu.org/cgi/bugreport.cgi?bug=7797#16
>
> Testing would be appreciated.

I backported your patch on top of your first one [1] and Julien's [2]
and everything is working as expected, thanks:

(setq mml2015-signers nil)
=> Passphrase for D91D57A03BE9F36D Luca Capello <luca@pca.it>:

(setq mml2015-signers (list "3BE9F36D"))
=> Passphrase for D91D57A03BE9F36D Luca Capello <luca@pca.it>

(setq mml2015-signers (list "9DDB992B"))
=> No secret key for 9DDB992B; skip it? (y or n) y
   Passphrase for D91D57A03BE9F36D Luca Capello <luca@pca.it>:

(setq mml2015-signers (list "9DDB992B" "3BE9F36D"))
=> No secret key for 9DDB992B; skip it? (y or n) y
   Passphrase for D91D57A03BE9F36D Luca Capello <luca@pca.it>:

[1] <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=7797#13>
[2] <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=7797#39>
    FWIW I would have preferred Daniel's patch, the variable name was a
    bit clearer and more self-explicative, but never mind, what is
    important is that it is fixed!

BTW, the description for `mml2015-signers' still needs
--8<---------------cut here---------------start------------->8---
diff --git a/lisp/mml2015.el b/lisp/mml2015.el
index 1271168..df106bb 100644
--- a/lisp/mml2015.el
+++ b/lisp/mml2015.el
@@ -116,7 +116,7 @@ Whether the passphrase is cached at all is controlled by
   :type 'integer)
 
 (defcustom mml2015-signers nil
-  "A list of your own key ID which will be used to sign a message.
+  "A list of your own key ID(s) which will be used to sign a message.
 If set, it overrides the setting of `mml2015-sign-with-sender'."
   :group 'mime-security
   :type '(repeat (string :tag "Key ID")))
--8<---------------cut here---------------end--------------->8---

Apart from the above, given that all the patches have been included in
the emacs tree, this bug should be closed, I leave this to you ;-)

Thx, bye,
Gismo / Luca

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

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

end of thread, other threads:[~2011-02-09 12:03 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-06 23:30 bug#7797: 24.0.50; [EasyPG/Gnus] always pick up the first key from `gpg --list-key $SENDER` Luca Capello
2011-01-07  2:04 ` Daiki Ueno
2011-01-07  9:34   ` Daiki Ueno
2011-01-07 10:17     ` Luca Capello
2011-01-07 13:18       ` Daiki Ueno
2011-01-07 17:29       ` bug#7797: Configure the use of from header for epg signing Daniel Dehennin
     [not found]       ` <877heghbc2.fsf@hati.baby-gnu.org>
2011-01-16 20:32         ` Luca Capello
2011-01-16 20:52         ` Daniel Dehennin
     [not found]         ` <87aaj0wozw.fsf@hati.baby-gnu.org>
2011-01-22 18:51           ` Lars Ingebrigtsen
     [not found]           ` <87sjwku5zp.fsf@gnus.org>
2011-01-24  3:09             ` Daiki Ueno
     [not found]             ` <m3lj2byp3x.fsf-ueno@unixuser.org>
2011-01-27 17:18               ` Julien Danjou
     [not found]               ` <sa3bp32464t.fsf@cigue.easter-eggs.fr>
2011-01-28  1:08                 ` Daiki Ueno
     [not found]                 ` <m362t9dedj.fsf-ueno@unixuser.org>
2011-02-09 12:03                   ` Luca Capello

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.