| 
        php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             
             [2011-02-04 10:53 UTC] lukasz at wasikowski dot net
  | 
    |||||||||||||||||||||||||||
            
                 
                Copyright © 2001-2025 The PHP GroupAll rights reserved.  | 
        Last updated: Tue Nov 04 03:00:01 2025 UTC | 
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: