|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2007-06-19 19:40 UTC] alex at schestag dot info
Description: ------------ Hi, I have a problem with the PECL gnupg extension 1.3.1 that might be a bug. When I try to encrypt or sign a string with gnupg_encrypt or gnupg_sign and try to produce an output of the signed or encrypted string, the output is empty. I tested it with the code given below and with some of my own code. This code is the original code that can be found in the manual. I get this behaviour with PHP 4.4.7, 5.2.3 and 6.0.0dev on Apache 2.2.3 on Debian Lenny (so, please ignore the version selection above as my PHP versions are not listed there). PHP 4.4.7 is compiled as a module, 5.2.3 and 6.0.0dev are CGIs. The Apache errorlog and the accesslog don't shown any error. The script doesn't crash like in Bug #10840;. When I add an additional line like echo 'hello';, hello is given as output. gnupg is installed and works fine, the extension is shown in phpinfo(); for all versions mentioned above. The environment GNUPGHOME is set properly. Kind regards, Alexander Schestag Reproduce code: --------------- Encryption: <?php $res = gnupg_init(); gnupg_addencryptkey($res,"8660281B6051D071D94B5B230549F9DC851566DC"); $enc = gnupg_encrypt($res, "just a test"); echo $enc; ?> Signing: <?php $res = gnupg_init(); gnupg_addsignkey($res,"8660281B6051D071D94B5B230549F9DC851566DC","test"); $signed = gnupg_sign($res, "just a test"); echo $signed; ?> Expected result: ---------------- I expect echo $enc; to give me the encrypted/signed string as output. Actual result: -------------- echo $enc; gives just an empty string as output. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 08:00:02 2025 UTC |
I'm seeing this exact same issue as well with Debian and PHP 5.2.0 on Apache 2.2.3. Permissions have been set correctly on the .gnupg directory. The same thing happens without running the putenv function. Reproduce code: --------------------- <?php putenv("GNUPGHOME=/home/apacheuser/.gnupg/"); $res = gnupg_init(); gnupg_seterrormode($res,GNUPG_ERROR_WARNING); gnupg_addencryptkey($res,"8660281B6051D071D94B5B230549F9DC851566DC"); $enc = gnupg_encrypt($res, "just a test"); echo "'$enc'"; ?> Expected result: --------------------- 'encrypted result' Actual result: --------------------- Warning: gnupg_addencryptkey() [function.gnupg-addencryptkey]: get_key failed in /var/www/site/public_html/index.php on line 5 Warning: gnupg_encrypt() [function.gnupg-encrypt]: no key for encryption set in /var/www/site/public_html/index.php on line 6 ''