FAQ
Edit report at http://pear.php.net/bugs/bug.php?id=17822&edit=1

ID: 17822
Updated by: alec@alec.pl
Reported By: alec at alec dot pl
-Summary: Missing keyId in KeyNotFoundException for decryption
process
+Summary: Missing keyId in KeyNotFoundException for
decryption/verify process
Status: Open
Type: Bug
Package: Crypt_GPG
Package Version: SVN
PHP Version: Irrelevant
Roadmap Versions:
New Comment:

-Summary: Missing keyId in KeyNotFoundException for decryption
process
+Summary: Missing keyId in KeyNotFoundException for
decryption/verify process
This patch is for decryption. I've found that key Id is also not set on
verification. E.g. when there's no public key I got such responses:

ERROR: gpg: Signature made Mon Aug 10 01:50:14 2009 CEST using DSA key
ID B459AB58
ERROR: gpg: Can't check signature: No public key
STATUS: ERRSIG 6BEFD4D6B459AB58 17 2 01 1249861814 9
STATUS: NO_PUBKEY 6BEFD4D6B459AB58


Previous Comments:
------------------------------------------------------------------------

[2010-08-26 10:23:48] alec

Description:
------------
When decryption fails because of lack of private key its ID is not set
in exception object. Simple fix:
--- DecryptStatusHandler.old 2010-08-26 11:16:31.000000000 +0200
+++ DecryptStatusHandler.php 2010-08-26 12:21:30.365249721 +0200
@@ -288,7 +288,7 @@
throw new Crypt_GPG_KeyNotFoundException(
'Cannot decrypt data. No suitable private key is in the
' .
'keyring. Import a suitable private key before trying
to ' .
- 'decrypt this data.', $code);
+ 'decrypt this data.', $code, $this->currentSubKeyId);

