Hi,

i try to create a self signed certificate using this code:

<?php

        if(!isset($_GET['password']))
        {
                echo "Error Code: 1";
                exit(1);
        }

        
        if($_GET['password'] == "")
        {
                echo "Error Code 2";
                exit(1);
        }       
        
        $password = mysql_real_escape_string($_GET['password']);

        
        
$dn = array(
    "countryName" => "DE",
    "stateOrProvinceName" => "test",
    "localityName" => "test",
    "organizationName" => "test",
    "organizationalUnitName" => "test",
    "commonName" => "test",
    "emailAddress" => "t...@test.de"
);


$privkey = openssl_pkey_new();


$csr = openssl_csr_new($dn, $privkey);


$sscert = openssl_csr_sign($csr, null, $privkey, 365);

openssl_csr_export($csr, $csrout) and var_dump($csrout);
openssl_x509_export($sscert, $certout) and var_dump($certout);
openssl_pkey_export($privkey, $pkeyout, $password) and var_dump($pkeyout);

while (($e = openssl_error_string()) !== false) {
    echo $e . "\n";
}

?>


But all i get is this:
Warning: openssl_csr_sign() [function.openssl-csr-sign]: cannot get
CSR from parameter 1 in
C:\xampp\htdocs\test\admin\create_self_signed_crt_action.php on line
42
Warning: openssl_csr_export() expects parameter 1 to be resource,
boolean given in
C:\xampp\htdocs\test\admin\create_self_signed_crt_action.php on line
51
Warning: openssl_x509_export() [function.openssl-x509-export]: cannot
get cert from parameter 1 in
C:\xampp\htdocs\test\admin\create_self_signed_crt_action.php on line
52
Warning: openssl_pkey_export() [function.openssl-pkey-export]: cannot
get key from parameter 1 in
C:\xampp\htdocs\test\admin\create_self_signed_crt_action.php on line
53
error:02001003:system library:fopen:No such process error:2006D080:BIO
routines:BIO_new_file:no such file error:0E064002:configuration file
routines:CONF_load:system lib error:02001003:system library:fopen:No
such process error:2006D080:BIO routines:BIO_new_file:no such file
error:0E064002:configuration file routines:CONF_load:system lib
error:02001003:system library:fopen:No such process error:2006D080:BIO
routines:BIO_new_file:no such file error:0E064002:configuration file
routines:CONF_load:system lib error:02001003:system library:fopen:No
such process error:2006D080:BIO routines:BIO_new_file:no such file
error:0E064002:configuration file routines:CONF_load:system lib

I'm using a windows box with xampp installed.

regards.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to