ID:               20705
 Comment by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
 Status:           Bogus
 Bug Type:         OpenSSL related
 Operating System: Windows 2000 Professional
 PHP Version:      4.2.3
 New Comment:

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()".


Previous Comments:
------------------------------------------------------------------------

[2002-12-10 04:36:57] [EMAIL PROTECTED]

Your test script is wrong:
/** read in key */ 
$loaded_key = openssl_pkey_get_private($key_content, $pass);

$pass is not set to anything; you meant $password, in which case this
works fine.
 

------------------------------------------------------------------------

[2002-12-07 01:17:40] [EMAIL PROTECTED]

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-11-28 14:27:08] [EMAIL PROTECTED]

wrong email address entered..
correct one: [EMAIL PROTECTED]

------------------------------------------------------------------------

[2002-11-28 14:25:05] [EMAIL PROTECTED]

OS: Windows 2000 Professional
PHP version: 4.2.3
Apache version: 1.3.24 Win32
openssl: 0.9.6c

Problem: openssl_pkey_new does not seem to generate a new key

how to reproduces the problem:
I have the following script to test openssl..

--------------------------------------------------
<?php 
/** generate key */
$privkey = openssl_pkey_new(); 

/** export key to file */
$password = "test";
$dest_file = "./key.pem"; 
openssl_pkey_export_to_file($privkey,$dest_file, $password);

/** read in keyfile */
$fp = fopen($dest_file, "r");
$key_content = fread($fp, filesize($dest_file));
fclose($fp);

/** read in key */ 
$loaded_key = openssl_pkey_get_private($key_content, $pass); 

/** check key */ 
if ($loaded_key === false)
{
        die("not correct");
}
else
{
        echo "correct";
}
openssl_pkey_free($loaded_key); 
?>
--------------------------------------------------

The output is the following:
Warning: cannot get key from parameter 1 in
c:\dev\htdocs\openssl\test.php on line 9
not correct

--------------------------------------------------
I first compiled openssl 0.9.6c using Visual C++ and copied
libeay32.dll and ssley32.dll to c:/winnt/system32.
Then I upgraded to php 4.2.3 and replaced the two files with ones in
the folder "dlls".

Openssl seems to be installed:
> OpenSSL support enabled 
> OpenSSL Version OpenSSL 0.9.6c 21 dec 2001

------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=20705&edit=1

Reply via email to