Bug 253408

Summary: kgpg fails to create a new key pair
Product: kgpg Reporter: Gareth Williams <gareth>
Component: generalAssignee: Rolf Eike Beer <kde>
Status: RESOLVED FIXED    
Severity: normal CC: gareth, virgolus, yuri.bongiorno
Priority: NOR    
Version: 2.7.x   
Target Milestone: ---   
Platform: Ubuntu Packages   
OS: Linux   
Latest Commit: Version Fixed In: 4.8.3

Description Gareth Williams 2010-10-06 18:28:58 UTC
Version:           unspecified (using KDE 4.5.1) 
OS:                Linux

On starting kgpg it should show a wizard to create a key-pair.  It doesn't.  Attempting it from the Keys\Generate Key Pair... menu brings up the dialog.  Completing the dialog and continuing causes many notifications to show up saying that it is generating a key pair, but nothing happens.

Reproducible: Always

Steps to Reproduce:
Start kgpg.  Click Keys\Generate Key Pair...  Complete dialog and continue.

Actual Results:  
Should get a key pair, but nothing is created.

Expected Results:  
A key pair is generated.

OS: Linux (x86_64) release 2.6.35-22-generic
Compiler: cc
Comment 1 Gareth Williams 2010-10-06 18:30:10 UTC
Have deleted the .gnupgp directory, but this didn't help.
Comment 2 Rolf Eike Beer 2010-10-18 19:50:13 UTC
Please start KGpg from a terminal (make sure it is not running before). Then paste all messages it spits out when you try to create a key pair.

Please also include the output of "gpg --version".
Comment 3 Gareth Williams 2010-10-21 12:19:18 UTC
I'm sorry, but I got fed up with KDE and returned to Gnome!  This means that KGpg is not on my laptop any more and I therefore cannot carry out your request.

As nobody else has confirmed this bug then maybe it was my install.  Can this bug be closed?  There is no option for me to do so as far as I can see.
Comment 4 Rolf Eike Beer 2010-11-07 12:52:50 UTC
You can run KGpg inside a Gnome environment without problems if you like to try again.
Comment 5 Yuri 2011-03-13 15:25:16 UTC
I had a similar experience (my system: kde 4.6.1, kgpg 2.5.0, latest ubuntu natty): kgpg tell me "gpg process did not finish. Cannot generate a new key pair".

So I run "strace -eexecve,read,write -f -s 256 -o file.log -p NNNNN" where
NNNNN is the process id (output of "ps -C kgpg").

Here is a part of the output:


1911  read(18, "[GNUPG:] KEY_NOT_CREATED \n", 26) = 26
1911  read(20, "gpg: -:2: invalid algorithm\n", 28) = 28
1911  write(2, "", 0)                   = 0
1911  read(8, 0x23a8ff4, 4096)          = -1 EAGAIN (Resource temporarily unavailable)
1911  read(8, 0x23a8ff4, 4096)          = -1 EAGAIN (Resource temporarily unavailable)
1911  write(17, "quit\n", 5 <unfinished ...>
1919  <... read resumed> "quit\n", 8192) = 5
1919  write(2, "gpg: ", 5)              = 5
1919  write(2, "-:8: missing colon\n", 19) = 19
1911  <... write resumed> )             = 5
1911  --- SIGCHLD (Child exited) @ 0 (0) ---
1911  write(7, "\0", 1 <unfinished ...>
1912  read(6, "\0", 1)                  = 1
1912  write(25, "\0", 1)                = 1
1911  <... write resumed> )             = 1
1911  read(8, 0x23a8ff4, 4096)          = -1 EAGAIN (Resource temporarily unavailable)
1911  read(8, 0x23a8ff4, 4096)          = -1 EAGAIN (Resource temporarily unavailable)
1911  read(24, "\0", 1)                 = 1
1911  read(20, "gpg: -:8: missing colon\n", 24) = 24
1911  write(2, "", 0)                   = 0


I  chose default options (1024, dsa elgamal).
if you need the complete logfile, send me an email.
Comment 6 Rolf Eike Beer 2011-03-13 15:37:18 UTC
This looks like the algorithm is not avaibale from GnuPG. Please run

gpg --gen-key

Then it will show the list of available algorithms. Please paste that output here. Additionally the output of "gpg --version" would be useful.
Comment 7 Yuri 2011-03-13 15:43:13 UTC
LANG=C gpg --gen-key
gpg (GnuPG) 1.4.11; Copyright (C) 2010 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
                                                                                                                                                                                    
Please select what kind of key you want:                                                                                                                                            
   (1) RSA and RSA (default)                                                                                                                                                        
   (2) DSA and Elgamal                                                                                                                                                              
   (3) DSA (sign only)                                                                                                                                                              
   (4) RSA (sign only)                                                                                                                                                              
Your selection?    

---------------------

LANG=C  gpg --version
gpg (GnuPG) 1.4.11
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Home: ~/.gnupg
Supported algorithms:
Pubkey: RSA, RSA-E, RSA-S, ELG-E, DSA
Cipher: 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH, CAMELLIA128, 
        CAMELLIA192, CAMELLIA256
