I have found couple of posts with this problem but I have not solved my problem using their solution.
This is my test script:
<?php
echo "\n*** Errors before calling openssl_pkey_new\n";
// no errors
while (($e = openssl_error_string()) !== false) {
var_dump($e);
}
$config = [
'config' => '/etc/ssl/openssl.cnf',
"digest_alg" => "sha1",
"private_key_bits" => 4096,
"private_key_type" => OPENSSL_KEYTYPE_RSA,
];
var_dump(openssl_pkey_new($config));
echo "\n*** Errors after calling openssl_pkey_new\n";
while (($e = openssl_error_string()) !== false) {
echo "<pre>";print_r($e);echo "</pre>";
}
Tried also sha256 and sha512.
cnf file:
ls /etc/ssl/openssl.cnf
-rw-r--r-- 1 root root 10835 Jun 20 2014 /etc/ssl/openssl.cnf
Errors:
error:0E06D06C:configuration file routines:NCONF_get_string:no value</pre><pre>error:0E06D06C:configuration file routines:NCONF_get_string:no value</pre><pre>error:0E06D06C:configuration file routines:NCONF_get_string:no value
I have also tried to set OPENSSL_CONF on the top of script but without success:
putenv('OPENSSL_CONF=/etc/ssl/openssl.cnf');
I have also tried to use custom openssl.cnf but also without any success:
cat /var/www/openssl.cnf
distinguished_name = req_distinguished_name
[req_distinguished_name]
[v3_req]
[v3_ca]
What could be a problem?
Is it safe to ignore this errors and clear them out after using openssl_pkey_new or there is a solution?
Thank you in advance