ID:               47863
 Updated by:       fel...@php.net
 Reported By:      laurent dot jouannic at cbsa dot fr
-Status:           Open
+Status:           Feedback
 Bug Type:         OpenSSL related
 Operating System: debian
 PHP Version:      5.2.9
 New Comment:

Please try using this snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/




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

[2009-04-01 15:06:13] laurent dot jouannic at cbsa dot fr

Description:
------------
When I manualy sign a certificate from the shell:
./CA.sh -sign
or
openssl ca -policy policy_anything -out newcert.pem -infiles
newreq.pem

the value in the file 'serial' increase  ($value++).

When I sign a certificate with php (openssl_csr_sign):
-the serial (file) doesn't change
-the new certificate has a good 'serial' value



Reproduce code:
---------------
        $CAcrt = file_get_contents("/usr/lib/ssl/misc/demoCA/cacert.pem");
        $serial_hexa = file_get_contents("/usr/lib/ssl/misc/demoCA/serial");
        $serial_dec_net=intval($serial_hexa,16); /*04*/

        $CAkey =
array(file_get_contents("/usr/lib/ssl/misc/demoCA/private/cakey.pem"),
"Gas/ZWmUkz7y2");
        
        echo "--".$serial_hexa."--";
        echo "<br>++".$serian_dec_net."++";
        


        $clientKeys = openssl_pkey_new();
        $dn = array(
                "countryName" => "FR",
                "stateOrProvinceName" => "Ain",
                "localityName" => "Jouan",
                "organizationName" => "Certificat client",
                "organizationalUnitName" => "Info",
                "commonName" => "www.abc.fr",
                "emailAddress" => "l...@xp.fr"
        );
        $csr = openssl_csr_new($dn, $clientPrivKey);
        
        $config = array(
                "config" => "/etc/ssl/openssl.cnf",
        );

        $cert = openssl_csr_sign($csr, $CAcrt, $CAkey, 1095, $config, '04');
        openssl_x509_export($cert, $certout);
        echo $certout;
        openssl_pkcs12_export_to_file  ( $certout, "tmp/tito.p12"  ,
$clientPrivKey , "mimine")

Expected result:
----------------
The result is good, as the certificate, but the value inside 'serial'
doesn't change....



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


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

Reply via email to