Hash: MD5, SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224
Compression: Uncompressed, ZIP, ZLIB, BZIP2
Comment 8 Rolf Eike Beer 2011-03-13 16:03:10 UTC
Can you please post the lines from strace output beginning with the first line containing "Key-Type:"?
Comment 9 Yuri 2011-03-13 16:11:02 UTC
1911  write(17, "Key-Type: DSA\nSubkey-Type: ELG\nKey-Length: 1024\nName-Real: yurix\nName-Email: y@y.y\nPassphrase: ", 95 <unfinished ...>
1919  <... read resumed> "Key-Type: DSA\nSubkey-Type: ELG\nKey-Length: 1024\nName-Real: yurix\nName-Email: y@y.y\nPassphrase: ", 8192) = 95
1919  read(0,  <unfinished ...>
1911  <... write resumed> )             = 95
1911  read(8, 0x23a8ff4, 4096)          = -1 EAGAIN (Resource temporarily unavailable)
1911  read(8, "\34\0\326\350y;\240\2.\1\0\0cn\16\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\34\0\327\350y;\240\0027\1\0\0cn\16\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\34\0\331\350y;\240\2\v\1\0\0cn\16\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\34\0\333\350y;\240\2(\0\0\0cn\16\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\34\0\336\350y;\240\0027\1\0\0cn\16\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 4096) = 160
1911  read(8, 0x23a8ff4, 4096)          = -1 EAGAIN (Resource temporarily unavailable)
1911  read(8, "\34\0M\354y;\240\2\177\1\0\0{n\16\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\26\0M\354y;\240\2y;\240\2O\f\240\2\0\0\0\0\30\1\21\1\0\0\0\0\0\0\0\0", 4096) = 64
1911  read(8, 0x23a8ff4, 4096)          = -1 EAGAIN (Resource temporarily unavailable)
1911  read(8, "\1 \234\363\1\0\0\0\4\0\0\0\0\0\0\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0004\1\0\0", 4096) = 36
1911  read(8, 0x23a8ff4, 4096)          = -1 EAGAIN (Resource temporarily unavailable)
1911  read(8, "\1\1\235\363\0\0\0\0;\0\240\2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 4096) = 32
1911  read(8, 0x23a8ff4, 4096)          = -1 EAGAIN (Resource temporarily unavailable)
1911  read(8, "\1\1\236\363\0\0\0\0;\0\240\2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 4096) = 32
1911  read(8, 0x23a8ff4, 4096)          = -1 EAGAIN (Resource temporarily unavailable)
1911  read(8, "\25\0\236\363y;\240\2y;\240\2s\233\200\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 4096) = 32
1911  read(8, 0x23a8ff4, 4096)          = -1 EAGAIN (Resource temporarily unavailable)
1911  read(8, "\34\0\236\363y;\240\2.\1\0\0\277n\16\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 4096) = 32
1911  read(8, 0x23a8ff4, 4096)          = -1 EAGAIN (Resource temporarily unavailable)
1911  read(8, "\34\0\236\363y;\240\2\223\1\0\0\300n\16\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 4096) = 32
1911  read(8, "\34\0\236\363y;\240\2\204\1\0\0\307n\16\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\34\0\236\363y;\240\2J\1\0\0\307n\16\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\34\0\236\363y;\240\2\231\1\0\0\307n\16\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 4096) = 96
1911  read(8, "\34\0\236\363y;\240\2.\1\0\0\310n\16\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\23\0\236\363y;\240\2y;\240\2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\34\0\236\363y;\240\2\f\1\0\0\310n\16\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\n\3\236\363;\0\240\2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\t\3\236\363y;\240\2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\v\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\241 \236\363y;\240\2\5\1\0\0\7\1\0\0\200n\16\0\0\0\0\0\0\0\0\0\0\0\0\0\26\0\236\363y;\240\2y;\240\2\0\0\0\0\0\0\0\0\30\1\"\1\0\0\0\0\0\0\0\0"..., 4096) = 324

[...]
Comment 10 Yuri 2011-03-14 10:55:14 UTC
In "Configure kgpg...", section "Gnupg settings",  in "Program path: "  I wrote "gpg2" instead of default "gpg", and now generation key worked!

So this bug is only for gpg (1.4.x), non for gpg2 (2.0.x).
Comment 11 Ezio Vergine 2011-08-03 12:41:28 UTC
Thanks Yuri! same problem for me, but if I put "gpg2" instead of "gpg" in it works!
Comment 12 Rolf Eike Beer 2012-04-03 17:03:39 UTC
Confirmed to be a problem with gpg 1.x. Since I can reproduce it I will likely be able to come up with a fix. In the meantime either use gpg2 or RSA/RSA keys.
Comment 13 Rolf Eike Beer 2012-04-03 18:58:24 UTC
Git commit 654048def1ca9d89d31076e4d19ae0ed6d1d06f0 by Rolf Eike Beer.
Committed on 03/04/2012 at 20:54.
Pushed by dakon into branch 'KDE/4.8'.

fix generation of DSA/ElGamal keys with GnuPG 1.x

The name "ELG" for ElGamal keys only works with 2.x. Use ELG-E which works with
both 1.4 and 2.0.18. It will not work with 2.0.0, but given that it's only that
single version and it is more than 5 years old I don't care.
FIXED-IN:4.8.3

M  +5    -4    transactions/kgpggeneratekey.cpp

http://commits.kde.org/kgpg/654048def1ca9d89d31076e4d19ae0ed6d1d06f0