ID: 50776
Updated by: [email protected]
Reported By: gufophp at gmail dot com
-Status: Open
+Status: Feedback
Bug Type: OpenSSL related
Operating System: win32 apache
PHP Version: 5.3.1
New Comment:
Try Google for the error:
"Likewise, if the senderâs certificate isnât recognized by your
OpenSSL infrastructure, youâll get a similar error"
Looks like your script is buggy.
Previous Comments:
------------------------------------------------------------------------
[2010-01-16 06:06:14] gufophp at gmail dot com
Description:
------------
PKCS7_verify:certificate verify error
Reproduce code:
---------------
<?php
$body = <<<EOD
You have my authorization to spend $10,000 on dinner expenses.
The CEO
EOD;
$key = file_get_contents("test.key");
$crt = file_get_contents("test.crt");
$file = tempnam('', 'mail');
file_put_contents($file, $body);
$signed = tempnam("", "signed"); // view 1
echo openssl_x509_check_private_key($crt,
array($key,"gufogufogufogufogufogufo")) ;
while ($msg = openssl_error_string())
echo $msg . "<br />\n";
echo "<hr />"; // view 1
$arr = array("To" => "[email protected]", // keyed syntax
"From: HQ <[email protected]>", // indexed syntax
"Subject" => "Eyes only");
echo openssl_pkcs7_sign($file, $signed, $crt, array($key,
"gufogufogufogufogufogufo"),$arr);
while ($msg = openssl_error_string())
echo $msg . "<br />\n";
echo "<hr />";
$body = file_get_contents($signed);
file_put_contents("signed.txt",$body);
$pa = "C:\\Programmi\\Apache Software
Foundation\\Apache2.2\\htdocs\sign\\";
// error here
echo openssl_pkcs7_verify(
$pa."signed.txt",
PKCS7_BINARY,
$pa.'test3.crt',
array($pa.'test.crt'),
$pa.'test.crt',
$pa.'content.eml'
);
// error:21075075:PKCS7 routines:PKCS7_verify:certificate verify error
while ($msg = openssl_error_string())
echo $msg . "<br />\n";
?>
Expected result:
----------------
1
Actual result:
--------------
error:21075075:PKCS7 routines:PKCS7_verify:certificate verify error
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=50776&edit=1