Edit report at https://bugs.php.net/bug.php?id=80715&edit=1
ID: 80715
Updated by: [email protected]
Reported by: nyuszika7h at gmail dot com
Summary: Incorrect documentation for certificate and
private_key in openssl_cms_sign()
-Status: Open
+Status: Closed
Type: Documentation Problem
Package: OpenSSL related
Operating System: Debian 10
PHP Version: 8.0.2
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of saundefined (author) and web-flow (committer)
Revision: https://github.com/php/doc-en/commit/377518d34bea7620a75116b27d431eb2dfbb7fc6
Log: Fix `openssl_cms_sign` parameters description (#1040)
Previous Comments:
------------------------------------------------------------------------
[2021-02-05 23:07:23] [email protected]
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>
------------------------------------------------------------------------
[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
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.