openssl_sign() - $private_key in signature shows array but no array in params description
From manual page: https://php.net/function.openssl-sign
openssl_sign(
string $data,
string &$signature,
#[\SensitiveParameter] OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $private_key,
string|int $algorithm = OPENSSL_ALGO_SHA1
): bool
but in description there is only
private_key
OpenSSLAsymmetricKey - a key, returned by openssl_get_privatekey()
string - a PEM formatted key
Checked history of doc file for this function and even 10 years ago it did not allow array. It was just resource or string before php 8.0.
The documentation of the $private_key parameter certainly needs to be improved. I consider the current state a bug.
Note that the signatures are now declared in stub files. If they do not match the implementation, that should be reported at https://github.com/php/php-src/issues.
@cmb69 I've reported his to php-src because I honestly don't know if stub is correct or not. We will see.
@cmb69 And I've got the answer. Array is correct and should be like
array(0 => key, 1 => phrase)
where key can be multiple things but this need to be tested. Do you have someone who can test it if this is working as mentioned here ?