<?php
$c = $_POST['c'];
$city = $_POST['city'];
$cn = $_POST['cn'];
$mail = $_POST['email'];
$p = $_POST['pass'];
echo "$c<BR>$city<br>$cn<br>$mail";
$key = $_POST['key'];
$dn = array(
"countryName" => "$c",
"stateOrProvinceName" => ".",
"localityName" => "$city",
"organizationName" => ".",
"organizationalUnitName" => ".",
"commonName" => "$cn",
"emailAddress" => "$key"
//"passphase" => "$p"
);
// Generate a certificate signing request
$csr = openssl_csr_new($dn, $key);
var_dump($csr);
while ($msg = openssl_error_string())
echo $msg . "<br />\n";
?>
It is showing me an error:
Warning: openssl_csr_new(): dn: add_entry_by_NID 48 -> -----BEGIN RSA PRIVATE KEY----- M[...]= -----END RSA PRIVATE KEY----- (failed; check error queue and value of string_mask OpenSSL option if illegal characters are reported) in D:\wamp\www\csr.php on line 21
and
boolean false
error:0E06D06C:configuration file routines:NCONF_get_string:no value
error:0E06D06C:configuration file routines:NCONF_get_string:no value
error:0E06D06C:configuration file routines:NCONF_get_string:no value
error:0E06D06C:configuration file routines:NCONF_get_string:no value
error:0E06D06C:configuration file routines:NCONF_get_string:no value
error:0E06D06C:configuration file routines:NCONF_get_string:no value
error:0D07A097:asn1 encoding routines:ASN1_mbstring_ncopy:string too long
This is what I found on php.net
mixed openssl_csr_new ( array $dn , resource &$privkey [, array $configargs [, array $extraattribs ]] )
$pivkey
should be a resource type, what if I already have got a private key as string?