Jump to content

openssl certficate serial no problem.......


rahuul

Recommended Posts

hi all,

 

i have made a code which produces key & certificate files but the problem is every certificate has same serial no pls help how to correct

 

my code is like this

$dn = array(
    "countryName" => "US",
    "stateOrProvinceName" => "LA",
    "O" => "VPN",
    "OU" => "vpnxxx",
"commonName" => "$user",
    "emailAddress" => "$email");

$config = array("config" => "D:/xampp/php/extras/openssl/openssl.cnf");

$privkey1 = openssl_pkey_new($config)or die(openssl_error_string());



$csr = openssl_csr_new($dn, $privkey1)or die(openssl_error_string());

$cacert = file_get_contents('keys/ca.crt');
$privkey = array(file_get_contents("keys/ca.key"),"");
$sscert = openssl_csr_sign($csr, $cacert, $privkey, $days);

$dir = 'keys_tmp/';

//for generating csr
openssl_csr_export($csr, $csrout);
file_put_contents($dir.$user.'.csr',$csrout);


//for generating crt
openssl_x509_export($sscert, $certout);
file_put_contents($dir.$user.'.crt', $certout);

//for generating keys
openssl_pkey_export($privkey1, $pkeyout);
file_put_contents($dir.$user.'.key', $pkeyout);

 

in creating manually from DOS we have a index.txt, serial file which help in keeping information but how to do that in php......

 

also advice how to revoke certificates in php

Link to comment
https://forums.phpfreaks.com/topic/196097-openssl-certficate-serial-no-problem/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.