|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-10-20 05:20 UTC] rusxakep at mail dot ru
[2006-10-24 09:53 UTC] traufeisen@php.net
[2013-02-18 00:35 UTC] pecl-dev at lists dot php dot net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 03:00:01 2025 UTC |
Description: ------------ Hi! Sorry for my poor english! I have a problem. I'm run script for decode test.asc (crypted by my public key) (sure, i'm change real data to 1111,2222,3333 and 4444 :-): Script: #!/usr/bin/php-cgi -q <?php putenv("GNUPGHOME=/home/mike/.gnupg/"); $text=file_get_contents("test.asc"); $res = gnupg_init(); gnupg_seterrormode($res,GNUPG_ERROR_WARNING); print_r(gnupg_keyinfo($res,"1111111111111111111111111111111111111111")); echo gnupg_geterror($res); if (!gnupg_adddecryptkey($res,"1111111111111111111111111111111111111111","password")) echo "ERROR"; echo gnupg_decrypt($res,$text); ?> I'm try to decode, but i got next error message: Array ( [0] => Array ( [disabled] => [expired] => [revoked] => [is_secret] => [can_sign] => 1 [can_encrypt] => 1 [uids] => Array ( [0] => Array ( [name] => Mega Ltd. [comment] => Only for Cyb.Com [email] => cyb@mega.ru [uid] => Mega Ltd. (Only for Cyb.Com) <cyb@megapage.ru> [revoked] => [invalid] => ) ) [subkeys] => Array ( [0] => Array ( [fingerprint] => 1111111111111111111111111111111111111111 [keyid] => 4444444444444444 [timestamp] => 1161251952 [expires] => 1192355952 [is_secret] => [invalid] => [can_encrypt] => [can_sign] => 1 [disabled] => [expired] => [revoked] => ) [1] => Array ( [fingerprint] => 2222222222222222222222222222222222222222 [keyid] => 3333333333333333 [timestamp] => 1161251957 [expires] => 1192355957 [is_secret] => [invalid] => [can_encrypt] => 1 [can_sign] => [disabled] => [expired] => [revoked] => ) ) ) ) PHP Warning: gnupg_decrypt() [<a href='function.gnupg-decrypt'>function.gnupg-decrypt</a>]: no passphrase set in /var/www/megapage.ru/htdocs/test2.php on line 10 <br /> <b>Warning</b>: gnupg_decrypt() [<a href='function.gnupg-decrypt'>function.gnupg-decrypt</a>]: no passphrase set in <b>/var/www/megapage.ru/htdocs/test2.php</b> on line <b>10</b><br /> PHP Warning: gnupg_decrypt() [<a href='function.gnupg-decrypt'>function.gnupg-decrypt</a>]: decrypt failed in /var/www/megapage.ru/htdocs/test2.php on line 10 <br /> <b>Warning</b>: gnupg_decrypt() [<a href='function.gnupg-decrypt'>function.gnupg-decrypt</a>]: decrypt failed in <b>/var/www/megapage.ru/htdocs/test2.php</b> on line <b>10</b><br /> As you see, your module correct load my keys. Manual decode with gpg --decode working fine. I'm debug some code in your module (unknown error in this code): gpgme_error_t passphrase_decrypt_cb (gnupg_object *intern, const char *uid_hint, const char *passphrase_info,int last_was_bad, int fd TSRMLS_DC){ char uid[16]; int idx; char *passphrase = NULL; zval *return_value = NULL; if(last_was_bad){ GNUPG_ERR("Incorrent passphrase"); return 1; } for(idx=0;idx<16;idx++){ uid[idx] = uid_hint[idx]; } uid[16] = '\0'; if(zend_hash_find(intern->decryptkeys,(char *) uid,17,(void **) &passphrase)==FAILURE){ GNUPG_ERR("no passphrase set"); return 1; } Why zend_hash_find can't find hash for passphrase? PHP 5.1.6, gpgme 1.1.2, gnupg-1.9.20 What's problem? Thanks for support.