diff --git a/Makefile b/Makefile index a7263526..cb9d4d82 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ mu: vendor ## Mutation tests - vendor/bin/infection -s --threads=$(nproc) --min-msi=40 --min-covered-msi=40 + vendor/bin/infection -s --threads=$$(nproc) --min-msi=40 --min-covered-msi=40 tests: vendor ## Run all tests vendor/bin/phpunit --color @@ -8,7 +8,7 @@ cc: vendor ## Show test coverage rates (HTML) vendor/bin/phpunit --coverage-html ./build cs: vendor ## Fix all files using defined ECS rules - vendor/bin/ecs check --fix + XDEBUG_MODE=off vendor/bin/ecs check --fix tu: vendor ## Run only unit tests vendor/bin/phpunit --color --group Unit @@ -20,19 +20,19 @@ tf: vendor ## Run only functional tests vendor/bin/phpunit --color --group Functional st: vendor ## Run static analyse - vendor/bin/phpstan analyse + XDEBUG_MODE=off vendor/bin/phpstan analyse ################################################ ci-mu: vendor ## Mutation tests (for Github only) - vendor/bin/infection --logger-github -s --threads=$(nproc) --min-msi=40 --min-covered-msi=40 + vendor/bin/infection --logger-github -s --threads=$$(nproc) --min-msi=40 --min-covered-msi=40 ci-cc: vendor ## Show test coverage rates (console) vendor/bin/phpunit --coverage-text ci-cs: vendor ## Check all files using defined ECS rules - vendor/bin/ecs check + XDEBUG_MODE=off vendor/bin/ecs check ################################################ @@ -42,7 +42,7 @@ vendor: composer.json composer.lock composer install rector: vendor ## Check all files using Rector - vendor/bin/rector process --ansi --dry-run --xdebug + XDEBUG_MODE=off vendor/bin/rector process --ansi --dry-run --xdebug .DEFAULT_GOAL := help help: diff --git a/composer.json b/composer.json index 42d01391..c23128b2 100644 --- a/composer.json +++ b/composer.json @@ -83,14 +83,13 @@ "php-http/mock-client": "^1.5", "php-parallel-lint/php-parallel-lint": "^1.3", "phpbench/phpbench": "^1.2", - "phpstan/extension-installer": "^1.1", "phpstan/phpstan": "^1.8", "phpstan/phpstan-deprecation-rules": "^1.0", "phpstan/phpstan-phpunit": "^1.1", "phpstan/phpstan-strict-rules": "^1.4", "phpunit/phpunit": "^9.5.23", "qossmic/deptrac-shim": "^1.0", - "rector/rector": "^0.14", + "rector/rector": "^0.15", "roave/security-advisories": "dev-latest", "symfony/browser-kit": "^6.1.3", "symfony/finder": "^5.4|^6.0", @@ -145,7 +144,6 @@ "config": { "sort-packages": true, "allow-plugins": { - "phpstan/extension-installer": true, "infection/extension-installer": true, "composer/package-versions-deprecated": true } diff --git a/rector.php b/rector.php index 601130d7..848daf15 100644 --- a/rector.php +++ b/rector.php @@ -5,7 +5,6 @@ use Rector\Config\RectorConfig; use Rector\Core\ValueObject\PhpVersion; use Rector\Doctrine\Set\DoctrineSetList; -use Rector\Php74\Rector\Property\TypedPropertyRector; use Rector\PHPUnit\Set\PHPUnitLevelSetList; use Rector\PHPUnit\Set\PHPUnitSetList; use Rector\Set\ValueObject\LevelSetList; @@ -20,7 +19,6 @@ SymfonyLevelSetList::UP_TO_SYMFONY_54, SymfonySetList::SYMFONY_CODE_QUALITY, SymfonySetList::SYMFONY_CONSTRUCTOR_INJECTION, - SymfonySetList::SYMFONY_STRICT, DoctrineSetList::DOCTRINE_CODE_QUALITY, DoctrineSetList::ANNOTATIONS_TO_ATTRIBUTES, PHPUnitSetList::PHPUNIT_SPECIFIC_METHOD, @@ -33,6 +31,8 @@ $config->parallel(); $config->paths([__DIR__ . '/src', __DIR__ . '/performance', __DIR__ . '/tests']); $config->skip([ + \Rector\Php80\Rector\Class_\AnnotationToAttributeRector::class => __DIR__ . '/tests', + \Rector\PHPUnit\Rector\Class_\AnnotationWithValueToAttributeRector::class => __DIR__ . '/tests', __DIR__ . '/src/Component/Core/JWKSet.php', __DIR__ . '/src/Bundle/JoseFramework/DependencyInjection/Source/KeyManagement/JWKSource.php', __DIR__ . '/src/Bundle/JoseFramework/DependencyInjection/Source/KeyManagement/JWKSetSource.php', @@ -40,7 +40,4 @@ $config->phpVersion(PhpVersion::PHP_81); $config->importNames(); $config->importShortClasses(); - - $services = $config->services(); - $services->set(TypedPropertyRector::class); }; diff --git a/src/Component/Core/Util/RSAKey.php b/src/Component/Core/Util/RSAKey.php index d207e3d6..d2661173 100644 --- a/src/Component/Core/Util/RSAKey.php +++ b/src/Component/Core/Util/RSAKey.php @@ -4,14 +4,6 @@ namespace Jose\Component\Core\Util; -use SpomkyLabs\Pki\ASN1\Type\Constructed\Sequence; -use SpomkyLabs\Pki\ASN1\Type\Primitive\BitString; -use SpomkyLabs\Pki\ASN1\Type\Primitive\Integer; -use SpomkyLabs\Pki\ASN1\Type\Primitive\NullType; -use SpomkyLabs\Pki\ASN1\Type\Primitive\ObjectIdentifier; -use SpomkyLabs\Pki\ASN1\Type\Primitive\OctetString; -use SpomkyLabs\Pki\CryptoEncoding\PEM; -use SpomkyLabs\Pki\CryptoTypes\AlgorithmIdentifier\Asymmetric\RSAEncryptionAlgorithmIdentifier; use function array_key_exists; use function count; use InvalidArgumentException; @@ -19,6 +11,12 @@ use Jose\Component\Core\JWK; use ParagonIE\ConstantTime\Base64UrlSafe; use RuntimeException; +use SpomkyLabs\Pki\ASN1\Type\Constructed\Sequence; +use SpomkyLabs\Pki\ASN1\Type\Primitive\BitString; +use SpomkyLabs\Pki\ASN1\Type\Primitive\Integer; +use SpomkyLabs\Pki\ASN1\Type\Primitive\OctetString; +use SpomkyLabs\Pki\CryptoEncoding\PEM; +use SpomkyLabs\Pki\CryptoTypes\AlgorithmIdentifier\Asymmetric\RSAEncryptionAlgorithmIdentifier; use SpomkyLabs\Pki\CryptoTypes\Asymmetric\RSA\RSAPrivateKey; use SpomkyLabs\Pki\CryptoTypes\Asymmetric\RSA\RSAPublicKey; @@ -182,8 +180,8 @@ public static function exponentiate(self $key, BigInteger $c): BigInteger throw new RuntimeException(); } if ($key->isPublic() || $key->getCoefficient() === null || count($key->getPrimes()) === 0 || count( - $key->getExponents() - ) === 0) { + $key->getExponents() + ) === 0) { return $c->modPow($key->getExponent(), $key->getModulus()); } @@ -216,9 +214,9 @@ private function populateBigIntegers(): void $this->convertBase64StringToBigInteger($this->values['q']), ]; if (array_key_exists('dp', $this->values) && array_key_exists('dq', $this->values) && array_key_exists( - 'qi', - $this->values - )) { + 'qi', + $this->values + )) { $this->exponents = [ $this->convertBase64StringToBigInteger($this->values['dp']), $this->convertBase64StringToBigInteger($this->values['dq']), diff --git a/src/Component/KeyManagement/KeyConverter/KeyConverter.php b/src/Component/KeyManagement/KeyConverter/KeyConverter.php index 8da0e471..2de389c3 100644 --- a/src/Component/KeyManagement/KeyConverter/KeyConverter.php +++ b/src/Component/KeyManagement/KeyConverter/KeyConverter.php @@ -4,7 +4,6 @@ namespace Jose\Component\KeyManagement\KeyConverter; -use SpomkyLabs\Pki\CryptoTypes\Asymmetric\EC\ECPublicKey; use function array_key_exists; use function count; use function extension_loaded; @@ -134,10 +133,10 @@ public static function loadFromX5C(array $x5c): array } foreach ($x5c as $id => $cert) { $x5c[$id] = '-----BEGIN CERTIFICATE-----' . PHP_EOL . chunk_split( - (string) $cert, - 64, - PHP_EOL - ) . '-----END CERTIFICATE-----'; + (string) $cert, + 64, + PHP_EOL + ) . '-----END CERTIFICATE-----'; $x509 = openssl_x509_read($x5c[$id]); if ($x509 === false) { throw new InvalidArgumentException('Unable to load the certificate chain'); diff --git a/src/EncryptionAlgorithm/Experimental/KeyEncryption/AESCTR.php b/src/EncryptionAlgorithm/Experimental/KeyEncryption/AESCTR.php index 3dab4849..35d062cb 100644 --- a/src/EncryptionAlgorithm/Experimental/KeyEncryption/AESCTR.php +++ b/src/EncryptionAlgorithm/Experimental/KeyEncryption/AESCTR.php @@ -45,8 +45,8 @@ public function encryptKey(JWK $key, string $cek, array $completeHeader, array & public function decryptKey(JWK $key, string $encrypted_cek, array $header): string { $k = $this->getKey($key); - isset($header['iv']) ||throw new InvalidArgumentException('The header parameter "iv" is missing.'); - is_string($header['iv']) ||throw new InvalidArgumentException('The header parameter "iv" is not valid.'); + isset($header['iv']) || throw new InvalidArgumentException('The header parameter "iv" is missing.'); + is_string($header['iv']) || throw new InvalidArgumentException('The header parameter "iv" is not valid.'); $iv = Base64UrlSafe::decode($header['iv']); $result = openssl_decrypt($encrypted_cek, $this->getMode(), $k, OPENSSL_RAW_DATA, $iv); diff --git a/src/EncryptionAlgorithm/Experimental/KeyEncryption/Chacha20Poly1305.php b/src/EncryptionAlgorithm/Experimental/KeyEncryption/Chacha20Poly1305.php index d4c9a80d..f7d5e3db 100644 --- a/src/EncryptionAlgorithm/Experimental/KeyEncryption/Chacha20Poly1305.php +++ b/src/EncryptionAlgorithm/Experimental/KeyEncryption/Chacha20Poly1305.php @@ -59,8 +59,8 @@ public function encryptKey(JWK $key, string $cek, array $completeHeader, array & public function decryptKey(JWK $key, string $encrypted_cek, array $header): string { $k = $this->getKey($key); - isset($header['nonce']) ||throw new InvalidArgumentException('The header parameter "nonce" is missing.'); - is_string($header['nonce']) ||throw new InvalidArgumentException('The header parameter "nonce" is not valid.'); + isset($header['nonce']) || throw new InvalidArgumentException('The header parameter "nonce" is missing.'); + is_string($header['nonce']) || throw new InvalidArgumentException('The header parameter "nonce" is not valid.'); $nonce = Base64UrlSafe::decode($header['nonce']); if (mb_strlen($nonce, '8bit') !== 12) { throw new InvalidArgumentException('The header parameter "nonce" is not valid.'); diff --git a/src/EncryptionAlgorithm/KeyEncryption/AESGCMKW/AESGCMKW.php b/src/EncryptionAlgorithm/KeyEncryption/AESGCMKW/AESGCMKW.php index 92e0d688..cf17be40 100644 --- a/src/EncryptionAlgorithm/KeyEncryption/AESGCMKW/AESGCMKW.php +++ b/src/EncryptionAlgorithm/KeyEncryption/AESGCMKW/AESGCMKW.php @@ -46,8 +46,12 @@ public function wrapKey(JWK $key, string $cek, array $completeHeader, array &$ad public function unwrapKey(JWK $key, string $encrypted_cek, array $completeHeader): string { $kek = $this->getKey($key); - (isset($completeHeader['iv']) && is_string($completeHeader['iv'])) || throw new InvalidArgumentException('Parameter "iv" is missing.'); - (isset($completeHeader['tag']) && is_string($completeHeader['tag'])) || throw new InvalidArgumentException('Parameter "tag" is missing.'); + (isset($completeHeader['iv']) && is_string($completeHeader['iv'])) || throw new InvalidArgumentException( + 'Parameter "iv" is missing.' + ); + (isset($completeHeader['tag']) && is_string($completeHeader['tag'])) || throw new InvalidArgumentException( + 'Parameter "tag" is missing.' + ); $tag = Base64UrlSafe::decode($completeHeader['tag']); $iv = Base64UrlSafe::decode($completeHeader['iv']); diff --git a/src/EncryptionAlgorithm/KeyEncryption/ECDHES/AbstractECDH.php b/src/EncryptionAlgorithm/KeyEncryption/ECDHES/AbstractECDH.php index 9fab2069..124644c4 100644 --- a/src/EncryptionAlgorithm/KeyEncryption/ECDHES/AbstractECDH.php +++ b/src/EncryptionAlgorithm/KeyEncryption/ECDHES/AbstractECDH.php @@ -140,8 +140,8 @@ protected function calculateAgreementKey(JWK $private_key, JWK $public_key): str } /** - * @return JWK[] * @param array $additional_header_values + * @return JWK[] */ protected function getKeysFromPublicKey( JWK $recipient_key, diff --git a/tests/Bundle/JoseFramework/Functional/Serializer/JWEEncoderTest.php b/tests/Bundle/JoseFramework/Functional/Serializer/JWEEncoderTest.php index 827a0cd7..ab3bb4e1 100644 --- a/tests/Bundle/JoseFramework/Functional/Serializer/JWEEncoderTest.php +++ b/tests/Bundle/JoseFramework/Functional/Serializer/JWEEncoderTest.php @@ -188,7 +188,7 @@ public function theJWEEncoderShouldThrowOnUnsupportedFormatWhenDecoding(): void $serializer->decode($jweString, 'jwe_json_flattened'); } - public function encoderServiceDataProvider(): array + public static function encoderServiceDataProvider(): array { return [ 'indirect serializer' => ['serializer'], @@ -196,7 +196,7 @@ public function encoderServiceDataProvider(): array ]; } - public function jweFormatDataProvider(): array + public static function jweFormatDataProvider(): array { return [ 'jwe_compact with indirect serializer' => ['jwe_compact', 'serializer'], diff --git a/tests/Bundle/JoseFramework/Functional/Serializer/JWESerializerTest.php b/tests/Bundle/JoseFramework/Functional/Serializer/JWESerializerTest.php index d320d0b2..f7ef674b 100644 --- a/tests/Bundle/JoseFramework/Functional/Serializer/JWESerializerTest.php +++ b/tests/Bundle/JoseFramework/Functional/Serializer/JWESerializerTest.php @@ -81,7 +81,7 @@ public function serializerServiceDataProvider(): array ]; } - public function jweFormatDataProvider(): array + public static function jweFormatDataProvider(): array { return [ 'jwe_compact with indirect serializer' => ['jwe_compact', 'serializer'], diff --git a/tests/Bundle/JoseFramework/Functional/Serializer/JWSEncoderTest.php b/tests/Bundle/JoseFramework/Functional/Serializer/JWSEncoderTest.php index 7e3b435e..09c7bd58 100644 --- a/tests/Bundle/JoseFramework/Functional/Serializer/JWSEncoderTest.php +++ b/tests/Bundle/JoseFramework/Functional/Serializer/JWSEncoderTest.php @@ -190,7 +190,7 @@ public function serializerServiceDataProvider(): array ]; } - public function jwsFormatDataProvider(): array + public static function jwsFormatDataProvider(): array { return [ 'jws_compact with indirect serializer' => ['jws_compact', 'serializer'], diff --git a/tests/Bundle/JoseFramework/Functional/Serializer/JWSSerializerTest.php b/tests/Bundle/JoseFramework/Functional/Serializer/JWSSerializerTest.php index b8f6bb47..4ff192de 100644 --- a/tests/Bundle/JoseFramework/Functional/Serializer/JWSSerializerTest.php +++ b/tests/Bundle/JoseFramework/Functional/Serializer/JWSSerializerTest.php @@ -81,7 +81,7 @@ public function serializerServiceDataProvider(): array ]; } - public function jwsFormatDataProvider(): array + public static function jwsFormatDataProvider(): array { return [ 'jws_compact with indirect serializer' => ['jws_compact', 'serializer'], diff --git a/tests/Component/Encryption/RSAKeyWithoutAllPrimesTest.php b/tests/Component/Encryption/RSAKeyWithoutAllPrimesTest.php index 8fb6eccc..0c25220f 100644 --- a/tests/Component/Encryption/RSAKeyWithoutAllPrimesTest.php +++ b/tests/Component/Encryption/RSAKeyWithoutAllPrimesTest.php @@ -86,7 +86,7 @@ public function encryptionAlgorithmsWithMinimalRsaKey(string $encryption_algorit static::assertTrue($jweDecrypter->decryptUsingKey($loaded, $key, 0)); } - public function dataEncryptionAlgorithms(): array + public static function dataEncryptionAlgorithms(): array { return [['RSA1_5'], ['RSA-OAEP'], ['RSA-OAEP-256']]; } diff --git a/tests/Component/KeyManagement/CertificateTest.php b/tests/Component/KeyManagement/CertificateTest.php index 6a259a45..678d5fff 100644 --- a/tests/Component/KeyManagement/CertificateTest.php +++ b/tests/Component/KeyManagement/CertificateTest.php @@ -113,7 +113,7 @@ public function loadCertificate(string $file, array $expected_values): void static::assertEqualsCanonicalizing($expected_values, $result); } - public function dataLoadCertificate(): array + public static function dataLoadCertificate(): array { return [ [ diff --git a/tests/Component/KeyManagement/JWKFactoryTest.php b/tests/Component/KeyManagement/JWKFactoryTest.php index 818a3353..51815007 100644 --- a/tests/Component/KeyManagement/JWKFactoryTest.php +++ b/tests/Component/KeyManagement/JWKFactoryTest.php @@ -232,14 +232,11 @@ public function createFromPublicEC512KeyFile(string $filename, string $expectedJ $jwk = JWKFactory::createFromKeyFile($filename); // Then - static::assertSame( - $expectedJWK, - json_encode($jwk, JSON_THROW_ON_ERROR) - ); + static::assertSame($expectedJWK, json_encode($jwk, JSON_THROW_ON_ERROR)); static::assertSame($content, ECKey::convertPublicKeyToPEM($jwk)); } - public function publicKeysAndPem(): iterable + public static function publicKeysAndPem(): iterable { yield [ __DIR__ . '/Keys/EC/public.es256.key', @@ -288,7 +285,7 @@ public function loadKeyPEMEncoded(string $filename, array $expectedValues): void /** * @return array> */ - public function dataKeys(): array + public static function dataKeys(): array { return [ [ diff --git a/tests/Component/KeyManagement/Keys/ECKeysTest.php b/tests/Component/KeyManagement/Keys/ECKeysTest.php index ce5ca639..caf719f7 100644 --- a/tests/Component/KeyManagement/Keys/ECKeysTest.php +++ b/tests/Component/KeyManagement/Keys/ECKeysTest.php @@ -4,10 +4,10 @@ namespace Jose\Tests\Component\KeyManagement\Keys; -use Jose\Component\Core\Util\ECKey; use const DIRECTORY_SEPARATOR; use InvalidArgumentException; use Jose\Component\Core\JWK; +use Jose\Component\Core\Util\ECKey; use Jose\Component\KeyManagement\JWKFactory; use Jose\Component\KeyManagement\KeyConverter\KeyConverter; use PHPUnit\Framework\TestCase; diff --git a/tests/Component/KeyManagement/Keys/RSAKeysTest.php b/tests/Component/KeyManagement/Keys/RSAKeysTest.php index 1cefdfbe..b5da31cf 100644 --- a/tests/Component/KeyManagement/Keys/RSAKeysTest.php +++ b/tests/Component/KeyManagement/Keys/RSAKeysTest.php @@ -4,9 +4,6 @@ namespace Jose\Tests\Component\KeyManagement\Keys; -use SpomkyLabs\Pki\ASN1\Type\Constructed\Sequence; -use SpomkyLabs\Pki\ASN1\Type\Primitive\RelativeOID; -use SpomkyLabs\Pki\CryptoEncoding\PEM; use const DIRECTORY_SEPARATOR; use InvalidArgumentException; use Jose\Component\Core\JWK; @@ -142,7 +139,7 @@ public function loadPrivateRSAKey(): void $content = trim(file_get_contents($file)); // When - $rsaKey = RSAKey::createFromPEM('file://'.$file); + $rsaKey = RSAKey::createFromPEM('file://' . $file); // Then static::assertEqualsCanonicalizing([ diff --git a/tests/SignatureAlgorithm/ECDSA/ECDSAFromRFC6979Test.php b/tests/SignatureAlgorithm/ECDSA/ECDSAFromRFC6979Test.php index 58367ba2..dcf2df0a 100644 --- a/tests/SignatureAlgorithm/ECDSA/ECDSAFromRFC6979Test.php +++ b/tests/SignatureAlgorithm/ECDSA/ECDSAFromRFC6979Test.php @@ -43,7 +43,7 @@ public function withVectors(SignatureAlgorithm $algorithm, $message, JWK $key, $ static::assertTrue($is_valid); } - public function dataWithVectors(): array + public static function dataWithVectors(): array { return [ [ @@ -53,19 +53,19 @@ public function dataWithVectors(): array 'kty' => 'EC', 'crv' => 'P-256', 'd' => Base64UrlSafe::encodeUnpadded( - $this->convertHexToBin('C9AFA9D845BA75166B5C215767B1D6934E50C3DB36E89B127B8A622B120F6721') + self::convertHexToBin('C9AFA9D845BA75166B5C215767B1D6934E50C3DB36E89B127B8A622B120F6721') ), 'x' => Base64UrlSafe::encodeUnpadded( - $this->convertHexToBin('60FED4BA255A9D31C961EB74C6356D68C049B8923B61FA6CE669622E60F29FB6') + self::convertHexToBin('60FED4BA255A9D31C961EB74C6356D68C049B8923B61FA6CE669622E60F29FB6') ), 'y' => Base64UrlSafe::encodeUnpadded( - $this->convertHexToBin('7903FE1008B8BC99A41AE9E95628BC64F2F1B20C2D7E9F5177A3C294D4462299') + self::convertHexToBin('7903FE1008B8BC99A41AE9E95628BC64F2F1B20C2D7E9F5177A3C294D4462299') ), ]), sprintf( '%s%s', - $this->convertHexToBin('EFD48B2AACB6A8FD1140DD9CD45E81D69D2C877B56AAF991C34D0EA84EAF3716'), - $this->convertHexToBin('F7CB1C942D657C41D436C7A1B6E29F65F3E900DBB9AFF4064DC4AB2F843ACDA8') + self::convertHexToBin('EFD48B2AACB6A8FD1140DD9CD45E81D69D2C877B56AAF991C34D0EA84EAF3716'), + self::convertHexToBin('F7CB1C942D657C41D436C7A1B6E29F65F3E900DBB9AFF4064DC4AB2F843ACDA8') ), ], [ @@ -75,19 +75,19 @@ public function dataWithVectors(): array 'kty' => 'EC', 'crv' => 'P-256', 'd' => Base64UrlSafe::encodeUnpadded( - $this->convertHexToBin('C9AFA9D845BA75166B5C215767B1D6934E50C3DB36E89B127B8A622B120F6721') + self::convertHexToBin('C9AFA9D845BA75166B5C215767B1D6934E50C3DB36E89B127B8A622B120F6721') ), 'x' => Base64UrlSafe::encodeUnpadded( - $this->convertHexToBin('60FED4BA255A9D31C961EB74C6356D68C049B8923B61FA6CE669622E60F29FB6') + self::convertHexToBin('60FED4BA255A9D31C961EB74C6356D68C049B8923B61FA6CE669622E60F29FB6') ), 'y' => Base64UrlSafe::encodeUnpadded( - $this->convertHexToBin('7903FE1008B8BC99A41AE9E95628BC64F2F1B20C2D7E9F5177A3C294D4462299') + self::convertHexToBin('7903FE1008B8BC99A41AE9E95628BC64F2F1B20C2D7E9F5177A3C294D4462299') ), ]), sprintf( '%s%s', - $this->convertHexToBin('F1ABB023518351CD71D881567B1EA663ED3EFCF6C5132B354F28D3B0B7D38367'), - $this->convertHexToBin('019F4113742A2B14BD25926B49C649155F267E60D3814B4C0CC84250E46F0083') + self::convertHexToBin('F1ABB023518351CD71D881567B1EA663ED3EFCF6C5132B354F28D3B0B7D38367'), + self::convertHexToBin('019F4113742A2B14BD25926B49C649155F267E60D3814B4C0CC84250E46F0083') ), ], [ @@ -97,27 +97,27 @@ public function dataWithVectors(): array 'kty' => 'EC', 'crv' => 'P-384', 'd' => Base64UrlSafe::encodeUnpadded( - $this->convertHexToBin( + self::convertHexToBin( '6B9D3DAD2E1B8C1C05B19875B6659F4DE23C3B667BF297BA9AA47740787137D896D5724E4C70A825F872C9EA60D2EDF5' ) ), 'x' => Base64UrlSafe::encodeUnpadded( - $this->convertHexToBin( + self::convertHexToBin( 'EC3A4E415B4E19A4568618029F427FA5DA9A8BC4AE92E02E06AAE5286B300C64DEF8F0EA9055866064A254515480BC13' ) ), 'y' => Base64UrlSafe::encodeUnpadded( - $this->convertHexToBin( + self::convertHexToBin( '8015D9B72D7D57244EA8EF9AC0C621896708A59367F9DFB9F54CA84B3F1C9DB1288B231C3AE0D4FE7344FD2533264720' ) ), ]), sprintf( '%s%s', - $this->convertHexToBin( + self::convertHexToBin( '94EDBB92A5ECB8AAD4736E56C691916B3F88140666CE9FA73D64C4EA95AD133C81A648152E44ACF96E36DD1E80FABE46' ), - $this->convertHexToBin( + self::convertHexToBin( '99EF4AEB15F178CEA1FE40DB2603138F130E740A19624526203B6351D0A3A94FA329C145786E679E7B82C71A38628AC8' ) ), @@ -129,27 +129,27 @@ public function dataWithVectors(): array 'kty' => 'EC', 'crv' => 'P-384', 'd' => Base64UrlSafe::encodeUnpadded( - $this->convertHexToBin( + self::convertHexToBin( '6B9D3DAD2E1B8C1C05B19875B6659F4DE23C3B667BF297BA9AA47740787137D896D5724E4C70A825F872C9EA60D2EDF5' ) ), 'x' => Base64UrlSafe::encodeUnpadded( - $this->convertHexToBin( + self::convertHexToBin( 'EC3A4E415B4E19A4568618029F427FA5DA9A8BC4AE92E02E06AAE5286B300C64DEF8F0EA9055866064A254515480BC13' ) ), 'y' => Base64UrlSafe::encodeUnpadded( - $this->convertHexToBin( + self::convertHexToBin( '8015D9B72D7D57244EA8EF9AC0C621896708A59367F9DFB9F54CA84B3F1C9DB1288B231C3AE0D4FE7344FD2533264720' ) ), ]), sprintf( '%s%s', - $this->convertHexToBin( + self::convertHexToBin( '8203B63D3C853E8D77227FB377BCF7B7B772E97892A80F36AB775D509D7A5FEB0542A7F0812998DA8F1DD3CA3CF023DB' ), - $this->convertHexToBin( + self::convertHexToBin( 'DDD0760448D42D8A43AF45AF836FCE4DE8BE06B485E9B61B827C2F13173923E06A739F040649A667BF3B828246BAA5A5' ) ), @@ -162,27 +162,27 @@ public function dataWithVectors(): array 'kty' => 'EC', 'crv' => 'P-521', 'd' => Base64UrlSafe::encodeUnpadded( - $this->convertHexToBin( + self::convertHexToBin( '00FAD06DAA62BA3B25D2FB40133DA757205DE67F5BB0018FEE8C86E1B68C7E75CAA896EB32F1F47C70855836A6D16FCC1466F6D8FBEC67DB89EC0C08B0E996B83538' ) ), 'x' => Base64UrlSafe::encodeUnpadded( - $this->convertHexToBin( + self::convertHexToBin( '01894550D0785932E00EAA23B694F213F8C3121F86DC97A04E5A7167DB4E5BCD371123D46E45DB6B5D5370A7F20FB633155D38FFA16D2BD761DCAC474B9A2F5023A4' ) ), 'y' => Base64UrlSafe::encodeUnpadded( - $this->convertHexToBin( + self::convertHexToBin( '00493101C962CD4D2FDDF782285E64584139C2F91B47F87FF82354D6630F746A28A0DB25741B5B34A828008B22ACC23F924FAAFBD4D33F81EA66956DFEAA2BFDFCF5' ) ), ]), sprintf( '%s%s', - $this->convertHexToBin( + self::convertHexToBin( '00C328FAFCBD79DD77850370C46325D987CB525569FB63C5D3BC53950E6D4C5F174E25A1EE9017B5D450606ADD152B534931D7D4E8455CC91F9B15BF05EC36E377FA' ), - $this->convertHexToBin( + self::convertHexToBin( '00617CCE7CF5064806C467F678D3B4080D6F1CC50AF26CA209417308281B68AF282623EAA63E5B5C0723D8B8C37FF0777B1A20F8CCB1DCCC43997F1EE0E44DA4A67A' ) ), @@ -194,27 +194,27 @@ public function dataWithVectors(): array 'kty' => 'EC', 'crv' => 'P-521', 'd' => Base64UrlSafe::encodeUnpadded( - $this->convertHexToBin( + self::convertHexToBin( '00FAD06DAA62BA3B25D2FB40133DA757205DE67F5BB0018FEE8C86E1B68C7E75CAA896EB32F1F47C70855836A6D16FCC1466F6D8FBEC67DB89EC0C08B0E996B83538' ) ), 'x' => Base64UrlSafe::encodeUnpadded( - $this->convertHexToBin( + self::convertHexToBin( '01894550D0785932E00EAA23B694F213F8C3121F86DC97A04E5A7167DB4E5BCD371123D46E45DB6B5D5370A7F20FB633155D38FFA16D2BD761DCAC474B9A2F5023A4' ) ), 'y' => Base64UrlSafe::encodeUnpadded( - $this->convertHexToBin( + self::convertHexToBin( '00493101C962CD4D2FDDF782285E64584139C2F91B47F87FF82354D6630F746A28A0DB25741B5B34A828008B22ACC23F924FAAFBD4D33F81EA66956DFEAA2BFDFCF5' ) ), ]), sprintf( '%s%s', - $this->convertHexToBin( + self::convertHexToBin( '013E99020ABF5CEE7525D16B69B229652AB6BDF2AFFCAEF38773B4B7D08725F10CDB93482FDCC54EDCEE91ECA4166B2A7C6265EF0CE2BD7051B7CEF945BABD47EE6D' ), - $this->convertHexToBin( + self::convertHexToBin( '01FBD0013C674AA79CB39849527916CE301C66EA7CE8B80682786AD60F98F7E78A19CA69EFF5C57400E3B3A0AD66CE0978214D13BAF4E9AC60752F7B155E2DE4DCE3' ) ), @@ -227,7 +227,7 @@ public function dataWithVectors(): array * * @return string */ - private function convertHexToBin($data) + private static function convertHexToBin($data) { return hex2bin($data); } diff --git a/tests/SignatureAlgorithm/RSA/RSAKeyWithoutAllPrimesTest.php b/tests/SignatureAlgorithm/RSA/RSAKeyWithoutAllPrimesTest.php index 8683ad3e..b0fae3ad 100644 --- a/tests/SignatureAlgorithm/RSA/RSAKeyWithoutAllPrimesTest.php +++ b/tests/SignatureAlgorithm/RSA/RSAKeyWithoutAllPrimesTest.php @@ -53,7 +53,7 @@ public function signatureAlgorithms(string $signature_algorithm): void static::assertTrue($jwsVerifier->verifyWithKey($loaded, $key, 0)); } - public function dataSignatureAlgorithms(): array + public static function dataSignatureAlgorithms(): array { return [[RS256::class], [RS384::class], [RS512::class], [PS256::class], [PS384::class], [PS512::class]]; }