Bug 332167

Summary: KMail is failing to encrypt PGP/Inline for non-signed key
Product: [Applications] kmail2 Reporter: kolAflash <kolAflash>
Component: cryptoAssignee: kdepim bugs <kdepim-bugs>
Status: CONFIRMED ---    
Severity: normal CC: sknauss
Priority: NOR    
Version: 5.1.3   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:

Description kolAflash 2014-03-15 01:59:40 UTC
I can't send an PGP/Inline email to a receiver with an key I didn't sign before.

If I sign the receivers key before sending OR use PGP/MIME everything's working fine.

Reproducible: Always

Steps to Reproduce:
1. Create a new email.
2. Encrypt the email and set the encryption-format to PGP/Inline.
3. Click "Send".
Actual Results:  
KMail tells: It was not possible to create a message composer.

Expected Results:  
E-Mail should be encrypted and send using the PGP/Inline format.

I tried to find the bug searching in
messagecomposer/composer/keyresolver.cpp

https://projects.kde.org/projects/kde/kdepim/repository/revisions/6fce5eb967cc02398bcf9032959e48d0a3c64b78/entry/messagecomposer/composer/keyresolver.cpp


Line 547
ValidTrustedOpenPGPEncryptionKey ) != item.keys.end() ) {  // -= trusted?
looks suspicious. I tried replacing it with:
ValidOpenPGPEncryptionKey ) != item.keys.end() ) {

Same for line 1575
NotValidTrustedOpenPGPEncryptionKey ); // -= trusted (see above, too)?
I replaced with
NotValidOpenPGPEncryptionKey );

But both didn't helped. I just got another error telling me, that the key is corrupt (it definitely isn't - I can use it for PGP/MIME and in Thunderbird it also works for PGP/Inline).
Comment 1 Sandro Knauß 2014-03-30 14:33:33 UTC
I modified keyresolver.cpp within the version 4.12.2. So please make sure that the problem occures at 4.12.2, too. See #328311
Comment 2 kolAflash 2014-04-03 11:30:49 UTC
It's a little complicated for me, because my distribution (openSUSE 13.1) comes with KDE 4.11.4 and I don't like to play too much around with that system.

I'll try to set up a whole vm with KDE 4.12.2. But I don't have much time for gthat at the moment. (is there a ready-to-use KDE 4.12.2 livecd?)

Probably you could be much faster, trying what I described on your system. I'd be very happy if you could do so.
Comment 3 kolAflash 2014-04-11 02:05:35 UTC
Tested it with openSUSE 13.1 + KDE 4.12.4 from this repo:

http://download.opensuse.org/repositories/KDE:/Current/openSUSE_13.1/

Result: Bug still exists in KDE 4.12.4 :-(

Console output using PGP/Inline:
==========
$ kmail --nofork --composer
Enchant dict for "en_US" 0x2945f40 
Enchant dict for "en_US" 0x2eb52a0 
Enchant dict for "en_US" 0x2eb52a0 
kmail2(3789) ValidTrustedOpenPGPEncryptionKey: bad validity 0 
kmail2(3789) ValidTrustedOpenPGPEncryptionKey: bad validity 0 

** (process:3789): WARNING **: 1 dictionaries weren't free'd.
==========

Console output using PGP/MIME:
==========
$ kmail --nofork --composer
Enchant dict for "en_US" 0x10a3ba0 
Enchant dict for "en_US" 0x1621610 
Enchant dict for "en_US" 0x1621610 
kmail2(3836) ValidTrustedOpenPGPEncryptionKey: bad validity 0 
kmail2(3836) ValidTrustedOpenPGPEncryptionKey: bad validity 0 

** (process:3836): WARNING **: 1 dictionaries weren't free'd.
==========
Comment 4 kolAflash 2014-12-01 10:23:35 UTC
Bug still exists in KDE 4.14.3
Comment 5 kolAflash 2015-10-07 02:20:36 UTC
Bug still exists in KDE 4.14.9
Comment 6 kolAflash 2016-09-25 21:21:09 UTC
Still existing in Kontact 5.1.3 (KDE Frameworks 5.21.0 on openSUSE 42.1)
Comment 7 Sandro Knauß 2016-09-26 11:50:31 UTC
confired for serveral version now. Justto clearify it, what version of gnupg you are using?
Comment 8 kolAflash 2016-09-28 19:42:07 UTC
I'm using openSUSE 42.1 default software (KMail and GnuPG).

gpg2-2.0.24-5.1.x86_64
kmail5-15.12.3-18.5.x86_64

https://software.opensuse.org/package/gpg2
https://software.opensuse.org/package/kmail5