Bug 289728

Summary: Incorrect inline-openpgp encrypted message is generated
Product: kmail2 Reporter: Stanislav Sidorenko <mail>
Component: cryptoAssignee: kdepim bugs <kdepim-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: arpad.kunszt, montel, quazgar, rdieter, sknauss
Priority: NOR    
Version: 4.7   
Target Milestone: ---   
Platform: Ubuntu Packages   
OS: Linux   
Latest Commit: Version Fixed In: 4.10.2

Description Stanislav Sidorenko 2011-12-24 11:05:54 UTC
Version:           4.7 (using KDE 4.7.3) 
OS:                Linux

Kmail generate inline-pgp encrypted messages incorrectly if they contain non-7bit characters.

Reproducible: Always

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

Actual Results:  
The following nonsense message is generated (some first lines are skipped):

User-Agent: KMail/4.7.3 (Linux/3.0.0-15-generic; KDE/4.7.4; x86_64; ; )
MIME-Version: 1.0
Content-Transfer-Encoding: base64
Content-Type: text/plain; charset="utf-8"

BEGINPGPMESSAGEVersionGnuPGv1411GNU/LinuxhQEMA5XFb/XflcUEAQf8DgQ4PWfOI7Q9WRw
nN/V9qu7fIJRlK7sqb9DKF/PlaNy8ZfTf/TNG5MJ+yokeX0nXkRBCPdVBLVLRnfuUam2xK3kC1LV
6ORPRWBJcTyj27pKejXemSenPb0H1dXZwqNvf3g/wYRKbgU+6R2zQVlb8dvwoP48S3pOFSYfrmr4
xXSwvJ+xcgQ6u8ul27tZ7HhdSwlYrV7HF5aPFQZL00zqZ1Pxth0qss8aaW8aOAnjssncW2ipN6u8
dtVMMdr+AWPPI15Tyatvo6m7O532FTkz1+keIwGf0eFZsbYbriMY44ff5YKNnM7GMULXOC61bGuw
aF51Rapy2IT4suLMvlaCt0dJIAaw2qCWbCKz7agF2WaGvhcuQJmmcTQ9DmrlDvXY4NUUHM/1Ga/j
euZUIK5TtDch5eECh0tBOhwEjJPNZcRg22ZvhOdUfzj/HAzFD8ENDPGPMESSAGEACg==



Expected Results:  
If new message contains only 7bit characters then generation will be correct.
Comment 1 Christophe Giboudeaux 2012-01-08 10:33:05 UTC
*** Bug 289722 has been marked as a duplicate of this bug. ***
Comment 2 Christophe Giboudeaux 2012-01-08 10:33:13 UTC
*** Bug 289723 has been marked as a duplicate of this bug. ***
Comment 3 quazgar 2012-01-21 23:01:21 UTC
I can confirm this with Kmail2 on KDE 4.7.3.
Comment 4 Kunszt Arpad 2012-03-06 08:35:41 UTC
Is there any progress on this? It's a very frustrating bug if you work in a non-English speaking country...

