From:             bassijunior at gmail dot com
Operating system: Windows XP
PHP version:      5.1.4
PHP Bug Type:     OpenSSL related
Bug description:  openssl_csr_sign()

Description:
------------
 I'm using a PHP 5.1.1, but I have a folowing problem:

I made a code that was to sign a request. I used almost all the code from
PHP page. I made some modifications.
The openssl_csr_sign function doesn´t work. Please, help me!!!

Reproduce code:
---------------
// You will usually want to create a self-signed certificate at this
// point until your CA fulfills your request.
// This creates a self-signed cert that is valid for 365 days

$cacert = "C:\demoCA\cacert.pem";
$privkey_ca = array("C:\demoCA\private\cakey.pem", "junior");
$req_cert = "C:\demoCA\csr_2.pem";

var_dump($req_cert);

$usercert = openssl_csr_sign($req_cert, $cacert, $privkey_ca, 365);

if($usercert) 
{ 
        echo " A requisicao foi assinada</br>"; 
} 
else 
{ 
        echo "Erro : A requisicao nao foi assinada</br>"; 
} 

var_dump($usercert);


openssl_x509_export_to_file($usercert, "C:\demoCA\user_cert_signed.pem");



/*
// Show any errors that occurred here
while (($e = openssl_error_string()) !== false) {
   echo $e . "\n";
}

*/
?>

Expected result:
----------------
I expect that my request is signed by CA that I created.
I made previously the request using the openssl_csr_new() function.

Actual result:
--------------
The result was: 

string(19) "C:\demoCA\csr_2.pem" 
Warning: openssl_csr_sign() [function.openssl-csr-sign]: cannot get CSR
from parameter 1 in
C:\xampp\xampp\htdocs\teste_php\criando_certificado_auto_assinado_teste.php
on line 24
Erro : A requisicao nao foi assinada
bool(false) 
Warning: openssl_x509_export_to_file() expects parameter 1 to be resource,
boolean given in
C:\xampp\xampp\htdocs\teste_php\criando_certificado_auto_assinado_teste.php
on line 38



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

Reply via email to