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

From: Date: Sat, 07 Dec 2002 07:17:40 +0000
Subject: #20705 [Opn->Fbk]: openssl_pkey_new does not seem to generate a new key
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-26937@lists.php.net to get a copy of this message
ID: 20705 Updated by: iliaa@php.net Reported By: Troublegum@woltlab.de -Status: Open +Status: Feedback Bug Type: OpenSSL related Operating System: Windows 2000 Professional PHP Version: 4.2.3 New Comment: 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 Previous Comments: ------------------------------------------------------------------------ [2002-11-28 14:27:08] Troublegum@woltlab.de wrong email address entered.. correct one: troublegum@woltlab.de ------------------------------------------------------------------------ [2002-11-28 14:25:05] Troublegum@woltlab.de 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

« previous php.bugs (#26937) next »