I can confirm this with KMail 4.7.4 on KDE 4.7.4.
Comment 5 quazgar 2012-05-11 18:55:06 UTC
I can confirm this with Kontact 4.8.0 (gpg 2.0.17), even when the body consists of just one single umlaut character.
Comment 6 Laurent Montel 2012-08-16 14:19:31 UTC
Still valid in 4.9 ?
What is real bug ?
Sorry I don't understand problem
Comment 7 quazgar 2012-08-16 14:44:52 UTC
(In reply to comment #6)
> Still valid in 4.9 ?
This will have to be answered by somebody with 4.9.  Still valid in 4.8.3, I just tested it again.

> What is real bug ?
> Sorry I don't understand problem
As Stanislav wrote, create a message that sets the Content-Transfer-Encoding to base64 (so, not 7bit), e.g. by putting only a single non-ascii character into the message body ("ä" or "и" should be enough). Tell KMail to encrypt it, using Inline OpenPGP (may be required, since Thunderbird/Enigmail may have problems otherwise) and send the message to yourself.

As shown in the example, the message composer seems remove all non-base64 characters, thus rendering the message unreadable by the receiving program.

Example A: (working encryption)

Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset="iso-8859-1"

-----BEGIN PGP MESSAGE-----
Version: GnuPG v2.0.19 (GNU/Linux)

hQIOA2EOZthMz4KpEAgA6MjhMzsjgDQlmAXB39JgvoAE0v2+1qN7hztb8rSMVrkD
GRislUNIedEW8htmiC1dOrm8GxOhuUTlcVeQhpz17uIFng377ZLbpER7FUma3hv9
....

Example B: (buggy mail composer)

Content-Transfer-Encoding: base64
Content-Type: text/plain; charset="iso-8859-1"

BEGINPGPMESSAGEVersionGnuPGv2019GNU/LinuxhQIMAzReyxSL2tmNAQ//fM9gYpg/+Je96y4
qPkyb2jeFaQATSVy6yM1n0KZ/kZlttnHhe0joGFXNY7+gvvpjalj0wWSvVO7HfhYORpIir1qdPe6
Comment 8 quazgar 2013-01-18 22:00:33 UTC
(In reply to comment #6)
> Still valid in 4.9 ?
Yes, I can still reproduce this with 4.9.3.
Comment 9 quazgar 2013-01-18 22:09:58 UTC
Actually the message source as written in comment #1 is not quite correct. The actual message is a correct gpg-encoded ascii text, BUT of this text only the characters which fit into the base64 encoding will be displayed within KMail's internal source code viewer.

Real message:

Content-Transfer-Encoding: base64
Content-Type: text/plain; charset="utf-8"

-----BEGIN PGP MESSAGE-----
Version: GnuPG v2.0.19 (GNU/Linux)

hQQOAwDFNNdvZQ1REA/+O8yMkDf1nYU63sCEpojF+L6tzLKBQnZL25PmFkYKrThQ
F4PurybdjtLsCpim38hyANgGxJikgKUAXUJCHkNha213FasflyFqunbBtkfHJZZx
flBpT19VnRICAApYn8yO1IVhVj4MxzOl8JIrC4VNjsZbAvfKkPWqR3wrTxCJH5bM
PmecooZIBRtPN+CnylfQQMELTsAkiZIpYfwWQw3omPYKSEwl7hQB6tUCgiyr2zw+
p97UUzDgpo1hDcBXsz17NSEYwUjMSxfJ+M8qmJeasHaZrBp/C23tJqvRo621bWfv
S1QdkU6Wb6TFR+aZefD8hQH8EFsIUCaLwUtf/D+xl1jWfBRlZq0HkYYcqEKGC1Zp
...

Displayed in KMail's source viewer:

Content-Transfer-Encoding: base64
Content-Type: text/plain; charset="utf-8"

BEGINPGPMESSAGEVersionGnuPGv2019GNU/LinuxhQQOAwDFNNdvZQ1REA/+O8yMkDf1nYU63sC
EpojF+L6tzLKBQnZL25PmFkYKrThQF4PurybdjtLsCpim38hyANgGxJikgKUAXUJCHkNha213Fas
flyFqunbBtkfHJZZxflBpT19VnRICAApYn8yO1IVhVj4MxzOl8JIrC4VNjsZbAvfKkPWqR3wrTxC
JH5bMPmecooZIBRtPN+CnylfQQMELTsAkiZIpYfwWQw3omPYKSEwl7hQB6tUCgiyr2zw+p97UUzD
gpo1hDcBXsz17NSEYwUjMSxfJ+M8qmJeasHaZrBp/C23tJqvRo621bWfvS1QdkU6Wb6TFR+aZefD
8hQH8EFsIUCaLwUtf/D+xl1jWfBRlZq0HkYYcqEKGC1Zp3dUGnqemEdsjXRK9B+EVPgPli71dbvl
....
Comment 10 Sandro Knauß 2013-03-03 21:16:43 UTC
A Patch is now on reviewboard, that fixes this bug:
https://git.reviewboard.kde.org/r/109272
Comment 11 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 289722
REVIEW: 109272
FIXED-IN: 4.10.2

M  +31   -7    messagecomposer/util.cpp

http://commits.kde.org/kdepim/597f7a5f56061d0107b3264b6453cf7b09cbfc6a