|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2019-08-22 14:45 UTC] jmaguire at duo dot com
[2019-08-22 16:20 UTC] jmaguire at duo dot com
[2019-08-22 17:15 UTC] jmaguire at duo dot com
[2019-10-20 16:54 UTC] bukka@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 05:00:01 2025 UTC |
Description: ------------ If a .rnd file does not exist in the user's directory, openssl_pkey_new will generate an error: error:2406F079:random number generator:RAND_load_file:Cannot open file The .rnd file will be created, and the operation appears to work, but this causes issues when trying to detect errors in the OpenSSL pkey creation. Subsequent calls to openssl_pkey_new succeed, as the .rnd file is created successfully. It seems that running, e.g. `openssl genrsa -des3 -out private.pem 2048` at the command line does not create or need this .rnd file anymore. Test script: --------------- <?php unlink(getenv('HOME') . '/.rnd'); openssl_pkey_new(); while ($err = openssl_error_string()) { echo $err . PHP_EOL; } Expected result: ---------------- error:0E06D06C:configuration file routines:NCONF_get_string:no value error:0E06D06C:configuration file routines:NCONF_get_string:no value error:0E06D06C:configuration file routines:NCONF_get_string:no value error:0E06D06C:configuration file routines:NCONF_get_string:no value error:0E06D06C:configuration file routines:NCONF_get_string:no value error:0E06D06C:configuration file routines:NCONF_get_string:no value error:0E06D06C:configuration file routines:NCONF_get_string:no value Actual result: -------------- error:0E06D06C:configuration file routines:NCONF_get_string:no value error:0E06D06C:configuration file routines:NCONF_get_string:no value error:0E06D06C:configuration file routines:NCONF_get_string:no value error:0E06D06C:configuration file routines:NCONF_get_string:no value error:0E06D06C:configuration file routines:NCONF_get_string:no value error:0E06D06C:configuration file routines:NCONF_get_string:no value error:0E06D06C:configuration file routines:NCONF_get_string:no value error:2406F079:random number generator:RAND_load_file:Cannot open file