Doc #65176 [Ver->Csd]: openssl_pkey_new / openssl_pkey_get_public
Edit report at https://bugs.php.net/bug.php?id=65176&edit=1
ID: 65176
Updated by: cmb@php.net
Reported by: lynch@php.net
Summary: openssl_pkey_new / openssl_pkey_get_public
-Status: Verified
+Status: Closed
Type: Documentation Problem
Package: OpenSSL related
Operating System: N/A
PHP Version: Irrelevant
Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of cmbecker69@gmx.de
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=b316a70fec35440b51c158395ecc5ac3a6e0f538
Log: Fix #65176: openssl_pkey_new / openssl_pkey_get_public
Previous Comments:
------------------------------------------------------------------------
[2021-01-13 12:47:37] cmb@php.net
The handling of bug #25614 was really suboptimal. Despite the
last few comments, the documentation is still in error (see the
first comment from wez).
------------------------------------------------------------------------
[2013-07-01 14:52:49] lynch@php.net
Description:
------------
---
From manual page: http://www.php.net/function.openssl-pkey-new#refsect1-function.openssl-pkey-new-description
---
The resulting resource cannot be used with openssl_pkey_get_public as stated.
At least not always.
Maybe that statement is only valid for some inputs for the config?
If so, clarification is needed, preferably identifying the sorts of keys where the statement is
applicable.
See also: 25614 from 2009...
Test script:
---------------
$key_pair = openssl_pkey_new(array('digest_alg'=>'sha1',
'private_key_bits'=>1024, 'private_key_type'=>OPENSSL_KEYTYPE_RSA));
var_dump($key_pair);
$public = openssl_pkey_get_public($key_pair);
var_dump($public);
Expected result:
----------------
resource (4) of type (OpenSSL key)
Actual result:
--------------
PHP Warning: openssl_pkey_get_public(): Don't know how to get public key from this private key
in /var/www/vhost.d/zackstrade.dev/ib/keys/key_setup.php on line 8
PHP Stack trace:
PHP 1. {main}() /var/www/vhost.d/zackstrade.dev/ib/keys/key_setup.php:0
PHP 2. openssl_pkey_get_public() /var/www/vhost.d/zackstrade.dev/ib/keys/key_setup.php:8
Warning: openssl_pkey_get_public(): Don't know how to get public key from this private key in
/var/www/vhost.d/zackstrade.dev/ib/keys/key_setup.php on line 8
Call Stack:
0.0005 222672 1. {main}() /var/www/vhost.d/zackstrade.dev/ib/keys/key_setup.php:0
0.0466 223696 2. openssl_pkey_get_public()
/var/www/vhost.d/zackstrade.dev/ib/keys/key_setup.php:8
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=65176&edit=1
Thread (3 messages)