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

CryptoHelper::verify method seems wrong #31

Open
mcorteel-harel opened this issue Jun 29, 2021 · 2 comments
Open

CryptoHelper::verify method seems wrong #31

mcorteel-harel opened this issue Jun 29, 2021 · 2 comments

Comments

@mcorteel-harel
Copy link

mcorteel-harel commented Jun 29, 2021

The CryptoHelper::verify() method (here) uses openssl_pkcs7_verify.
But the parameters do not match the documentation at all:

  • The first parameter is a MimePart or a content string when it should be a filename
  • The third parameter is an output file when it should be null
  • The fourth parameter is an array of strings (which actually only contains a single certificate as a string, which comes from PartnerInterface::getCertificate()) when according to this, it should contain an array of filenames.

Am I missing something here?

@mackieee
Copy link

mackieee commented Jun 29, 2021

The first paramater supplied to openssl_pkcs7_verify is a temporary filename, on the basis that $data is checked to be an instance of MimePart at the beginning of the method

From what i can gather though for the other paramaters - these have changed since the PHP 7 upgrade:

PHP 5 Docs on openssl-pkcs7-verify:
https://php-legacy-docs.zend.com/manual/php4/en/function.openssl-pkcs7-verify

The arguments linked above I think matches the input on the verify method.

@mcorteel-harel
Copy link
Author

mcorteel-harel commented Jun 29, 2021

Well the parameters look backward-compatible (at least in this case), but the $cainfo (or $ca_info) parameter still requires an array of locations, not an array of certificate strings according to the doc...
Maybe it works and it's just not mentioned in the doc.

About the first parameter you are right though, it's just that the this docblock is wrong, because providing a string would skip over the getTempFilename part and provide the content as-is to the openssl_pkcs7_verify function (which again might work but is not documented that way).

I'm having an issue with this method in my use case (upon reception of a signed message) and I'm looking for the source of the problem.

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

No branches or pull requests

2 participants