Doc #69855 [NEW]: openssl_pkcs12_read() doesn't read a file
| From: | aaron dot cicali at gmail dot com | Date: | Tue, 16 Jun 2015 21:18:43 +0000 |
| Subject: | Doc #69855 [NEW]: openssl_pkcs12_read() doesn't read a file | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-12443@lists.php.net to get a copy of this message | ||
From: aaron dot cicali at gmail dot com
Operating system:
PHP version: Irrelevant
Package: Documentation problem
Bug Type: Documentation Problem
Bug description:openssl_pkcs12_read() doesn't read a file
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 bug report at https://bugs.php.net/bug.php?id=69855&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=69855&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=69855&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=69855&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=69855&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=69855&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=69855&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=69855&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=69855&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=69855&r=support
Expected behavior: https://bugs.php.net/fix.php?id=69855&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=69855&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=69855&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=69855&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=69855&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=69855&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=69855&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=69855&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=69855&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=69855&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=69855&r=mysqlcfg