From:             dark-tranquillity at yandex dot ru
Operating system: Win32
PHP version:      5.3.1
PHP Bug Type:     OpenSSL related
Bug description:  openssl_pkcs7_verify returns TRUE, but openssl_error_string() 
returns an error

Description:
------------
I have a private key & self-signed certificate.
1) create a signature (openssl_pkcs7_sign)

2) verify the signature: function openssl_pkcs7_verify returns TRUE
(Verification successful),
   but openssl_error_string() - returns an error message
(error:2107C080:PKCS7 routines:PKCS7_get0_signers:signer certificate not
found)

3) in the command line are no errors
   openssl smime -sign -nocerts -signer proc.crt -inkey proc.key -in
in.txt -out signed.txt
   openssl smime -verify -noverify -nointern -nochain -in signed.txt
-certfile proc.crt


Reproduce code:
---------------
<?
    file_put_contents("in.txt", "demo text");

    $certfname='./proc.crt'; 
    $crt      =file_get_contents($certfname);
    $priv_key =file_get_contents('./proc.key');

    if(openssl_pkcs7_sign("in.txt", "signed.txt", $crt, $priv_key,
array(), PKCS7_NOCERTS))
    {
       $status=openssl_pkcs7_verify("signed.txt",
PKCS7_NOVERIFY|PKCS7_NOINTERN|PKCS7_NOCHAIN, "1.tmp", array(),
$certfname);
       while($msg=openssl_error_string()) echo "$msg\n"; 
       echo "status=$status\n";
    }
    else die('failed openssl_pkcs7_sign');
?>


Expected result:
----------------
status=1

Actual result:
--------------
error:2107C080:PKCS7 routines:PKCS7_get0_signers:signer certificate not
found
status=1

-- 
Edit bug report at http://bugs.php.net/?id=50713&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=50713&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=50713&r=trysnapshot53
Try a snapshot (PHP 6.0):            
http://bugs.php.net/fix.php?id=50713&r=trysnapshot60
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=50713&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=50713&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=50713&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=50713&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=50713&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=50713&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=50713&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=50713&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=50713&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=50713&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=50713&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=50713&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=50713&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=50713&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=50713&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=50713&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=50713&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=50713&r=mysqlcfg

Reply via email to