ssl and php (generate certs)

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I want to generate ssl certificate (with public key) and private key. My  

$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

Re: ssl and php (generate certs)

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.

Site Timeline