ID:               13522
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
-Status:           Open
+Status:           Feedback
 Bug Type:         OpenSSL related
 Operating System: SunOS 5.7
 PHP Version:      4.0.6
 New Comment:

Have you resolved this problem yet?


Previous Comments:
------------------------------------------------------------------------

[2001-10-11 15:09:41] [EMAIL PROTECTED]

I *probably* could, but I really wouldn't want to put
RC on that machine. Also I don't think PHP version
is the problem - the function should work on 
PHP 4 >= 4.0.4... it must be something in the 
configuration.

Are there any scripts I could use to test if the 
openssl extension is set up properly? 

------------------------------------------------------------------------

[2001-10-08 18:22:34] [EMAIL PROTECTED]

The same script works just fine for me with PHP 4.0.7RC3.
Could you try it out too?

http://www.php.net/~zeev/php-4.0.7RC3.tar.gz

--Wez.

------------------------------------------------------------------------

[2001-10-08 12:42:10] [EMAIL PROTECTED]

Below is the *whole* script. The only output I get is
"There were errors". It can't seal the data, returning
FALSE, but no error messages are generated.

<?php
$cert_path1 = "/usr/installs/openssl-0.9.6a/demos/maurice/cert.pem";
$cert_path2 = "/usr/installs/openssl-0.9.6a/demos/sign/cert.pem";
$data = "This is the data to be sealed";

$fp = fopen($cert_path1, "r");
$cert = fread($fp, 8192);
fclose($fp);
$pk1 = openssl_get_publickey($cert);
$fp = fopen($cert_path2, "r");
$cert = fread($fp, 8192);
fclose($fp);
$pk2 = openssl_get_publickey($cert);

if (openssl_seal($data, $sealed, $ekeys, array($pk1,$pk2)))
        echo "Sealed data: $sealed<br />";
else    {
        echo "There were errors<br />";
        while ($text = openssl_error_string())
                echo "$text <br />";
}
openssl_free_key($pk1);
openssl_free_key($pk2);
?>

------------------------------------------------------------------------

[2001-10-05 16:29:39] [EMAIL PROTECTED]

Upgraded to 4.0.6, so now I can use the openssl_error_string()
function. However, I still don't see any errors generated
by openssl_seal(). Below is how I use it:

if (openssl_seal($data, $sealed, $ekeys, array($pk1,$pk2)))     {
        echo "Sealed: $sealed\n";
}
else    {
        echo "Could not seal data\n";
        while ($text = openssl_error_string())
                echo "$text \n";
}

This reports no errors. When I try to open the 'encrypted'
data, I do get some errors (I think these are expected):

error:0407106B:rsa routines:RSA_padding_check_PKCS1_type_2:block type
is not 02 
error:04065072:rsa routines:RSA_EAY_PRIVATE_DECRYPT:padding check
failed 





------------------------------------------------------------------------

[2001-10-03 08:57:46] [EMAIL PROTECTED]

Please try with PHP 4.0.6 or PHP 4.0.7RC3.
If you are still getting a false return, try using
the openssl_error_string() as mentioned in the online
manual.

--Wez.

------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/13522

-- 
Edit this bug report at http://bugs.php.net/?id=13522&edit=1

Reply via email to