php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59422 pecl-gnupg don't work with gnupg >=2
Submitted: 2010-09-15 05:29 UTC Modified: 2011-02-04 10:53 UTC
From: lukasz at wasikowski dot net Assigned:
Status: Closed Package: gnupg (PECL)
PHP Version: 5.2.13 OS: Gentoo Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: lukasz at wasikowski dot net
New email:
PHP Version: OS:

 

 [2010-09-15 05:29 UTC] lukasz at wasikowski dot net
Description:
------------
Gentoo Linux
pecl-gnupg-1.3.2
gnupg-2.0.16-r1
php-5.2.14

Encrypt works fine, but decryption fails with

Warning: gnupg::decrypt(): decrypt failed in /home/idaho/test-gnupg.php on line 19

Downgrade gnupg to version 1.4.10 solves the problem. Seems that the problem is in gpgme_op_decrypt call - it returns value != GPG_ERR_NO_ERROR.


Reproduce code:
---------------
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
putenv('GNUPGHOME=/home/idaho/.gnupg');
$GnuPG = new gnupg();
$GnuPG->seterrormode(GNUPG_ERROR_WARNING);
$GnuPG->addencryptkey("lukasz@wasikowski.net");
$ciphertext = $GnuPG->encrypt("test message");
echo "Encrypted:\n" . $ciphertext;
$try= $GnuPG->adddecryptkey("lukasz@wasikowski.net",'test');
$decryptedtext = $GnuPG->decrypt($ciphertext);
echo "\nDecrypted:\n" . $decryptedtext;
?>


Expected result:
----------------
Encrypted:
-----BEGIN PGP MESSAGE-----
Version: GnuPG v1.4.10 (GNU/Linux)

[...]

-----END PGP MESSAGE-----

Decrypted:
test message

Actual result:
--------------
Encrypted:
-----BEGIN PGP MESSAGE-----
Version: GnuPG v2.0.16 (GNU/Linux)

[...]

-----END PGP MESSAGE-----

Warning: gnupg::decrypt(): decrypt failed in /home/idaho/test-gnupg.php on line 11

Decrypted:


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-02-04 10:53 UTC] lukasz at wasikowski dot net
Decryption started to work with:

pecl-gnupg-1.3.2-r1
gnupg-2.0.17
php-5.2.17
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sun Jun 16 14:01:27 2019 UTC