← All changes
|
includes/sdk/google/google/auth/src/ServiceAccountSignerTrait.php
+7
-7
1.2.9
→
1.4.1
View file →
| @@ -14,12 +14,12 @@ | ||
| 14 | 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | 15 | * See the License for the specific language governing permissions and |
| 16 | 16 | * limitations under the License. |
| 17 | 17 | */ |
| 18 | -namespace Dudlewebs\WPMCS\Google\Auth; | |
| 18 | +namespace Dudlewebs\WPMCS\GCP\Google\Auth; | |
| 19 | 19 | |
| 20 | -use Dudlewebs\WPMCS\phpseclib3\Crypt\PublicKeyLoader; | |
| 21 | -use Dudlewebs\WPMCS\phpseclib3\Crypt\RSA; | |
| 20 | +use Dudlewebs\WPMCS\GCP\phpseclib3\Crypt\PublicKeyLoader; | |
| 21 | +use Dudlewebs\WPMCS\GCP\phpseclib3\Crypt\RSA; | |
| 22 | 22 | /** |
| 23 | 23 | * Sign a string using a Service Account private key. |
| 24 | 24 | */ |
| 25 | 25 | trait ServiceAccountSignerTrait |
| @@ -35,18 +35,18 @@ | ||
| 35 | 35 | public function signBlob($stringToSign, $forceOpenssl = \false) |
| 36 | 36 | { |
| 37 | 37 | $privateKey = $this->auth->getSigningKey(); |
| 38 | 38 | $signedString = ''; |
| 39 | - if (class_exists(phpseclib3\Crypt\RSA::class) && !$forceOpenssl) { | |
| 39 | + if (\class_exists(phpseclib3\Crypt\RSA::class) && !$forceOpenssl) { | |
| 40 | 40 | $key = PublicKeyLoader::load($privateKey); |
| 41 | 41 | $rsa = $key->withHash('sha256')->withPadding(RSA::SIGNATURE_PKCS1); |
| 42 | 42 | $signedString = $rsa->sign($stringToSign); |
| 43 | - } elseif (extension_loaded('openssl')) { | |
| 44 | - openssl_sign($stringToSign, $signedString, $privateKey, 'sha256WithRSAEncryption'); | |
| 43 | + } elseif (\extension_loaded('openssl')) { | |
| 44 | + \openssl_sign($stringToSign, $signedString, $privateKey, 'sha256WithRSAEncryption'); | |
| 45 | 45 | } else { |
| 46 | 46 | // @codeCoverageIgnoreStart |
| 47 | 47 | throw new \RuntimeException('OpenSSL is not installed.'); |
| 48 | 48 | } |
| 49 | 49 | // @codeCoverageIgnoreEnd |
| 50 | - return base64_encode($signedString); | |
| 50 | + return \base64_encode($signedString); | |
| 51 | 51 | } |
| 52 | 52 | } |