簡體   English   中英

創建CSR時OpenSSL錯誤0x2006D002

[英]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或我需要解決的幫助嗎?

  • PHP 5.3.28作為Apache mod;
  • phpinfo:已啟用OpenSSL支持
  • OpenSSL庫版本0.9.8y 2013年2月5日
  • PHP已重新安裝並且已經重新啟動。

解決了,我需要為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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM