Bug 248161

Summary: Decrypting ascii armored files fails -- no passphrase prompt
Product: [Applications] kgpg Reporter: Chuck <cfox04>
Component: generalAssignee: Rolf Eike Beer <kde>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: 2.7.x   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In: 4.8.2
Sentry Crash Report:
Attachments: Bug still present, but there's an error message now

Description Chuck 2010-08-17 17:17:24 UTC
Version:           unspecified (using KDE 4.5.0) 
OS:                Linux

Using version 2.4.0 distributed with Arch Linux standard KDE packages 4.5.0.  

When using the built-in editor and decrypting an ascii-armored text file, the decryption process fails.  Instead of prompting for a passphrase for my key (like what happened in earlier versions), nothing happens and the editor text field goes blank.  When I run kgpg from the command line, I get this output:

You need a passphrase to unlock the secret key for
user: "NAME (lame) <EMAIL@EMAIL.net>"
XXXX-bit RSA key, ID 1234567, created 2009-06-14 
(Note: the specifics above are faked, the key itself is fine).

A few notes:
1. The key itself appears to be imported fine, and the key is valid.
2. Using gpg at the command line is working fine. I can decrypt the same file using the same key using the standard commands without problems.
3. If the passphrase prompt came up and let me enter the passphrase, then I think the decryption process would work.



Reproducible: Always

Steps to Reproduce:
1. Run kgpg, I started from a fresh configuration and imported my key.
    -- Use a key that requires a passphrase for decryption.
2. Open ascii-armored file in the kgpg editor
3. Cick "decrypt" and instead of prompting for a passhprase, the editor goes blank.


Expected Results:  
There should be a passphrase prompt, and the text should decrypt in response to entering the correct passphrase.
Comment 1 Rolf Eike Beer 2010-08-17 22:15:54 UTC
SVN commit 1164870 by dakon:

gpg should not try to open a terminal

CCBUG:248161

 M  +1 -1      kgpgtextorfiletransaction.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1164870
Comment 2 Rolf Eike Beer 2010-08-17 22:17:32 UTC
SVN commit 1164871 by dakon:

gpg should not try to open a terminal

CCBUG:248161
FIXEDIN:4.5.1

backport of r1164870


 M  +1 -1      kgpgtextorfiletransaction.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1164871
Comment 3 Chuck 2010-09-04 02:53:45 UTC
Could you please re-open this bug?  Not only did the proposed fix not actually fix the problem, the "fix" should be reverted since now kgpg can no longer emit valuable debug information when run from the command line!


I tried kgpg using KDE 4.5.1 and a completely fresh .kde4 configuration to eliminate possible problems with configuration.  The bug behaves exactly as it did in kde 4.5.0, except that now it is impossible to get useful debug information from the command line. The editor in kgpg does not prompt for a passphrase and instead blanks out all text in the editor.  



Suggested actions:
1. Revert the SVN commits made for this bug, they are a regression.
2. Fix the bug: kgpg does not properly prompt for a passphrase and does not use the passphrase when decrypting files using a key that is passphrase protected. This is a regression from earlier versions of kgpg in kde 4.4 and earlier that worked fine.
Comment 4 Rolf Eike Beer 2010-09-05 21:38:02 UTC
I had the same behaviour with but could never see what was actually happen until you reported it. I just upgraded to 4.5.1 and it works like expected for me. If it doesn't work for you please use kdebugdialog to set the debug logging of KGpg (#2100) to on and run it. If that doesn't help please use start KGpg, open the editor, then go to a terminal. Find out the process id (pid) of KGpg ("ps -C kgpg" should show you exactly one) and then use

strace -f -s256 -eopen,read,write,execve -p ENTER_PID_OF_KGPG_HERE

Then go back to KGpg's editor, try to decrypt a file and once that failed break (Ctrl-C) the strace. Please put the log in an attachment to this bug.
Comment 5 Rolf Eike Beer 2012-03-07 19:35:42 UTC
Any news on this? Otherwise I'll assume it's fixed now.
Comment 6 Chuck 2012-03-08 01:06:46 UTC
Created attachment 69356 [details]
Bug still present, but there's an error message now

Unfortunately the bug is not gone.  Just to recap: Encryption works fine with my gnupg public key.  Decryption from the editor in kgpg, however, fails. Everything works fine using gpg at the command line. I have both gpg 1 (version 1.4.12) and gpg 2 (version 2.0.18) installed (I need both for different package dependencies unfortunately).

Good news: The new version of kgpg (version 2.7.1 with KDE 4.8.1) at least gives an error message:
[GNUPG:] ENC_TO 01XXXXXXXXXXXXB9 1 0
[GNUPG:] NEED_PASSPHRASE 01XXXXXXXXXXXXB9 0XXXXXXXXXX9 1 0

It would be great if the program would just prompt me for the passphrase and keep going...
Comment 7 Rolf Eike Beer 2012-03-08 07:40:32 UTC
Ok, thanks for the feedback. I'll have a look.
Comment 8 Rolf Eike Beer 2012-03-08 22:41:07 UTC
Git commit e2ac9db16bbab040e51ebdfb3c4e296644dc9a24 by Rolf Eike Beer.
Committed on 08/03/2012 at 22:46.
Pushed by dakon into branch 'KDE/4.8'.

fix password requests when using GnuPG 1.x

This all works well with GnuPG 2.x because that is using pinentry. Things were
broken for older versions that require direct password supply.
FIXED-IN:4.8.2

M  +19   -13   transactions/kgpgchangepass.cpp
M  +1    -0    transactions/kgpgchangepass.h
M  +7    -2    transactions/kgpgdecrypt.cpp
M  +0    -5    transactions/kgpgeditkeytransaction.cpp
M  +0    -5    transactions/kgpggeneraterevoke.cpp
M  +11   -2    transactions/kgpgtextorfiletransaction.cpp
M  +1    -0    transactions/kgpgtextorfiletransaction.h
M  +34   -4    transactions/kgpgtransaction.cpp
M  +19   -0    transactions/kgpgtransaction.h

http://commits.kde.org/kgpg/e2ac9db16bbab040e51ebdfb3c4e296644dc9a24
Comment 9 Chuck 2012-03-09 01:11:43 UTC
Thank you for taking the time to look into this bug!  I don't have time to do a direct checkout from the trunk right now, but I'll give it a test with KDE 4.8.2 at the latest.  If you're ever in Indianapolis, we have a half-way decent Biergarten and I'll get you a round!
Comment 10 Chuck 2012-03-09 01:12:38 UTC
Thank you for taking the time to look into this bug!  I don't have time to do a direct checkout from the trunk right now, but I'll give it a test with KDE 4.8.2 at the latest.  If you're ever in Indianapolis, we have a half-way decent Biergarten and I'll get you a round!