Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

openssl_sign() - $private_key in signature shows array but no array in params description #3829

Open
piotrekkr opened this issue Oct 4, 2024 · 4 comments
Labels
bug Documentation contains incorrect information

Comments

@piotrekkr
Copy link

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

@piotrekkr
Copy link
Author

piotrekkr commented Oct 4, 2024

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.

@cmb69
Copy link
Member

cmb69 commented Oct 4, 2024

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.

@piotrekkr
Copy link
Author

@cmb69 I've reported his to php-src because I honestly don't know if stub is correct or not. We will see.

@piotrekkr
Copy link
Author

@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 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Documentation contains incorrect information
Projects
None yet
Development

No branches or pull requests

2 participants