Archive of RubyForge sup-talk mailing list
 help / color / mirror / Atom feed
* [sup-talk] Bug: Messages using inline GPG are not decrypted
@ 2009-09-22 17:05 Michael Stapelberg
  2009-09-22 17:24 ` Michael Stapelberg
  0 siblings, 1 reply; 8+ messages in thread
From: Michael Stapelberg @ 2009-09-22 17:05 UTC (permalink / raw)


Hi,

I noticed that emails sent by Thunderbird which contain inline GPG messages
are not decrypted at all. I?ve attached such a message so you can verify
it. Unfortunately my ruby skills did not suffice to fix this on my own.

Thanks and best regards,
Michael
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: crypted.txt
URL: <http://rubyforge.org/pipermail/sup-talk/attachments/20090922/628024f2/attachment.txt>


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

* [sup-talk] Bug: Messages using inline GPG are not decrypted
  2009-09-22 17:05 [sup-talk] Bug: Messages using inline GPG are not decrypted Michael Stapelberg
@ 2009-09-22 17:24 ` Michael Stapelberg
  2009-09-25 19:10   ` Michael Stapelberg
  0 siblings, 1 reply; 8+ messages in thread
From: Michael Stapelberg @ 2009-09-22 17:24 UTC (permalink / raw)


Hi,

Excerpts from Michael Stapelberg's message of Di Sep 22 19:05:48 +0200 2009:
> I noticed that emails sent by Thunderbird which contain inline GPG messages
> are not decrypted at all. I?ve attached such a message so you can verify
> it. Unfortunately my ruby skills did not suffice to fix this on my own.
Addition: Probably I was able to fix it, but the other bug I reported about
not being able to open GPG encrypted email at all was the one I was seeing.
So, fix should be easy (untested, because of the other bug):

--- a/lib/sup/message.rb
+++ b/lib/sup/message.rb
@@ -436,6 +436,16 @@ private
       end
 
       chunks
+    elsif m.header.content_type == "application/pgp"
+     notice, sig, decryptedm = CryptoManager.decrypt m.body
+     if decryptedm # managed to decrypt
+       children = message_to_chunks(decryptedm, true)
+       chunks = [notice, sig, children]
+     else
+       chunks = [notice]
+     end
+
+     chunks
     elsif m.header.content_type == "message/rfc822"
       if m.body
         payload = RMail::Parser.read(m.body)

Best regards,
Michael


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

* [sup-talk] Bug: Messages using inline GPG are not decrypted
  2009-09-22 17:24 ` Michael Stapelberg
@ 2009-09-25 19:10   ` Michael Stapelberg
  2009-09-26 18:09     ` William Morgan
  0 siblings, 1 reply; 8+ messages in thread
From: Michael Stapelberg @ 2009-09-25 19:10 UTC (permalink / raw)


Hi,

after fixing the other bug related to GPG messages, this patch has to be
modified, too:

--- a/lib/sup/message.rb
+++ b/lib/sup/message.rb
@@ -436,6 +436,16 @@ private
       end
 
       chunks
+    elsif m.header.content_type == "application/pgp"
+     notice, sig, decryptedm = CryptoManager.decrypt m.body
+     if decryptedm # managed to decrypt
+       children = message_to_chunks(decryptedm, true)
+       chunks = [notice, sig, children].flatten.compact
+     else
+       chunks = [notice]
+     end
+
+     chunks
     elsif m.header.content_type == "message/rfc822"
       if m.body
         payload = RMail::Parser.read(m.body)

Best regards,
Michael


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

* [sup-talk] Bug: Messages using inline GPG are not decrypted
  2009-09-25 19:10   ` Michael Stapelberg
@ 2009-09-26 18:09     ` William Morgan
  2009-09-26 20:28       ` Michael Stapelberg
  0 siblings, 1 reply; 8+ messages in thread
From: William Morgan @ 2009-09-26 18:09 UTC (permalink / raw)


Reformatted excerpts from Michael Stapelberg's message of 2009-09-25:
> after fixing the other bug related to GPG messages, this patch has to be
> modified, too:

I believe I've fixed this in git. Thunderbird is not producing
RFC3156-compliant encrypted emails, but by the Postel's Law we will
accomodate their errors. Let me know if it doesn't work.
-- 
William <wmorgan-sup at masanjin.net>


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

* [sup-talk] Bug: Messages using inline GPG are not decrypted
  2009-09-26 18:09     ` William Morgan
