php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #69855 openssl_pkcs12_read() doesn't read a file
Submitted: 2015-06-16 21:18 UTC Modified: 2015-09-09 23:14 UTC
From: aaron dot cicali at gmail dot com Assigned: philip (profile)
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: aaron dot cicali at gmail dot com
New email:
PHP Version: OS:

 

 [2015-06-16 21:18 UTC] 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!


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-09-09 23:13 UTC] 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-09-09 23:14 UTC] philip@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: philip
 [2015-09-09 23:14 UTC] philip@php.net
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!
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 21:01:27 2024 UTC