php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57308 library not work
Submitted: 2006-10-20 05:18 UTC Modified: 2013-02-18 00:35 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: rusxakep at mail dot ru Assigned:
Status: No Feedback Package: gnupg (PECL)
PHP Version: 5.1.6 OS: Linux
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2006-10-20 05:18 UTC] rusxakep at mail dot ru
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.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-10-20 05:20 UTC] rusxakep at mail dot ru
Tests from distro package also FAIL.
gpg -d ./test.asc working fine
 [2006-10-24 09:53 UTC] traufeisen@php.net
Hi,
I?ve tried to reproduce this issue, but everything worked fine.
But as far as I can see, the most recent gnupg-version is 1.4.5 (http://www.gnupg.org/(en)/download/index.html) and not 1.9.20
 [2013-02-18 00:35 UTC] pecl-dev at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Wed Oct 28 09:01:28 2020 UTC