unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* How to decrypt multipart/encrypted parts in notmuch-emacs
@ 2012-04-11 15:07 Olivier Berger
  2012-04-11 16:41 ` Jameson Graef Rollins
  2012-04-11 16:58 ` Notmuch not able to decrypt some GPG multipart/encrypted emails - Was: " Olivier Berger
  0 siblings, 2 replies; 9+ messages in thread
From: Olivier Berger @ 2012-04-11 15:07 UTC (permalink / raw)
  To: notmuch

Hi.

Is there a way to decrypt multipart/encrypted messages in notmuch-emacs
?

I can only get a purple "Decryption error" message...

The mail looks like :

MIME-Version: 1.0
Content-Type: multipart/encrypted; boundary="=-=-=";
	protocol="application/pgp-encrypted"

--=-=-=
Content-Type: application/pgp-encrypted

Version: 1

--=-=-=
Content-Type: application/octet-stream

-----BEGIN PGP MESSAGE-----
Version: GnuPG v1.4.12 (GNU/Linux)

hQEMA5jnkYlGlgRTAQf9F6tXf5NsYR01YW/7kvOmlQRN6lFvu6O37Vl7hhy4abEA
[...]
N+EEwAHGxnSyHXZhhro00kZ/MJvc7w8ryafIP7IlbSj5FqjEl+olwrqgiAB0msZh
4A==
=wBO/
-----END PGP MESSAGE-----
--=-=-=--

Note that gnus decrypts it without any problem.

Thanks in advance.
-- 
Olivier BERGER 
http://www-public.it-sudparis.eu/~berger_o/ - OpenPGP-Id: 2048R/5819D7E8
Ingenieur Recherche - Dept INF
Institut Mines-Telecom, Telecom SudParis, Evry (France)

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

* Re: How to decrypt multipart/encrypted parts in notmuch-emacs
  2012-04-11 15:07 How to decrypt multipart/encrypted parts in notmuch-emacs Olivier Berger
@ 2012-04-11 16:41 ` Jameson Graef Rollins
  2012-04-11 20:50   ` Olivier Berger
  2012-04-11 16:58 ` Notmuch not able to decrypt some GPG multipart/encrypted emails - Was: " Olivier Berger
  1 sibling, 1 reply; 9+ messages in thread
From: Jameson Graef Rollins @ 2012-04-11 16:41 UTC (permalink / raw)
  To: Olivier Berger, notmuch

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

On Wed, Apr 11 2012, Olivier Berger <olivier.berger@it-sudparis.eu> wrote:
> Is there a way to decrypt multipart/encrypted messages in notmuch-emacs

Hi, Olivier.  Yes, it is possible.

> I can only get a purple "Decryption error" message...

The fact that you're getting this messages means that notmuch is
attempting to decrypt the message, but there was a decryption problem.

A typical problem is that gpg-agent is not running.  Notmuch uses gnupg
to decrypt, but it requires that gpg-agent be running to get the
passphrase from the user.  Do you have gpg-agent running?

> The mail looks like :

The format of the multipart/encrypted looks fine, so I see no problems
there (assuming the encryption was done properly).

You might also try decrypting the message on the command line, as that
will take any emacs issues out of the loop:

notmuch show --decrypt id:$msgid

It might help to redirect stdout to /dev/null to make it easier to see
any gnupg error messages

I hope that helps.  Let us know if you still can't figure it out, or if
you have other questions.

jamie.

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

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

* Notmuch not able to decrypt some GPG multipart/encrypted emails - Was: Re: How to decrypt multipart/encrypted parts in notmuch-emacs
  2012-04-11 15:07 How to decrypt multipart/encrypted parts in notmuch-emacs Olivier Berger
  2012-04-11 16:41 ` Jameson Graef Rollins
@ 2012-04-11 16:58 ` Olivier Berger
  2012-04-11 17:09   ` Daniel Kahn Gillmor
  1 sibling, 1 reply; 9+ messages in thread
