Bug 289722

Summary: Incorrect Content-Transfer-Encoding header value is set for openpgp/mime encrypted mails
Product: [Applications] kmail2 Reporter: Stanislav Sidorenko <mail>
Component: cryptoAssignee: kdepim bugs <kdepim-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: arpad.kunszt, bugs, gentoo, heri+kde, mail, rdieter, saschpe, sknauss
Priority: NOR    
Version: 4.9.2   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In: 4.10.2
Sentry Crash Report:
Attachments: Proposed patch

Description Stanislav Sidorenko 2011-12-24 09:49:37 UTC
Version:           4.7 (using KDE 4.7.3) 
OS:                Linux

If you try to send encrypted pgp/mime email that contain 8bit characters then main Content-Transfer-Encoding header will be set to base64, but it shoud contain 7Bit in this case. 

Here is a part of problematic message:

----------------------------------
MIME-Version: 1.0
Content-Type: multipart/encrypted; boundary="nextPart5141910.e6Y767UtIz"; protocol="application/pgp-encrypted"
Content-Transfer-Encoding: base64 


--nextPart5141910.e6Y767UtIz
Content-Type: application/pgp-encrypted
Content-Disposition: attachment

Version: 1
--nextPart5141910.e6Y767UtIz
Content-Type: application/octet-stream
Content-Disposition: inline; filename="msg.asc"

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

hQEMA5XFb/XflcUEAQf/XJ8D5zLDrTTXaE3MtlW4//pMc6ZH8S1bKMeQqKg8LM0U
8KnzFCoy5smyWZrMFqNmoK7CwVnfDS1AgYamVwDNPJLcYlTTqs1YCEJ2Fv/t6EtA
----------------------------------

As a result other mail client fail to decrypt and verify such mail - they try to decode base64 stream which is actually absent here.


Reproducible: Always

Steps to Reproduce:
1) Create a new message with some non 7bit characters, e.g. "Тестовое сообщение".
2) Enable PGP/MIME encryption for message.
3) Put it to queue or send it.

Actual Results:  
Content-Transfer-Encoding: base64 

Expected Results:  
Content-Transfer-Encoding: 7Bit

Note, that only main(external) Content-Transfer-Encoding header should contain 7Bit, some headers are also included into encrypted stream - they are to be defined depending on actual message data.
Comment 1 Christophe Marin 2012-01-08 10:33:05 UTC

*** This bug has been marked as a duplicate of bug 289728 ***
Comment 2 Stanislav Sidorenko 2012-06-04 19:05:22 UTC
This is not actually duplicate of bug 289728. That bug is similar to this one, but that is about inline (deprecated) openpgp format, but this one is about newer pgp/mime format.
Comment 3 Stanislav Sidorenko 2012-06-04 19:07:31 UTC
Created attachment 71583 [details]
Proposed patch

This fixes this bug for me, but I'm not sure about potential regressions. And it does not fix bug 289728.
Comment 4 Sandro Knauß 2013-03-03 21:14:58 UTC
Hey,

A Patch is now in review that should fix this bug:
https://git.reviewboard.kde.org/r/109272
Comment 5 Sandro Knauß 2013-03-06 22:13:48 UTC
Git commit 597f7a5f56061d0107b3264b6453cf7b09cbfc6a by Sandro Knauß.
Committed on 03/03/2013 at 19:50.
Pushed by knauss into branch 'KDE/4.10'.

Fixing ContentTransferEncoding for signed&encrypted messages
Related: bug 289728
REVIEW: 109272
FIXED-IN: 4.10.2

M  +31   -7    messagecomposer/util.cpp

http://commits.kde.org/kdepim/597f7a5f56061d0107b3264b6453cf7b09cbfc6a
Comment 6 Sandro Knauß 2013-03-28 09:01:25 UTC
*** Bug 296629 has been marked as a duplicate of this bug. ***
Comment 7 Sandro Knauß 2013-11-08 14:36:16 UTC
*** Bug 109229 has been marked as a duplicate of this bug. ***
Comment 8 Sandro Knauß 2013-11-08 14:37:06 UTC
*** Bug 263155 has been marked as a duplicate of this bug. ***
Comment 9 Dennis Schridde 2015-01-22 08:26:03 UTC
I am using KMail 4.14.2 on Ubuntu 14.04 and am still experience this issue. Please reopen.

Listserv replies:
---
Your message contains a QUOTED-PRINTABLE encoded composite MIME part, which is
not allowed by Internet standards (see  RFC2045, section 6.4, paragraph 5). In
plain English, an error in your mail program, or in a firewall or mail gateway
between your computer and LISTSERV, has caused  an error in the format of your
message.
---

Excerpt from the message returned by listserv:
---
[…]
User-Agent: KMail/4.14.2 (Linux/3.13.0-44-generic; KDE/4.14.2; x86_64; ; )
[…]
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="nextPart1643101.pK0q01Qtpq"; micalg="pgp-sha1"; protocol="application/pgp-signature"


--nextPart1643101.pK0q01Qtpq
Content-Type: multipart/mixed; boundary="nextPart1991752.9pWY7iA1iV"
Content-Transfer-Encoding: quoted-printable

This is a multi-part message in MIME format.
[…]
---

My original problem description can be found in bug #296629.
Comment 10 Dennis Schridde 2015-01-22 08:32:49 UTC
P.S: This message also has two 500KiB PDF attachments:

=2D-nextPart2164026.fLyKns4tNR
Content-Disposition: attachment; filename="[…].pdf"
Content-Transfer-Encoding: base64
Content-Type: application/pdf; name="[…].pdf"
Comment 11 Dennis Schridde 2015-01-29 18:46:11 UTC
Just ran into this again. Please reopen.