* [sup-talk] PGP INLINE - can't make it work
@ 2010-02-26 17:08 kosmici-atakuja
2010-02-26 17:43 ` Sven Schober
0 siblings, 1 reply; 16+ messages in thread
From: kosmici-atakuja @ 2010-02-26 17:08 UTC (permalink / raw)
To: sup-talk
First of wall I want to say I absolutely love sup! I used all the major mail
clients like mutt, claws, thunderbird, kmail. All mail clients just fail (mutt
was the closest though...). Sup so far has the potential to be the best of
them. If only I can get it to read the inline gpg that enigmail makes...
Example email looks like this in sup:
-----BEGIN PGP MESSAGE-----
Charset: UTF-8
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
hQIOA3WKxDKSmLd7EAf/cKH72GNHWgkY46sjHuYBlV5Q9udlmjB1ucTqtVfSUysH
[cut]
NYqMmmJ1HHG58B9bPqGFPNe/jEPeiiqj9Ez58kYzS32VeelJFwV+O8K9/TAvG4HN
fEIgtYMGj0Uc5v0eZ7yVqFfluJrEX5V7mN2InahTCD+uFEfguvld8rZagEtlyxU5
=nAMm
-----END PGP MESSAGE-----
And it gets displayed like this, no error messages or anything. I have
configured my gpg in sup as per this wiki page:
http://sup.rubyforge.org/wiki/wiki.pl?GPG
(with the numeric ID and such).
And I enabled verbose debug logging, here's the log:
(cutting leading timestamp for better reading)
using character set encoding "UTF-8"
No 'chronic' gem detected. Install it for date/time query restrictions.
No 'ncursesw' gem detected. Install it for wide character support.
dynamically loading setlocale() from libc.so.6
setting locale...
using xapian index
locking /home/piotr/.sup/lock...
crypto: detected gpg binary in /usr/bin/gpg
starting curses
initializing log buffer
Welcome to Sup! Log level is set to debug.
initializing inbox buffer
ready for interaction!
colormap: for color twiddle_color, using id 1 -> 4, -1
colormap: for color status_color, using id 2 -> 7, 4
colormap: for color tagged_color_highlight, using id 3 -> 3, 6
colormap: for color date_color_highlight, using id 4 -> 0, 6
colormap: for color to_me_color_highlight, using id 5 -> 2, 6
colormap: for color tagged_color, using id 6 -> 3, -1
colormap: for color date_color, using id 7 -> 7, -1
colormap: for color to_me_color, using id 8 -> 2, -1
colormap: for color snippet_color, using id 9 -> 6, -1
scanning maildir /home/piotr/Mail...
done scanning maildir
crypto: running: /usr/bin/gpg --quiet --batch --no-verbose --logger-fd 1 --
use-agent --output /tmp/32042-0-redwood.outp
scanning maildir /home/piotr/Mail...
done scanning maildir
crypto: running: /usr/bin/gpg --quiet --batch --no-verbose --logger-fd 1 --
use-agent --output /tmp/32042-0-redwood.outp
crypto: running: /usr/bin/gpg --quiet --batch --no-verbose --logger-fd 1 --
use-agent --output /tmp/32042-2-redwood.outp
crypto: running: /usr/bin/gpg --quiet --batch --no-verbose --logger-fd 1 --
use-agent --output /tmp/32042-0-redwood.outp
colormap: for color alternate_patina_color, using id 10 -> 0, 4
colormap: for color message_patina_color, using id 11 -> 0, 2
colormap: for color system_buf_color_highlight, using id 12 -> 7, 6
(no errors there as far as I can see... And looks like it's running the gpg
binary succesfully... I just changed the maildir path for privacy in this log)
GPG is configured to use gpg-agent, the gpg-agent is running, pinentry program
shows up when running sup and I enter the correct password. I checked the
password many times already. Also, the environment variable $GPG_AGENT_INFO is
present and visible in sup environment (it's global and visible anywhere).
I already tried it without "use gpg-agent" and the effect was the same.
In mutt this worked, I mean the inline gpg messages were decrypted using this
same setup of gpg-agent and gpg. It also works in kmail (although not
perfectly, but decodes the messages).
Now, this may be a clue: when normal gpg message is used (mime) it sometimes
geta decrypted and sometimes doesn't. If it doesn't, sup only says this in the
message:
x This message has been decrypted for display
x Attachment: sup-attachment-1267203299-4513. (multipart/mixed; 71b)
When I'm trying to display this attachment it says:
For some bizarre reason, RubyMail was unable to parse this attachment.
and in the status line:
Couldn't execute view command, viewing as text.
(this may be because I have no run-mailcap file, but the message was in plain
text, no html, so it shouldn't be needed now should it? I'm planning on
getting some run-mailcap script from some debian system when I have some time,
but for now this inline GPG is my main priority)
I'm still not sure why they sometimes decrypt correctly and sometimes not, but
I can work with this, at least it works sometimes. But even when mime gpg
works, the inline stuff doesn't.
Verisions:
I'm using sup version 0.10.2 from Archlinux AUR.
ruby version is 1.9.1
xapian-core is 1.0.18
Is there anything I can do to get this working? This is a crucial feature for
me as almost all my work colleagues use thunderbird and enigmail to send their
email and that uses inline pgp crap as default (which I know is not conforming
to any standards etc.). And even if I can convince verybody to switch to mime,
I still have a couple hundred megs of archives in this damn format.
Moreover, I searched the list archives and it looks like some people have got
it working as there have been patches to make it work a couple of months ago.
And my version is recent (January) so those patches should be in it. It just
doesn't for me for some reason :(
I know I should read crypto.rb and figure it out from there. I tried, I just
can't understand it, as I'm not experienced in ruby, or email clients code for
that matter.
Please help!
Thank you
Piotr
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [sup-talk] PGP INLINE - can't make it work
2010-02-26 17:08 [sup-talk] PGP INLINE - can't make it work kosmici-atakuja
@ 2010-02-26 17:43 ` Sven Schober
2010-03-02 10:49 ` piotr.kempa
0 siblings, 1 reply; 16+ messages in thread
From: Sven Schober @ 2010-02-26 17:43 UTC (permalink / raw)
To: sup-talk
[-- Attachment #1.1: Type: text/plain, Size: 1346 bytes --]
Excerpts from kosmici-atakuja's message of Fri Feb 26 18:08:36 +0100 2010:
> First of wall I want to say I absolutely love sup! I used all the major mail
> clients like mutt, claws, thunderbird, kmail. All mail clients just fail (mutt
> was the closest though...). Sup so far has the potential to be the best of
> them. If only I can get it to read the inline gpg that enigmail makes...
>
+1
> Is there anything I can do to get this working? This is a crucial feature for
> me...
>
+1
> Moreover, I searched the list archives and it looks like some people have got
> it working as there have been patches to make it work a couple of months ago.
> And my version is recent (January) so those patches should be in it. It just
> doesn't for me for some reason :(
>
I think there was a (preliminary) patch from Michael Stapelberg
floating around, but somehow that didn't make it into next?
> I know I should read crypto.rb and figure it out from there. I tried, I just
> can't understand it, as I'm not experienced in ruby, or email clients code for
> that matter.
>
+1
> Please help!
+1
> Thank you
> Piotr
Ciao,
Sven
--
Sven Schober, sven.schober@uni-ulm.de |UNI ULM
http://www-vs.informatik.uni-ulm.de/dept/staff/schober/ |DISTRIBUTED
Room O27-346, Phone: +49-731-5024146 [+49-179-5060182] |SYSTEMS LAB
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
[-- Attachment #2: Type: text/plain, Size: 140 bytes --]
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [sup-talk] PGP INLINE - can't make it work
2010-02-26 17:43 ` Sven Schober
@ 2010-03-02 10:49 ` piotr.kempa
2010-03-02 13:59 ` Michael Stapelberg
2010-03-02 14:12 ` Sam Hall
0 siblings, 2 replies; 16+ messages in thread
From: piotr.kempa @ 2010-03-02 10:49 UTC (permalink / raw)
To: sup-talk
I digged a bit further, trying to decode the emails from commandline with "gpg
--decode". For some of the inline GPG emails the commandline version fails,
but for some other it works. Even for those that it works, sup just shows
undecoded version which leads me to believe it doesn't even try to decode,
which means it doesn't recognize the email as encrypted at all.
As far as I can deduct, sup only recognizes encrypted emails if they have
something like this inside:
Content-Type: multipart/encrypted;
boundary="nextPart15239034.i9UOPnLxZ9";
protocol="application/pgp-encrypted"
Or similar. Which is a reasonable behaviour.
On the other hand, if the damned enigmail creates an email with "Content-Type:
text/plain;" and then proceeds to include "-----BEGIN PGP MESSAGE-----" in the
body, sup treats this as (no surprise) text/plain and doesn't decode. If it
tried, it would succeed since this message passed through gpg --decode is
decoded okay.
So, I guess if this functionality is to be included in sup (and I think it
doesn't have to be since enigmail just makes broken messages and there's no
reason why anybody should put up with that:) it should not be in crypto.rb but
somewhere else, where the decision is made to even use functions from
crypto.rb (like decrypt) on a message. I'm no programmer but I guess it should
be something like this:
if payload contains "BEGIN PGP MESSAGE" then run the decrypt function from
crypto.rb on it.
For now - does anybody know a way to mass decrypt all messages in my mailbox
so I can keep them in plain text and use sup anyway? That would be ideal
solution but I just can't find a program to do that. And gpg itself isn't
helpful since it just prints decoded payload on --output, without the headers,
so it's no use in batch. I can try to code this in bash but maybe there's
something out there already?
Thank you
Piotr
On Friday 26 February 2010 18:43:04 Sven Schober wrote:
> Excerpts from kosmici-atakuja's message of Fri Feb 26 18:08:36 +0100 2010:
> > First of wall I want to say I absolutely love sup! I used all the major
mail
> > clients like mutt, claws, thunderbird, kmail. All mail clients just fail
(mutt
> > was the closest though...). Sup so far has the potential to be the best of
> > them. If only I can get it to read the inline gpg that enigmail makes...
> >
> +1
>
> > Is there anything I can do to get this working? This is a crucial feature
for
> > me...
> >
> +1
> > Moreover, I searched the list archives and it looks like some people have
got
> > it working as there have been patches to make it work a couple of months
ago.
> > And my version is recent (January) so those patches should be in it. It
just
> > doesn't for me for some reason :(
> >
> I think there was a (preliminary) patch from Michael Stapelberg
> floating around, but somehow that didn't make it into next?
>
> > I know I should read crypto.rb and figure it out from there. I tried, I
just
> > can't understand it, as I'm not experienced in ruby, or email clients code
for
> > that matter.
> >
> +1
>
> > Please help!
> +1
>
> > Thank you
> > Piotr
>
> Ciao,
> Sven
> --
> Sven Schober, sven.schober@uni-ulm.de |UNI ULM
> http://www-vs.informatik.uni-ulm.de/dept/staff/schober/ |DISTRIBUTED
> Room O27-346, Phone: +49-731-5024146 [+49-179-5060182] |SYSTEMS LAB
>
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [sup-talk] PGP INLINE - can't make it work
2010-03-02 10:49 ` piotr.kempa
@ 2010-03-02 13:59 ` Michael Stapelberg
2010-03-02 14:19 ` piotr.kempa
2010-03-02 14:12 ` Sam Hall
1 sibling, 1 reply; 16+ messages in thread
From: Michael Stapelberg @ 2010-03-02 13:59 UTC (permalink / raw)
To: sup-talk
Hi Piotr,
Excerpts from piotr.kempa's message of Di Mär 02 11:49:59 +0100 2010:
> So, I guess if this functionality is to be included in sup (and I think it
> doesn't have to be since enigmail just makes broken messages and there's no
> reason why anybody should put up with that:) it should not be in crypto.rb but
> somewhere else, where the decision is made to even use functions from
> crypto.rb (like decrypt) on a message. I'm no programmer but I guess it should
As mentioned, I wrote a patch to do this. It is currently in review and will
hopefully be included soon.
Best regards,
Michael
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [sup-talk] PGP INLINE - can't make it work
2010-03-02 10:49 ` piotr.kempa
2010-03-02 13:59 ` Michael Stapelberg
@ 2010-03-02 14:12 ` Sam Hall
1 sibling, 0 replies; 16+ messages in thread
From: Sam Hall @ 2010-03-02 14:12 UTC (permalink / raw)
To: sup-talk
On Tue, Mar 02, 2010 at 11:49 (+0100), piotr.kempa@wp.eu wrote:
> For now - does anybody know a way to mass decrypt all messages in my
> mailbox so I can keep them in plain text and use sup anyway?
Using mutt with tagging and decrypt-save should work (didn't test that,
though). Google for decrypt-save, it's not documented in the manual.
Best wishes,
/Sam
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [sup-talk] PGP INLINE - can't make it work
2010-03-02 13:59 ` Michael Stapelberg
@ 2010-03-02 14:19 ` piotr.kempa
2010-03-08 10:18 ` piotr.kempa
0 siblings, 1 reply; 16+ messages in thread
From: piotr.kempa @ 2010-03-02 14:19 UTC (permalink / raw)
To: sup-talk
Sounds cool, I can't wait then. Let's hope the patch is included in 0.11.
Thanks Michael!
Piotr
On Tuesday 02 March 2010 14:59:19 Michael Stapelberg wrote:
> Hi Piotr,
>
> Excerpts from piotr.kempa's message of Di Mär 02 11:49:59 +0100 2010:
> > So, I guess if this functionality is to be included in sup (and I think it
> > doesn't have to be since enigmail just makes broken messages and there's
no
> > reason why anybody should put up with that:) it should not be in crypto.rb
but
> > somewhere else, where the decision is made to even use functions from
> > crypto.rb (like decrypt) on a message. I'm no programmer but I guess it
should
> As mentioned, I wrote a patch to do this. It is currently in review and will
> hopefully be included soon.
>
> Best regards,
> Michael
> _______________________________________________
> sup-talk mailing list
> sup-talk@rubyforge.org
> http://rubyforge.org/mailman/listinfo/sup-talk
>
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [sup-talk] PGP INLINE - can't make it work
2010-03-02 14:19 ` piotr.kempa
@ 2010-03-08 10:18 ` piotr.kempa
2010-03-08 10:29 ` piotr.kempa
0 siblings, 1 reply; 16+ messages in thread
From: piotr.kempa @ 2010-03-08 10:18 UTC (permalink / raw)
To: sup-talk
On Tuesday 02 March 2010 15:19:23 piotr.kempa@wp.eu wrote:
> Sounds cool, I can't wait then. Let's hope the patch is included in 0.11.
> Thanks Michael!
> Piotr
>
> On Tuesday 02 March 2010 14:59:19 Michael Stapelberg wrote:
> > Hi Piotr,
> >
> > Excerpts from piotr.kempa's message of Di Mär 02 11:49:59 +0100 2010:
> > > So, I guess if this functionality is to be included in sup (and I think
it
> > > doesn't have to be since enigmail just makes broken messages and there's
> no
> > > reason why anybody should put up with that:) it should not be in
crypto.rb
> but
> > > somewhere else, where the decision is made to even use functions from
> > > crypto.rb (like decrypt) on a message. I'm no programmer but I guess it
> should
> > As mentioned, I wrote a patch to do this. It is currently in review and
will
> > hopefully be included soon.
> >
Can anyone confirm if this patch made it to 0.11? I just installed the new
version and it still doesn't work but if it's there then maybe I'm doing
something wrong. If it didn't, is it posted anywhere? I'll be happy to patch
0.11 myself instead of waiting for the next version. I really, really want to
start using sup :)
Thank you,
Piotr
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [sup-talk] PGP INLINE - can't make it work
2010-03-08 10:18 ` piotr.kempa
@ 2010-03-08 10:29 ` piotr.kempa
2010-03-08 10:41 ` Michael Stapelberg
2010-03-08 10:50 ` Sven Moritz Hallberg
0 siblings, 2 replies; 16+ messages in thread
From: piotr.kempa @ 2010-03-08 10:29 UTC (permalink / raw)
To: sup-talk
On Monday 08 March 2010 11:18:55 piotr.kempa@wp.eu wrote:
> On Tuesday 02 March 2010 15:19:23 piotr.kempa@wp.eu wrote:
> > Sounds cool, I can't wait then. Let's hope the patch is included in 0.11.
> > Thanks Michael!
> > Piotr
> >
> > On Tuesday 02 March 2010 14:59:19 Michael Stapelberg wrote:
> > > Hi Piotr,
> > >
> > > Excerpts from piotr.kempa's message of Di Mär 02 11:49:59 +0100 2010:
> > > > So, I guess if this functionality is to be included in sup (and I
think
> it
> > > > doesn't have to be since enigmail just makes broken messages and
there's
> > no
> > > > reason why anybody should put up with that:) it should not be in
> crypto.rb
> > but
> > > > somewhere else, where the decision is made to even use functions from
> > > > crypto.rb (like decrypt) on a message. I'm no programmer but I guess
it
> > should
> > > As mentioned, I wrote a patch to do this. It is currently in review and
> will
> > > hopefully be included soon.
> > >
>
> Can anyone confirm if this patch made it to 0.11? I just installed the new
> version and it still doesn't work but if it's there then maybe I'm doing
> something wrong. If it didn't, is it posted anywhere? I'll be happy to patch
> 0.11 myself instead of waiting for the next version. I really, really want
to
> start using sup :)
>
> Thank you,
> Piotr
>
Okay, I found the patch here: http://www.mail-archive.com/sup-
talk@rubyforge.org/msg02770.html
And it is included in 0.11, I just checked in the code.
However, this still doesn't work because the header doesn't contain Content
Type = application/pgp, it is text/plain, which is absolutely crazy and I have
no idea what the enigmail developers are thinking... Anyway, here's how it
looks like (only the important part):
X-Enigmail-Version: 0.95.7
Content-Type: text/plain;
charset=UTF-8
Content-Transfer-Encoding: quoted-printable
-----BEGIN PGP MESSAGE-----
Charset: UTF-8
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
=20
hQIOA3WKxDKSmLd7EAf9GP5JLA77IcGOAUrOZ8fGCEtK8Pm838Me+pMD94ulHlDS
LcidQKPSVGXaj4lLU8RqxoMKTpxuaZAm1u286C+SL9eQc51N3gH/X57loKhjCRb+
[...]
So in order to decide about encrypted content you actually have to look inside
the body of the message, not just at the header. At least I couldn't find any
indication in the headers :(
All in all, I wouldn't be surprised if you decided not to support such broken
emails so I'll just go about learning enough ruby to patch it myself :)
Piotr
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [sup-talk] PGP INLINE - can't make it work
2010-03-08 10:29 ` piotr.kempa
@ 2010-03-08 10:41 ` Michael Stapelberg
2010-03-08 10:50 ` Sven Moritz Hallberg
1 sibling, 0 replies; 16+ messages in thread
From: Michael Stapelberg @ 2010-03-08 10:41 UTC (permalink / raw)
To: sup-talk
Hi Piotr,
Excerpts from piotr.kempa's message of Mo Mär 08 11:29:47 +0100 2010:
> Okay, I found the patch here: http://www.mail-archive.com/sup-
> talk@rubyforge.org/msg02770.html
>
> And it is included in 0.11, I just checked in the code.
You are mistaken, this is a different patch (not for inline gpg).
> So in order to decide about encrypted content you actually have to look inside
> the body of the message, not just at the header. At least I couldn't find any
> indication in the headers :(
This is actually the very intention of inline gpg -- to work with existing
standards/mailclients which do not support different headers.
Unfortunately I did not yet have time to rework the patch, but I hope to do
so in the next few days.
Best regards,
Michael
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [sup-talk] PGP INLINE - can't make it work
2010-03-08 10:29 ` piotr.kempa
2010-03-08 10:41 ` Michael Stapelberg
@ 2010-03-08 10:50 ` Sven Moritz Hallberg
2010-03-08 11:20 ` piotr.kempa
1 sibling, 1 reply; 16+ messages in thread
From: Sven Moritz Hallberg @ 2010-03-08 10:50 UTC (permalink / raw)
To: sup-talk
> However, this still doesn't work because the header doesn't contain Content
> Type = application/pgp, it is text/plain, which is absolutely crazy and I have
> no idea what the enigmail developers are thinking...
In fact I think this might be a design decision on the part of PGP, where the
original thinking went something like this: It should be possible to use it
with ANY mailer, even those that do not know about it. Thus the support for
"inline PGP", i.e. a PGP message embedded within the text of a regular email.
From this standpoint it makes sense to keep the Content-Type as text/plain.
Imagine your recipient's MUA has no idea how to handle application/pgp. With
text/plain, she's still able to copy/paste into a separate PGP application.
The merit of this design decision is debatable, but I think that's the way it
came to be.
So, I'd say it's unlikely Enigmail is going to change the header. I'd also
guess that everyone else is doing it the same way.
So, actually inspecting the body of the message is the way to go...
HTH,
pesco
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [sup-talk] PGP INLINE - can't make it work
2010-03-08 10:50 ` Sven Moritz Hallberg
@ 2010-03-08 11:20 ` piotr.kempa
2010-03-09 17:06 ` Michael Stapelberg
0 siblings, 1 reply; 16+ messages in thread
From: piotr.kempa @ 2010-03-08 11:20 UTC (permalink / raw)
To: sup-talk
On Monday 08 March 2010 11:50:56 Sven Moritz Hallberg wrote:
> > However, this still doesn't work because the header doesn't contain
Content
> > Type = application/pgp, it is text/plain, which is absolutely crazy and I
have
> > no idea what the enigmail developers are thinking...
>
> In fact I think this might be a design decision on the part of PGP, where
the
> original thinking went something like this: It should be possible to use it
> with ANY mailer, even those that do not know about it. Thus the support for
> "inline PGP", i.e. a PGP message embedded within the text of a regular
email.
> >From this standpoint it makes sense to keep the Content-Type as text/plain.
> Imagine your recipient's MUA has no idea how to handle application/pgp. With
> text/plain, she's still able to copy/paste into a separate PGP application.
>
> The merit of this design decision is debatable, but I think that's the way
it
> came to be.
>
> So, I'd say it's unlikely Enigmail is going to change the header. I'd also
> guess that everyone else is doing it the same way.
>
> So, actually inspecting the body of the message is the way to go...
>
> HTH,
> pesco
> _______________________________________________
> sup-talk mailing list
> sup-talk@rubyforge.org
> http://rubyforge.org/mailman/listinfo/sup-talk
>
>
Thank you and Michael for the explanation. Now it all makes sense. I'll just
keep watching the git repo in case a patch makes it there. Or this list. If
anybody needs help testing such patch - I'm at your service. Coding it myself
could be way over my head though...
Thank you,
Piotr
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [sup-talk] PGP INLINE - can't make it work
2010-03-08 11:20 ` piotr.kempa
@ 2010-03-09 17:06 ` Michael Stapelberg
2010-03-10 10:53 ` Piotr Kempa
0 siblings, 1 reply; 16+ messages in thread
From: Michael Stapelberg @ 2010-03-09 17:06 UTC (permalink / raw)
To: sup-talk
Hi Piotr,
Excerpts from piotr.kempa's message of Mo Mär 08 12:20:02 +0100 2010:
> Thank you and Michael for the explanation. Now it all makes sense. I'll just
> keep watching the git repo in case a patch makes it there. Or this list. If
> anybody needs help testing such patch - I'm at your service. Coding it myself
> could be way over my head though...
I just sent an updated patch to sup-devel, you can find it at
http://rubyforge.org/pipermail/sup-devel/2010-March/000463.html
Testing it would be appreciated.
Best regards,
Michael
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [sup-talk] PGP INLINE - can't make it work
2010-03-09 17:06 ` Michael Stapelberg
@ 2010-03-10 10:53 ` Piotr Kempa
2010-03-10 11:14 ` Michael Stapelberg
0 siblings, 1 reply; 16+ messages in thread
From: Piotr Kempa @ 2010-03-10 10:53 UTC (permalink / raw)
To: sup-talk
[-- Attachment #1: Type: text/plain, Size: 1101 bytes --]
Excerpts from Michael Stapelberg's message of 2010-03-09 18:06:35 +0100:
> Hi Piotr,
>
> Excerpts from piotr.kempa's message of Mo Mär 08 12:20:02 +0100 2010:
> > Thank you and Michael for the explanation. Now it all makes sense. I'll just
> > keep watching the git repo in case a patch makes it there. Or this list. If
> > anybody needs help testing such patch - I'm at your service. Coding it myself
> > could be way over my head though...
> I just sent an updated patch to sup-devel, you can find it at
> http://rubyforge.org/pipermail/sup-devel/2010-March/000463.html
>
> Testing it would be appreciated.
>
> Best regards,
> Michael
Hello Michael,
Thank you. I just tried the patch and unfortunately sup crashes on me
now. I patched the 0.11 version and checked that the patches were
applied successfully (as far as I could at least).
I'm attaching the crash log. The crash happens like this: I add the
new source maildir with encrypted emails, run sup, it executes, sees
the new source and starts indexing emails and then crashes.
Hope this helps somehow.
Piotr
--
Piotr Kempa
[-- Attachment #2: exception-log.txt --]
[-- Type: text/plain, Size: 2024 bytes --]
--- NoMethodError from thread: poll after loading inbox
undefined method `split' for nil:NilClass
/usr/lib/ruby/gems/1.9.1/gems/sup-0.11/lib/sup/message.rb:515:in `message_to_chunks'
/usr/lib/ruby/gems/1.9.1/gems/sup-0.11/lib/sup/message.rb:420:in `multipart_encrypted_to_chunks'
/usr/lib/ruby/gems/1.9.1/gems/sup-0.11/lib/sup/message.rb:435:in `message_to_chunks'
/usr/lib/ruby/gems/1.9.1/gems/sup-0.11/lib/sup/message.rb:244:in `load_from_source!'
/usr/lib/ruby/gems/1.9.1/gems/sup-0.11/lib/sup/message.rb:340:in `build_from_source'
/usr/lib/ruby/gems/1.9.1/gems/sup-0.11/lib/sup/poll.rb:170:in `block in each_message_from'
/usr/lib/ruby/gems/1.9.1/gems/sup-0.11/lib/sup/maildir.rb:160:in `block in each'
/usr/lib/ruby/gems/1.9.1/gems/sup-0.11/lib/sup/maildir.rb:157:in `upto'
/usr/lib/ruby/gems/1.9.1/gems/sup-0.11/lib/sup/maildir.rb:157:in `each'
/usr/lib/ruby/gems/1.9.1/gems/sup-0.11/lib/sup/util.rb:610:in `__pass'
/usr/lib/ruby/gems/1.9.1/gems/sup-0.11/lib/sup/util.rb:597:in `method_missing'
/usr/lib/ruby/gems/1.9.1/gems/sup-0.11/lib/sup/poll.rb:164:in `each_message_from'
/usr/lib/ruby/gems/1.9.1/gems/sup-0.11/lib/sup/poll.rb:116:in `block (2 levels) in do_poll'
/usr/lib/ruby/gems/1.9.1/gems/sup-0.11/lib/sup/poll.rb:104:in `each'
/usr/lib/ruby/gems/1.9.1/gems/sup-0.11/lib/sup/poll.rb:104:in `block in do_poll'
<internal:prelude>:8:in `synchronize'
/usr/lib/ruby/gems/1.9.1/gems/sup-0.11/lib/sup/poll.rb:103:in `do_poll'
/usr/lib/ruby/gems/1.9.1/gems/sup-0.11/lib/sup/util.rb:570:in `method_missing'
/usr/lib/ruby/gems/1.9.1/gems/sup-0.11/lib/sup/modes/poll-mode.rb:15:in `poll'
/usr/lib/ruby/gems/1.9.1/gems/sup-0.11/lib/sup/poll.rb:50:in `poll_with_sources'
/usr/lib/ruby/gems/1.9.1/gems/sup-0.11/lib/sup/poll.rb:69:in `poll'
/usr/lib/ruby/gems/1.9.1/gems/sup-0.11/lib/sup/util.rb:570:in `method_missing'
/usr/lib/ruby/gems/1.9.1/gems/sup-0.11/bin/sup:231:in `block (2 levels) in <module:Redwood>'
/usr/lib/ruby/gems/1.9.1/gems/sup-0.11/lib/sup.rb:76:in `block in reporting_thread'
[-- Attachment #3: Type: text/plain, Size: 140 bytes --]
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [sup-talk] PGP INLINE - can't make it work
2010-03-10 10:53 ` Piotr Kempa
@ 2010-03-10 11:14 ` Michael Stapelberg
2010-03-10 14:41 ` Piotr Kempa
0 siblings, 1 reply; 16+ messages in thread
From: Michael Stapelberg @ 2010-03-10 11:14 UTC (permalink / raw)
To: sup-talk
[-- Attachment #1: Type: text/plain, Size: 400 bytes --]
Hi Piotr,
Excerpts from Piotr Kempa's message of Mi Mär 10 11:53:00 +0100 2010:
> Thank you. I just tried the patch and unfortunately sup crashes on me
> now. I patched the 0.11 version and checked that the patches were
> applied successfully (as far as I could at least).
Thanks for testing. Can you please see if the updated version works
for you (attached to this mail)?
Best regards,
Michael
[-- Attachment #2: 0001-Implement-inline-GPG.patch --]
[-- Type: application/octet-stream, Size: 7925 bytes --]
From 9c3de457828827b0ba9a3d98ca1870325eb6d21d Mon Sep 17 00:00:00 2001
From: Michael Stapelberg <michael@stapelberg.de>
Date: Tue, 9 Mar 2010 17:40:48 +0100
Subject: [PATCH] Implement inline GPG
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The SIG_PATTERN had to be changed because GPG, when clearsigning (which
is what happens when you send inline GPG messages), kind of escapes
lines beginning with dashes (so that the -----BEGIN PGP MESSAGE-----
lines don’t get messed up). Therefore, signatures, starting with "-- "
will be escaped as "- -- ". The manpage of GPG states that the process
of clearsigning is not reversible. Thus, there is no method in GPG to
get the original message.
---
lib/sup/crypto.rb | 62 ++++++++++++++++++++++++++++++++-------------------
lib/sup/message.rb | 42 ++++++++++++++++++++++++++++++++--
2 files changed, 78 insertions(+), 26 deletions(-)
diff --git a/lib/sup/crypto.rb b/lib/sup/crypto.rb
index 5ece6d9..abbcb98 100644
--- a/lib/sup/crypto.rb
+++ b/lib/sup/crypto.rb
@@ -97,18 +97,24 @@ EOS
encrypt from, to, payload, true
end
- def verify payload, signature # both RubyMail::Message objects
+ def verify payload, signature, detached=true # both RubyMail::Message objects
return unknown_status(cant_find_binary) unless @cmd
- payload_fn = Tempfile.new "redwood.payload"
- payload_fn.write format_payload(payload)
- payload_fn.close
+ if detached
+ payload_fn = Tempfile.new "redwood.payload"
+ payload_fn.write format_payload(payload)
+ payload_fn.close
+ end
signature_fn = Tempfile.new "redwood.signature"
signature_fn.write signature.decode
signature_fn.close
- output = run_gpg "--verify #{signature_fn.path} #{payload_fn.path}"
+ if detached
+ output = run_gpg "--verify #{signature_fn.path} #{payload_fn.path}"
+ else
+ output = run_gpg "--verify #{signature_fn.path}"
+ end
output_lines = output.split(/\n/)
if output =~ /^gpg: (.* signature from .*$)/
@@ -123,7 +129,7 @@ EOS
end
## returns decrypted_message, status, desc, lines
- def decrypt payload # a RubyMail::Message object
+ def decrypt payload, armor=false # a RubyMail::Message object
return unknown_status(cant_find_binary) unless @cmd
payload_fn = Tempfile.new "redwood.payload"
@@ -153,24 +159,34 @@ EOS
Chunk::CryptoNotice.new :invalid, $1, message.split("\n")
end
- # This is gross. This decrypted payload could very well be a multipart
- # element itself, as opposed to a simple payload. For example, a
- # multipart/signed element, like those generated by Mutt when encrypting
- # and signing a message (instead of just clearsigning the body).
- # Supposedly, decrypted_payload being a multipart element ought to work
- # out nicely because Message::multipart_encrypted_to_chunks() runs the
- # decrypted message through message_to_chunks() again to get any
- # children. However, it does not work as intended because these inner
- # payloads need not carry a MIME-Version header, yet they are fed to
- # RMail as a top-level message, for which the MIME-Version header is
- # required. This causes for the part not to be detected as multipart,
- # hence being shown as an attachment. If we detect this is happening,
- # we force the decrypted payload to be interpreted as MIME.
- msg = RMail::Parser.read output
- if msg.header.content_type =~ %r{^multipart/} && !msg.multipart?
- output = "MIME-Version: 1.0\n" + output
- output.force_encoding Encoding::ASCII_8BIT if output.respond_to? :force_encoding
+ if armor
+ msg = RMail::Message.new
+ # Look for Charset, they are put before the base64 crypted part
+ charsets = payload.body.split("\n").grep(/^Charset:/)
+ if !charsets.empty? and charsets[0] =~ /^Charset: (.+)$/
+ output = Iconv.easy_decode($encoding, $1, output)
+ end
+ msg.body = output
+ else
+ # This is gross. This decrypted payload could very well be a multipart
+ # element itself, as opposed to a simple payload. For example, a
+ # multipart/signed element, like those generated by Mutt when encrypting
+ # and signing a message (instead of just clearsigning the body).
+ # Supposedly, decrypted_payload being a multipart element ought to work
+ # out nicely because Message::multipart_encrypted_to_chunks() runs the
+ # decrypted message through message_to_chunks() again to get any
+ # children. However, it does not work as intended because these inner
+ # payloads need not carry a MIME-Version header, yet they are fed to
+ # RMail as a top-level message, for which the MIME-Version header is
+ # required. This causes for the part not to be detected as multipart,
+ # hence being shown as an attachment. If we detect this is happening,
+ # we force the decrypted payload to be interpreted as MIME.
msg = RMail::Parser.read output
+ if msg.header.content_type =~ %r{^multipart/} && !msg.multipart?
+ output = "MIME-Version: 1.0\n" + output
+ output.force_encoding Encoding::ASCII_8BIT if output.respond_to? :force_encoding
+ msg = RMail::Parser.read output
+ end
end
notice = Chunk::CryptoNotice.new :valid, "This message has been decrypted for display"
[notice, sig, msg]
diff --git a/lib/sup/message.rb b/lib/sup/message.rb
index ebc73fc..7a19f27 100644
--- a/lib/sup/message.rb
+++ b/lib/sup/message.rb
@@ -26,7 +26,7 @@ class Message
QUOTE_PATTERN = /^\s{0,4}[>|\}]/
BLOCK_QUOTE_PATTERN = /^-----\s*Original Message\s*----+$/
- SIG_PATTERN = /(^-- ?$)|(^\s*----------+\s*$)|(^\s*_________+\s*$)|(^\s*--~--~-)|(^\s*--\+\+\*\*==)/
+ SIG_PATTERN = /(^(- )*-- ?$)|(^\s*----------+\s*$)|(^\s*_________+\s*$)|(^\s*--~--~-)|(^\s*--\+\+\*\*==)/
MAX_SIG_DISTANCE = 15 # lines from the end
DEFAULT_SUBJECT = ""
@@ -511,8 +511,44 @@ private
## if there's no charset, use the current encoding as the charset.
## this ensures that the body is normalized to avoid non-displayable
## characters
- body = Iconv.easy_decode($encoding, m.charset || $encoding, m.decode) if m.body
- text_to_chunks((body || "").normalize_whitespace.split("\n"), encrypted)
+ if m.body
+ body = Iconv.easy_decode($encoding, m.charset || $encoding, m.decode)
+ else
+ body = ""
+ end
+ lines = body.split("\n")
+
+ ## Check for inline-PGP
+ msg_start = "^-----BEGIN PGP SIGNED MESSAGE-----$"
+ msg_end = "^-----END PGP SIGNED MESSAGE-----$"
+ gpg = lines.select { |l| true if l =~ /#{msg_start}/ .. l =~ /#{msg_end}/ }
+ if !gpg.empty?
+ msg = RMail::Message.new
+ msg.body = gpg.join("\n")
+
+ sig_start = "^-----BEGIN PGP SIGNATURE-----$"
+ sig = lines.select { |l| true if l =~ /#{msg_start}/ .. l =~ /#{sig_start}/ }
+ payload = RMail::Message.new
+ payload.body = sig[1, sig.count-2].join("\n")
+ return [CryptoManager.verify(nil, msg, false), message_to_chunks(payload)].flatten.compact
+ end
+
+ msg_start = "^-----BEGIN PGP MESSAGE-----$"
+ msg_end = "^-----END PGP MESSAGE-----$"
+ gpg = lines.select { |l| true if l =~ /#{msg_start}/ .. l =~ /#{msg_end}/ }
+ if !gpg.empty?
+ msg = RMail::Message.new
+ msg.body = gpg.join("\n")
+ notice, sig, decryptedm = CryptoManager.decrypt msg, true
+ if decryptedm # managed to decrypt
+ children = message_to_chunks(decryptedm, true)
+ return [notice, sig].compact + children
+ else
+ return [notice]
+ end
+ end
+
+ text_to_chunks(body.normalize_whitespace.split("\n"), encrypted)
end
end
end
--
1.6.5
[-- Attachment #3: Type: text/plain, Size: 140 bytes --]
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [sup-talk] PGP INLINE - can't make it work
2010-03-10 11:14 ` Michael Stapelberg
@ 2010-03-10 14:41 ` Piotr Kempa
2010-03-10 21:21 ` Michael Stapelberg
0 siblings, 1 reply; 16+ messages in thread
From: Piotr Kempa @ 2010-03-10 14:41 UTC (permalink / raw)
To: sup-talk
Excerpts from Michael Stapelberg's message of 2010-03-10 12:14:04 +0100:
> Hi Piotr,
>
> Excerpts from Piotr Kempa's message of Mi Mär 10 11:53:00 +0100 2010:
> > Thank you. I just tried the patch and unfortunately sup crashes on me
> > now. I patched the 0.11 version and checked that the patches were
> > applied successfully (as far as I could at least).
> Thanks for testing. Can you please see if the updated version works
> for you (attached to this mail)?
>
> Best regards,
> Michael
Wow, this works!! Thank you so much Michael! This will make my job soooo much
easier, faster and more pleasant :)
I have just two messages that give errors to sup-sync, but the remaining ones
(a hundred or more) just work beautifully. The error is like this:
[2010-03-10 15:25:28 +0100] Error while running gpg: gpg: invalid armor header:
gpg: malformed CRC
gpg: encrypted_mdc packet with unknown version 255
gpg: quoted printable character in armor - probably a buggy MTA has been used
[2010-03-10 15:25:33 +0100] Error while running gpg: gpg: invalid armor
header: gpg: CRC error; 9C0326 - DC39C0
gpg: encrypted_mdc packet with unknown version 255
gpg: quoted printable character in armor - probably a buggy MTA has been used
(two long lines with the timestamp broken by me)
But I guess this is what it says it is - an invalid message with CRC errors in
the GPG payload, so this should be nothing to worry about.
Anyway, thanks a million Michael!
--
Piotr Kempa
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [sup-talk] PGP INLINE - can't make it work
2010-03-10 14:41 ` Piotr Kempa
@ 2010-03-10 21:21 ` Michael Stapelberg
0 siblings, 0 replies; 16+ messages in thread
From: Michael Stapelberg @ 2010-03-10 21:21 UTC (permalink / raw)
To: sup-talk
Hi Piotr,
Excerpts from Piotr Kempa's message of Mi Mär 10 15:41:35 +0100 2010:
> Wow, this works!! Thank you so much Michael! This will make my job soooo much
> easier, faster and more pleasant :)
You’re welcome. Thanks for testing. I will now post the updated patch to
sup-devel and hope that rlane will merge it soon.
Best regards,
Michael
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2010-03-10 21:24 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-26 17:08 [sup-talk] PGP INLINE - can't make it work kosmici-atakuja
2010-02-26 17:43 ` Sven Schober
2010-03-02 10:49 ` piotr.kempa
2010-03-02 13:59 ` Michael Stapelberg
2010-03-02 14:19 ` piotr.kempa
2010-03-08 10:18 ` piotr.kempa
2010-03-08 10:29 ` piotr.kempa
2010-03-08 10:41 ` Michael Stapelberg
2010-03-08 10:50 ` Sven Moritz Hallberg
2010-03-08 11:20 ` piotr.kempa
2010-03-09 17:06 ` Michael Stapelberg
2010-03-10 10:53 ` Piotr Kempa
2010-03-10 11:14 ` Michael Stapelberg
2010-03-10 14:41 ` Piotr Kempa
2010-03-10 21:21 ` Michael Stapelberg
2010-03-02 14:12 ` Sam Hall
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox