|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37374 openssl_csr_sign()
Submitted: 2006-05-09 01:25 UTC Modified: 2006-06-03 17:47 UTC
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: bassijunior at gmail dot com Assigned:
Status: Not a bug Package: OpenSSL related
PHP Version: 5.1.4 OS: Windows XP
Private report: No CVE-ID: None
 [2006-05-09 01:25 UTC] bassijunior at gmail dot com
 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";


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

        echo " A requisicao foi assinada</br>"; 
        echo "Erro : A requisicao nao foi assinada</br>"; 


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
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


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-05-10 10:16 UTC]
Thank you for taking the time to report a problem with PHP.
Unfortunately you are not using a current version of PHP -- 
the problem might already be fixed. Please download a new
PHP version from

If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.

 [2006-06-03 17:47 UTC] bassijunior at gmail dot com
Now I?m using the new version, but the problem continues. The same problem!! Can be anything about openssl library?
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Thu Oct 06 05:05:53 2022 UTC