#20705 [Opn]: openssl_pkey_new does not seem to generate a new key

From: Date: Wed, 11 Dec 2002 12:33:11 +0000
Subject: #20705 [Opn]: openssl_pkey_new does not seem to generate a new key
References: 1  Groups: php.doc 
Request: Send a blank email to phpdoc+get-969350267@lists.php.net to get a copy of this message
ID: 20705 Updated by: wez@php.net Reported By: Troublegum@woltlab.de Status: Open Bug Type: Documentation problem Operating System: Windows 2000 Professional PHP Version: 4.2.3 Assigned To: wez New Comment: A little more info: The default path for the openssl.cnf file is determined as follows: OPENSSL_CONF environmental variable, if set, is assumed to hold the path to the file. If it is not set, SSLEAY_CONF environmental variable is checked next. If neither are set, PHP will look in the default certificate area that was set at the time that the SSL DLLs were compiled. This is typically "C:\usr\local\ssl\openssl.cnf". Previous Comments: ------------------------------------------------------------------------ [2002-12-11 06:13:12] wez@php.net It seems that you need to have a valid openssl.cnf file for this to work correctly. You can obtain this file from one of the packages at: http://www.openssl.org/source/ The default path is C:\usr\local\ssl\openssl.cnf, but you can override this path like this: $key = openssl_pkey_new( array("config" => "path/to/openssl.cnf") ); We are currently investigating including a file for this purpose in our win32 binary distributions. Making this a documentation problem (I already added more information, but this has yet to filter through to the online docs). ------------------------------------------------------------------------ [2002-12-11 01:04:41] sniper@php.net Please try using this CVS snapshot: http://snaps.php.net/php4-latest.tar.gz For Windows: http://snaps.php.net/win32/php4-win32-latest.zip ------------------------------------------------------------------------ [2002-12-10 18:31:32] Troublegum@woltlab.de openssl_error_string() returns different messages when I reload the page. I used the following test script: ---------- <?php $privkey = openssl_pkey_new(); if(empty($privkey)) { echo "error: no key was generated by openssl_pkey_new()"; } else { echo "a private key was generated by openssl_pkey_new()"; } echo "<br>Error Message: ".openssl_error_string()."<br>"; exit; ?> -------------------- These are the error messages openssl_error_string() returned: 1. request) error:02001003:system library:fopen:No such process 2. request) error:2006D002:BIO routines:BIO_new_file:system lib 3. request) error:02001003:system library:fopen:No such process Thanks.. ------------------------------------------------------------------------ [2002-12-10 13:30:05] wez@php.net And what error messages does openssl_error_string() return? ------------------------------------------------------------------------ [2002-12-10 11:27:12] Troublegum@woltlab.de Yes, you are right. But even with the correct variable and the latest win32 snapshot (downloaded at 07/12/2002) it did not work for me. The problem is the following: <?php /** generate key */ $privkey = openssl_pkey_new(); if(empty($privkey)) { die("error: no key was generated by openssl_pkey_new()"); } else { echo "a private key was generated by openssl_pkey_new()"; } ?> produces "error: no key was generated by openssl_pkey_new()". ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/20705 -- Edit this bug report at http://bugs.php.net/?id=20705&edit=1

« previous php.doc (#969350267) next »