|
Posted by xer on 03/02/06 18:52
I want to generate ssl certificate (with public key) and private key. My
code:
$ssl_configargs = array(
"digest_alg" => "sha1",
"private_key_bits" => 2048,
"private_key_type" => OPENSSL_KEYTYPE_RSA,
"encrypt_key" => false
);
$dn = array("countryName" => $_POST[ 'country' ],
"stateOrProvinceName" => $_POST[ 'state' ],
"localityName" => $_POST[ 'city' ],
"organizationName" => $_POST[ 'org' ],
"organizationalUnitName" => $_POST[ 'unit' ],
"commonName" => $_POST[ 'name' ],
"emailAddress" => $_POST[ 'mail' ] );
$numberofdays = $_POST[ 'days' ];
$pkey = openssl_pkey_new( $ssl_configargs );
// there is a error
$csr = openssl_csr_new( $dn, $privkey, $ssl_configargs );
$sscert = openssl_csr_sign( $csr, null, $privkey, $numberofdays );
openssl_csr_export( $csr, $csrout );
openssl_x509_export( $sscert, $certout );
openssl_pkey_export( $privkey, $pkeyout, $configargs[
'licence_pwd' ] );
I've tried use openssl_pkey_new without param ($ssl_configargs ), but it
still doesn't work.
My errors:
Warning: openssl_csr_sign(): key type not supported in this PHP build! in
xx.php on line xx
Warning: openssl_csr_sign(): failed to sign it in xx.php on line x
Warning: openssl_x509_export() expects parameter 1 to be resource, boolean
given in xx.php on line xx
Warning: openssl_pkey_export(): key type not supported in this PHP build! in
xx.php on line xx
Can somebody help me? This is very important. Thx
[Back to original message]
|