case Crypt_GPG::ERROR_BAD_PASSPHRASE:
$badPassphrases = array_diff_key(

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

Search Discussions

  • Alec at Aug 26, 2010 at 12:31 pm
    Edit report at http://pear.php.net/bugs/bug.php?id=17822&edit=1

    ID: 17822
    Updated by: alec@alec.pl
    Reported By: alec at alec dot pl
    Summary: Missing keyId in KeyNotFoundException for
    decryption/verify process
    Status: Open
    Type: Bug
    Package: Crypt_GPG
    Package Version: SVN
    PHP Version: Irrelevant
    Roadmap Versions:
    New Comment:

    --- GPG.old 2010-08-26 11:16:31.000000000 +0200
    +++ GPG.php 2010-08-26 14:20:13.253145205 +0200
    @@ -2394,7 +2394,7 @@
    case Crypt_GPG::ERROR_KEY_NOT_FOUND:
    throw new Crypt_GPG_KeyNotFoundException(
    'Public key required for data verification not in
    keyring.',
    - $code);
    + $code, $this->engine->getErrorKeyId());
    default:
    throw new Crypt_GPG_Exception(
    'Unknown error validating signature details. Please use
    the ' .
    --- Engine.old 2010-08-26 11:16:31.000000000 +0200
    +++ Engine.php 2010-08-26 14:19:40.800391989 +0200
    @@ -295,6 +295,14 @@
    private $_errorFilename = '';

    /**
    + * Key ID related to the error code of the current operation
    + *
    + * @var string
    + * @see Crypt_GPG_Engine::getErrorKeyId()
    + */
    + private $_errorKeyId = '';
    +
    + /**
    * The number of currently needed passphrases
    *
    * If this is not zero when the GPG command is completed, the error
    code is
    @@ -735,6 +743,24 @@
    }

    // }}}
    + // {{{ getErrorKeyId()
    +
    + /**
    + * Gets the key ID related to the error code of the last executed
    operation
    + *
    + * This value is only meaningful after {@link
    Crypt_GPG_Engine::run()} has
    + * been executed. If there is no key ID related to the error, an
    empty string
    + * is returned.
    + *
    + * @return string the key ID related to the error code of the last
    executed
    + * operation.
    + */
    + public function getErrorKeyId()
    + {
    + return $this->_errorKeyId;
    + }
    +
    + // }}}
    // {{{ setInput()

    /**
    @@ -936,6 +962,7 @@

    case 'NO_PUBKEY':
    case 'NO_SECKEY':
    + $this->_errorKeyId = $tokens[1];
    $this->_errorCode = Crypt_GPG::ERROR_KEY_NOT_FOUND;
    break;


    Previous Comments:
    ------------------------------------------------------------------------

    [2010-08-26 11:06:05] alec

    -Summary: Missing keyId in KeyNotFoundException for decryption
    process
    +Summary: Missing keyId in KeyNotFoundException for
    decryption/verify process
    This patch is for decryption. I've found that key Id is also not set on
    verification. E.g. when there's no public key I got such responses:

    ERROR: gpg: Signature made Mon Aug 10 01:50:14 2009 CEST using DSA key
    ID B459AB58
    ERROR: gpg: Can't check signature: No public key
    STATUS: ERRSIG 6BEFD4D6B459AB58 17 2 01 1249861814 9
    STATUS: NO_PUBKEY 6BEFD4D6B459AB58

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

    [2010-08-26 10:23:48] alec

    Description:
    ------------
    When decryption fails because of lack of private key its ID is not set
    in exception object. Simple fix:
    --- DecryptStatusHandler.old 2010-08-26 11:16:31.000000000 +0200
    +++ DecryptStatusHandler.php 2010-08-26 12:21:30.365249721 +0200
    @@ -288,7 +288,7 @@
    throw new Crypt_GPG_KeyNotFoundException(
    'Cannot decrypt data. No suitable private key is in the
    ' .
    'keyring. Import a suitable private key before trying
    to ' .
    - 'decrypt this data.', $code);
    + 'decrypt this data.', $code, $this->currentSubKeyId);

    case Crypt_GPG::ERROR_BAD_PASSPHRASE:
    $badPassphrases = array_diff_key(

    ------------------------------------------------------------------------
  • Mike at Aug 26, 2010 at 3:43 pm
    Edit report at http://pear.php.net/bugs/bug.php?id=17822&edit=1

    ID: 17822
    Updated by: mike@silverorange.com
    Reported By: alec at alec dot pl
    Summary: Missing keyId in KeyNotFoundException for
    decryption/verify process
    -Status: Open
    +Status: Closed
    Type: Bug
    Package: Crypt_GPG
    Package Version: SVN
    PHP Version: Irrelevant
    -Assigned To:
    +Assigned To: gauthierm
    Roadmap Versions:
    New Comment:

    -Status: Open
    +Status: Closed
    -Assigned To:
    +Assigned To: gauthierm
    This bug has been fixed in SVN.

    If this was a documentation problem, the fix will appear on pear.php.net
    by the end of next Sunday (CET).

    If this was a problem with the pear.php.net website, the change should
    be live shortly.

    Otherwise, the fix will appear in the package's next release.

    Thank you for the report and for helping us make PEAR better.

    Fixed in revision 302814. Thank you for your patch.

    http://svn.php.net/viewvc?view=revision&revision=302814


    Previous Comments:
    ------------------------------------------------------------------------

    [2010-08-26 12:31:51] alec

    --- GPG.old 2010-08-26 11:16:31.000000000 +0200
    +++ GPG.php 2010-08-26 14:20:13.253145205 +0200
    @@ -2394,7 +2394,7 @@
    case Crypt_GPG::ERROR_KEY_NOT_FOUND:
    throw new Crypt_GPG_KeyNotFoundException(
    'Public key required for data verification not in
    keyring.',
    - $code);
    + $code, $this->engine->getErrorKeyId());
    default:
    throw new Crypt_GPG_Exception(
    'Unknown error validating signature details. Please use
    the ' .
    --- Engine.old 2010-08-26 11:16:31.000000000 +0200
    +++ Engine.php 2010-08-26 14:19:40.800391989 +0200
    @@ -295,6 +295,14 @@
    private $_errorFilename = '';

    /**
    + * Key ID related to the error code of the current operation
    + *
    + * @var string
    + * @see Crypt_GPG_Engine::getErrorKeyId()
    + */
    + private $_errorKeyId = '';
    +
    + /**
    * The number of currently needed passphrases
    *
    * If this is not zero when the GPG command is completed, the error
    code is
    @@ -735,6 +743,24 @@
    }

    // }}}
    + // {{{ getErrorKeyId()
    +
    + /**
    + * Gets the key ID related to the error code of the last executed
    operation
    + *
    + * This value is only meaningful after {@link
    Crypt_GPG_Engine::run()} has
    + * been executed. If there is no key ID related to the error, an
    empty string
    + * is returned.
    + *
    + * @return string the key ID related to the error code of the last
    executed
    + * operation.
    + */
    + public function getErrorKeyId()
    + {
    + return $this->_errorKeyId;
    + }
    +
    + // }}}
    // {{{ setInput()

    /**
    @@ -936,6 +962,7 @@

    case 'NO_PUBKEY':
    case 'NO_SECKEY':
    + $this->_errorKeyId = $tokens[1];
    $this->_errorCode = Crypt_GPG::ERROR_KEY_NOT_FOUND;
    break;

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

    [2010-08-26 11:06:05] alec

    -Summary: Missing keyId in KeyNotFoundException for decryption
    process
    +Summary: Missing keyId in KeyNotFoundException for
    decryption/verify process
    This patch is for decryption. I've found that key Id is also not set on
    verification. E.g. when there's no public key I got such responses:

    ERROR: gpg: Signature made Mon Aug 10 01:50:14 2009 CEST using DSA key
    ID B459AB58
    ERROR: gpg: Can't check signature: No public key
    STATUS: ERRSIG 6BEFD4D6B459AB58 17 2 01 1249861814 9
    STATUS: NO_PUBKEY 6BEFD4D6B459AB58

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

    [2010-08-26 10:23:48] alec

    Description:
    ------------
    When decryption fails because of lack of private key its ID is not set
    in exception object. Simple fix:
    --- DecryptStatusHandler.old 2010-08-26 11:16:31.000000000 +0200
    +++ DecryptStatusHandler.php 2010-08-26 12:21:30.365249721 +0200
    @@ -288,7 +288,7 @@
    throw new Crypt_GPG_KeyNotFoundException(
    'Cannot decrypt data. No suitable private key is in the
    ' .
    'keyring. Import a suitable private key before trying
    to ' .
    - 'decrypt this data.', $code);
    + 'decrypt this data.', $code, $this->currentSubKeyId);

    case Crypt_GPG::ERROR_BAD_PASSPHRASE:
    $badPassphrases = array_diff_key(

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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
categoriesphp
postedAug 26, '10 at 11:06a
activeAug 26, '10 at 3:43p
posts3
users2
websitepear.php.net

2 users in discussion

Alec: 2 posts Mike: 1 post

People

Translate

site design / logo © 2022 Grokbase