From: Olivier Berger @ 2012-04-11 16:58 UTC (permalink / raw)
  To: notmuch


Some more details :

Olivier Berger <olivier.berger@it-sudparis.eu>
writes:

> Hi.
>
> Is there a way to decrypt multipart/encrypted messages in notmuch-emacs
> ?
>
> I can only get a purple "Decryption error" message...
>
> The mail looks like :
>
> MIME-Version: 1.0
> Content-Type: multipart/encrypted; boundary="=-=-=";
> 	protocol="application/pgp-encrypted"
>
> --=-=-=
> Content-Type: application/pgp-encrypted
>
> Version: 1
>
> --=-=-=
> Content-Type: application/octet-stream
>
>
> --=-=-=--
>
> Note that gnus decrypts it without any problem.
>

I traced a bit what could be wrong and found out that it's not in the
emacs part :

$ notmuch show --decrypt "subject:whatever"

[...]

header{
olivier.berger@it-sudparis.eu (20 mins. ago) (encrypted)
Subject: whatever
From: olivier.berger@it-sudparis.eu
To: whomever
Date: Wed, 11 Apr 2012 18:32:23 +0200

header}

body{
Failed to decrypt part: Canceled.

part{ ID: 1, Content-type: multipart/encrypted

part{ ID: 2, Filename: msg.asc, Content-type: application/pgp-encrypted
Non-text part: application/pgp-encrypted

part}

part{ ID: 3, Content-type: application/octet-stream
Non-text part: application/octet-stream

part}

part}

body}

message}


Dunno what happens. Anyone else ?

Thanks in advance.

Best regards,

-- 
Olivier BERGER 
http://www-public.it-sudparis.eu/~berger_o/ - OpenPGP-Id: 2048R/5819D7E8
Ingenieur Recherche - Dept INF
Institut Mines-Telecom, Telecom SudParis, Evry (France)

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

* Re: Notmuch not able to decrypt some GPG multipart/encrypted emails - Was: Re: How to decrypt multipart/encrypted parts in notmuch-emacs
  2012-04-11 16:58 ` Notmuch not able to decrypt some GPG multipart/encrypted emails - Was: " Olivier Berger
@ 2012-04-11 17:09   ` Daniel Kahn Gillmor
  2012-04-11 20:46     ` Olivier Berger
  0 siblings, 1 reply; 9+ messages in thread
From: Daniel Kahn Gillmor @ 2012-04-11 17:09 UTC (permalink / raw)
  To: Olivier Berger; +Cc: notmuch

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

On 04/11/2012 12:58 PM, Olivier Berger wrote:
> 
> Dunno what happens. Anyone else ?

Are you running gpg-agent?

what do you get if you do:

 gpg-connect-agent /bye

(please include the return code)?

if you are running on a debian or debian-derived system, do you have the
gnupg-agent package installed?

	--dkg


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 1030 bytes --]

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

* Re: Notmuch not able to decrypt some GPG multipart/encrypted emails - Was: Re: How to decrypt multipart/encrypted parts in notmuch-emacs
  2012-04-11 17:09   ` Daniel Kahn Gillmor
@ 2012-04-11 20:46     ` Olivier Berger
  0 siblings, 0 replies; 9+ messages in thread
From: Olivier Berger @ 2012-04-11 20:46 UTC (permalink / raw)
  To: notmuch

Hi.

Daniel Kahn Gillmor
<dkg@fifthhorseman.net> writes:

> On 04/11/2012 12:58 PM, Olivier Berger wrote:
>> 
>> Dunno what happens. Anyone else ?
>
> Are you running gpg-agent?
>

I wasn't, but was using gnome's keyring daemon instead.

I have added 'use_agent' back in my ~/.gnupg/gpg.conf, rebooted and can
now see gpg-agent running, and all seems much better.

> what do you get if you do:
>
>  gpg-connect-agent /bye
>
> (please include the return code)?
>

Works now, with $? == 0.

> if you are running on a debian or debian-derived system, do you have the
> gnupg-agent package installed?
>
> 	--dkg
>

Thanks for these hints : notmuch show --decrypt works now.

Thanks for your help.

Best regards,

P.S.: I have a somewhat special gpg setup, cause I'm wrapping it with a
script which tests its options and eventually add necessary bits to
access a crypted FS on a usb key... some that may have created some of a
mess in my GPG agent config :-/
-- 
Olivier BERGER 
http://www-public.it-sudparis.eu/~berger_o/ - OpenPGP-Id: 2048R/5819D7E8
Ingenieur Recherche - Dept INF
Institut Mines-Telecom, Telecom SudParis, Evry (France)

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

* Re: How to decrypt multipart/encrypted parts in notmuch-emacs
  2012-04-11 16:41 ` Jameson Graef Rollins
