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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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

Pull Requests

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-2024 The PHP Group
All rights reserved.
Last updated: Tue Oct 08 22:01:27 2024 UTC