#50776 [NEW]: openssl_pkcs7_verify
| From: | gufophp at gmail dot com | Date: | Sat, 16 Jan 2010 06:06:14 +0000 |
| Subject: | #50776 [NEW]: openssl_pkcs7_verify | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-146725@lists.php.net to get a copy of this message | ||
From: gufophp at gmail dot com
Operating system: win32 apache
PHP version: 5.3.1
PHP Bug Type: OpenSSL related
Bug description: openssl_pkcs7_verify
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" => "joes@example.com", // keyed syntax
"From: HQ <ceo@example.com>", // 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 bug report at http://bugs.php.net/?id=50776&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=50776&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=50776&r=trysnapshot53
Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=50776&r=trysnapshot60
Fixed in SVN: http://bugs.php.net/fix.php?id=50776&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=50776&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=50776&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=50776&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=50776&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=50776&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=50776&r=support
Expected behavior: http://bugs.php.net/fix.php?id=50776&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=50776&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=50776&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=50776&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=50776&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=50776&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=50776&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=50776&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=50776&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=50776&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=50776&r=mysqlcfg