@ 2012-04-11 20:50   ` Olivier Berger
  2012-04-11 21:02     ` Olivier Berger
  2012-04-11 21:14     ` Jameson Graef Rollins
  0 siblings, 2 replies; 9+ messages in thread
From: Olivier Berger @ 2012-04-11 20:50 UTC (permalink / raw)
  To: notmuch

Hi.

Jameson Graef Rollins
<jrollins@finestructure.net> writes:

> On Wed, Apr 11 2012, Olivier Berger <olivier.berger@it-sudparis.eu> wrote:
>> Is there a way to decrypt multipart/encrypted messages in notmuch-emacs
>
> Hi, Olivier.  Yes, it is possible.
>
>> I can only get a purple "Decryption error" message...
>
> The fact that you're getting this messages means that notmuch is
> attempting to decrypt the message, but there was a decryption problem.
>
> A typical problem is that gpg-agent is not running.  Notmuch uses gnupg
> to decrypt, but it requires that gpg-agent be running to get the
> passphrase from the user.  Do you have gpg-agent running?
>

Thanks for this suggestion.

As I've responded to Daniel Kahn Gillmor in another message, it seems
that I may have messed with my config, and gpg-agent may not have worked
properly.

That's now fixed, I think. See below.

>> The mail looks like :
>
> The format of the multipart/encrypted looks fine, so I see no problems
> there (assuming the encryption was done properly).
>
> You might also try decrypting the message on the command line, as that
> will take any emacs issues out of the loop:
>
> notmuch show --decrypt id:$msgid
>

That works now, but only on the command-line.

Still, in notmuch-emacs, I can still see the purple "Decryption error"
message :-/

Weird.

Any other ideas ?

Best regards,

-- 
Olivier BERGER 
http://www-public.it-sudparis.eu/~berger_o/ - OpenPGP-Id: 2048R/5819D7E8
Ingenieur Recherche - Dept INF
Institut Mines-Telecom, Telecom SudParis, Evry (France)

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

* Re: How to decrypt multipart/encrypted parts in notmuch-emacs
  2012-04-11 20:50   ` Olivier Berger
@ 2012-04-11 21:02     ` Olivier Berger
  2012-04-11 21:09       ` Daniel Kahn Gillmor
  2012-04-11 21:14     ` Jameson Graef Rollins
  1 sibling, 1 reply; 9+ messages in thread
From: Olivier Berger @ 2012-04-11 21:02 UTC (permalink / raw)
  To: notmuch

Hi again.

Olivier Berger <olivier.berger@it-sudparis.eu>
writes:

> Hi.
>
> Jameson Graef Rollins
> <jrollins@finestructure.net> writes:
>
>>
>> You might also try decrypting the message on the command line, as that
>> will take any emacs issues out of the loop:
>>
>> notmuch show --decrypt id:$msgid
>>
>
> That works now, but only on the command-line.
>
> Still, in notmuch-emacs, I can still see the purple "Decryption error"
> message :-/
>
> Weird.
>

Oh, I've spotted why it fails.

So : if I launch emacs (23) from bash running in gnome-terminal in my gnome
(fallback) session, decryption works.

If I use Alt+F2 to trigger gnome's launcher, and type emacs, then
decryption won't work :-/

Both emacses run in X, but they don't have same ancestry, which may
explain why agent connection runs or not ?

Bug, feature ?

Thanks in advance.

Best regards,

-- 
Olivier BERGER 
http://www-public.it-sudparis.eu/~berger_o/ - OpenPGP-Id: 2048R/5819D7E8
Ingenieur Recherche - Dept INF
Institut Mines-Telecom, Telecom SudParis, Evry (France)

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

* Re: How to decrypt multipart/encrypted parts in notmuch-emacs
  2012-04-11 21:02     ` Olivier Berger
