Page MenuHome GnuPG

Kleopatra fails to create new Key Pair
Open, NormalPublic

Description

Kleopatra does not create a key pair.
OS: Windows 10 Home, Version 1803

Bug occurs when pressing File -> New Key Pair -> Creating a personal OpenPGP key pair.

After entering a name, email and passphrase a menu appears stating

"Key Pair Successfully Created" with the Fingerprint and the options to Backup the Key Pair, send the public key per email and to upload it to directory service.

Until here everything is working correctly.

But after pressing "Finish", no new key-pair appears, as i was not doing anything at all and doesn't show my new key-pair.

When I try to backup the key pair in the end of the setup and safe it, it shows an error message:

"An error occurred while trying to export the secret key.
The output from C:\Program Files (x86)\GnuPG\bin\gpgsm.exe was: gpgsm: key '' not found: Invalid User-ID"


I tried instaling different GPG4Win versions but the problem stayed.

Thank's in advance!

Details

Version
3.1.3-gpg4win-3.1.3 5.43.0, Gpg4win

Event Timeline

aheinecke added a subscriber: aheinecke.

Thank you for your detailed report. Seems like something strange is broken on your system and our error handling does not properly cover that.

Can you please open the command line (cmd.exe) and check there with
"gpg -K" if the key was created?

Or if there are any errors from this output.

Afterwards can you do:

"gpg --gen-key" and follow the instructions on the screen to create a key from the command line.

It's probably easiest if you copy & paste the output from that here so that we can take a look if we see any unusual messages.

Thanks in advance!

So these are the results for gpg -K:

C:\Users\Name>gpg -K
gpg: checking the trustdb
gpg: keydb_search failed: Provided object is too short
gpg: public key of ultimately trusted key E9E355832F13734C not found
gpg: keydb_search failed: Provided object is too short
gpg: public key of ultimately trusted key B54E64A8B83E9246 not found
gpg: keydb_search failed: Provided object is too short
gpg: public key of ultimately trusted key A1862C86349D3C19 not found
gpg: keydb_search failed: Provided object is too short
gpg: public key of ultimately trusted key EBB81D6CE7E49639 not found
gpg: keydb_search failed: Provided object is too short
gpg: public key of ultimately trusted key 276168DEC8740C53 not found
gpg: keydb_search failed: Provided object is too short
gpg: public key of ultimately trusted key DEF60A9CF29CA329 not found
gpg: keydb_search failed: Provided object is too short
gpg: public key of ultimately trusted key ACCF63EEF76D4D1E not found
gpg: keydb_search failed: Provided object is too short
gpg: public key of ultimately trusted key 0B8957B971248A66 not found
gpg: keydb_search failed: Provided object is too short
gpg: public key of ultimately trusted key D9685178D9B94E8F not found
gpg: keydb_search failed: Provided object is too short
gpg: public key of ultimately trusted key 1675F906AF43DE01 not found
gpg: keydb_search failed: Provided object is too short
gpg: public key of ultimately trusted key 0C71515390B9091A not found
gpg: keydb_search failed: Provided object is too short
gpg: public key of ultimately trusted key 09F4740DD303D189 not found
gpg: keydb_search failed: Provided object is too short
gpg: public key of ultimately trusted key 853A7FBF21A3DF92 not found
gpg: keydb_search failed: Provided object is too short
gpg: public key of ultimately trusted key A9A7CE218B4A9F6C not found
gpg: keydb_search failed: Provided object is too short
gpg: public key of ultimately trusted key 851DCBF5E1949C0C not found
gpg: keydb_search failed: Provided object is too short
gpg: public key of ultimately trusted key 1DD591312ACBF29E not found
gpg: keydb_search failed: Provided object is too short
gpg: public key of ultimately trusted key 0E9C6DDBCF6C0380 not found
gpg: keydb_search failed: Provided object is too short
gpg: public key of ultimately trusted key E39D5F7E8EA958F3 not found
gpg: marginals needed: 3 completes needed: 1 trust model: pgp
gpg: keydb_search(first) failed: Provided object is too short
gpg: validate_key_list failed
gpg: keydb_search_first failed: Provided object is too short

And the results to gpg --gen-key

C:\Users\Name>gpg --gen-key
gpg (GnuPG) 2.2.10; Copyright (C) 2018 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.

Note: Use "gpg --full-generate-key" for a full featured key generation dialog.

GnuPG needs to construct a user ID to identify your key.

Real name: Testing
Email address: test@test.com
You selected this USER-ID:

"Testing <test@test.com>"

Change (N)ame, (E)mail, or (O)kay/(Q)uit? o
We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.
gpg: keydb_search failed: Provided object is too short
We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.
gpg: keydb_search failed: Provided object is too short
gpg: key 7051331FBE8F7F98 marked as ultimately trusted
gpg: keydb_search failed: Provided object is too short
gpg: keydb_search failed: Provided object is too short
gpg: revocation certificate stored as 'C:/Users/Name/AppData/Roaming/gnupg/openpgp-revocs.d\3F27F2A74C64D2EE09B25D337051331FBE8F7F98.rev'
public and secret key created and signed.

pub rsa2048 2018-09-29 [SC] [expires: 2020-09-28]

3F27F2A74C64D2EE09B25D337051331FBE8F7F98

uid Testing <test@test.com>
sub rsa2048 2018-09-29 [E] [expires: 2020-09-28]

Thank you!

aheinecke added a subscriber: werner.

Thanks!

gpg: keydb_search failed: Provided object is too short

This is the underlying cause. The internal storage of gnupg is corrupted.

As a workaround you can rename the folder "%APPDATA%\gnupg" to something line %APPDATA%\gnupg-old
Then it should work. (%APPDATA% expands to something like c:\users\your_user_name\appdata\roaming\ )

We do not have a known issue though how this could happen. So I will keep this as a bug.

@werner Do you have any idea how this can happen?

Got another reliable report in the Wald Forum about this. https://wald.intevation.org/forum/message.php?msg_id=6371&group_id=11

According to this reporter it happened after he deleted a number of secret keys.

The usual reasons for corruptions of binary data are FTP transfers in text mode; or opening a file with a Windows editor.

I don't think the cause of the corruptions is user interference. Users which report that don't even know about the GnuPG home directory in advance. I think we have some kind of rare bug which causes the keyring to break.

ikloecker added a subscriber: ikloecker.

This doesn't look like a problem in Kleopatra.