File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -174,7 +174,7 @@ public static function parseKey(array $jwk, string $defaultAlg = null): ?Key
174
174
throw new UnexpectedValueException ('x not set ' );
175
175
}
176
176
177
- $ publicKey = JWT ::urlsafeToStandardB64 ($ jwk ['x ' ]);
177
+ $ publicKey = JWT ::convertBase64urlToBase64 ($ jwk ['x ' ]);
178
178
$ alg = self ::OKP_CURVES [$ jwk ['crv ' ]];
179
179
return new Key ($ publicKey , $ alg );
180
180
default :
Original file line number Diff line number Diff line change @@ -400,18 +400,20 @@ public static function jsonEncode(array $input): string
400
400
*/
401
401
public static function urlsafeB64Decode (string $ input ): string
402
402
{
403
- return \base64_decode (self ::urlsafeToStandardB64 ($ input ));
403
+ return \base64_decode (self ::convertBase64urlToBase64 ($ input ));
404
404
}
405
405
406
406
/**
407
- * Convert a string from URL-safe Base64 to standard Base64 .
407
+ * Convert a string in the base64url ( URL-safe Base64) encoding to standard base64 .
408
408
*
409
409
* @param string $input A Base64 encoded string with URL-safe characters (-_ and no padding)
410
410
*
411
411
* @return string A Base64 encoded string with standard characters (+/) and padding (=), when
412
412
* needed.
413
+ *
414
+ * @see https://www.rfc-editor.org/rfc/rfc4648
413
415
*/
414
- public static function urlsafeToStandardB64 (string $ input ): string
416
+ public static function convertBase64urlToBase64 (string $ input ): string
415
417
{
416
418
$ remainder = \strlen ($ input ) % 4 ;
417
419
if ($ remainder ) {
You can’t perform that action at this time.
0 commit comments