Bug 325596

Summary: gpg does not work
Product: [Applications] kmail2 Reporter: Daniel Moyne <daniel.moyne>
Component: cryptoAssignee: kdepim bugs <kdepim-bugs>
Status: RESOLVED UNMAINTAINED    
Severity: normal CC: sknauss
Priority: NOR    
Version: 4.11.2   
Target Milestone: ---   
Platform: Kubuntu   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: gpg.conf
gpg-agent.conf

Description Daniel Moyne 2013-10-03 18:37:05 UTC
gpg does not work in Kmail when gpg is run through /home/dmoyne/.kde/Autostart/start-gpg-agent.sh
where start-gpg-agent.sh contains :
#!/bin/sh
# to use gpg in kmail
if grep -q '^use-agent' ~/.gnupg/gpg.conf; then
	eval "`gpg-agent --daemon`"
fi

But if in konsole I do :
eval "`gpg-agent --daemon`"
kmail
it does work

Reproducible: Always

Steps to Reproduce:
1. use start-gpg-agent.sh in /home/dmoyne/.kde/Autostart
2. log though kde
3. try to send a message with gpg signature using pinentry-kwallet
Actual Results:  
no gpg working

Expected Results:  
gpg working

works if executed from a konsole as explained above
Comment 1 Sandro Knauß 2013-10-21 01:30:14 UTC
can you post ~/.gnupg/gpg.conf and ~/.gnupg/gpg-agent.conf ?
Comment 2 Daniel Moyne 2013-10-21 14:54:12 UTC
Created attachment 82990 [details]
gpg.conf
Comment 3 Daniel Moyne 2013-10-21 14:56:29 UTC
Created attachment 82991 [details]
gpg-agent.conf

pinentry-qt4 workd whereas pinentry-kwallet does not
Comment 4 Daniel Moyne 2013-11-11 07:39:34 UTC
Sandro,
have you found anything wrong?
For the time being I am working without storing passphrases in KwalletManager.
Comment 5 Sandro Knauß 2013-11-12 00:21:20 UTC
No I didn't found anything wrong with your gpg config. But actually you are using kubuntu, so there you don't need the  /home/dmoyne/.kde/Autostart/start-gpg-agent.sh and should remove it. Do you know where you found the tip about creating this script?
The agent will be started with XSession see /etc/X11/Xsession.d/90gpg-agent ( part of  gnupg-agent package).
If that doesn't help, than I'll have to look into the code of  pinentry-kwallet.

One question a little bit unrelated, why do you want to store the passphrase inside kwallet? For me it sounds like a big secure break. I know the gnupg guy really care about, where, when, what is written to RAM/Harddisk, so make it very difficult to get to the encrypted gnupg key. And I don't think this is true for kwallet.
Comment 6 Daniel Moyne 2013-11-13 11:50:36 UTC
Yes Sandro regarding the use of a specific script in /home/dmoyne/.kde/Autostart/start-gpg-agent.sh
It seems useless as it is trated where you say I will remove it.

Now I have also a script to shut it down in .kde/shutdown
What do I do with it?

All these scripts were proposed at one time on internet. Now apparently they are uncecessary.

The idea to use kwallet to store the passphrase is documented in gpg doc somewhere and I find it comfortable to be avoid answering the pasphrase question that is all.
Comment 7 Sandro Knauß 2013-11-13 23:12:07 UTC
I would also delete the shutdown script too and test if gpg-anget is killed with the end of the session.
Actually this additional start-gpg-agent.sh script start an additional gpg-agent, that can problems :) Like one programm connets to one agent the other to the other. 
So please make sure, when trying pinentry-kwallet again, that only one gpg-agent is running.
Comment 8 Daniel Moyne 2013-11-20 14:01:45 UTC
Sandro after removing all scripts if I set in"gpg-agent.conf":
pinentry-program /usr/bin/pinentry-kwallet

it is still hanging after kwallwallet question for password. Therefore I still think that the problem is in the way the passphrase is stored in kwallet and retrieved from kwallet
Comment 9 Sandro Knauß 2013-11-20 17:21:10 UTC
I search today around and saw, that pinentry-kwallet is not part of KDE. It is developed by MirBSD (Thorsten Glaser <tg@mirbsd.org>). The code of pinentry-kwallet hasn't changed since 2012, so maybe the kwallet protocoll has changed.

The best would be to send this bugreport to Thorsten.  Please add a bugnumbers, if you creates bugreports at other project.
Comment 10 Daniel Moyne 2013-11-21 09:25:12 UTC
Thanks Sando I will ty to liaise with Thorsten Glaser if the e-mail is still correct and keep you posted in case he answers anything.
Comment 11 Denis Kurz 2016-09-24 18:06:04 UTC
This bug has only been reported for versions before 4.14, which have been unsupported for at least two years now. Can anyone tell if this bug still present?

If noone confirms this bug for a Framework-based version of kmail2 (version 5.0 or later, as part of KDE Applications 15.12 or later), it gets closed in about three months.
Comment 12 Denis Kurz 2017-01-07 21:49:11 UTC
Just as announced in my last comment, I close this bug. If you encounter it again in a recent version (at least 5.0 aka 15.08), please open a new one unless it already exists. Thank you for all your input.