@ 2009-09-26 20:28       ` Michael Stapelberg
  2009-09-26 21:37         ` Ben Walton
  2009-09-26 21:41         ` Michael Stapelberg
  0 siblings, 2 replies; 8+ messages in thread
From: Michael Stapelberg @ 2009-09-26 20:28 UTC (permalink / raw)


Hi,

Excerpts from William Morgan's message of Sa Sep 26 20:09:36 +0200 2009:
> I believe I've fixed this in git. Thunderbird is not producing
> RFC3156-compliant encrypted emails, but by the Postel's Law we will
> accomodate their errors. Let me know if it doesn't work.
The changes basically work. The message itself is opened and decrypted
correctly. However, when handling some messages, an exception occurs
(downcase called on NilClass), which can be fixed like this:

--- a/lib/sup/message.rb
+++ b/lib/sup/message.rb
@@ -436,7 +436,7 @@ private
       end
 
       chunks
-    elsif m.header.content_type.downcase == "message/rfc822"
+    elsif m.header.content_type && m.header.content_type.downcase == "message/rfc822"
       if m.body
         payload = RMail::Parser.read(m.body)
         from = payload.header.from.first ? payload.header.from.first.format : ""
@@ -456,7 +456,7 @@ private
         debug "no body for message/rfc822 enclosure; skipping"
         []
       end
-    elsif m.header.content_type.downcase == "application/pgp" && m.body
+    elsif m.header.content_type && m.header.content_type.downcase == "application/pgp" && m.body
       ## apparently some versions of Thunderbird generate encryped email that
       ## does not follow RFC3156, e.g. messages with X-Enigmail-Version: 0.95.0
       ## they have no MIME multipart and just set the body content type to

Best regards,
Michael


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

* [sup-talk] Bug: Messages using inline GPG are not decrypted
  2009-09-26 20:28       ` Michael Stapelberg
@ 2009-09-26 21:37         ` Ben Walton
  2009-09-26 21:41         ` Michael Stapelberg
  1 sibling, 0 replies; 8+ messages in thread
From: Ben Walton @ 2009-09-26 21:37 UTC (permalink / raw)


Excerpts from Michael Stapelberg's message of Sat Sep 26 16:28:54 -0400 2009:
> The changes basically work. The message itself is opened and decrypted
> correctly. However, when handling some messages, an exception occurs
> (downcase called on NilClass), which can be fixed like this:

+1 for this patch.  I need it after updating too.

-Ben
-- 
Ben Walton
Systems Programmer - CHASS
University of Toronto
C:416.407.5610 | W:416.978.4302

GPG Key Id: 8E89F6D2; Key Server: pgp.mit.edu
Contact me to arrange for a CAcert assurance meeting.


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

* [sup-talk] Bug: Messages using inline GPG are not decrypted
  2009-09-26 20:28       ` Michael Stapelberg
  2009-09-26 21:37         ` Ben Walton
@ 2009-09-26 21:41         ` Michael Stapelberg
  2009-09-27  1:40           ` William Morgan
  1 sibling, 1 reply; 8+ messages in thread
From: Michael Stapelberg @ 2009-09-26 21:41 UTC (permalink / raw)


Hi,

Excerpts from Michael Stapelberg's message of Sa Sep 26 22:28:54 +0200 2009:
> The changes basically work. The message itself is opened and decrypted
> correctly. However, when handling some messages, an exception occurs
> (downcase called on NilClass), which can be fixed like this:
I noticed that this is not the only place where this was wrong. Complete
patch attached (also fixes mixups like control.header.downcase.content_type
vs. control.header.content_type.downcase).

Best regards,
Michael
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sup-downcase.patch
Type: application/octet-stream
Size: 2375 bytes
Desc: not available
URL: <http://rubyforge.org/pipermail/sup-talk/attachments/20090926/da544580/attachment.obj>


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

* [sup-talk] Bug: Messages using inline GPG are not decrypted
  2009-09-26 21:41         ` Michael Stapelberg
@ 2009-09-27  1:40           ` William Morgan
  0 siblings, 0 replies; 8+ messages in thread
From: William Morgan @ 2009-09-27  1:40 UTC (permalink / raw)


Reformatted excerpts from Michael Stapelberg's message of 2009-09-26:
> I noticed that this is not the only place where this was wrong. Complete
> patch attached (also fixes mixups like control.header.downcase.content_type
> vs. control.header.content_type.downcase).

Applied, thanks. BTW it will be slightly easier on me if you commit
changes and use git format-patch to send them (or git send-email). That
will also put your name in the automatically-generated contributors
list.
-- 
William <wmorgan-sup at masanjin.net>


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

end of thread, other threads:[~2009-09-27  1:40 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-22 17:05 [sup-talk] Bug: Messages using inline GPG are not decrypted Michael Stapelberg
2009-09-22 17:24 ` Michael Stapelberg
2009-09-25 19:10   ` Michael Stapelberg
2009-09-26 18:09     ` William Morgan
2009-09-26 20:28       ` Michael Stapelberg
2009-09-26 21:37         ` Ben Walton
2009-09-26 21:41         ` Michael Stapelberg
2009-09-27  1:40           ` William Morgan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox