Doc #69855 [Opn->Csd]: openssl_pkcs12_read() doesn't read a file
| From: | philip@php.net | Date: | Wed, 09 Sep 2015 23:14:24 +0000 |
| Subject: | Doc #69855 [Opn->Csd]: openssl_pkcs12_read() doesn't read a file | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-12745@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=69855&edit=1
ID: 69855
Updated by: philip@php.net
Reported by: aaron dot cicali at gmail dot com
Summary: openssl_pkcs12_read() doesn't read a file
-Status: Open
+Status: Closed
Type: Documentation Problem
Package: Documentation problem
PHP Version: Irrelevant
-Assigned To:
+Assigned To: philip
Block user comment: N
Private report: N
New Comment:
Thank you for the good suggestion, a fix was committed and it will show up online within a few days
or so. A parameter description was added, as was an example. Again, thank you for the bug report!
Previous Comments:
------------------------------------------------------------------------
[2015-09-09 23:13:38] philip@php.net
Automatic comment from SVN on behalf of philip
Revision: http://svn.php.net/viewvc/?view=revision&revision=337797
Log: Added pkcs12 param description and example for PHP Bug #69855
------------------------------------------------------------------------
[2015-06-16 21:18:42] aaron dot cicali at gmail dot com
Description:
------------
Hi,
First time user of openssl_pkcs12_read() here. Having "_read()" in the function name
implied to me that this function actually reads the file, which I believe is consistent with other
PHP functions containing "_read()".
I got caught troubleshooting this function for a white until googling and finding other developers
with the same issue. Indeed, openssl_pkcs12_read() doesn't actually read the file, but must be
provided with the contents of the key file as the first parameter.
I was attempting to use it like this:
openssl_pkcs12_read('/path/to/cert.p12', $certs, 'mypassphrase');
But it actually expected this:
$cert = file_get_contents('/path/to/cert.p12');
openssl_pkcs12_read($cert, $certs, 'mypassphrase');
On the documentation page (http://php.net/manual/en/function.openssl-pkcs12-read.php), the first
parameter is lacking any notes. While it does specify type String, it's not clear that it was
not expecting a string path to the certificate file. It would have saved me some time if this was
explained.
Thanks for reading!
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=69855&edit=1