I am getting the following error while trying to load my private key by simple way. This is my code.
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()
returns error:2006D002:BIO routines:BIO_new_file:system lib
.
I enabled OpenSSL in my php.ini
with extension=php_openssl.dll
.
What could be the problem? How do I fix it?
Thank you!