Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.6.9

Bug #21149 Wrong key ID in BadPassphrase exception on private key export
Submitted: 2016-11-13 13:52 UTC
From: alec Assigned:
Status: Bogus Package: Crypt_GPG (version 1.6.0b1)
PHP Version: Irrelevant OS:
Roadmaps: 1.6.0b2    
Subscription  


 [2016-11-13 13:52 UTC] alec (Aleksander Machniak)
Description: ------------ Using GnuPG 2.1.15 when exporting a private key (and no passphrase has been set using addPassphrase()) we have: STATUS: KEY_CONSIDERED 997AB1BC47FA639D166B206AABCBE2170E357396 0 STATUS: INQUIRE_MAXLEN 100 STATUS: GET_HIDDEN passphrase.enter ERROR: gpg: key 891AAE10172700DC38558FE123D95B690E37BB8D: error receiving key from agent: No passphrase given - skipped So, while KEY_CONSIDERED uses valid key ID, the ERROR entry uses subkey ID (or sth) which is not really useful for error handling. We can't find a key using this ID. So, the exception thrown should contain the ID used in KEY_CONSIDERED.

Comments

 [2016-11-13 14:43 UTC] alec (Aleksander Machniak)
-Status: Open +Status: Bogus
Thank you for taking the time to write to us, but this is not a bug. This requires some more thinking. According to other parts of the code the BadPassphrases/MissingPassphrases arrays are supposed to be indexed by sub-key Ids. So, it looks like this is not a bug. Problem is that in GnuPG 2.1 you don't get user ids in these cases. So, when we prompt the user for passphrase we can't display nice "Enter passphrase for key ID: XXXX of user XXXX" (as we do when encrypting a message). We can't also just do --list-keys using this subkey ID to get the user ID (it does not find a key by its subkey ID). It looks that getting the user id need to be done on a higher level, i.e. not in Crypt_GPG itself.