[英]Error 0x2006D002:BIO routines:BIO_new_file:system lib with PHP on Windows
[英]OpenSSL error 0x2006D002 when creating CSR
我有錯誤
error:2006D002:BIO routines:BIO_new_file:system lib
調用openssl_csr_new
函數時。
$pKey = openssl_pkey_new( $keyConfig );
$pCSR = openssl_csr_new( $sslConfig, $pKey );
如果沒有openssl.cnf
這將在第一個功能上失敗。
我嘗試了最低的openssl.cnf
和實際配置,但是沒有效果。 如果我使用錯誤的openssl.cnf
將出現以下錯誤:
error:0E064002:configuration file routines:CONF_load:system lib
請為您提供正確的最低openssl.cnf
或我需要解決的幫助嗎?
解決了,我需要為OpenSSL函數指定$ keyConfig:
$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 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.