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

CAPICOM implementation does not work (fix) #175

Closed
anzz1 opened this issue Feb 15, 2022 · 1 comment
Closed

CAPICOM implementation does not work (fix) #175

anzz1 opened this issue Feb 15, 2022 · 1 comment

Comments

@anzz1
Copy link

anzz1 commented Feb 15, 2022

Problem: method_exists does not work for the COM class.
Tested non-working on Windows 7 x64, PHP5.6.32 (VC11-x86-ts) and PHP 7.3.33 (VC15-x86-nts)

Solution: Use is_callable instead.

      $util = new COM('CAPICOM.Utilities.1');
      $method = array($util, 'GetRandom');
      if (is_callable($method)) { ...

See this gist for implementation example: https://gist.github.com/anzz1/29a787fac8ef6d693b41779911287505

Here is the Microsoft CAPICOM 2.1.0.2 SDK if someone needs it.
While kinda obscure in 2022, it's still an easy way for to add crypto capability for Windows PHP if for some reason you can't upgrade PHP itself.

@paragonie-security
Copy link
Contributor

Thank you for reporting this. The COM approach is definitely the coldest path for random_compat users, but we're happy to fix this.

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