[kmail2] [Bug 439904] Unable to decrypt PGP message sent via ProtonMail

2021-09-15 Thread Sandro Knauß
https://bugs.kde.org/show_bug.cgi?id=439904

--- Comment #4 from Sandro Knauß  ---
Here the relavant Applemail sample, that is used to test the correct parsing on
our side:
https://invent.kde.org/pim/messagelib/-/blob/master/mimetreeparser/autotests/data/openpgp-encrypted-applemail.mbox

-- 
You are receiving this mail because:
You are the assignee for the bug.

[kmail2] [Bug 439904] Unable to decrypt PGP message sent via ProtonMail

2021-09-15 Thread Sandro Knauß
https://bugs.kde.org/show_bug.cgi?id=439904

Sandro Knauß  changed:

   What|Removed |Added

 Ever confirmed|0   |1
 Status|REPORTED|CONFIRMED
 CC||skna...@kde.org

--- Comment #3 from Sandro Knauß  ---
Your information are not enough to understand what mime structure ProtonMail is
using. Can you provide one encrypted mail uploading it as attachment to this
bug? The content of the encrypted part, i can replace with something that can
be used in tests, but I need a sample of a real mail.

But for sure it seems, like they do not follow the RF 3156 Section 4 (
https://datatracker.ietf.org/doc/html/rfc3156#section-4):
"
   OpenPGP encrypted data is denoted by the "multipart/encrypted"
   content type, described in [2], and MUST have a "protocol" parameter
   value of "application/pgp-encrypted".  Note that the value of the
   parameter MUST be enclosed in quotes.

   The multipart/encrypted MIME body MUST consist of exactly two body
   parts, the first with content type "application/pgp-encrypted".  This
   body contains the control information.  A message complying with this
   standard MUST contain a "Version: 1" field in this body.  Since the
   OpenPGP packet format contains all other information necessary for
   decrypting, no other information is required here."

It would makes our life much more easier when ProtonMail would follow the RFC.
As all other e-mail clients need a special treatment for those mails too. 

Thanks for the patch. Often patches are missed, when provided as part of a
bugreport. Please create MR on https://invent.kde.org/pim/messagelib, than we
can make sure that this is fixed soon.

Btw normally encrypted mails should be handled by
MultiPartEncryptedBodyPartFormatter. The
ApplicationPGPEncryptedBodyPartFormatter was added to parse non conform
Applemail encrypted mails ;)
See https://bugs.kde.org/show_bug.cgi?id=360910

-- 
You are receiving this mail because:
You are the assignee for the bug.

[kmail2] [Bug 439904] Unable to decrypt PGP message sent via ProtonMail

2021-07-15 Thread Richard Weinberger
https://bugs.kde.org/show_bug.cgi?id=439904

--- Comment #2 from Richard Weinberger  ---
With this massiv hack I managed kmail to decrypt such messages:

diff --git a/mimetreeparser/src/bodyformatter/multipartmixed.cpp
b/mimetreeparser/src/bodyformatter/multipartmixed.cpp
index 00b90e121cf5..226909cef8d9 100644
--- a/mimetreeparser/src/bodyformatter/multipartmixed.cpp
+++ b/mimetreeparser/src/bodyformatter/multipartmixed.cpp
@@ -21,6 +21,9 @@

 #include "objecttreeparser.h"
 #include "messagepart.h"
+#include "utils.h"
+
+#include "bodyformatter/multipartencrypted.h"

 #include 

@@ -44,6 +47,14 @@ MessagePart::Ptr
MultiPartMixedBodyPartFormatter::process(Interface::BodyPart &p
 return MessagePart::Ptr();
 }

+// if the container contains a PGP part, assume it is some PGP mail and
re-inject
+// it into the MultiPartEncryptedBodyPartFormatter.
+if (findTypeInDirectChilds(part.content(), "application/pgp-encrypted")) {
+const auto formatter = MultiPartEncryptedBodyPartFormatter::create();
+qCWarning(MIMETREEPARSER_LOG) << "Found a application/pgp-encrypted
child";
+return formatter->process(part);
+}
+
 // normal treatment of the parts in the mp/mixed container
 MimeMessagePart::Ptr mp(new MimeMessagePart(part.objectTreeParser(),
part.content()->contents().at(0), false));
 return mp;

I had also to disable the ApplicationGnuPGWKSPlugin plugin from kdepim-addons.
ApplicationGnuPGWKSPlugin completely voids MultiPartMixedBodyPartFormatter. But
that's a different issue, I guess.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[kmail2] [Bug 439904] Unable to decrypt PGP message sent via ProtonMail

2021-07-15 Thread Richard Weinberger
https://bugs.kde.org/show_bug.cgi?id=439904

--- Comment #1 from Richard Weinberger  ---
I think I've found the root cause. The very first like of ProtonMail encrypted
mails are "Content-Type: multipart/mixed;".
When I manually change this line to "Content-Type: multipart/encrypted;"
Kmail is able to decrypt the message.

-- 
You are receiving this mail because:
You are the assignee for the bug.