Bug 160881

Summary: PGP encryption of mails results in empty MIME-part
Product: [Applications] kmail Reporter: Onno Molenkamp <onno>
Component: encryptionAssignee: kdepim bugs <kdepim-bugs>
Status: RESOLVED UNMAINTAINED    
Severity: normal CC: lemma, mutz, osterfeld
Priority: NOR Keywords: triaged
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: Suggested fix for bug 160881

Description Onno Molenkamp 2008-04-15 22:53:18 UTC
Version:            (using Devel)
Installed from:    Compiled sources
Compiler:          gcc version 4.2.1 (SUSE Linux) 
OS:                Linux

When messages are encrypted using PGP, the MIME-part that's supposed to contain the encrypted mail stays empty, like this:

--nextPart1711057.zOAskV6OyZ
Content-Type: application/octet-stream
Content-Disposition: inline; filename="msg.asc"


--nextPart1711057.zOAskV6OyZ--

I think this is caused by a change in kdepim/libkleo/backends/qgpgme/qgpgmeencryptjob.cpp in SVN revision 784823. In Kleo::QGpgMEEncryptJob::doOperationDoneEvent a resetDataObjects() call was added, which would be fine if the code actually used the signal that's emitted with the retrieved results.

However, Kleo::QGpgMEEncryptJob::exec simply calls outData() again after doOperationDoneEvent is called, which means the resulting ciphertext will always be empty.
Comment 1 Onno Molenkamp 2008-04-15 22:56:10 UTC
Created attachment 24348 [details]
Suggested fix for bug 160881
Comment 2 Frank Osterfeld 2008-04-17 16:14:42 UTC
Thanks for investigating this! Indeed, the synchronous implementation seems broken. I think your fix isn't correct for the asynchronous case though, and would reintroduce the bug the resetDataObjects() call was supposed to fix.
I don't see an easy way to fix this without breaking other assumptions made, I'll add the original author to CC.
Comment 3 Frank Osterfeld 2008-04-17 16:45:41 UTC
SVN commit 798118 by osterfeld:

do not reset data objects before exec() can read the outData. This fixes the synchronous libkleo API using the exec() methods (which returns empty QByteArrays without this patch) but breaks the shared_ptr<Output> usage (finalize() iirc) in kleopatra. 

define KLEO_SYNCHRONOUS_API_HOTFIX for now when build libkleo for use with KMail.
proper fix pending.

CCBUG:160881
CCMAIL:mutz@kde.org
CCMAIL:adam@kde.org
CCMAIL:js@iidea.pl


 M  +6 -1      CMakeLists.txt  
 M  +2 -0      backends/qgpgme/qgpgmedecryptjob.cpp  
 M  +2 -0      backends/qgpgme/qgpgmedecryptverifyjob.cpp  
 M  +2 -0      backends/qgpgme/qgpgmeencryptjob.cpp  
 M  +2 -0      backends/qgpgme/qgpgmesignencryptjob.cpp  
 M  +2 -0      backends/qgpgme/qgpgmeverifydetachedjob.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=798118
Comment 4 Michael Leupold 2009-04-04 14:14:52 UTC
I see this bug is still open. Encryption using GPG mostly works for me. Did the commit fix it?
Comment 5 Laurent Montel 2015-04-12 10:05:47 UTC
Thank you for taking the time to file a bug report.

KMail2 was released in 2011, and the entire code base went through significant changes. We are currently in the process of porting to Qt5 and KF5. It is unlikely that these bugs are still valid in KMail2.

We welcome you to try out KMail 2 with the KDE 4.14 release and give your feedback.