'Create Certificate x509 with php problem with the parameters
I am trying to create a certificate with PHP with library openssl . The code is:
global $gbl, $login, $ghtml;
$today = date("m.d.y") + rand(1,10000);
$cerpath = "server".$today.".crt";
$keypath = "server".$today.".key";
$requestpath = "a".$today.".csr";
$ltemp["countryName"] = "IN";
$ltemp["stateOrProvinceName"] = "Bn";
$ltemp["localityName"] = "Bn";
$ltemp["organizationName"] = "LxCenter OrganizationName";
$ltemp["organizationalUnitName"] = "MyOrgUnit";
// $ltemp["commonName"] = "Noirsolutions.net commonName";
$ltemp["emailAddress"] = "[email protected] emailAddress";
$ltemp["subjectAltName"]="subjectAltName";
$ltemp["basicConstraints"]="CA:false";
$ltemp["extendedKeyUsage"]="clientAuth";
$ltemp["subjectAltName"]="@sans";
$privkey = openssl_pkey_new();
openssl_pkey_export_to_file($privkey, $keypath);
$csr = openssl_csr_new($ltemp, $privkey);
openssl_csr_export_to_file($csr, $requestpath);
$sscert = openssl_csr_sign($csr, null, $privkey, 365);
openssl_x509_export_to_file($sscert, $cerpath);
$src = getcwd();
The code creates the csr and the other file, but I have the problem that "Released to"
and "Released From has the same value" = MyOrgUnit
.
Also if I use commonName I have the same problem, but this time with the value became Noirsolutions.net commonName
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|