From:             [EMAIL PROTECTED]
Operating system: Windows 2000 Professional
PHP version:      4.2.3
PHP Bug Type:     OpenSSL related
Bug description:  openssl_pkey_new does not seem to generate a new key

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 bug report at http://bugs.php.net/?id=20705&edit=1
-- 
Try a CVS snapshot:         http://bugs.php.net/fix.php?id=20705&r=trysnapshot
Fixed in CVS:               http://bugs.php.net/fix.php?id=20705&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=20705&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=20705&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=20705&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=20705&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=20705&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=20705&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=20705&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=20705&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=20705&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=20705&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=20705&r=isapi

Reply via email to