@ 2012-04-11 21:09       ` Daniel Kahn Gillmor
  0 siblings, 0 replies; 9+ messages in thread
From: Daniel Kahn Gillmor @ 2012-04-11 21:09 UTC (permalink / raw)
  To: Olivier Berger; +Cc: notmuch

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

On 04/11/2012 05:02 PM, Olivier Berger wrote:
> So : if I launch emacs (23) from bash running in gnome-terminal in my gnome
> (fallback) session, decryption works.
> 
> If I use Alt+F2 to trigger gnome's launcher, and type emacs, then
> decryption won't work :-/
> 
> Both emacses run in X, but they don't have same ancestry, which may
> explain why agent connection runs or not ?

Can you try comparing their environments?

Assuming you're using the Linux kernel, if the two emacsen have process
IDs $PID0 and $PID1, then in bash you can do:

diff -u \
 <(tr '\0' '\n' < /proc/$PID0/environ | sort) \
 <(tr '\0' '\n' < /proc/$PID1/environ | sort) \

hth,

	--dkg


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 1030 bytes --]

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

* Re: How to decrypt multipart/encrypted parts in notmuch-emacs
  2012-04-11 20:50   ` Olivier Berger
  2012-04-11 21:02     ` Olivier Berger
@ 2012-04-11 21:14     ` Jameson Graef Rollins
  1 sibling, 0 replies; 9+ messages in thread
From: Jameson Graef Rollins @ 2012-04-11 21:14 UTC (permalink / raw)
  To: Olivier Berger, notmuch

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

On Wed, Apr 11 2012, Olivier Berger <olivier.berger@it-sudparis.eu> wrote:
> Thanks for this suggestion.
>
> As I've responded to Daniel Kahn Gillmor in another message, it seems
> that I may have messed with my config, and gpg-agent may not have worked
> properly.
>
> That's now fixed, I think. See below.

That's great!  I'm glad you got it working.

On Wed, Apr 11 2012, Olivier Berger <olivier.berger@it-sudparis.eu> wrote:
> Oh, I've spotted why it fails.
>
> So : if I launch emacs (23) from bash running in gnome-terminal in my gnome
> (fallback) session, decryption works.
>
> If I use Alt+F2 to trigger gnome's launcher, and type emacs, then
> decryption won't work :-/
>
> Both emacses run in X, but they don't have same ancestry, which may
> explain why agent connection runs or not ?
>
> Bug, feature ?

I'm not sure what to say here, but it's almost certainly not a notmuch
issue.  It sounds like it may be related to your fairly complicated gpg
setup.  You might want to see what the GPG_AGENT_INFO environment
variable is in the two cases.

In any event, I'm glad you've got it sort of working.  Good luck!

jamie.

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

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

end of thread, other threads:[~2012-04-11 21:14 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-11 15:07 How to decrypt multipart/encrypted parts in notmuch-emacs Olivier Berger
2012-04-11 16:41 ` Jameson Graef Rollins
2012-04-11 20:50   ` Olivier Berger
2012-04-11 21:02     ` Olivier Berger
2012-04-11 21:09       ` Daniel Kahn Gillmor
2012-04-11 21:14     ` Jameson Graef Rollins
2012-04-11 16:58 ` Notmuch not able to decrypt some GPG multipart/encrypted emails - Was: " Olivier Berger
2012-04-11 17:09   ` Daniel Kahn Gillmor
2012-04-11 20:46     ` Olivier Berger

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

	https://yhetil.org/notmuch.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).