From:
Operating system: Windows Server 2008 R2
PHP version: 5.4.3
Package: OpenSSL related
Bug Type: Bug
Bug description:Warnings from OpenSSL functions
Description:
------------
When I run the test script I've pasted in the "test script" section of this
bug
report, I get the warnings shown under "actual result" of this bug report.
I'm running this code on Windows Servef 2008 R2. I have tried running this
exact
same code under both PHP 5.4.3 and PHP 5.3.13.
(However, the code works just fine on Mac OS X 10.7.4, using PHP version
5.3.10.)
Test script:
---------------
<?php
$privateKey = openssl_pkey_new(array(
'private_key_bits' => 1024,
'private_key_type' => OPENSSL_KEYTYPE_RSA,
));
openssl_pkey_export_to_file($privateKey, 'private_key', "somepassword");
$keyDetails = openssl_pkey_get_details($privateKey);
file_put_contents('public_key', $keyDetails['key']);
?>
Expected result:
----------------
I expect two files to get output, one with a private key and another with a
public key. In fact, this is exactly what happens on Mac OS X (as described
in
the "description" section of this bug report). On Windows, it's for some
reasons
not working, as described in the "actual result" section of this bug
report.
Actual result:
--------------
When I run the script on the command prompt (using "cd <path to script>"
and "
<path to php>\php.exe <path to script>\script.php"), I get the following
output:
PHP Warning: openssl_pkey_export_to_file(): cannot get key from parameter
1 in
C:\Users\Administrator\Documents\script.php on line 8
PHP Warning: openssl_pkey_get_details() expects parameter 1 to be
resource,
boolean given in C:\Users\Administrator\Documents\script.php on line 11
What ends up happening is that only one EMPTY file 'public_key' gets
created.
--
Edit bug report at https://bugs.php.net/bug.php?id=62014&edit=1
--
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=62014&r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=62014&r=trysnapshot53
Try a snapshot (trunk):
https://bugs.php.net/fix.php?id=62014&r=trysnapshottrunk
Fixed in SVN:
https://bugs.php.net/fix.php?id=62014&r=fixed
Fixed in SVN and need be documented:
https://bugs.php.net/fix.php?id=62014&r=needdocs
Fixed in release:
https://bugs.php.net/fix.php?id=62014&r=alreadyfixed
Need backtrace:
https://bugs.php.net/fix.php?id=62014&r=needtrace
Need Reproduce Script:
https://bugs.php.net/fix.php?id=62014&r=needscript
Try newer version:
https://bugs.php.net/fix.php?id=62014&r=oldversion
Not developer issue:
https://bugs.php.net/fix.php?id=62014&r=support
Expected behavior:
https://bugs.php.net/fix.php?id=62014&r=notwrong
Not enough info:
https://bugs.php.net/fix.php?id=62014&r=notenoughinfo
Submitted twice:
https://bugs.php.net/fix.php?id=62014&r=submittedtwice
register_globals:
https://bugs.php.net/fix.php?id=62014&r=globals
PHP 4 support discontinued:
https://bugs.php.net/fix.php?id=62014&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=62014&r=dst
IIS Stability:
https://bugs.php.net/fix.php?id=62014&r=isapi
Install GNU Sed:
https://bugs.php.net/fix.php?id=62014&r=gnused
Floating point limitations:
https://bugs.php.net/fix.php?id=62014&r=float
No Zend Extensions:
https://bugs.php.net/fix.php?id=62014&r=nozend
MySQL Configuration Error:
https://bugs.php.net/fix.php?id=62014&r=mysqlcfg