Skip to content

Commit

Permalink
feat: Support phpseclib3
Browse files Browse the repository at this point in the history
  • Loading branch information
kylekatarnls committed Dec 21, 2020
1 parent 81696e6 commit d988f8f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
12 changes: 12 additions & 0 deletions src/AccessToken/Verify.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}
Expand All @@ -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';
}
Expand All @@ -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';
}
Expand Down
4 changes: 4 additions & 0 deletions tests/Google/AccessToken/VerifyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}
Expand Down

0 comments on commit d988f8f

Please sign in to comment.