I currently have OpenSSL configured in XAMPP on Windows. Following this tutorial, I tried to use the following code:
$privateKey = openssl_pkey_new(array(
'private_key_bits' => 1024,
'private_key_type' => OPENSSL_KEYTYPE_RSA,
));
openssl_pkey_export_to_file($privateKey, 'private.key');
$a_key = openssl_pkey_get_details($privateKey);
file_put_contents('public.key', $a_key['key']);
openssl_free_key($privateKey);
When I open the page I get a "Webpage Not Available" error. I have managed to pinpoint the problem to openssl_pkey_get_details()
because if I remove this the page successfully loads. Additionally, a private.key is generated without a problem in the first part of the code. Any help would be appreciated.
This has been reported at bugs.php.net .
If you replace libeay32.dll and ssleay32.dll in xampp/apache/bin with the same files in xampp/php/ then it works but you CANNOT use SSL.
I have tried this and it works. I am using OpenSSL library in PHP(5.4.7) on XAMPP(1.8.1). However, I had to disable SSL.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.