|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-05-10 10:16 UTC] tony2001@php.net
[2006-06-03 17:47 UTC] bassijunior at gmail dot com
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Mon Aug 17 09:00:01 2026 UTC |
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