Bug 160881 - PGP encryption of mails results in empty MIME-part
Summary: PGP encryption of mails results in empty MIME-part
Alias: None
Product: kmail
Classification: Applications
Component: encryption (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal (vote)
Target Milestone: ---
Assignee: kdepim bugs
Keywords: triaged
Depends on:
Reported: 2008-04-15 22:53 UTC by Onno Molenkamp
Modified: 2015-04-12 10:05 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:

Suggested fix for bug 160881 (498 bytes, patch)
2008-04-15 22:56 UTC, Onno Molenkamp

Note You need to log in before you can comment on or make changes to this bug.
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:

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


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.


 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.