You are here: ssl (generate certs) « All PHP « IT news, forums, messages
ssl (generate certs)

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация