Skip to content

Commit 94ceabc

Browse files
committed
Align with the specification
1 parent 545130b commit 94ceabc

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

phpstan.neon

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ parameters:
1919
- '#Parameter \#1 \$value of static method Jose\\Component\\Core\\Util\\BigInteger::createFromGMPResource\(\) expects GMP, resource given\.#'
2020
- '#Return type \(void\) of method Jose\\Bundle\\JoseFramework\\Routing\\JWKSetLoader::getResolver\(\) should be compatible with return type \(Symfony\\Component\\Config\\Loader\\LoaderResolverInterface\) of method Symfony\\Component\\Config\\Loader\\LoaderInterface::getResolver\(\)#'
2121
- '#Instanceof between Jose\\Component\\Core\\JWK and Jose\\Component\\Core\\JWK will always evaluate to true\.#'
22-
- '#Function openssl_pkey_derive not found\.#'
2322
includes:
2423
- vendor/phpstan/phpstan-phpunit/extension.neon
2524
- vendor/phpstan/phpstan-phpunit/rules.neon

src/Component/Core/Util/ECKey.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public static function convertPublicKeyToPEM(JWK $jwk): string
3939
$der = self::p256PublicKey();
4040

4141
break;
42-
case 'P-256K':
42+
case 'secp256k1':
4343
$der = self::p256KPublicKey();
4444

4545
break;
@@ -69,7 +69,7 @@ public static function convertPrivateKeyToPEM(JWK $jwk): string
6969
$der = self::p256PrivateKey($jwk);
7070

7171
break;
72-
case 'P-256K':
72+
case 'secp256k1':
7373
$der = self::p256KPrivateKey($jwk);
7474

7575
break;
@@ -110,7 +110,7 @@ private static function getNistCurveSize(string $curve): int
110110
{
111111
switch ($curve) {
112112
case 'P-256':
113-
case 'P-256K':
113+
case 'secp256k1':
114114
return 256;
115115
case 'P-384':
116116
return 384;
@@ -155,8 +155,8 @@ private static function getOpensslCurveName(string $curve): string
155155
switch ($curve) {
156156
case 'P-256':
157157
return 'prime256v1';
158-
case 'P-256K':
159-
return 'prime256k1';
158+
case 'secp256k1':
159+
return 'secp256k1';
160160
case 'P-384':
161161
return 'secp384r1';
162162
case 'P-521':
@@ -245,7 +245,7 @@ private static function p256PrivateKey(JWK $jwk): string
245245
);
246246
}
247247

248-
private static function p256kPrivateKey(JWK $jwk): string
248+
private static function p256KPrivateKey(JWK $jwk): string
249249
{
250250
$d = unpack('H*', str_pad(Base64Url::decode($jwk->get('d')), 32, "\0", STR_PAD_LEFT))[1];
251251

src/SignatureAlgorithm/Experimental/Tests/P256KSignatureTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ private function getKey(): JWK
6060
{
6161
return new JWK([
6262
'kty' => 'EC',
63-
'crv' => 'P-256K',
63+
'crv' => 'secp256k1',
6464
'd' => Base64Url::encode(hex2bin('D1592A94BBB9B5D94CDC425FC7DA80B6A47863AE973A9D581FD9D8F29690B659')),
6565
'x' => Base64Url::encode(hex2bin('4B4DF318DE05BB8F3A115BF337F9BCBC55CA14B917B46BCB557D3C9A158D4BE0')),
6666
'y' => Base64Url::encode(hex2bin('627EB75731A8BBEBC7D9A3C57EC4D7DA2CBA6D2A28E7F45134921861FE1CF5D9')),

0 commit comments

Comments
 (0)