Michael Stapelberg
2009-Sep-22 17:05 UTC
[sup-talk] Bug: Messages using inline GPG are not decrypted
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>
Michael Stapelberg
2009-Sep-22 17:24 UTC
[sup-talk] Bug: Messages using inline GPG are not decrypted
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
Michael Stapelberg
2009-Sep-25 19:10 UTC
[sup-talk] Bug: Messages using inline GPG are not decrypted
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
William Morgan
2009-Sep-26 18:09 UTC
[sup-talk] Bug: Messages using inline GPG are not decrypted
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>
Michael Stapelberg
2009-Sep-26 20:28 UTC
[sup-talk] Bug: Messages using inline GPG are not decrypted
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
Ben Walton
2009-Sep-26 21:37 UTC
[sup-talk] Bug: Messages using inline GPG are not decrypted
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.
Michael Stapelberg
2009-Sep-26 21:41 UTC
[sup-talk] Bug: Messages using inline GPG are not decrypted
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>
William Morgan
2009-Sep-27 01:40 UTC
[sup-talk] Bug: Messages using inline GPG are not decrypted
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>