@@ -203,7 +203,7 @@ private static function p256PrivateKey(JWK $jwk): string
203203 if (! is_string ($ d )) {
204204 throw new InvalidArgumentException ('Unable to get the private key ' );
205205 }
206- $ d = unpack ('H* ' , str_pad (Base64UrlSafe::decode ($ d ), 32 , "\0" , STR_PAD_LEFT ));
206+ $ d = unpack ('H* ' , str_pad (Base64UrlSafe::decodeNoPadding ($ d ), 32 , "\0" , STR_PAD_LEFT ));
207207 if (! is_array ($ d ) || ! isset ($ d [1 ])) {
208208 throw new InvalidArgumentException ('Unable to get the private key ' );
209209 }
@@ -229,7 +229,7 @@ private static function p256KPrivateKey(JWK $jwk): string
229229 if (! is_string ($ d )) {
230230 throw new InvalidArgumentException ('Unable to get the private key ' );
231231 }
232- $ d = unpack ('H* ' , str_pad (Base64UrlSafe::decode ($ d ), 32 , "\0" , STR_PAD_LEFT ));
232+ $ d = unpack ('H* ' , str_pad (Base64UrlSafe::decodeNoPadding ($ d ), 32 , "\0" , STR_PAD_LEFT ));
233233 if (! is_array ($ d ) || ! isset ($ d [1 ])) {
234234 throw new InvalidArgumentException ('Unable to get the private key ' );
235235 }
@@ -255,7 +255,7 @@ private static function p384PrivateKey(JWK $jwk): string
255255 if (! is_string ($ d )) {
256256 throw new InvalidArgumentException ('Unable to get the private key ' );
257257 }
258- $ d = unpack ('H* ' , str_pad (Base64UrlSafe::decode ($ d ), 48 , "\0" , STR_PAD_LEFT ));
258+ $ d = unpack ('H* ' , str_pad (Base64UrlSafe::decodeNoPadding ($ d ), 48 , "\0" , STR_PAD_LEFT ));
259259 if (! is_array ($ d ) || ! isset ($ d [1 ])) {
260260 throw new InvalidArgumentException ('Unable to get the private key ' );
261261 }
@@ -281,7 +281,7 @@ private static function p521PrivateKey(JWK $jwk): string
281281 if (! is_string ($ d )) {
282282 throw new InvalidArgumentException ('Unable to get the private key ' );
283283 }
284- $ d = unpack ('H* ' , str_pad (Base64UrlSafe::decode ($ d ), 66 , "\0" , STR_PAD_LEFT ));
284+ $ d = unpack ('H* ' , str_pad (Base64UrlSafe::decodeNoPadding ($ d ), 66 , "\0" , STR_PAD_LEFT ));
285285 if (! is_array ($ d ) || ! isset ($ d [1 ])) {
286286 throw new InvalidArgumentException ('Unable to get the private key ' );
287287 }
@@ -317,8 +317,8 @@ private static function getKey(JWK $jwk): string
317317 if (! is_string ($ y )) {
318318 throw new InvalidArgumentException ('Unable to get the public key ' );
319319 }
320- $ binX = ltrim (Base64UrlSafe::decode ($ x ), "\0" );
321- $ binY = ltrim (Base64UrlSafe::decode ($ y ), "\0" );
320+ $ binX = ltrim (Base64UrlSafe::decodeNoPadding ($ x ), "\0" );
321+ $ binY = ltrim (Base64UrlSafe::decodeNoPadding ($ y ), "\0" );
322322
323323 return "\04"
324324 . str_pad ($ binX , $ length , "\0" , STR_PAD_LEFT )
0 commit comments