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

From: Date: Thu, 28 Nov 2002 20:27:08 +0000
Subject: #20705 [Opn]: 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-26115@lists.php.net to get a copy of this message
ID: 20705 User updated by: Troublegum@woltlab.de -Reported By: Troubleum@woltlab.de +Reported By: Troublegum@woltlab.de Status: Open Bug Type: OpenSSL related Operating System: Windows 2000 Professional PHP Version: 4.2.3 New Comment: wrong email address entered.. correct one: troublegum@woltlab.de Previous Comments: ------------------------------------------------------------------------ [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 (#26115) next »