I want to generate ssl certificate (with public key) and private key. My
code:
$ssl_configargs = array(
"digest_alg " => "sha1",
"private_key_bi ts" => 2048,
"private_key_ty pe" => OPENSSL_KEYTYPE _RSA,
"encrypt_ke y" => false
);
$dn = array("countryN ame" => $_POST[ 'country' ],
"stateOrProvinc eName" => $_POST[ 'state' ],
"localityNa me" => $_POST[ 'city' ],
"organizationNa me" => $_POST[ 'org' ],
"organizational UnitName" => $_POST[ 'unit' ],
"commonName " => $_POST[ 'name' ],
"emailAddre ss" => $_POST[ 'mail' ] );
$numberofdays = $_POST[ 'days' ];
$pkey = openssl_pkey_ne w( $ssl_configargs );
// there is a error
$csr = openssl_csr_new ( $dn, $privkey, $ssl_configargs );
$sscert = openssl_csr_sig n( $csr, null, $privkey, $numberofdays );
openssl_csr_exp ort( $csr, $csrout );
openssl_x509_ex port( $sscert, $certout );
openssl_pkey_ex port( $privkey, $pkeyout, $configargs[
'licence_pwd' ] );
I've tried use openssl_pkey_ne w without param ($ssl_configarg s ), but it
still doesn't work.
My errors:
Warning: openssl_csr_sig n(): key type not supported in this PHP build! in
xx.php on line xx
Warning: openssl_csr_sig n(): failed to sign it in xx.php on line x
Warning: openssl_x509_ex port() expects parameter 1 to be resource, boolean
given in xx.php on line xx
Warning: openssl_pkey_ex port(): key type not supported in this PHP build! in
xx.php on line xx
Can somebody help me? This is very important. Thx
code:
$ssl_configargs = array(
"digest_alg " => "sha1",
"private_key_bi ts" => 2048,
"private_key_ty pe" => OPENSSL_KEYTYPE _RSA,
"encrypt_ke y" => false
);
$dn = array("countryN ame" => $_POST[ 'country' ],
"stateOrProvinc eName" => $_POST[ 'state' ],
"localityNa me" => $_POST[ 'city' ],
"organizationNa me" => $_POST[ 'org' ],
"organizational UnitName" => $_POST[ 'unit' ],
"commonName " => $_POST[ 'name' ],
"emailAddre ss" => $_POST[ 'mail' ] );
$numberofdays = $_POST[ 'days' ];
$pkey = openssl_pkey_ne w( $ssl_configargs );
// there is a error
$csr = openssl_csr_new ( $dn, $privkey, $ssl_configargs );
$sscert = openssl_csr_sig n( $csr, null, $privkey, $numberofdays );
openssl_csr_exp ort( $csr, $csrout );
openssl_x509_ex port( $sscert, $certout );
openssl_pkey_ex port( $privkey, $pkeyout, $configargs[
'licence_pwd' ] );
I've tried use openssl_pkey_ne w without param ($ssl_configarg s ), but it
still doesn't work.
My errors:
Warning: openssl_csr_sig n(): key type not supported in this PHP build! in
xx.php on line xx
Warning: openssl_csr_sig n(): failed to sign it in xx.php on line x
Warning: openssl_x509_ex port() expects parameter 1 to be resource, boolean
given in xx.php on line xx
Warning: openssl_pkey_ex port(): key type not supported in this PHP build! in
xx.php on line xx
Can somebody help me? This is very important. Thx
Comment