Doc #80715 [Opn]: Incorrect documentation for certificate and private_key in openssl_cms_sign()
| From: | cmb@php.net | Date: | Fri, 05 Feb 2021 23:07:23 +0000 |
| Subject: | Doc #80715 [Opn]: Incorrect documentation for certificate and private_key in openssl_cms_sign() | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-18511@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=80715&edit=1
ID: 80715
Updated by: cmb@php.net
Reported by: nyuszika7h at gmail dot com
Summary: Incorrect documentation for certificate and
private_key in openssl_cms_sign()
Status: Open
Type: Documentation Problem
Package: OpenSSL related
Operating System: Debian 10
PHP Version: 8.0.2
Block user comment: N
Private report: N
New Comment:
That part of the documentation has been copied almost verbatim
from the respective RFC[1]. Is the RFC in error, or has that been
changed after the RFC had been accepted? Anyhow, a PR[2] fixing
this would be welcome.
[1] <https://wiki.php.net/rfc/add-cms-support>
[2] <https://github.com/php/doc-en/pulls>
Previous Comments:
------------------------------------------------------------------------
[2021-02-05 22:22:52] nyuszika7h at gmail dot com
Description:
------------
---
From manual page: https://php.net/function.openssl-cms-sign
---
The documentation states the following:
> certificate
> The name of the file containing the signing certificate.
>
> private_key
> The name of file containing the key associated with certificate.
This is incorrect and results in "PHP message: PHP Warning: openssl_cms_sign(): Error getting
private key in file.php". It actually has to be formatted per <https://www.php.net/manual/en/openssl.certparams.php>,
so for example
file://cert.pem.
Test script:
---------------
// Incorrect code (following documentation)
openssl_cms_sign('input.txt', 'output.txt', 'cert.pem',
'privkey.pem', null, OPENSSL_CMS_BINARY, OPENSSL_ENCODING_DER, 'chain.pem');
// Correct code
openssl_cms_sign('input.txt', 'output.txt', 'file://cert.pem',
'file://privkey.pem', null, OPENSSL_CMS_BINARY, OPENSSL_ENCODING_DER,
'chain.pem');
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=80715&edit=1