473,324 Members | 2,567 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

ssl and php (generate certs)

xer
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

Mar 2 '06 #1
1 2329
Seems like your OPENSSL_KEYTYPE_RSA would be undefined, get the value
out of somewhere, like a readme or look in the source code. it is
usually an integer. Anyway, the problem might be that your php version
is incompatible with the library etc..

If it also doesnt work with the params, ask the developers who built
the program or whomever it is made/supported by.

Mar 2 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Richard Shea | last post by:
Hi - Hoped someone who's done this could provide some pointers. I'm interested in developing a script which would make use of openssl_x509_read to read a certificate presented in the HTTP headers...
1
by: jtsree | last post by:
I am Using (Windows XP) Visual Studio.net 2003 professional edition working on VB.net language. I am bulding a very very simple project in VB.net where i connect to Access Database by dragging...
3
by: Tim Burris | last post by:
At the top here i will put a quick description of my problem followed by the long description. This way you want get bored reading! : short version what is the best/recommended way for ASPNET...
4
by: Chris | last post by:
I want to cheat on some certs to get ahead, is this a good idea? can microsoft catch me? chris
0
by: ward | last post by:
Greetings. Ok, I admit it, I bit off a bit more than I can chew. I need to complete this "Generate Report" page for my employer and I'm a little over my head. I could use some additional...
2
by: jens Jensen | last post by:
HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(ConfigurationManager.AppSettings); req.Proxy = new System.Net.WebProxy(ConfigurationManager.AppSettings, true); req.ContentType =...
2
by: Eli Criffield | last post by:
Does anyone have an example setup of a XML-RPC sever using client side certs for authentication? And instead of having a list of certs allowed to connect, I'd like to allow any cert signed by my...
1
by: Joe | last post by:
Hello, I'm currently using a C# class library which is also converted quickly to a console app by adding a MAIN and adjusting the building configuration. I'm using this page as a reference to the...
2
by: bthubbard | last post by:
This may not be the best group in which to post this. If there is a better location please direct me there. I have been experimenting with Sandcastle to generate CHM help file documentation for...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.