php.net |  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
Votes:2
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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: bassijunior at gmail dot com
New email:
PHP Version: OS:

 

 [2006-05-09 01:25 UTC] bassijunior at gmail dot com
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



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-05-10 10:16 UTC] tony2001@php.net
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 http://www.php.net/downloads.php

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-2021 The PHP Group
All rights reserved.
Last updated: Mon Nov 29 15:03:13 2021 UTC