Bug #13522 Updated: openssl_seal always returns FALSE
| From: | wez@php.net | Date: | Mon, 08 Oct 2001 22:22:34 +0000 |
| Subject: | Bug #13522 Updated: openssl_seal always returns FALSE | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-67574@lists.php.net to get a copy of this message | ||
ID: 13522
Updated by: wez
Reported By: kanareykin+nospam@denison.edu
Old Status: Open
Status: Feedback
Bug Type: OpenSSL related
Operating System: SunOS 5.7
PHP Version: 4.0.6
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[2001-10-08 12:42:10] kanareykin+nospam@denison.edu
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] kanareykin+nospam@denison.edu
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] wez@php.net
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.
------------------------------------------------------------------------
[2001-10-02 17:28:18] kanareykin+nospam@denison.edu
I can't get the example openssl_seal() code (given in the online manual) to work. The function
always returns FALSE without specifying an error; sealed data and envelope keys are void. I'm
using the demo key and certificate that comes with OpenSSL 0.9.6a (in demos dir) and all of the
other functions (like openssl_get_public_key) seem to work, i.e. they return resource identifiers.
Config line:
'./configure' '--with-apxs=/usr/local/apache/bin/apxs'
'--with-cybercash=/usr/installs/mck-3.3.1-sparc-sun-solaris2.7''--with-mysql=/usr/local'
'--with-xml' '--with-oci8'
'--with-curl=/usr/local''--with-openssl=/usr/local'
'--with-ldap=/usr/local'
------------------------------------------------------------------------
Edit this bug report at http://bugs.php.net/?id=13522&edit=1