2

I've already tried all.... but not works! I did put libeay32.dll and ssleay32.dll on System32 windows folder and I enabled php_openssl.dll extension on php.ini. But, when executes following code, some errors occurs. My openSSL version is 1.0.0. Anyone can help me?

Code:

$configargs = array(
    'config' => 'openssl.cnf',
    'digest_alg' => 'md5',
    'x509_extensions' => 'v3_ca',
    'req_extensions'   => 'v3_req',
    'private_key_bits' => 666,
    'private_key_type' => OPENSSL_KEYTYPE_RSA,
    'encrypt_key' => false,
    );

$dn = array(
    "countryName" => "DE",
    "stateOrProvinceName" => "wubbla wubbla",
    "localityName" => "wubbla",
    "organizationName" => "Internet Widgits Pty Ltd",
    "organizationalUnitName" => "Organizational Unit Name",
    "commonName" => "example.com",
    "emailAddress" => "Email Address"
);

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

// Show any errors that occurred here
while (($e = openssl_error_string()) !== false) {
    echo $e . "\n";
   }

The errors:

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:02001002:system library:fopen:No such file or directory
error:2006D080:BIO routines:BIO_new_file:no such file
error:0E064002:configuration file routines:CONF_load:system lib 
jww
  • 97,681
  • 90
  • 411
  • 885
Lucas Batistussi
  • 2,283
  • 3
  • 27
  • 35

1 Answers1

3

Well, according to the error message, it fails to fopen() the config file, which you configured as:

'config' => 'openssl.cnf',

Does it exist? Try using an absolute path, or relative to CWD.

Daniel Roethlisberger
  • 6,958
  • 2
  • 41
  • 59
  • Finally works... But now I have another trouble... :( When I try get information about private rsa key generated (using openssl_pkey_get_details), i.e., when I execute the php script, the page restart connection and don't execute! What would be the problem? – Lucas Batistussi Mar 20 '12 at 21:50
  • Is possible generate the private RSA key without using openssl.cnf? – Lucas Batistussi Mar 20 '12 at 21:51