@@ -203,7 +203,7 @@ private static function p256PrivateKey(JWK $jwk): string
203
203
if (! is_string ($ d )) {
204
204
throw new InvalidArgumentException ('Unable to get the private key ' );
205
205
}
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 ));
207
207
if (! is_array ($ d ) || ! isset ($ d [1 ])) {
208
208
throw new InvalidArgumentException ('Unable to get the private key ' );
209
209
}
@@ -229,7 +229,7 @@ private static function p256KPrivateKey(JWK $jwk): string
229
229
if (! is_string ($ d )) {
230
230
throw new InvalidArgumentException ('Unable to get the private key ' );
231
231
}
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 ));
233
233
if (! is_array ($ d ) || ! isset ($ d [1 ])) {
234
234
throw new InvalidArgumentException ('Unable to get the private key ' );
235
235
}
@@ -255,7 +255,7 @@ private static function p384PrivateKey(JWK $jwk): string
255
255
if (! is_string ($ d )) {
256
256
throw new InvalidArgumentException ('Unable to get the private key ' );
257
257
}
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 ));
259
259
if (! is_array ($ d ) || ! isset ($ d [1 ])) {
260
260
throw new InvalidArgumentException ('Unable to get the private key ' );
261
261
}
@@ -281,7 +281,7 @@ private static function p521PrivateKey(JWK $jwk): string
281
281
if (! is_string ($ d )) {
282
282
throw new InvalidArgumentException ('Unable to get the private key ' );
283
283
}
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 ));
285
285
if (! is_array ($ d ) || ! isset ($ d [1 ])) {
286
286
throw new InvalidArgumentException ('Unable to get the private key ' );
287
287
}
@@ -317,8 +317,8 @@ private static function getKey(JWK $jwk): string
317
317
if (! is_string ($ y )) {
318
318
throw new InvalidArgumentException ('Unable to get the public key ' );
319
319
}
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" );
322
322
323
323
return "\04"
324
324
. str_pad ($ binX , $ length , "\0" , STR_PAD_LEFT )
0 commit comments