OpenMage / magento-lts

Official OpenMage LTS codebase | Migrate easily from Magento Community Edition in minutes! Download the source code for free or contribute to OpenMage LTS | Security vulnerability patches, bug fixes, performance improvements and more.
https://www.openmage.org
Open Software License 3.0
870 stars 436 forks source link

Creativestyle AmazonCheckout: System Requirements: Unsupported version of phpseclib installed. #3652

Open tim-breitenstein-it opened 1 year ago

tim-breitenstein-it commented 1 year ago

Preconditions (*)

  1. Official Amazon Pay für OpenMage
  2. Download Amazon Pay (Checkout v2) for OpenMage

Steps to reproduce (*)

  1. Download and Install the Amazon Pay (Checkout v2) for OpenMage Extension

Expected result (*)

  1. No system requirement error

Actual result (*)

  1. image

(possible) Solution

  1. composer require phpseclib/phpseclib2_compat:~1.0
  2. Because phpseclib/mcrypt_compat is installed as well phpseclib/phpseclib2_compat would also be helpful

Amazon Pay (Checkout v2) for OpenMage Extension Check for phpseclib:

        try {
            if (class_exists('Crypt_RSA', false)) {
                $rsa = new Crypt_RSA();
            } elseif (class_exists('\phpseclib\Crypt\RSA', true)) {
                $rsa = new \phpseclib\Crypt\RSA();
            } else {
                return false;
            }

            $rsa->setHash(AmazonPayV2_Client::HASH_ALGORITHM);
            $rsa->setMGFHash(AmazonPayV2_Client::HASH_ALGORITHM);
            $rsa->setSaltLength(20);

            $rsa->loadKey($this->_getDummyPrivateKey());

            if (empty($rsa->modulus) || empty($rsa->exponent)) {
                return false;
            }

        } catch (Exception $e) {
            return false;
        }

        return true;

phpseclib:v3 need phpseclib3 instead of phpseclib and has some significant code changes as well.

In this Commit https://github.com/OpenMage/magento-lts/commit/a3a54fda4e06843ee3b87740a235ce6ecc5cd406#diff-d2ab9925cad7eac58e0ff4cc0d251a937ecf49e4b6bf57f8b95aab76648a9d34 the phpseclib library was moved to composer package installation with v3.

fballiano commented 1 year ago

could you install phpseclib2_compat in your project?

tim-breitenstein-it commented 1 year ago

could you install phpseclib2_compat in your project?

Sure!

This does not resolve the system requirement error because of this part of the check:

            if (empty($rsa->modulus) || empty($rsa->exponent)) {
                return false;
            }

The phpseclib2_compat does not have the variables.

But the rest of the checkout process might work.

fballiano commented 1 year ago

with a composer patch I think you should be able to patch the module quickly if that's the only part of code that breaks

fballiano commented 9 months ago

@tim-breitenstein-it did you manage to solve this in some way?

tim-breitenstein-it commented 9 months ago

Unfortunately not yet.

But at the end of the month or the beginning of next month I have to deal with it, because a server upgrade is scheduled.