【发布时间】:2016-07-16 19:20:30
【问题描述】:
尝试通过简单方式加载我的私钥时出现以下错误。这是我的代码。
public function loadPrivateKey($fileName, $password = null){
if(!is_file($fileName))
throw new SignException('Private key not found', SignException::KEY_NOT_FOUND);
$fileContent = file_get_contents($fileName);
if(!is_null($password))
$this->prvKey = openssl_get_privatekey($fileContent, $password);
else
$this->prvKey = openssl_get_privatekey($fileContent);
if(!empty(openssl_error_string()))
throw new SignException('OpenSSL Error: '.openssl_error_string());
if(!is_resource($this->prvKey))
throw new SignException('Private key is not resourse', SignException::EXTERNAL_ERROR);
}
openssl_error_string() 返回error:2006D002:BIO routines:BIO_new_file:system lib。
我在 php.ini 和 extension=php_openssl.dll 中启用了 OpenSSL。
可能是什么问题?我该如何解决?
谢谢!
【问题讨论】: