diff --git a/composer.json b/composer.json index 3f058bbc6..5795eae47 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,7 @@ "google/apiclient-services": "~0.13", "firebase/php-jwt": "~2.0||~3.0||~4.0||~5.0", "monolog/monolog": "^1.17|^2.0", - "phpseclib/phpseclib": "~0.3.10||~2.0", + "phpseclib/phpseclib": "~0.3.10||~2.0||~3.0", "guzzlehttp/guzzle": "~5.3.1||~6.0||~7.0", "guzzlehttp/psr7": "^1.2" }, diff --git a/src/AccessToken/Verify.php b/src/AccessToken/Verify.php index 96fabdefd..fadb417ef 100644 --- a/src/AccessToken/Verify.php +++ b/src/AccessToken/Verify.php @@ -231,6 +231,10 @@ private function getJwtService() private function getRsaClass() { + if (class_exists('phpseclib3\Crypt\RSA')) { + return 'phpseclib3\Crypt\RSA'; + } + if (class_exists('phpseclib\Crypt\RSA')) { return 'phpseclib\Crypt\RSA'; } @@ -240,6 +244,10 @@ private function getRsaClass() private function getBigIntClass() { + if (class_exists('phpseclib3\Math\BigInteger')) { + return 'phpseclib3\Math\BigInteger'; + } + if (class_exists('phpseclib\Math\BigInteger')) { return 'phpseclib\Math\BigInteger'; } @@ -249,6 +257,10 @@ private function getBigIntClass() private function getOpenSslConstant() { + if (class_exists('phpseclib3\Crypt\Common\SymmetricKey')) { + return 'hpseclib3\Crypt\Common\SymmetricKey::ENGINE_OPENSSL'; + } + if (class_exists('phpseclib\Crypt\RSA')) { return 'phpseclib\Crypt\RSA::MODE_OPENSSL'; } diff --git a/tests/Google/AccessToken/VerifyTest.php b/tests/Google/AccessToken/VerifyTest.php index bce9501b4..1ffb0e1e1 100644 --- a/tests/Google/AccessToken/VerifyTest.php +++ b/tests/Google/AccessToken/VerifyTest.php @@ -139,6 +139,10 @@ private function getJwtService() private function getOpenSslConstant() { + if (class_exists('phpseclib3\Crypt\RSA')) { + return 'phpseclib3\Crypt\RSA::MODE_OPENSSL'; + } + if (class_exists('phpseclib\Crypt\RSA')) { return 'phpseclib\Crypt\RSA::MODE_OPENSSL'; }