php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #33237 openssl_pkey_new() fails
Submitted: 2005-06-03 21:45 UTC Modified: 2005-06-10 09:11 UTC
From: christopher dot s dot ward at navy dot mil Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: Irrelevant OS: Windows 2000
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: christopher dot s dot ward at navy dot mil
New email:
PHP Version: OS:

 

 [2005-06-03 21:45 UTC] christopher dot s dot ward at navy dot mil
Description:
------------
Environment: W2K, IIS V5.0, PHP 5.1.0-dev  (I received identical results for PHP 5.0.3)

Problem:  openssl_pkey_new() fails 

I am running PHP 5.1.0-dev and OpenSSL 0.9.7c. Per the documentation, I have set the OPENSSL_CONF environment variable on my PHP server to point to the OPENSSL.CNF file. I have verified that libeay32.dll resides in the correct directory. I believe I have a "valid" openssl.cnf file, but it still doesn't work....

I have found comments indicating that this command works for others.  Is the installation documentation for opensll complete?

Reproduce code:
---------------
<?php
$privkey = openssl_pkey_new();

while (($e = openssl_error_string()) !== false) 
{ print($e . "<BR>");
}
?>

Expected result:
----------------
I expected $privkey to be a non-zero value.  It isn't.

Actual result:
--------------
error:02001003:system library:fopen:No such process
error:2006D080:BIO routines:BIO_new_file:no such file
error:0E064002:configuration file routines:CONF_load:system lib
error:02001003:system library:fopen:No such process
error:2006D080:BIO routines:BIO_new_file:no such file
error:0E064002:configuration file routines:CONF_load:system lib


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-06-06 17:41 UTC] vrana@php.net
Can you please copy the distributed openssl.cnf to the default location c:\usr\local\ssl\? If it helps, try to copy yours openssl.cnf there. If it still works, try <?php var_dump(getenv(OPENSSL_CONF)); ?> so that we can see where the problem lies.
 [2005-06-06 19:32 UTC] christopher dot s dot ward at navy dot mil
Per your request, I put a copy of the distributed OPENSSL.CNF file in the default location (c:\usr\local\ssl).  No change in results.
I then re-directed the OPENSSL_CONF environment variable to this new location and rebooted the box.  It still fails, but with different error messages:

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

== Output from var_dump(getenv(OPENSSL_CONF)) ==
string(28) "C:\usr\local\ssl\openssl.cnf"
 [2005-06-07 12:16 UTC] vrana@php.net
So it works - "NCONF_get_string:no value" is only some kind of notice.
 [2005-06-08 19:41 UTC] christopher dot s dot ward at navy dot mil
I respectfully disagree.  Shouldn't the openssl_pkey_new() function should return a value?  It doesn't.  When I issue the following code:

$privkey = openssl_pkey_new();
if($privkey)
	print("Private key is a non-zero value.<BR>");
else
	print("Private key is FALSE.<BR>");

I get the following:
Private key is FALSE.
 [2005-06-10 01:03 UTC] christopher dot s dot ward at navy dot mil
It started working.  I don't know why.  I am closing the bug report.
 [2005-06-10 09:11 UTC] vrana@php.net
There was no problem in the docs, so it's Bogus.
 [2012-07-25 08:11 UTC] marc at iacomputing dot co dot uk
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: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:0E06D06C:configuration file routines:NCONF_get_string:no value

I've got the same problem. I'm generating pkey, csr and certs.
 [2013-03-22 14:36 UTC] dirt at awoms dot com
$privateKey = openssl_pkey_new();
var_dump(getenv('OPENSSL_CONF'));
var_dump(getenv('RANDFILE'));
var_dump(getenv('HOME'));
while($message = openssl_error_string()){
	echo $message.'<br />'.PHP_EOL;
}

=====

string 'E:\easyphp\php\php546x130306104831\extras\openssl.cnf' (length=53)
string '.rnd' (length=4)
string 'E:\easyphp\php\php546x130306104831\extras' (length=41)
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

=====

http://stackoverflow.com/questions/15558321/openssl-configuration-on-windows-
with-easyphp
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 18:01:34 2024 UTC