سؤال

I have error

error:2006D002:BIO routines:BIO_new_file:system lib

when calling openssl_csr_new function.

$pKey = openssl_pkey_new( $keyConfig );
$pCSR = openssl_csr_new( $sslConfig, $pKey );

Without openssl.cnf this failed on first function.

I try a minimum openssl.cnf and real configuration, but no effect. If I use wrong openssl.cnf error will be:

error:0E064002:configuration file routines:CONF_load:system lib

Please, can you help with correct minimum openssl.cnf or that I need fix?

  • PHP 5.3.28 as Apache mod;
  • phpinfo: OpenSSL support enabled
  • OpenSSL Library Version 0.9.8y 5 Feb 2013
  • PHP reinstalled and already rebooted.
هل كانت مفيدة؟

المحلول

Solved, I need specify $keyConfig for OpenSSL function :

$keyConfig = array(
    'config' => dirname($_SERVER['SCRIPT_FILENAME']) . '/store/openssl.cnf',
    ...
);
$sslConfig = array(
    "countryName" => 'XX',
    "stateOrProvinceName" => 'XX',
    "localityName" => 'XX',
    ...
);
$pKey = openssl_pkey_new( $keyConfig );
$pCSR = openssl_csr_new( $sslConfig, $pKey , $keyConfig );
$pCRT = openssl_csr_sign( $pCSR , null , $pKey , self::TIME_INTERVAL_WEEK , $keyConfig );
openssl_x509_export( $pCRT, $strCertificate );
openssl_pkey_export( $pKey, $strPrivateKey , null , $keyConfig );
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top