From 969f3554c49ba7ed6fa603576f1f205e7d66a00c Mon Sep 17 00:00:00 2001 From: Florent Morselli Date: Wed, 14 Dec 2022 22:48:24 +0100 Subject: [PATCH] Deps/update (#26) * Dependencies updated and Rector+ECS fixes * PHPStan fixes * Makefile fixed * Tests with obsolete algos removed * Rector fixed --- .github/CONTRIBUTING.md | 2 +- .github/workflows/integrate.yml | 422 +++++++++--------- Makefile | 8 +- composer.json | 10 +- phpstan.neon | 2 +- phpunit.xml.dist | 27 +- rector.php | 6 +- src/ASN1/Type/Primitive/GeneralizedTime.php | 2 +- src/ASN1/Type/Primitive/RelativeOID.php | 5 +- src/CryptoEncoding/PEM.php | 4 + src/CryptoEncoding/PEMBundle.php | 28 +- .../AlgorithmIdentifier.php | 5 +- .../ECPublicKeyAlgorithmIdentifier.php | 5 +- .../Asymmetric/RFC8410/RFC8410PublicKey.php | 5 +- src/X501/ASN1/AttributeType.php | 5 +- .../ASN1/AttributeValue/AttributeValue.php | 5 +- src/X501/DN/DNParser.php | 7 +- src/X501/StringPrep/MapStep.php | 5 +- src/X501/StringPrep/TranscodeStep.php | 5 +- .../CertificatePolicy/PolicyQualifierInfo.php | 5 +- .../DistributionPointName.php | 5 +- .../Certificate/Extension/Target/Target.php | 5 +- .../PathBuilding/CertificationPathBuilder.php | 5 +- .../PathValidation/ValidatorState.php | 5 +- .../CertificationPath/Policy/PolicyTree.php | 5 +- src/X509/GeneralName/DNSName.php | 5 +- src/X509/GeneralName/EDIPartyName.php | 5 +- src/X509/GeneralName/GeneralName.php | 5 +- src/X509/GeneralName/RegisteredID.php | 5 +- src/X509/GeneralName/X400Address.php | 5 +- .../Unit/Crypto/OpenSSLCryptoTest.php | 25 +- .../Unit/AlgoId/AlgorithmIdentifierTest.php | 2 +- .../Unit/StringPrep/TranscodeStepTest.php | 4 +- tests/X509/Integration/Ac/HolderTest.php | 2 +- .../X509/Integration/Ac/IssuerSerialTest.php | 5 +- tests/X509/Integration/Ac/IssuerTest.php | 2 +- .../AcValidation/InvalidHolderNameTest.php | 7 +- .../AcValidation/InvalidHolderPathTest.php | 7 +- .../AcValidation/InvalidIssuerNameTest.php | 7 +- .../AcValidation/InvalidIssuerPathTest.php | 7 +- .../AcValidation/InvalidKeyUsageTest.php | 7 +- .../AcValidation/InvalidSignatureTest.php | 7 +- .../AcValidation/NoTargetingTest.php | 6 +- .../Integration/AcValidation/PassingTest.php | 6 +- .../AcValidation/TargetMismatchTest.php | 7 +- .../Integration/AcValidation/ValidityTest.php | 7 +- .../Certificate/CertificateEqualsTest.php | 6 +- .../BasicConstraintsMissingTest.php | 10 +- .../DifferentAlgoParamsTest.php | 10 +- .../PathValidation/InhibitAnyPolicyTest.php | 10 +- .../PathValidation/IntermediateTest.php | 14 +- .../PathValidation/IssuerMismatchTest.php | 10 +- .../PathValidation/NameConstraintsTest.php | 10 +- .../PathValidation/NoPoliciesTest.php | 10 +- .../Integration/PathValidation/NotCATest.php | 10 +- .../PathValidation/NotKeyCertSignTest.php | 10 +- .../PathValidation/PathLengthFailTest.php | 14 +- .../PathValidation/PathLengthTest.php | 10 +- .../PathValidation/PoliciesTest.php | 10 +- .../PathValidation/PolicyErrorTest.php | 10 +- .../PolicyIntersectionAnyPolicyTest.php | 10 +- .../PolicyIntersectionPruneTest.php | 10 +- .../PolicyIntersectionRemoveTest.php | 14 +- .../PolicyIntersectionSingleExplicitTest.php | 14 +- .../PathValidation/PolicyIntersectionTest.php | 14 +- .../PolicyMappingAnyPolicyTest.php | 10 +- .../PolicyMappingInhibitTest.php | 14 +- .../PolicyMappingMapAnyTest.php | 10 +- .../PathValidation/PolicyMappingTest.php | 10 +- .../PathValidation/PolicyProcessPruneTest.php | 10 +- .../PathValidation/SignatureMismatchTest.php | 10 +- .../PathValidation/WrapUpPolicyErrorTest.php | 10 +- .../Workflow/RequestToCertTest.php | 5 +- .../Unit/Ac/AttCertValidityPeriodTest.php | 4 +- .../Unit/Ac/AttributeCertificateInfoTest.php | 13 +- tests/X509/Unit/Ac/HolderTest.php | 6 +- tests/X509/Unit/Ac/IssuerSerialTest.php | 4 +- tests/X509/Unit/Ac/V2FormTest.php | 2 +- .../Certificate/CertificateBundleTest.php | 12 +- .../Unit/Certificate/CertificateChainTest.php | 10 +- .../X509/Unit/Certificate/CertificateTest.php | 3 +- .../Certificate/CertificateVersionTest.php | 5 +- .../Certificate/Extension/FreshestCRLTest.php | 2 +- .../Extension/Target/TargetsTest.php | 4 +- .../Unit/Certificate/TBSCertificateTest.php | 9 +- .../CertificationPathBuildingTest.php | 6 +- .../CertificationPathTest.php | 5 +- .../Validation/ValidatorStateTest.php | 2 +- .../Unit/Csr/CertificationRequestInfoTest.php | 7 +- .../Unit/Csr/CertificationRequestTest.php | 5 +- 90 files changed, 602 insertions(+), 503 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 7cc67ce3..42b491cc 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -25,4 +25,4 @@ Run test suite * install composer: `curl -s http://getcomposer.org/installer | php` * install dependencies: `php composer.phar install` -* run tests: `vendor/bin/phpunit` +* run tests: `vendor/bin/simple-phpunit` diff --git a/.github/workflows/integrate.yml b/.github/workflows/integrate.yml index 057142b4..89acd1ab 100644 --- a/.github/workflows/integrate.yml +++ b/.github/workflows/integrate.yml @@ -2,214 +2,218 @@ name: "Integrate" -on: [ push, pull_request ] +on: + push: + branches: + - "*.x" + pull_request: null jobs: - byte_level: - name: "0️⃣ Byte-level" - runs-on: "ubuntu-latest" - steps: - - name: "Checkout code" - uses: "actions/checkout@v3" - - - name: "Check file permissions" - run: | - test "$(find . -type f -not -path './.git/*' -executable)" == "" - - # - name: "Find non-printable ASCII characters" - # run: | - # ! LC_ALL=C.UTF-8 find . -type f -name "*.php" -print0 | xargs -0 -- grep -PHn "[^ -~]" - - syntax_errors: - name: "1️⃣ Syntax errors" - runs-on: "ubuntu-latest" - steps: - - name: "Set up PHP" - uses: "shivammathur/setup-php@v2" - with: - php-version: "8.1" - - - name: "Checkout code" - uses: "actions/checkout@v3" - - - name: "Install dependencies" - uses: "ramsey/composer-install@v2" - with: - dependency-versions: "highest" - - - name: "Check source code for syntax errors" - run: "composer exec -- parallel-lint src/ tests/" - - unit_tests: - name: "2️⃣ Unit and functional tests" - needs: - - "byte_level" - - "syntax_errors" - strategy: - matrix: - operating-system: - - "ubuntu-latest" - php-version: - - "8.1" - dependencies: - - "lowest" - - "highest" - runs-on: ${{ matrix.operating-system }} - steps: - - name: "Set up PHP" - uses: "shivammathur/setup-php@v2" - with: - php-version: "${{ matrix.php-version }}" - extensions: "json, mbstring, openssl, sqlite3, curl, uuid" - coverage: "xdebug" - - - name: "Checkout code" - uses: "actions/checkout@v3" - - - name: "Install dependencies" - uses: "ramsey/composer-install@v2" - with: - dependency-versions: "${{ matrix.dependencies }}" - composer-options: "--optimize-autoloader" - - - name: "Execute tests (PHP)" - run: "make ci-cc" - - # - name: Send coverage to Coveralls - # if: "matrix.php-version == '8.1' && matrix.dependencies == 'highest'" - # env: - # COVERALLS_REPO_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - # run: | - # wget "https://github.com/php-coveralls/php-coveralls/releases/download/v2.5.2/php-coveralls.phar" - # php ./php-coveralls.phar -v - - static_analysis: - name: "3️⃣ Static Analysis" - needs: - - "byte_level" - - "syntax_errors" - runs-on: "ubuntu-latest" - steps: - - name: "Set up PHP" - uses: "shivammathur/setup-php@v2" - with: - php-version: "8.1" - extensions: "json, mbstring, openssl, sqlite3, curl, uuid" - - - name: "Checkout code" - uses: "actions/checkout@v3" - - - name: "Validate Composer configuration" - run: "composer validate --strict" - - - name: "Install dependencies" - uses: "ramsey/composer-install@v2" - with: - dependency-versions: "highest" - composer-options: "--optimize-autoloader" - - - name: "Execute static analysis" - run: "make st" - - coding_standards: - name: "4️⃣ Coding Standards" - needs: - - "byte_level" - - "syntax_errors" - runs-on: "ubuntu-latest" - steps: - - name: "Set up PHP" - uses: "shivammathur/setup-php@v2" - with: - php-version: "8.1" - extensions: "json, mbstring, openssl, sqlite3, curl, uuid" - - - name: "Checkout code" - uses: "actions/checkout@v3" - - - name: "Check adherence to EditorConfig" - uses: "greut/eclint-action@v0" - - - name: "Install dependencies" - uses: "ramsey/composer-install@v2" - with: - dependency-versions: "highest" - composer-options: "--optimize-autoloader" - - - name: "Check coding style" - run: "make ci-cs" - - mutation_testing: - name: "5️⃣ Mutation Testing" - needs: - - "byte_level" - - "syntax_errors" - runs-on: "ubuntu-latest" - steps: - - name: "Set up PHP" - uses: "shivammathur/setup-php@v2" - with: - php-version: "8.1" - extensions: "json, mbstring, openssl, sqlite3, curl, uuid" - - - name: "Checkout code" - uses: "actions/checkout@v3" - - - name: "Fetch Git base reference" - run: "git fetch --depth=1 origin ${GITHUB_BASE_REF}" - - - name: "Install dependencies" - uses: "ramsey/composer-install@v2" - with: - dependency-versions: "highest" - composer-options: "--optimize-autoloader" - - - name: "Execute Infection" - run: "make ci-mu" - - rector_checkstyle: - name: "6️⃣ Rector Checkstyle" - needs: - - "byte_level" - - "syntax_errors" - runs-on: "ubuntu-latest" - steps: - - name: "Set up PHP" - uses: "shivammathur/setup-php@v2" - with: - php-version: "8.1" - extensions: "json, mbstring, openssl, sqlite3, curl, uuid" - coverage: "xdebug" - - - name: "Checkout code" - uses: "actions/checkout@v3" - - - name: "Fetch Git base reference" - run: "git fetch --depth=1 origin ${GITHUB_BASE_REF}" - - - name: "Install dependencies" - uses: "ramsey/composer-install@v2" - with: - dependency-versions: "highest" - composer-options: "--optimize-autoloader" - - - name: "Execute Rector" - run: "make rector" - - exported_files: - name: "7️⃣ Exported files" - needs: - - "byte_level" - - "syntax_errors" - runs-on: "ubuntu-20.04" - steps: - - name: "Checkout code" - uses: "actions/checkout@v3" - - - name: "Check exported files" - run: | - EXPECTED="LICENSE,README.md,SECURITY.md,composer.json" - CURRENT="$(git archive HEAD | tar --list --exclude="src" --exclude="src/*" | paste -s -d ",")" - echo "CURRENT =${CURRENT}" - echo "EXPECTED=${EXPECTED}" - test "${CURRENT}" == "${EXPECTED}" + byte_level: + name: "0️⃣ Byte-level" + runs-on: "ubuntu-latest" + steps: + - name: "Checkout code" + uses: "actions/checkout@v3" + + - name: "Check file permissions" + run: | + test "$(find . -type f -not -path './.git/*' -executable)" == "" + + # - name: "Find non-printable ASCII characters" + # run: | + # ! LC_ALL=C.UTF-8 find . -type f -name "*.php" -print0 | xargs -0 -- grep -PHn "[^ -~]" + + syntax_errors: + name: "1️⃣ Syntax errors" + runs-on: "ubuntu-latest" + steps: + - name: "Set up PHP" + uses: "shivammathur/setup-php@v2" + with: + php-version: "8.1" + + - name: "Checkout code" + uses: "actions/checkout@v3" + + - name: "Install dependencies" + uses: "ramsey/composer-install@v2" + with: + dependency-versions: "highest" + + - name: "Check source code for syntax errors" + run: "composer exec -- parallel-lint src/ tests/" + + unit_tests: + name: "2️⃣ Unit and functional tests" + needs: + - "byte_level" + - "syntax_errors" + strategy: + matrix: + operating-system: + - "ubuntu-latest" + php-version: + - "8.1" + dependencies: + - "lowest" + - "highest" + runs-on: ${{ matrix.operating-system }} + steps: + - name: "Set up PHP" + uses: "shivammathur/setup-php@v2" + with: + php-version: "${{ matrix.php-version }}" + extensions: "json, mbstring, openssl, sqlite3, curl, uuid" + coverage: "xdebug" + + - name: "Checkout code" + uses: "actions/checkout@v3" + + - name: "Install dependencies" + uses: "ramsey/composer-install@v2" + with: + dependency-versions: "${{ matrix.dependencies }}" + composer-options: "--optimize-autoloader" + + - name: "Execute tests (PHP)" + run: "make ci-cc" + + # - name: Send coverage to Coveralls + # if: "matrix.php-version == '8.1' && matrix.dependencies == 'highest'" + # env: + # COVERALLS_REPO_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + # run: | + # wget "https://github.com/php-coveralls/php-coveralls/releases/download/v2.5.2/php-coveralls.phar" + # php ./php-coveralls.phar -v + + static_analysis: + name: "3️⃣ Static Analysis" + needs: + - "byte_level" + - "syntax_errors" + runs-on: "ubuntu-latest" + steps: + - name: "Set up PHP" + uses: "shivammathur/setup-php@v2" + with: + php-version: "8.1" + extensions: "json, mbstring, openssl, sqlite3, curl, uuid" + + - name: "Checkout code" + uses: "actions/checkout@v3" + + - name: "Validate Composer configuration" + run: "composer validate --strict" + + - name: "Install dependencies" + uses: "ramsey/composer-install@v2" + with: + dependency-versions: "highest" + composer-options: "--optimize-autoloader" + + - name: "Execute static analysis" + run: "make st" + + coding_standards: + name: "4️⃣ Coding Standards" + needs: + - "byte_level" + - "syntax_errors" + runs-on: "ubuntu-latest" + steps: + - name: "Set up PHP" + uses: "shivammathur/setup-php@v2" + with: + php-version: "8.1" + extensions: "json, mbstring, openssl, sqlite3, curl, uuid" + + - name: "Checkout code" + uses: "actions/checkout@v3" + + - name: "Check adherence to EditorConfig" + uses: "greut/eclint-action@v0" + + - name: "Install dependencies" + uses: "ramsey/composer-install@v2" + with: + dependency-versions: "highest" + composer-options: "--optimize-autoloader" + + - name: "Check coding style" + run: "make ci-cs" + + mutation_testing: + name: "5️⃣ Mutation Testing" + needs: + - "byte_level" + - "syntax_errors" + runs-on: "ubuntu-latest" + steps: + - name: "Set up PHP" + uses: "shivammathur/setup-php@v2" + with: + php-version: "8.1" + extensions: "json, mbstring, openssl, sqlite3, curl, uuid" + + - name: "Checkout code" + uses: "actions/checkout@v3" + + - name: "Fetch Git base reference" + run: "git fetch --depth=1 origin ${GITHUB_BASE_REF}" + + - name: "Install dependencies" + uses: "ramsey/composer-install@v2" + with: + dependency-versions: "highest" + composer-options: "--optimize-autoloader" + + - name: "Execute Infection" + run: "make ci-mu" + + rector_checkstyle: + name: "6️⃣ Rector Checkstyle" + needs: + - "byte_level" + - "syntax_errors" + runs-on: "ubuntu-latest" + steps: + - name: "Set up PHP" + uses: "shivammathur/setup-php@v2" + with: + php-version: "8.1" + extensions: "json, mbstring, openssl, sqlite3, curl, uuid" + coverage: "xdebug" + + - name: "Checkout code" + uses: "actions/checkout@v3" + + - name: "Fetch Git base reference" + run: "git fetch --depth=1 origin ${GITHUB_BASE_REF}" + + - name: "Install dependencies" + uses: "ramsey/composer-install@v2" + with: + dependency-versions: "highest" + composer-options: "--optimize-autoloader" + + - name: "Execute Rector" + run: "make rector" + + exported_files: + name: "7️⃣ Exported files" + needs: + - "byte_level" + - "syntax_errors" + runs-on: "ubuntu-20.04" + steps: + - name: "Checkout code" + uses: "actions/checkout@v3" + + - name: "Check exported files" + run: | + EXPECTED="LICENSE,README.md,SECURITY.md,composer.json" + CURRENT="$(git archive HEAD | tar --list --exclude="src" --exclude="src/*" | paste -s -d ",")" + echo "CURRENT =${CURRENT}" + echo "EXPECTED=${EXPECTED}" + test "${CURRENT}" == "${EXPECTED}" diff --git a/Makefile b/Makefile index ee687b18..79269492 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,11 @@ .PHONY: tests tests: vendor ## Run all tests - vendor/bin/phpunit --color + vendor/bin/simple-phpunit --color yarn test .PHONY: cc cc: vendor ## Show test coverage rates (HTML) - vendor/bin/phpunit --coverage-html ./build + vendor/bin/simple-phpunit --coverage-html ./build .PHONY: cs cs: vendor ## Fix all files using defined ECS rules @@ -18,11 +18,11 @@ st: vendor ## Run static analyse ################################################ ci-mu: vendor ## Mutation tests (for Github only) - vendor/bin/infection --logger-github -s --threads=$(nproc) --min-msi=80 --min-covered-msi=80 + vendor/bin/infection --logger-github -s --threads=$$(nproc) --min-msi=80 --min-covered-msi=80 .PHONY: ci-cc ci-cc: vendor ## Show test coverage rates (for CI/CD only) - vendor/bin/phpunit --coverage-text + vendor/bin/simple-phpunit --coverage-text .PHONY: ci-cs ci-cs: vendor ## Check all files using defined ECS rules (for CI/CD only) diff --git a/composer.json b/composer.json index 9ccd346a..11d72b23 100644 --- a/composer.json +++ b/composer.json @@ -50,6 +50,7 @@ }, "require-dev": { "ext-gmp": "*", + "ext-openssl": "*", "ekino/phpstan-banned-code": "^1.0", "infection/infection": "^0.26", "php-parallel-lint/php-parallel-lint": "^1.3", @@ -58,14 +59,17 @@ "phpstan/phpstan-deprecation-rules": "^1.0", "phpstan/phpstan-phpunit": "^1.1", "phpstan/phpstan-strict-rules": "^1.3", - "phpunit/phpunit": "^9.5.5", - "rector/rector": "^0.14", + "rector/rector": "0.15.0", "roave/security-advisories": "dev-latest", "symfony/phpunit-bridge": "^6.1", - "symfony/var-dumper": "^6.1", "symplify/easy-coding-standard": "^11.1", "thecodingmachine/phpstan-safe-rule": "^1.2" }, + "suggest": { + "ext-openssl": "For OpenSSL based cyphering", + "ext-gmp": "For better performance (or BCMath)", + "ext-bcmath": "For better performance (or GMP)" + }, "autoload": { "psr-4": { "SpomkyLabs\\Pki\\": "src/" diff --git a/phpstan.neon b/phpstan.neon index 0b17c1e9..14ebfff0 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -22,7 +22,7 @@ parameters: path: src/X501/StringPrep/InsignificantNonSubstringSpaceStep.php count: 2 - - message: '#Offset int does not exist on array\\|null\.#' + message: '#Offset int might not exist on array\\|null\.#' path: src/ASN1/Type/Structure.php count: 1 checkMissingIterableValueType: true diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 28afd143..b12a0ac9 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,35 +1,34 @@ - + src - tests/ - - - - + + + + + diff --git a/rector.php b/rector.php index 716f4638..15ea4774 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; @@ -16,7 +15,7 @@ return static function (RectorConfig $config): void { $config->import(SetList::DEAD_CODE); $config->import(LevelSetList::UP_TO_PHP_81); - $config->import(SymfonyLevelSetList::UP_TO_SYMFONY_60); + $config->import(SymfonyLevelSetList::UP_TO_SYMFONY_61); $config->import(SymfonySetList::SYMFONY_CODE_QUALITY); $config->import(SymfonySetList::SYMFONY_52_VALIDATOR_ATTRIBUTES); $config->import(SymfonySetList::SYMFONY_CONSTRUCTOR_INJECTION); @@ -35,7 +34,4 @@ $config->parallel(); $config->importNames(); $config->importShortClasses(); - - $services = $config->services(); - $services->set(TypedPropertyRector::class); }; diff --git a/src/ASN1/Type/Primitive/GeneralizedTime.php b/src/ASN1/Type/Primitive/GeneralizedTime.php index cd52cc5d..a5fd4aec 100644 --- a/src/ASN1/Type/Primitive/GeneralizedTime.php +++ b/src/ASN1/Type/Primitive/GeneralizedTime.php @@ -103,7 +103,7 @@ protected static function decodeFromDER(Identifier $identifier, string $data, in if (isset($match[7])) { $frac = $match[7]; // DER restricts trailing zeroes in fractional seconds component - if ($frac[mb_strlen((string) $frac, '8bit') - 1] === '0') { + if ($frac[mb_strlen($frac, '8bit') - 1] === '0') { throw new DecodeException('Fractional seconds must omit trailing zeroes.'); } } else { diff --git a/src/ASN1/Type/Primitive/RelativeOID.php b/src/ASN1/Type/Primitive/RelativeOID.php index 67e44e9f..e65237ba 100644 --- a/src/ASN1/Type/Primitive/RelativeOID.php +++ b/src/ASN1/Type/Primitive/RelativeOID.php @@ -37,8 +37,9 @@ final class RelativeOID extends Element /** * @param string $oid OID in dotted format */ - private function __construct(private readonly string $oid) - { + private function __construct( + private readonly string $oid + ) { parent::__construct(self::TYPE_RELATIVE_OID); $this->subids = self::explodeDottedOID($oid); } diff --git a/src/CryptoEncoding/PEM.php b/src/CryptoEncoding/PEM.php index 0001b88b..f052afc6 100644 --- a/src/CryptoEncoding/PEM.php +++ b/src/CryptoEncoding/PEM.php @@ -4,6 +4,7 @@ namespace SpomkyLabs\Pki\CryptoEncoding; +use function is_string; use RuntimeException; use Stringable; use UnexpectedValueException; @@ -85,6 +86,9 @@ public static function fromString(string $str): self throw new UnexpectedValueException('Not a PEM formatted string.'); } $payload = preg_replace('/\s+/', '', $match[2]); + if (! is_string($payload)) { + throw new UnexpectedValueException('Failed to decode PEM data.'); + } $data = base64_decode($payload, true); if ($data === false) { throw new UnexpectedValueException('Failed to decode PEM data.'); diff --git a/src/CryptoEncoding/PEMBundle.php b/src/CryptoEncoding/PEMBundle.php index ae0cbe84..707bf6da 100644 --- a/src/CryptoEncoding/PEMBundle.php +++ b/src/CryptoEncoding/PEMBundle.php @@ -7,6 +7,7 @@ use ArrayIterator; use function count; use Countable; +use function is_string; use IteratorAggregate; use LogicException; use const PREG_SET_ORDER; @@ -26,11 +27,11 @@ final class PEMBundle implements Countable, IteratorAggregate, Stringable * * @var PEM[] */ - private array $_pems; + private array $pems; private function __construct(PEM ...$pems) { - $this->_pems = $pems; + $this->pems = $pems; } public function __toString(): string @@ -53,8 +54,11 @@ public static function fromString(string $str): self throw new UnexpectedValueException('No PEM blocks.'); } $pems = array_map( - function ($match) { + static function ($match) { $payload = preg_replace('/\s+/', '', $match[2]); + if (! is_string($payload)) { + throw new UnexpectedValueException('Failed to decode PEM data.'); + } $data = base64_decode($payload, true); if ($data === false) { throw new UnexpectedValueException('Failed to decode PEM data.'); @@ -87,7 +91,7 @@ public static function fromFile(string $filename): self public function withPEMs(PEM ...$pems): self { $obj = clone $this; - $obj->_pems = array_merge($obj->_pems, $pems); + $obj->pems = array_merge($obj->pems, $pems); return $obj; } @@ -98,7 +102,7 @@ public function withPEMs(PEM ...$pems): self */ public function all(): array { - return $this->_pems; + return $this->pems; } /** @@ -106,10 +110,10 @@ public function all(): array */ public function first(): PEM { - if (count($this->_pems) === 0) { + if (count($this->pems) === 0) { throw new LogicException('No PEMs.'); } - return $this->_pems[0]; + return $this->pems[0]; } /** @@ -117,10 +121,10 @@ public function first(): PEM */ public function last(): PEM { - if (count($this->_pems) === 0) { + if (count($this->pems) === 0) { throw new LogicException('No PEMs.'); } - return $this->_pems[count($this->_pems) - 1]; + return $this->pems[count($this->pems) - 1]; } /** @@ -128,7 +132,7 @@ public function last(): PEM */ public function count(): int { - return count($this->_pems); + return count($this->pems); } /** @@ -138,7 +142,7 @@ public function count(): int */ public function getIterator(): ArrayIterator { - return new ArrayIterator($this->_pems); + return new ArrayIterator($this->pems); } /** @@ -146,6 +150,6 @@ public function getIterator(): ArrayIterator */ public function string(): string { - return implode("\n", array_map(static fn (PEM $pem) => $pem->string(), $this->_pems)); + return implode("\n", array_map(static fn (PEM $pem) => $pem->string(), $this->pems)); } } diff --git a/src/CryptoTypes/AlgorithmIdentifier/AlgorithmIdentifier.php b/src/CryptoTypes/AlgorithmIdentifier/AlgorithmIdentifier.php index bf8efd90..71226d43 100644 --- a/src/CryptoTypes/AlgorithmIdentifier/AlgorithmIdentifier.php +++ b/src/CryptoTypes/AlgorithmIdentifier/AlgorithmIdentifier.php @@ -98,8 +98,9 @@ abstract class AlgorithmIdentifier implements AlgorithmIdentifierType final public const OID_SHA512 = '2.16.840.1.101.3.4.2.3'; - protected function __construct(protected readonly string $oid) - { + protected function __construct( + protected readonly string $oid + ) { } /** diff --git a/src/CryptoTypes/AlgorithmIdentifier/Asymmetric/ECPublicKeyAlgorithmIdentifier.php b/src/CryptoTypes/AlgorithmIdentifier/Asymmetric/ECPublicKeyAlgorithmIdentifier.php index 64422c3e..5571f611 100644 --- a/src/CryptoTypes/AlgorithmIdentifier/Asymmetric/ECPublicKeyAlgorithmIdentifier.php +++ b/src/CryptoTypes/AlgorithmIdentifier/Asymmetric/ECPublicKeyAlgorithmIdentifier.php @@ -244,8 +244,9 @@ final class ECPublicKeyAlgorithmIdentifier extends SpecificAlgorithmIdentifier i /** * @param string $namedCurve Curve identifier */ - private function __construct(private readonly string $namedCurve) - { + private function __construct( + private readonly string $namedCurve + ) { parent::__construct(self::OID_EC_PUBLIC_KEY); } diff --git a/src/CryptoTypes/Asymmetric/RFC8410/RFC8410PublicKey.php b/src/CryptoTypes/Asymmetric/RFC8410/RFC8410PublicKey.php index 2d497733..ceec70b3 100644 --- a/src/CryptoTypes/Asymmetric/RFC8410/RFC8410PublicKey.php +++ b/src/CryptoTypes/Asymmetric/RFC8410/RFC8410PublicKey.php @@ -20,8 +20,9 @@ abstract class RFC8410PublicKey extends PublicKey /** * @param string $publicKey Public key data */ - protected function __construct(private readonly string $publicKey) - { + protected function __construct( + private readonly string $publicKey + ) { } public function toDER(): string diff --git a/src/X501/ASN1/AttributeType.php b/src/X501/ASN1/AttributeType.php index a6546ba8..2cb3f514 100644 --- a/src/X501/ASN1/AttributeType.php +++ b/src/X501/ASN1/AttributeType.php @@ -411,8 +411,9 @@ final class AttributeType /** * @param string $_oid OID in dotted format */ - private function __construct(protected string $_oid) - { + private function __construct( + protected string $_oid + ) { } public static function create(string $oid): self diff --git a/src/X501/ASN1/AttributeValue/AttributeValue.php b/src/X501/ASN1/AttributeValue/AttributeValue.php index ab3ea2bb..c3167ebb 100644 --- a/src/X501/ASN1/AttributeValue/AttributeValue.php +++ b/src/X501/ASN1/AttributeValue/AttributeValue.php @@ -46,8 +46,9 @@ abstract class AttributeValue implements Stringable /** * @param string $oid OID of the attribute type. */ - protected function __construct(protected string $oid) - { + protected function __construct( + protected string $oid + ) { } /** diff --git a/src/X501/DN/DNParser.php b/src/X501/DN/DNParser.php index eb735f29..340b72ec 100644 --- a/src/X501/DN/DNParser.php +++ b/src/X501/DN/DNParser.php @@ -33,8 +33,9 @@ final class DNParser /** * @param string $_dn Distinguised name */ - private function __construct(private readonly string $_dn) - { + private function __construct( + private readonly string $_dn + ) { $this->_len = mb_strlen($_dn, '8bit'); } @@ -340,7 +341,7 @@ private function _regexMatch(string $pattern, int &$offset): ?string if (preg_match($pattern, mb_substr($this->_dn, $idx, null, '8bit'), $match) !== 1) { return null; } - $idx += mb_strlen((string) $match[0], '8bit'); + $idx += mb_strlen($match[0], '8bit'); $offset = $idx; return end($match); } diff --git a/src/X501/StringPrep/MapStep.php b/src/X501/StringPrep/MapStep.php index b361f96b..6855d9e2 100644 --- a/src/X501/StringPrep/MapStep.php +++ b/src/X501/StringPrep/MapStep.php @@ -16,8 +16,9 @@ final class MapStep implements PrepareStep /** * @param bool $fold Whether to apply case folding */ - private function __construct(protected bool $fold) - { + private function __construct( + protected bool $fold + ) { } public static function create(bool $fold = false): self diff --git a/src/X501/StringPrep/TranscodeStep.php b/src/X501/StringPrep/TranscodeStep.php index 31de87d6..58f94d3c 100644 --- a/src/X501/StringPrep/TranscodeStep.php +++ b/src/X501/StringPrep/TranscodeStep.php @@ -32,8 +32,9 @@ final class TranscodeStep implements PrepareStep /** * @param int $_type ASN.1 type tag of the string */ - private function __construct(private readonly int $_type) - { + private function __construct( + private readonly int $_type + ) { } public static function create(int $_type): self diff --git a/src/X509/Certificate/Extension/CertificatePolicy/PolicyQualifierInfo.php b/src/X509/Certificate/Extension/CertificatePolicy/PolicyQualifierInfo.php index 4ad37e73..240ad9db 100644 --- a/src/X509/Certificate/Extension/CertificatePolicy/PolicyQualifierInfo.php +++ b/src/X509/Certificate/Extension/CertificatePolicy/PolicyQualifierInfo.php @@ -31,8 +31,9 @@ abstract class PolicyQualifierInfo */ public const OID_UNOTICE = '1.3.6.1.5.5.7.2.2'; - protected function __construct(protected string $oid) - { + protected function __construct( + protected string $oid + ) { } /** diff --git a/src/X509/Certificate/Extension/DistributionPoint/DistributionPointName.php b/src/X509/Certificate/Extension/DistributionPoint/DistributionPointName.php index 4dcce51e..633333a9 100644 --- a/src/X509/Certificate/Extension/DistributionPoint/DistributionPointName.php +++ b/src/X509/Certificate/Extension/DistributionPoint/DistributionPointName.php @@ -22,8 +22,9 @@ abstract class DistributionPointName public const TAG_RDN = 1; - protected function __construct(protected int $tag) - { + protected function __construct( + protected int $tag + ) { } /** diff --git a/src/X509/Certificate/Extension/Target/Target.php b/src/X509/Certificate/Extension/Target/Target.php index 6c200723..eb3f6af4 100644 --- a/src/X509/Certificate/Extension/Target/Target.php +++ b/src/X509/Certificate/Extension/Target/Target.php @@ -22,8 +22,9 @@ abstract class Target public const TYPE_CERT = 2; - protected function __construct(protected int $type) - { + protected function __construct( + protected int $type + ) { } /** diff --git a/src/X509/CertificationPath/PathBuilding/CertificationPathBuilder.php b/src/X509/CertificationPath/PathBuilding/CertificationPathBuilder.php index 80f535c1..ac6ed1b0 100644 --- a/src/X509/CertificationPath/PathBuilding/CertificationPathBuilder.php +++ b/src/X509/CertificationPath/PathBuilding/CertificationPathBuilder.php @@ -20,8 +20,9 @@ final class CertificationPathBuilder /** * @param CertificateBundle $trustList List of trust anchors */ - private function __construct(private readonly CertificateBundle $trustList) - { + private function __construct( + private readonly CertificateBundle $trustList + ) { } public static function create(CertificateBundle $trustList): self diff --git a/src/X509/CertificationPath/PathValidation/ValidatorState.php b/src/X509/CertificationPath/PathValidation/ValidatorState.php index 9415601b..7f83b1d7 100644 --- a/src/X509/CertificationPath/PathValidation/ValidatorState.php +++ b/src/X509/CertificationPath/PathValidation/ValidatorState.php @@ -7,6 +7,7 @@ use LogicException; use SpomkyLabs\Pki\ASN1\Element; use SpomkyLabs\Pki\CryptoTypes\AlgorithmIdentifier\Feature\AlgorithmIdentifierType; +use SpomkyLabs\Pki\CryptoTypes\AlgorithmIdentifier\Feature\SignatureAlgorithmIdentifier; use SpomkyLabs\Pki\CryptoTypes\Asymmetric\PublicKeyInfo; use SpomkyLabs\Pki\X501\ASN1\Name; use SpomkyLabs\Pki\X509\Certificate\Certificate; @@ -81,10 +82,8 @@ final class ValidatorState * Working public key algorithm (working_public_key_algorithm). * * The digital signature algorithm used to verify the signature of a certificate. - * - * @var AlgorithmIdentifierType */ - private $_workingPublicKeyAlgorithm; + private SignatureAlgorithmIdentifier|AlgorithmIdentifierType|null $_workingPublicKeyAlgorithm = null; /** * Working public key (working_public_key). diff --git a/src/X509/CertificationPath/Policy/PolicyTree.php b/src/X509/CertificationPath/Policy/PolicyTree.php index 914f7258..5f70e740 100644 --- a/src/X509/CertificationPath/Policy/PolicyTree.php +++ b/src/X509/CertificationPath/Policy/PolicyTree.php @@ -16,8 +16,9 @@ final class PolicyTree /** * @param PolicyNode $root Initial root node */ - private function __construct(private ?PolicyNode $root) - { + private function __construct( + private ?PolicyNode $root + ) { } public static function create(?PolicyNode $root): self diff --git a/src/X509/GeneralName/DNSName.php b/src/X509/GeneralName/DNSName.php index 61eafe3a..a71db11a 100644 --- a/src/X509/GeneralName/DNSName.php +++ b/src/X509/GeneralName/DNSName.php @@ -19,8 +19,9 @@ final class DNSName extends GeneralName /** * @param string $name Domain name */ - private function __construct(private readonly string $name) - { + private function __construct( + private readonly string $name + ) { parent::__construct(self::TAG_DNS_NAME); } diff --git a/src/X509/GeneralName/EDIPartyName.php b/src/X509/GeneralName/EDIPartyName.php index 0bd02027..231c4d59 100644 --- a/src/X509/GeneralName/EDIPartyName.php +++ b/src/X509/GeneralName/EDIPartyName.php @@ -20,8 +20,9 @@ */ final class EDIPartyName extends GeneralName { - private function __construct(protected Sequence $element) - { + private function __construct( + protected Sequence $element + ) { parent::__construct(self::TAG_EDI_PARTY_NAME); } diff --git a/src/X509/GeneralName/GeneralName.php b/src/X509/GeneralName/GeneralName.php index 159f7798..485f5957 100644 --- a/src/X509/GeneralName/GeneralName.php +++ b/src/X509/GeneralName/GeneralName.php @@ -36,8 +36,9 @@ abstract class GeneralName implements Stringable public const TAG_REGISTERED_ID = 8; - protected function __construct(protected int $tag) - { + protected function __construct( + protected int $tag + ) { } /** diff --git a/src/X509/GeneralName/RegisteredID.php b/src/X509/GeneralName/RegisteredID.php index 6b84b0da..a30e02a7 100644 --- a/src/X509/GeneralName/RegisteredID.php +++ b/src/X509/GeneralName/RegisteredID.php @@ -19,8 +19,9 @@ final class RegisteredID extends GeneralName /** * @param string $oid OID in dotted format */ - private function __construct(private readonly string $oid) - { + private function __construct( + private readonly string $oid + ) { parent::__construct(self::TAG_REGISTERED_ID); } diff --git a/src/X509/GeneralName/X400Address.php b/src/X509/GeneralName/X400Address.php index 31c6de56..8b0476c2 100644 --- a/src/X509/GeneralName/X400Address.php +++ b/src/X509/GeneralName/X400Address.php @@ -20,8 +20,9 @@ */ final class X400Address extends GeneralName { - protected function __construct(private readonly Sequence $element) - { + protected function __construct( + private readonly Sequence $element + ) { parent::__construct(self::TAG_X400_ADDRESS); } diff --git a/tests/CryptoBridge/Unit/Crypto/OpenSSLCryptoTest.php b/tests/CryptoBridge/Unit/Crypto/OpenSSLCryptoTest.php index 230126cb..3f51b976 100644 --- a/tests/CryptoBridge/Unit/Crypto/OpenSSLCryptoTest.php +++ b/tests/CryptoBridge/Unit/Crypto/OpenSSLCryptoTest.php @@ -34,6 +34,7 @@ use SpomkyLabs\Pki\CryptoTypes\AlgorithmIdentifier\Signature\SHA384WithRSAEncryptionAlgorithmIdentifier; use SpomkyLabs\Pki\CryptoTypes\AlgorithmIdentifier\Signature\SHA512WithRSAEncryptionAlgorithmIdentifier; use SpomkyLabs\Pki\CryptoTypes\AlgorithmIdentifier\SpecificAlgorithmIdentifier; +use SpomkyLabs\Pki\CryptoTypes\Asymmetric\OneAsymmetricKey; use SpomkyLabs\Pki\CryptoTypes\Asymmetric\PrivateKeyInfo; use SpomkyLabs\Pki\CryptoTypes\Asymmetric\RSA\RSAPrivateKey; use SpomkyLabs\Pki\CryptoTypes\Signature\RSASignature; @@ -51,15 +52,9 @@ final class OpenSSLCryptoTest extends TestCase private static ?OpenSSLCrypto $_crypto; - /** - * @var PrivateKeyInfo - */ - private static $_rsaPrivKeyInfo; + private static ?OneAsymmetricKey $_rsaPrivKeyInfo = null; - /** - * @var PrivateKeyInfo - */ - private static $_ecPrivKeyInfo; + private static ?OneAsymmetricKey $_ecPrivKeyInfo = null; public static function setUpBeforeClass(): void { @@ -91,7 +86,7 @@ public function signAndVerifyRSA(SignatureAlgorithmIdentifier $algo): void public function provideSignAndVerifyRSA(): iterable { - yield [MD4WithRSAEncryptionAlgorithmIdentifier::create()]; + //yield [MD4WithRSAEncryptionAlgorithmIdentifier::create()]; /** Removed as MD4 is now obsolete and fails with newer OpenSSL versions */ yield [MD5WithRSAEncryptionAlgorithmIdentifier::create()]; yield [SHA1WithRSAEncryptionAlgorithmIdentifier::create()]; yield [SHA224WithRSAEncryptionAlgorithmIdentifier::create()]; @@ -174,16 +169,16 @@ public function provideEncryptAndDecrypt(): iterable $data16 = str_repeat($data8, 2); $iv8 = hex2bin('8877665544332211'); $iv16 = str_repeat($iv8, 2); - $key5 = hex2bin('1122334455'); + //$key5 = hex2bin('1122334455'); $key8 = hex2bin('1122334455667788'); $key16 = str_repeat($key8, 2); $key24 = str_repeat($key8, 3); $key32 = str_repeat($key16, 2); - yield [$data8, DESCBCAlgorithmIdentifier::create($iv8), $key8]; + //yield [$data8, DESCBCAlgorithmIdentifier::create($iv8), $key8]; /** Removed as now obsolete and fails with newer OpenSSL versions */ yield [$data8, DESEDE3CBCAlgorithmIdentifier::create($iv8), $key24]; - yield [$data8, RC2CBCAlgorithmIdentifier::create(40, $iv8), $key5]; - yield [$data8, RC2CBCAlgorithmIdentifier::create(64, $iv8), $key8]; - yield [$data8, RC2CBCAlgorithmIdentifier::create(128, $iv8), $key16]; + //yield [$data8, RC2CBCAlgorithmIdentifier::create(40, $iv8), $key5]; /** Removed as now obsolete and fails with newer OpenSSL versions */ + //yield [$data8, RC2CBCAlgorithmIdentifier::create(64, $iv8), $key8]; /** Removed as now obsolete and fails with newer OpenSSL versions */ + //yield [$data8, RC2CBCAlgorithmIdentifier::create(128, $iv8), $key16]; /** Removed as now obsolete and fails with newer OpenSSL versions */ yield [$data16, AES128CBCAlgorithmIdentifier::create($iv16), $key16]; yield [$data16, AES192CBCAlgorithmIdentifier::create($iv16), $key24]; yield [$data16, AES256CBCAlgorithmIdentifier::create($iv16), $key32]; @@ -268,7 +263,7 @@ public function provideSignatureMethod(): iterable { $rsa_key = PrivateKeyInfo::fromPEM(PEM::fromFile(TEST_ASSETS_DIR . '/rsa/private_key.pem')); $ec_key = PrivateKeyInfo::fromPEM(PEM::fromFile(TEST_ASSETS_DIR . '/ec/private_key.pem')); - yield [$rsa_key, MD4WithRSAEncryptionAlgorithmIdentifier::create()]; + //yield [$rsa_key, MD4WithRSAEncryptionAlgorithmIdentifier::create()]; /** Removed as MD4 is now obsolete and fails with newer OpenSSL versions */ yield [$rsa_key, MD5WithRSAEncryptionAlgorithmIdentifier::create()]; yield [$rsa_key, SHA1WithRSAEncryptionAlgorithmIdentifier::create()]; yield [$rsa_key, SHA224WithRSAEncryptionAlgorithmIdentifier::create()]; diff --git a/tests/CryptoTypes/Unit/AlgoId/AlgorithmIdentifierTest.php b/tests/CryptoTypes/Unit/AlgoId/AlgorithmIdentifierTest.php index 6482cb6c..30f31d15 100644 --- a/tests/CryptoTypes/Unit/AlgoId/AlgorithmIdentifierTest.php +++ b/tests/CryptoTypes/Unit/AlgoId/AlgorithmIdentifierTest.php @@ -16,7 +16,7 @@ */ final class AlgorithmIdentifierTest extends TestCase { - private static $_unknownASN1; + private static ?Sequence $_unknownASN1 = null; public static function setUpBeforeClass(): void { diff --git a/tests/X501/Unit/StringPrep/TranscodeStepTest.php b/tests/X501/Unit/StringPrep/TranscodeStepTest.php index ee6e6e52..7ad8be57 100644 --- a/tests/X501/Unit/StringPrep/TranscodeStepTest.php +++ b/tests/X501/Unit/StringPrep/TranscodeStepTest.php @@ -41,7 +41,7 @@ public function bMP() { static $str = 'κόσμε'; $step = TranscodeStep::create(Element::TYPE_BMP_STRING); - static::assertEquals($str, $step->apply(mb_convert_encoding($str, 'UCS-2BE', 'UTF-8'))); + static::assertEquals($str, $step->apply(mb_convert_encoding((string) $str, 'UCS-2BE', 'UTF-8'))); } /** @@ -51,7 +51,7 @@ public function universal() { static $str = 'κόσμε'; $step = TranscodeStep::create(Element::TYPE_UNIVERSAL_STRING); - static::assertEquals($str, $step->apply(mb_convert_encoding($str, 'UCS-4BE', 'UTF-8'))); + static::assertEquals($str, $step->apply(mb_convert_encoding((string) $str, 'UCS-4BE', 'UTF-8'))); } /** diff --git a/tests/X509/Integration/Ac/HolderTest.php b/tests/X509/Integration/Ac/HolderTest.php index de8d4f33..7eec7d7d 100644 --- a/tests/X509/Integration/Ac/HolderTest.php +++ b/tests/X509/Integration/Ac/HolderTest.php @@ -17,7 +17,7 @@ */ final class HolderTest extends TestCase { - private static $_pkc; + private static ?Certificate $_pkc = null; public static function setUpBeforeClass(): void { diff --git a/tests/X509/Integration/Ac/IssuerSerialTest.php b/tests/X509/Integration/Ac/IssuerSerialTest.php index 0e29f7d5..a69a8792 100644 --- a/tests/X509/Integration/Ac/IssuerSerialTest.php +++ b/tests/X509/Integration/Ac/IssuerSerialTest.php @@ -7,6 +7,7 @@ use PHPUnit\Framework\TestCase; use SpomkyLabs\Pki\CryptoEncoding\PEM; use SpomkyLabs\Pki\CryptoTypes\AlgorithmIdentifier\Signature\SHA256WithRSAEncryptionAlgorithmIdentifier; +use SpomkyLabs\Pki\CryptoTypes\Asymmetric\OneAsymmetricKey; use SpomkyLabs\Pki\CryptoTypes\Asymmetric\PrivateKeyInfo; use SpomkyLabs\Pki\X501\ASN1\Name; use SpomkyLabs\Pki\X509\AttributeCertificate\IssuerSerial; @@ -22,9 +23,9 @@ */ final class IssuerSerialTest extends TestCase { - private static $_cert; + private static ?Certificate $_cert = null; - private static $_privKey; + private static ?OneAsymmetricKey $_privKey = null; public static function setUpBeforeClass(): void { diff --git a/tests/X509/Integration/Ac/IssuerTest.php b/tests/X509/Integration/Ac/IssuerTest.php index abf4e919..663e637a 100644 --- a/tests/X509/Integration/Ac/IssuerTest.php +++ b/tests/X509/Integration/Ac/IssuerTest.php @@ -15,7 +15,7 @@ */ final class IssuerTest extends TestCase { - private static $_pkc; + private static ?Certificate $_pkc = null; public static function setUpBeforeClass(): void { diff --git a/tests/X509/Integration/AcValidation/InvalidHolderNameTest.php b/tests/X509/Integration/AcValidation/InvalidHolderNameTest.php index a0240b14..74d54fd5 100644 --- a/tests/X509/Integration/AcValidation/InvalidHolderNameTest.php +++ b/tests/X509/Integration/AcValidation/InvalidHolderNameTest.php @@ -11,6 +11,7 @@ use SpomkyLabs\Pki\CryptoTypes\Asymmetric\PrivateKeyInfo; use SpomkyLabs\Pki\X509\AttributeCertificate\AttCertIssuer; use SpomkyLabs\Pki\X509\AttributeCertificate\AttCertValidityPeriod; +use SpomkyLabs\Pki\X509\AttributeCertificate\AttributeCertificate; use SpomkyLabs\Pki\X509\AttributeCertificate\AttributeCertificateInfo; use SpomkyLabs\Pki\X509\AttributeCertificate\Attributes; use SpomkyLabs\Pki\X509\AttributeCertificate\Holder; @@ -29,11 +30,11 @@ */ final class InvalidHolderNameTest extends TestCase { - private static $_holderPath; + private static ?CertificationPath $_holderPath = null; - private static $_issuerPath; + private static ?CertificationPath $_issuerPath = null; - private static $_ac; + private static ?AttributeCertificate $_ac = null; public static function setUpBeforeClass(): void { diff --git a/tests/X509/Integration/AcValidation/InvalidHolderPathTest.php b/tests/X509/Integration/AcValidation/InvalidHolderPathTest.php index 3ebc35fb..ea592484 100644 --- a/tests/X509/Integration/AcValidation/InvalidHolderPathTest.php +++ b/tests/X509/Integration/AcValidation/InvalidHolderPathTest.php @@ -11,6 +11,7 @@ use SpomkyLabs\Pki\CryptoTypes\Asymmetric\PrivateKeyInfo; use SpomkyLabs\Pki\X509\AttributeCertificate\AttCertIssuer; use SpomkyLabs\Pki\X509\AttributeCertificate\AttCertValidityPeriod; +use SpomkyLabs\Pki\X509\AttributeCertificate\AttributeCertificate; use SpomkyLabs\Pki\X509\AttributeCertificate\AttributeCertificateInfo; use SpomkyLabs\Pki\X509\AttributeCertificate\Attributes; use SpomkyLabs\Pki\X509\AttributeCertificate\Holder; @@ -26,11 +27,11 @@ */ final class InvalidHolderPathTest extends TestCase { - private static $_holderPath; + private static ?CertificationPath $_holderPath = null; - private static $_issuerPath; + private static ?CertificationPath $_issuerPath = null; - private static $_ac; + private static ?AttributeCertificate $_ac = null; public static function setUpBeforeClass(): void { diff --git a/tests/X509/Integration/AcValidation/InvalidIssuerNameTest.php b/tests/X509/Integration/AcValidation/InvalidIssuerNameTest.php index 67ab3fdb..e3c4b73b 100644 --- a/tests/X509/Integration/AcValidation/InvalidIssuerNameTest.php +++ b/tests/X509/Integration/AcValidation/InvalidIssuerNameTest.php @@ -12,6 +12,7 @@ use SpomkyLabs\Pki\X501\ASN1\Name; use SpomkyLabs\Pki\X509\AttributeCertificate\AttCertIssuer; use SpomkyLabs\Pki\X509\AttributeCertificate\AttCertValidityPeriod; +use SpomkyLabs\Pki\X509\AttributeCertificate\AttributeCertificate; use SpomkyLabs\Pki\X509\AttributeCertificate\AttributeCertificateInfo; use SpomkyLabs\Pki\X509\AttributeCertificate\Attributes; use SpomkyLabs\Pki\X509\AttributeCertificate\Holder; @@ -27,11 +28,11 @@ */ final class InvalidIssuerNameTest extends TestCase { - private static $_holderPath; + private static ?CertificationPath $_holderPath = null; - private static $_issuerPath; + private static ?CertificationPath $_issuerPath = null; - private static $_ac; + private static ?AttributeCertificate $_ac = null; public static function setUpBeforeClass(): void { diff --git a/tests/X509/Integration/AcValidation/InvalidIssuerPathTest.php b/tests/X509/Integration/AcValidation/InvalidIssuerPathTest.php index 22f61e92..91bf142e 100644 --- a/tests/X509/Integration/AcValidation/InvalidIssuerPathTest.php +++ b/tests/X509/Integration/AcValidation/InvalidIssuerPathTest.php @@ -11,6 +11,7 @@ use SpomkyLabs\Pki\CryptoTypes\Asymmetric\PrivateKeyInfo; use SpomkyLabs\Pki\X509\AttributeCertificate\AttCertIssuer; use SpomkyLabs\Pki\X509\AttributeCertificate\AttCertValidityPeriod; +use SpomkyLabs\Pki\X509\AttributeCertificate\AttributeCertificate; use SpomkyLabs\Pki\X509\AttributeCertificate\AttributeCertificateInfo; use SpomkyLabs\Pki\X509\AttributeCertificate\Attributes; use SpomkyLabs\Pki\X509\AttributeCertificate\Holder; @@ -26,11 +27,11 @@ */ final class InvalidIssuerPathTest extends TestCase { - private static $_holderPath; + private static ?CertificationPath $_holderPath = null; - private static $_issuerPath; + private static ?CertificationPath $_issuerPath = null; - private static $_ac; + private static ?AttributeCertificate $_ac = null; public static function setUpBeforeClass(): void { diff --git a/tests/X509/Integration/AcValidation/InvalidKeyUsageTest.php b/tests/X509/Integration/AcValidation/InvalidKeyUsageTest.php index 248b53f2..b4479c04 100644 --- a/tests/X509/Integration/AcValidation/InvalidKeyUsageTest.php +++ b/tests/X509/Integration/AcValidation/InvalidKeyUsageTest.php @@ -13,6 +13,7 @@ use SpomkyLabs\Pki\X501\ASN1\Name; use SpomkyLabs\Pki\X509\AttributeCertificate\AttCertIssuer; use SpomkyLabs\Pki\X509\AttributeCertificate\AttCertValidityPeriod; +use SpomkyLabs\Pki\X509\AttributeCertificate\AttributeCertificate; use SpomkyLabs\Pki\X509\AttributeCertificate\AttributeCertificateInfo; use SpomkyLabs\Pki\X509\AttributeCertificate\Attributes; use SpomkyLabs\Pki\X509\AttributeCertificate\Holder; @@ -31,11 +32,11 @@ */ final class InvalidKeyUsageTest extends TestCase { - private static $_holderPath; + private static ?CertificationPath $_holderPath = null; - private static $_issuerPath; + private static ?CertificationPath $_issuerPath = null; - private static $_ac; + private static ?AttributeCertificate $_ac = null; public static function setUpBeforeClass(): void { diff --git a/tests/X509/Integration/AcValidation/InvalidSignatureTest.php b/tests/X509/Integration/AcValidation/InvalidSignatureTest.php index c48ead0f..6df8e35c 100644 --- a/tests/X509/Integration/AcValidation/InvalidSignatureTest.php +++ b/tests/X509/Integration/AcValidation/InvalidSignatureTest.php @@ -11,6 +11,7 @@ use SpomkyLabs\Pki\CryptoTypes\Asymmetric\PrivateKeyInfo; use SpomkyLabs\Pki\X509\AttributeCertificate\AttCertIssuer; use SpomkyLabs\Pki\X509\AttributeCertificate\AttCertValidityPeriod; +use SpomkyLabs\Pki\X509\AttributeCertificate\AttributeCertificate; use SpomkyLabs\Pki\X509\AttributeCertificate\AttributeCertificateInfo; use SpomkyLabs\Pki\X509\AttributeCertificate\Attributes; use SpomkyLabs\Pki\X509\AttributeCertificate\Holder; @@ -26,11 +27,11 @@ */ final class InvalidSignatureTest extends TestCase { - private static $_holderPath; + private static ?CertificationPath $_holderPath = null; - private static $_issuerPath; + private static ?CertificationPath $_issuerPath = null; - private static $_ac; + private static ?AttributeCertificate $_ac = null; public static function setUpBeforeClass(): void { diff --git a/tests/X509/Integration/AcValidation/NoTargetingTest.php b/tests/X509/Integration/AcValidation/NoTargetingTest.php index fbaf632d..440a5e3b 100644 --- a/tests/X509/Integration/AcValidation/NoTargetingTest.php +++ b/tests/X509/Integration/AcValidation/NoTargetingTest.php @@ -28,11 +28,11 @@ */ final class NoTargetingTest extends TestCase { - private static $_holderPath; + private static ?CertificationPath $_holderPath = null; - private static $_issuerPath; + private static ?CertificationPath $_issuerPath = null; - private static $_ac; + private static ?AttributeCertificate $_ac = null; public static function setUpBeforeClass(): void { diff --git a/tests/X509/Integration/AcValidation/PassingTest.php b/tests/X509/Integration/AcValidation/PassingTest.php index bdcfa834..6c63387a 100644 --- a/tests/X509/Integration/AcValidation/PassingTest.php +++ b/tests/X509/Integration/AcValidation/PassingTest.php @@ -29,11 +29,11 @@ */ final class PassingTest extends TestCase { - private static $_holderPath; + private static ?CertificationPath $_holderPath = null; - private static $_issuerPath; + private static ?CertificationPath $_issuerPath = null; - private static $_ac; + private static ?AttributeCertificate $_ac = null; public static function setUpBeforeClass(): void { diff --git a/tests/X509/Integration/AcValidation/TargetMismatchTest.php b/tests/X509/Integration/AcValidation/TargetMismatchTest.php index a1145ff6..79c3f802 100644 --- a/tests/X509/Integration/AcValidation/TargetMismatchTest.php +++ b/tests/X509/Integration/AcValidation/TargetMismatchTest.php @@ -11,6 +11,7 @@ use SpomkyLabs\Pki\CryptoTypes\Asymmetric\PrivateKeyInfo; use SpomkyLabs\Pki\X509\AttributeCertificate\AttCertIssuer; use SpomkyLabs\Pki\X509\AttributeCertificate\AttCertValidityPeriod; +use SpomkyLabs\Pki\X509\AttributeCertificate\AttributeCertificate; use SpomkyLabs\Pki\X509\AttributeCertificate\AttributeCertificateInfo; use SpomkyLabs\Pki\X509\AttributeCertificate\Attributes; use SpomkyLabs\Pki\X509\AttributeCertificate\Holder; @@ -29,11 +30,11 @@ */ final class TargetMismatchTest extends TestCase { - private static $_holderPath; + private static ?CertificationPath $_holderPath = null; - private static $_issuerPath; + private static ?CertificationPath $_issuerPath = null; - private static $_ac; + private static ?AttributeCertificate $_ac = null; public static function setUpBeforeClass(): void { diff --git a/tests/X509/Integration/AcValidation/ValidityTest.php b/tests/X509/Integration/AcValidation/ValidityTest.php index d89fbee2..cac00112 100644 --- a/tests/X509/Integration/AcValidation/ValidityTest.php +++ b/tests/X509/Integration/AcValidation/ValidityTest.php @@ -12,6 +12,7 @@ use SpomkyLabs\Pki\CryptoTypes\Asymmetric\PrivateKeyInfo; use SpomkyLabs\Pki\X509\AttributeCertificate\AttCertIssuer; use SpomkyLabs\Pki\X509\AttributeCertificate\AttCertValidityPeriod; +use SpomkyLabs\Pki\X509\AttributeCertificate\AttributeCertificate; use SpomkyLabs\Pki\X509\AttributeCertificate\AttributeCertificateInfo; use SpomkyLabs\Pki\X509\AttributeCertificate\Attributes; use SpomkyLabs\Pki\X509\AttributeCertificate\Holder; @@ -27,11 +28,11 @@ */ final class ValidityTest extends TestCase { - private static $_holderPath; + private static ?CertificationPath $_holderPath = null; - private static $_issuerPath; + private static ?CertificationPath $_issuerPath = null; - private static $_ac; + private static ?AttributeCertificate $_ac = null; public static function setUpBeforeClass(): void { diff --git a/tests/X509/Integration/Certificate/CertificateEqualsTest.php b/tests/X509/Integration/Certificate/CertificateEqualsTest.php index 1f5e1b56..54c4b0c7 100644 --- a/tests/X509/Integration/Certificate/CertificateEqualsTest.php +++ b/tests/X509/Integration/Certificate/CertificateEqualsTest.php @@ -15,11 +15,11 @@ */ final class CertificateEqualsTest extends TestCase { - private static $_cert1; + private static ?Certificate $_cert1 = null; - private static $_cert1DifKey; + private static ?Certificate $_cert1DifKey = null; - private static $_cert2; + private static ?Certificate $_cert2 = null; public static function setUpBeforeClass(): void { diff --git a/tests/X509/Integration/PathValidation/BasicConstraintsMissingTest.php b/tests/X509/Integration/PathValidation/BasicConstraintsMissingTest.php index 6625a8f4..07ae0721 100644 --- a/tests/X509/Integration/PathValidation/BasicConstraintsMissingTest.php +++ b/tests/X509/Integration/PathValidation/BasicConstraintsMissingTest.php @@ -9,7 +9,9 @@ use SpomkyLabs\Pki\CryptoEncoding\PEM; use SpomkyLabs\Pki\CryptoTypes\AlgorithmIdentifier\Signature\SHA1WithRSAEncryptionAlgorithmIdentifier; use SpomkyLabs\Pki\CryptoTypes\Asymmetric\PrivateKey; +use SpomkyLabs\Pki\CryptoTypes\Asymmetric\PrivateKeyInfo; use SpomkyLabs\Pki\X501\ASN1\Name; +use SpomkyLabs\Pki\X509\Certificate\Certificate; use SpomkyLabs\Pki\X509\Certificate\TBSCertificate; use SpomkyLabs\Pki\X509\Certificate\Validity; use SpomkyLabs\Pki\X509\CertificationPath\CertificationPath; @@ -27,13 +29,13 @@ final class BasicConstraintsMissingTest extends TestCase public const CERT_NAME = 'cn=EE'; - private static $_caKey; + private static ?PrivateKeyInfo $_caKey = null; - private static $_ca; + private static ?Certificate $_ca = null; - private static $_certKey; + private static ?PrivateKeyInfo $_certKey = null; - private static $_cert; + private static ?Certificate $_cert = null; public static function setUpBeforeClass(): void { diff --git a/tests/X509/Integration/PathValidation/DifferentAlgoParamsTest.php b/tests/X509/Integration/PathValidation/DifferentAlgoParamsTest.php index daa7ae3f..4543c3eb 100644 --- a/tests/X509/Integration/PathValidation/DifferentAlgoParamsTest.php +++ b/tests/X509/Integration/PathValidation/DifferentAlgoParamsTest.php @@ -9,7 +9,9 @@ use SpomkyLabs\Pki\CryptoEncoding\PEM; use SpomkyLabs\Pki\CryptoTypes\AlgorithmIdentifier\Signature\SHA1WithRSAEncryptionAlgorithmIdentifier; use SpomkyLabs\Pki\CryptoTypes\Asymmetric\PrivateKey; +use SpomkyLabs\Pki\CryptoTypes\Asymmetric\PrivateKeyInfo; use SpomkyLabs\Pki\X501\ASN1\Name; +use SpomkyLabs\Pki\X509\Certificate\Certificate; use SpomkyLabs\Pki\X509\Certificate\TBSCertificate; use SpomkyLabs\Pki\X509\Certificate\Validity; use SpomkyLabs\Pki\X509\CertificationPath\CertificationPath; @@ -27,13 +29,13 @@ final class DifferentAlgoParamsTest extends TestCase public const CERT_NAME = 'cn=EE'; - private static $_caKey; + private static ?PrivateKeyInfo $_caKey = null; - private static $_ca; + private static ?Certificate $_ca = null; - private static $_certKey; + private static ?PrivateKeyInfo $_certKey = null; - private static $_cert; + private static ?Certificate $_cert = null; public static function setUpBeforeClass(): void { diff --git a/tests/X509/Integration/PathValidation/InhibitAnyPolicyTest.php b/tests/X509/Integration/PathValidation/InhibitAnyPolicyTest.php index a18a5d6b..286ab3a2 100644 --- a/tests/X509/Integration/PathValidation/InhibitAnyPolicyTest.php +++ b/tests/X509/Integration/PathValidation/InhibitAnyPolicyTest.php @@ -9,7 +9,9 @@ use SpomkyLabs\Pki\CryptoEncoding\PEM; use SpomkyLabs\Pki\CryptoTypes\AlgorithmIdentifier\Signature\SHA1WithRSAEncryptionAlgorithmIdentifier; use SpomkyLabs\Pki\CryptoTypes\Asymmetric\PrivateKey; +use SpomkyLabs\Pki\CryptoTypes\Asymmetric\PrivateKeyInfo; use SpomkyLabs\Pki\X501\ASN1\Name; +use SpomkyLabs\Pki\X509\Certificate\Certificate; use SpomkyLabs\Pki\X509\Certificate\Extension\BasicConstraintsExtension; use SpomkyLabs\Pki\X509\Certificate\Extension\InhibitAnyPolicyExtension; use SpomkyLabs\Pki\X509\Certificate\TBSCertificate; @@ -29,13 +31,13 @@ final class InhibitAnyPolicyTest extends TestCase public const CERT_NAME = 'cn=EE'; - private static $_caKey; + private static ?PrivateKeyInfo $_caKey = null; - private static $_ca; + private static ?Certificate $_ca = null; - private static $_certKey; + private static ?PrivateKeyInfo $_certKey = null; - private static $_cert; + private static ?Certificate $_cert = null; public static function setUpBeforeClass(): void { diff --git a/tests/X509/Integration/PathValidation/IntermediateTest.php b/tests/X509/Integration/PathValidation/IntermediateTest.php index 765d65c8..58e36581 100644 --- a/tests/X509/Integration/PathValidation/IntermediateTest.php +++ b/tests/X509/Integration/PathValidation/IntermediateTest.php @@ -9,7 +9,9 @@ use SpomkyLabs\Pki\CryptoEncoding\PEM; use SpomkyLabs\Pki\CryptoTypes\AlgorithmIdentifier\Signature\SHA1WithRSAEncryptionAlgorithmIdentifier; use SpomkyLabs\Pki\CryptoTypes\Asymmetric\PrivateKey; +use SpomkyLabs\Pki\CryptoTypes\Asymmetric\PrivateKeyInfo; use SpomkyLabs\Pki\X501\ASN1\Name; +use SpomkyLabs\Pki\X509\Certificate\Certificate; use SpomkyLabs\Pki\X509\Certificate\Extension\BasicConstraintsExtension; use SpomkyLabs\Pki\X509\Certificate\Extension\KeyUsageExtension; use SpomkyLabs\Pki\X509\Certificate\TBSCertificate; @@ -29,17 +31,17 @@ final class IntermediateTest extends TestCase public const CERT_NAME = 'cn=EE'; - private static $_caKey; + private static ?PrivateKeyInfo $_caKey = null; - private static $_ca; + private static ?Certificate $_ca = null; - private static $_intermKey; + private static ?PrivateKeyInfo $_intermKey = null; - private static $_interm; + private static ?Certificate $_interm = null; - private static $_certKey; + private static ?PrivateKeyInfo $_certKey = null; - private static $_cert; + private static ?Certificate $_cert = null; public static function setUpBeforeClass(): void { diff --git a/tests/X509/Integration/PathValidation/IssuerMismatchTest.php b/tests/X509/Integration/PathValidation/IssuerMismatchTest.php index 64616cfc..67d8fecb 100644 --- a/tests/X509/Integration/PathValidation/IssuerMismatchTest.php +++ b/tests/X509/Integration/PathValidation/IssuerMismatchTest.php @@ -9,7 +9,9 @@ use SpomkyLabs\Pki\CryptoEncoding\PEM; use SpomkyLabs\Pki\CryptoTypes\AlgorithmIdentifier\Signature\SHA1WithRSAEncryptionAlgorithmIdentifier; use SpomkyLabs\Pki\CryptoTypes\Asymmetric\PrivateKey; +use SpomkyLabs\Pki\CryptoTypes\Asymmetric\PrivateKeyInfo; use SpomkyLabs\Pki\X501\ASN1\Name; +use SpomkyLabs\Pki\X509\Certificate\Certificate; use SpomkyLabs\Pki\X509\Certificate\TBSCertificate; use SpomkyLabs\Pki\X509\Certificate\Validity; use SpomkyLabs\Pki\X509\CertificationPath\CertificationPath; @@ -27,13 +29,13 @@ final class IssuerMismatchTest extends TestCase public const CERT_NAME = 'cn=EE'; - private static $_caKey; + private static ?PrivateKeyInfo $_caKey = null; - private static $_ca; + private static ?Certificate $_ca = null; - private static $_certKey; + private static ?PrivateKeyInfo $_certKey = null; - private static $_cert; + private static ?Certificate $_cert = null; public static function setUpBeforeClass(): void { diff --git a/tests/X509/Integration/PathValidation/NameConstraintsTest.php b/tests/X509/Integration/PathValidation/NameConstraintsTest.php index 472ac282..42c01366 100644 --- a/tests/X509/Integration/PathValidation/NameConstraintsTest.php +++ b/tests/X509/Integration/PathValidation/NameConstraintsTest.php @@ -9,7 +9,9 @@ use SpomkyLabs\Pki\CryptoEncoding\PEM; use SpomkyLabs\Pki\CryptoTypes\AlgorithmIdentifier\Signature\SHA1WithRSAEncryptionAlgorithmIdentifier; use SpomkyLabs\Pki\CryptoTypes\Asymmetric\PrivateKey; +use SpomkyLabs\Pki\CryptoTypes\Asymmetric\PrivateKeyInfo; use SpomkyLabs\Pki\X501\ASN1\Name; +use SpomkyLabs\Pki\X509\Certificate\Certificate; use SpomkyLabs\Pki\X509\Certificate\Extension\BasicConstraintsExtension; use SpomkyLabs\Pki\X509\Certificate\Extension\NameConstraints\GeneralSubtree; use SpomkyLabs\Pki\X509\Certificate\Extension\NameConstraints\GeneralSubtrees; @@ -32,13 +34,13 @@ final class NameConstraintsTest extends TestCase public const CERT_NAME = 'cn=EE,c=FI'; - private static $_caKey; + private static ?PrivateKeyInfo $_caKey = null; - private static $_ca; + private static ?Certificate $_ca = null; - private static $_certKey; + private static ?PrivateKeyInfo $_certKey = null; - private static $_cert; + private static ?Certificate $_cert = null; public static function setUpBeforeClass(): void { diff --git a/tests/X509/Integration/PathValidation/NoPoliciesTest.php b/tests/X509/Integration/PathValidation/NoPoliciesTest.php index ed8e2e8b..29df9110 100644 --- a/tests/X509/Integration/PathValidation/NoPoliciesTest.php +++ b/tests/X509/Integration/PathValidation/NoPoliciesTest.php @@ -9,7 +9,9 @@ use SpomkyLabs\Pki\CryptoEncoding\PEM; use SpomkyLabs\Pki\CryptoTypes\AlgorithmIdentifier\Signature\SHA1WithRSAEncryptionAlgorithmIdentifier; use SpomkyLabs\Pki\CryptoTypes\Asymmetric\PrivateKey; +use SpomkyLabs\Pki\CryptoTypes\Asymmetric\PrivateKeyInfo; use SpomkyLabs\Pki\X501\ASN1\Name; +use SpomkyLabs\Pki\X509\Certificate\Certificate; use SpomkyLabs\Pki\X509\Certificate\Extension\BasicConstraintsExtension; use SpomkyLabs\Pki\X509\Certificate\Extension\CertificatePoliciesExtension; use SpomkyLabs\Pki\X509\Certificate\Extension\CertificatePolicy\PolicyInformation; @@ -29,13 +31,13 @@ final class NoPoliciesTest extends TestCase public const CERT_NAME = 'cn=EE'; - private static $_caKey; + private static ?PrivateKeyInfo $_caKey = null; - private static $_ca; + private static ?Certificate $_ca = null; - private static $_certKey; + private static ?PrivateKeyInfo $_certKey = null; - private static $_cert; + private static ?Certificate $_cert = null; public static function setUpBeforeClass(): void { diff --git a/tests/X509/Integration/PathValidation/NotCATest.php b/tests/X509/Integration/PathValidation/NotCATest.php index f3cce486..67e5a395 100644 --- a/tests/X509/Integration/PathValidation/NotCATest.php +++ b/tests/X509/Integration/PathValidation/NotCATest.php @@ -9,7 +9,9 @@ use SpomkyLabs\Pki\CryptoEncoding\PEM; use SpomkyLabs\Pki\CryptoTypes\AlgorithmIdentifier\Signature\SHA1WithRSAEncryptionAlgorithmIdentifier; use SpomkyLabs\Pki\CryptoTypes\Asymmetric\PrivateKey; +use SpomkyLabs\Pki\CryptoTypes\Asymmetric\PrivateKeyInfo; use SpomkyLabs\Pki\X501\ASN1\Name; +use SpomkyLabs\Pki\X509\Certificate\Certificate; use SpomkyLabs\Pki\X509\Certificate\Extension\BasicConstraintsExtension; use SpomkyLabs\Pki\X509\Certificate\TBSCertificate; use SpomkyLabs\Pki\X509\Certificate\Validity; @@ -28,13 +30,13 @@ final class NotCATest extends TestCase public const CERT_NAME = 'cn=EE'; - private static $_caKey; + private static ?PrivateKeyInfo $_caKey = null; - private static $_ca; + private static ?Certificate $_ca = null; - private static $_certKey; + private static ?PrivateKeyInfo $_certKey = null; - private static $_cert; + private static ?Certificate $_cert = null; public static function setUpBeforeClass(): void { diff --git a/tests/X509/Integration/PathValidation/NotKeyCertSignTest.php b/tests/X509/Integration/PathValidation/NotKeyCertSignTest.php index b27aa634..136520df 100644 --- a/tests/X509/Integration/PathValidation/NotKeyCertSignTest.php +++ b/tests/X509/Integration/PathValidation/NotKeyCertSignTest.php @@ -9,7 +9,9 @@ use SpomkyLabs\Pki\CryptoEncoding\PEM; use SpomkyLabs\Pki\CryptoTypes\AlgorithmIdentifier\Signature\SHA1WithRSAEncryptionAlgorithmIdentifier; use SpomkyLabs\Pki\CryptoTypes\Asymmetric\PrivateKey; +use SpomkyLabs\Pki\CryptoTypes\Asymmetric\PrivateKeyInfo; use SpomkyLabs\Pki\X501\ASN1\Name; +use SpomkyLabs\Pki\X509\Certificate\Certificate; use SpomkyLabs\Pki\X509\Certificate\Extension\BasicConstraintsExtension; use SpomkyLabs\Pki\X509\Certificate\Extension\KeyUsageExtension; use SpomkyLabs\Pki\X509\Certificate\TBSCertificate; @@ -29,13 +31,13 @@ final class NotKeyCertSignTest extends TestCase public const CERT_NAME = 'cn=EE'; - private static $_caKey; + private static ?PrivateKeyInfo $_caKey = null; - private static $_ca; + private static ?Certificate $_ca = null; - private static $_certKey; + private static ?PrivateKeyInfo $_certKey = null; - private static $_cert; + private static ?Certificate $_cert = null; public static function setUpBeforeClass(): void { diff --git a/tests/X509/Integration/PathValidation/PathLengthFailTest.php b/tests/X509/Integration/PathValidation/PathLengthFailTest.php index 4b169e28..8481b0fb 100644 --- a/tests/X509/Integration/PathValidation/PathLengthFailTest.php +++ b/tests/X509/Integration/PathValidation/PathLengthFailTest.php @@ -9,7 +9,9 @@ use SpomkyLabs\Pki\CryptoEncoding\PEM; use SpomkyLabs\Pki\CryptoTypes\AlgorithmIdentifier\Signature\SHA1WithRSAEncryptionAlgorithmIdentifier; use SpomkyLabs\Pki\CryptoTypes\Asymmetric\PrivateKey; +use SpomkyLabs\Pki\CryptoTypes\Asymmetric\PrivateKeyInfo; use SpomkyLabs\Pki\X501\ASN1\Name; +use SpomkyLabs\Pki\X509\Certificate\Certificate; use SpomkyLabs\Pki\X509\Certificate\Extension\BasicConstraintsExtension; use SpomkyLabs\Pki\X509\Certificate\TBSCertificate; use SpomkyLabs\Pki\X509\Certificate\Validity; @@ -30,17 +32,17 @@ final class PathLengthFailTest extends TestCase public const CERT_NAME = 'cn=EE'; - private static $_caKey; + private static ?PrivateKeyInfo $_caKey = null; - private static $_ca; + private static ?Certificate $_ca = null; - private static $_intermKey; + private static ?PrivateKeyInfo $_intermKey = null; - private static $_interm; + private static ?Certificate $_interm = null; - private static $_certKey; + private static ?PrivateKeyInfo $_certKey = null; - private static $_cert; + private static ?Certificate $_cert = null; public static function setUpBeforeClass(): void { diff --git a/tests/X509/Integration/PathValidation/PathLengthTest.php b/tests/X509/Integration/PathValidation/PathLengthTest.php index a25d2e8c..a8905cf4 100644 --- a/tests/X509/Integration/PathValidation/PathLengthTest.php +++ b/tests/X509/Integration/PathValidation/PathLengthTest.php @@ -9,7 +9,9 @@ use SpomkyLabs\Pki\CryptoEncoding\PEM; use SpomkyLabs\Pki\CryptoTypes\AlgorithmIdentifier\Signature\SHA1WithRSAEncryptionAlgorithmIdentifier; use SpomkyLabs\Pki\CryptoTypes\Asymmetric\PrivateKey; +use SpomkyLabs\Pki\CryptoTypes\Asymmetric\PrivateKeyInfo; use SpomkyLabs\Pki\X501\ASN1\Name; +use SpomkyLabs\Pki\X509\Certificate\Certificate; use SpomkyLabs\Pki\X509\Certificate\Extension\BasicConstraintsExtension; use SpomkyLabs\Pki\X509\Certificate\TBSCertificate; use SpomkyLabs\Pki\X509\Certificate\Validity; @@ -28,13 +30,13 @@ final class PathLengthTest extends TestCase public const CERT_NAME = 'cn=EE'; - private static $_caKey; + private static ?PrivateKeyInfo $_caKey = null; - private static $_ca; + private static ?Certificate $_ca = null; - private static $_certKey; + private static ?PrivateKeyInfo $_certKey = null; - private static $_cert; + private static ?Certificate $_cert = null; public static function setUpBeforeClass(): void { diff --git a/tests/X509/Integration/PathValidation/PoliciesTest.php b/tests/X509/Integration/PathValidation/PoliciesTest.php index 48cbbb4f..a92134a4 100644 --- a/tests/X509/Integration/PathValidation/PoliciesTest.php +++ b/tests/X509/Integration/PathValidation/PoliciesTest.php @@ -9,7 +9,9 @@ use SpomkyLabs\Pki\CryptoEncoding\PEM; use SpomkyLabs\Pki\CryptoTypes\AlgorithmIdentifier\Signature\SHA1WithRSAEncryptionAlgorithmIdentifier; use SpomkyLabs\Pki\CryptoTypes\Asymmetric\PrivateKey; +use SpomkyLabs\Pki\CryptoTypes\Asymmetric\PrivateKeyInfo; use SpomkyLabs\Pki\X501\ASN1\Name; +use SpomkyLabs\Pki\X509\Certificate\Certificate; use SpomkyLabs\Pki\X509\Certificate\Extension\BasicConstraintsExtension; use SpomkyLabs\Pki\X509\Certificate\Extension\CertificatePoliciesExtension; use SpomkyLabs\Pki\X509\Certificate\Extension\CertificatePolicy\PolicyInformation; @@ -30,13 +32,13 @@ final class PoliciesTest extends TestCase public const CERT_NAME = 'cn=EE'; - private static $_caKey; + private static ?PrivateKeyInfo $_caKey = null; - private static $_ca; + private static ?Certificate $_ca = null; - private static $_certKey; + private static ?PrivateKeyInfo $_certKey = null; - private static $_cert; + private static ?Certificate $_cert = null; public static function setUpBeforeClass(): void { diff --git a/tests/X509/Integration/PathValidation/PolicyErrorTest.php b/tests/X509/Integration/PathValidation/PolicyErrorTest.php index da303871..7317034b 100644 --- a/tests/X509/Integration/PathValidation/PolicyErrorTest.php +++ b/tests/X509/Integration/PathValidation/PolicyErrorTest.php @@ -9,7 +9,9 @@ use SpomkyLabs\Pki\CryptoEncoding\PEM; use SpomkyLabs\Pki\CryptoTypes\AlgorithmIdentifier\Signature\SHA1WithRSAEncryptionAlgorithmIdentifier; use SpomkyLabs\Pki\CryptoTypes\Asymmetric\PrivateKey; +use SpomkyLabs\Pki\CryptoTypes\Asymmetric\PrivateKeyInfo; use SpomkyLabs\Pki\X501\ASN1\Name; +use SpomkyLabs\Pki\X509\Certificate\Certificate; use SpomkyLabs\Pki\X509\Certificate\Extension\BasicConstraintsExtension; use SpomkyLabs\Pki\X509\Certificate\Extension\CertificatePoliciesExtension; use SpomkyLabs\Pki\X509\Certificate\Extension\CertificatePolicy\PolicyInformation; @@ -31,13 +33,13 @@ final class PolicyErrorTest extends TestCase public const CERT_NAME = 'cn=EE'; - private static $_caKey; + private static ?PrivateKeyInfo $_caKey = null; - private static $_ca; + private static ?Certificate $_ca = null; - private static $_certKey; + private static ?PrivateKeyInfo $_certKey = null; - private static $_cert; + private static ?Certificate $_cert = null; public static function setUpBeforeClass(): void { diff --git a/tests/X509/Integration/PathValidation/PolicyIntersectionAnyPolicyTest.php b/tests/X509/Integration/PathValidation/PolicyIntersectionAnyPolicyTest.php index 0a3693a3..0a34cc2e 100644 --- a/tests/X509/Integration/PathValidation/PolicyIntersectionAnyPolicyTest.php +++ b/tests/X509/Integration/PathValidation/PolicyIntersectionAnyPolicyTest.php @@ -9,7 +9,9 @@ use SpomkyLabs\Pki\CryptoEncoding\PEM; use SpomkyLabs\Pki\CryptoTypes\AlgorithmIdentifier\Signature\SHA1WithRSAEncryptionAlgorithmIdentifier; use SpomkyLabs\Pki\CryptoTypes\Asymmetric\PrivateKey; +use SpomkyLabs\Pki\CryptoTypes\Asymmetric\PrivateKeyInfo; use SpomkyLabs\Pki\X501\ASN1\Name; +use SpomkyLabs\Pki\X509\Certificate\Certificate; use SpomkyLabs\Pki\X509\Certificate\Extension\BasicConstraintsExtension; use SpomkyLabs\Pki\X509\Certificate\Extension\CertificatePoliciesExtension; use SpomkyLabs\Pki\X509\Certificate\Extension\CertificatePolicy\PolicyInformation; @@ -29,13 +31,13 @@ final class PolicyIntersectionAnyPolicyTest extends TestCase public const CERT_NAME = 'cn=EE'; - private static $_caKey; + private static ?PrivateKeyInfo $_caKey = null; - private static $_ca; + private static ?Certificate $_ca = null; - private static $_certKey; + private static ?PrivateKeyInfo $_certKey = null; - private static $_cert; + private static ?Certificate $_cert = null; public static function setUpBeforeClass(): void { diff --git a/tests/X509/Integration/PathValidation/PolicyIntersectionPruneTest.php b/tests/X509/Integration/PathValidation/PolicyIntersectionPruneTest.php index dbe5f843..ab82b87e 100644 --- a/tests/X509/Integration/PathValidation/PolicyIntersectionPruneTest.php +++ b/tests/X509/Integration/PathValidation/PolicyIntersectionPruneTest.php @@ -9,7 +9,9 @@ use SpomkyLabs\Pki\CryptoEncoding\PEM; use SpomkyLabs\Pki\CryptoTypes\AlgorithmIdentifier\Signature\SHA1WithRSAEncryptionAlgorithmIdentifier; use SpomkyLabs\Pki\CryptoTypes\Asymmetric\PrivateKey; +use SpomkyLabs\Pki\CryptoTypes\Asymmetric\PrivateKeyInfo; use SpomkyLabs\Pki\X501\ASN1\Name; +use SpomkyLabs\Pki\X509\Certificate\Certificate; use SpomkyLabs\Pki\X509\Certificate\Extension\BasicConstraintsExtension; use SpomkyLabs\Pki\X509\Certificate\Extension\CertificatePoliciesExtension; use SpomkyLabs\Pki\X509\Certificate\Extension\CertificatePolicy\PolicyInformation; @@ -30,13 +32,13 @@ final class PolicyIntersectionPruneTest extends TestCase public const CERT_NAME = 'cn=EE'; - private static $_caKey; + private static ?PrivateKeyInfo $_caKey = null; - private static $_ca; + private static ?Certificate $_ca = null; - private static $_certKey; + private static ?PrivateKeyInfo $_certKey = null; - private static $_cert; + private static ?Certificate $_cert = null; public static function setUpBeforeClass(): void { diff --git a/tests/X509/Integration/PathValidation/PolicyIntersectionRemoveTest.php b/tests/X509/Integration/PathValidation/PolicyIntersectionRemoveTest.php index 2f5b29ff..070dacaf 100644 --- a/tests/X509/Integration/PathValidation/PolicyIntersectionRemoveTest.php +++ b/tests/X509/Integration/PathValidation/PolicyIntersectionRemoveTest.php @@ -9,7 +9,9 @@ use SpomkyLabs\Pki\CryptoEncoding\PEM; use SpomkyLabs\Pki\CryptoTypes\AlgorithmIdentifier\Signature\SHA1WithRSAEncryptionAlgorithmIdentifier; use SpomkyLabs\Pki\CryptoTypes\Asymmetric\PrivateKey; +use SpomkyLabs\Pki\CryptoTypes\Asymmetric\PrivateKeyInfo; use SpomkyLabs\Pki\X501\ASN1\Name; +use SpomkyLabs\Pki\X509\Certificate\Certificate; use SpomkyLabs\Pki\X509\Certificate\Extension\BasicConstraintsExtension; use SpomkyLabs\Pki\X509\Certificate\Extension\CertificatePoliciesExtension; use SpomkyLabs\Pki\X509\Certificate\Extension\CertificatePolicy\PolicyInformation; @@ -31,17 +33,17 @@ final class PolicyIntersectionRemoveTest extends TestCase public const CERT_NAME = 'cn=EE'; - private static $_caKey; + private static ?PrivateKeyInfo $_caKey = null; - private static $_ca; + private static ?Certificate $_ca = null; - private static $_intermKey; + private static ?PrivateKeyInfo $_intermKey = null; - private static $_interm; + private static ?Certificate $_interm = null; - private static $_certKey; + private static ?PrivateKeyInfo $_certKey = null; - private static $_cert; + private static ?Certificate $_cert = null; public static function setUpBeforeClass(): void { diff --git a/tests/X509/Integration/PathValidation/PolicyIntersectionSingleExplicitTest.php b/tests/X509/Integration/PathValidation/PolicyIntersectionSingleExplicitTest.php index e553fbc0..505366e1 100644 --- a/tests/X509/Integration/PathValidation/PolicyIntersectionSingleExplicitTest.php +++ b/tests/X509/Integration/PathValidation/PolicyIntersectionSingleExplicitTest.php @@ -9,7 +9,9 @@ use SpomkyLabs\Pki\CryptoEncoding\PEM; use SpomkyLabs\Pki\CryptoTypes\AlgorithmIdentifier\Signature\SHA1WithRSAEncryptionAlgorithmIdentifier; use SpomkyLabs\Pki\CryptoTypes\Asymmetric\PrivateKey; +use SpomkyLabs\Pki\CryptoTypes\Asymmetric\PrivateKeyInfo; use SpomkyLabs\Pki\X501\ASN1\Name; +use SpomkyLabs\Pki\X509\Certificate\Certificate; use SpomkyLabs\Pki\X509\Certificate\Extension\BasicConstraintsExtension; use SpomkyLabs\Pki\X509\Certificate\Extension\CertificatePoliciesExtension; use SpomkyLabs\Pki\X509\Certificate\Extension\CertificatePolicy\PolicyInformation; @@ -31,17 +33,17 @@ final class PolicyIntersectionSingleExplicitTest extends TestCase public const CERT_NAME = 'cn=EE'; - private static $_caKey; + private static ?PrivateKeyInfo $_caKey = null; - private static $_ca; + private static ?Certificate $_ca = null; - private static $_intermKey; + private static ?PrivateKeyInfo $_intermKey = null; - private static $_interm; + private static ?Certificate $_interm = null; - private static $_certKey; + private static ?PrivateKeyInfo $_certKey = null; - private static $_cert; + private static ?Certificate $_cert = null; public static function setUpBeforeClass(): void { diff --git a/tests/X509/Integration/PathValidation/PolicyIntersectionTest.php b/tests/X509/Integration/PathValidation/PolicyIntersectionTest.php index 3aa87617..83cd9a30 100644 --- a/tests/X509/Integration/PathValidation/PolicyIntersectionTest.php +++ b/tests/X509/Integration/PathValidation/PolicyIntersectionTest.php @@ -9,7 +9,9 @@ use SpomkyLabs\Pki\CryptoEncoding\PEM; use SpomkyLabs\Pki\CryptoTypes\AlgorithmIdentifier\Signature\SHA1WithRSAEncryptionAlgorithmIdentifier; use SpomkyLabs\Pki\CryptoTypes\Asymmetric\PrivateKey; +use SpomkyLabs\Pki\CryptoTypes\Asymmetric\PrivateKeyInfo; use SpomkyLabs\Pki\X501\ASN1\Name; +use SpomkyLabs\Pki\X509\Certificate\Certificate; use SpomkyLabs\Pki\X509\Certificate\Extension\BasicConstraintsExtension; use SpomkyLabs\Pki\X509\Certificate\Extension\CertificatePoliciesExtension; use SpomkyLabs\Pki\X509\Certificate\Extension\CertificatePolicy\DisplayText; @@ -31,17 +33,17 @@ final class PolicyIntersectionTest extends TestCase public const CERT_NAME = 'cn=EE'; - private static $_caKey; + private static ?PrivateKeyInfo $_caKey = null; - private static $_ca; + private static ?Certificate $_ca = null; - private static $_intermKey; + private static ?PrivateKeyInfo $_intermKey = null; - private static $_interm; + private static ?Certificate $_interm = null; - private static $_certKey; + private static ?PrivateKeyInfo $_certKey = null; - private static $_cert; + private static ?Certificate $_cert = null; public static function setUpBeforeClass(): void { diff --git a/tests/X509/Integration/PathValidation/PolicyMappingAnyPolicyTest.php b/tests/X509/Integration/PathValidation/PolicyMappingAnyPolicyTest.php index cfa73364..3de04ee2 100644 --- a/tests/X509/Integration/PathValidation/PolicyMappingAnyPolicyTest.php +++ b/tests/X509/Integration/PathValidation/PolicyMappingAnyPolicyTest.php @@ -9,7 +9,9 @@ use SpomkyLabs\Pki\CryptoEncoding\PEM; use SpomkyLabs\Pki\CryptoTypes\AlgorithmIdentifier\Signature\SHA1WithRSAEncryptionAlgorithmIdentifier; use SpomkyLabs\Pki\CryptoTypes\Asymmetric\PrivateKey; +use SpomkyLabs\Pki\CryptoTypes\Asymmetric\PrivateKeyInfo; use SpomkyLabs\Pki\X501\ASN1\Name; +use SpomkyLabs\Pki\X509\Certificate\Certificate; use SpomkyLabs\Pki\X509\Certificate\Extension\BasicConstraintsExtension; use SpomkyLabs\Pki\X509\Certificate\Extension\CertificatePoliciesExtension; use SpomkyLabs\Pki\X509\Certificate\Extension\CertificatePolicy\PolicyInformation; @@ -32,13 +34,13 @@ final class PolicyMappingAnyPolicyTest extends TestCase public const CERT_NAME = 'cn=EE'; - private static $_caKey; + private static ?PrivateKeyInfo $_caKey = null; - private static $_ca; + private static ?Certificate $_ca = null; - private static $_certKey; + private static ?PrivateKeyInfo $_certKey = null; - private static $_cert; + private static ?Certificate $_cert = null; public static function setUpBeforeClass(): void { diff --git a/tests/X509/Integration/PathValidation/PolicyMappingInhibitTest.php b/tests/X509/Integration/PathValidation/PolicyMappingInhibitTest.php index 77b7a5d8..11a32d4f 100644 --- a/tests/X509/Integration/PathValidation/PolicyMappingInhibitTest.php +++ b/tests/X509/Integration/PathValidation/PolicyMappingInhibitTest.php @@ -9,7 +9,9 @@ use SpomkyLabs\Pki\CryptoEncoding\PEM; use SpomkyLabs\Pki\CryptoTypes\AlgorithmIdentifier\Signature\SHA1WithRSAEncryptionAlgorithmIdentifier; use SpomkyLabs\Pki\CryptoTypes\Asymmetric\PrivateKey; +use SpomkyLabs\Pki\CryptoTypes\Asymmetric\PrivateKeyInfo; use SpomkyLabs\Pki\X501\ASN1\Name; +use SpomkyLabs\Pki\X509\Certificate\Certificate; use SpomkyLabs\Pki\X509\Certificate\Extension\BasicConstraintsExtension; use SpomkyLabs\Pki\X509\Certificate\Extension\CertificatePoliciesExtension; use SpomkyLabs\Pki\X509\Certificate\Extension\CertificatePolicy\PolicyInformation; @@ -35,17 +37,17 @@ final class PolicyMappingInhibitTest extends TestCase public const CERT_NAME = 'cn=EE'; - private static $_caKey; + private static ?PrivateKeyInfo $_caKey = null; - private static $_ca; + private static ?Certificate $_ca = null; - private static $_intermKey; + private static ?PrivateKeyInfo $_intermKey = null; - private static $_interm; + private static ?Certificate $_interm = null; - private static $_certKey; + private static ?PrivateKeyInfo $_certKey = null; - private static $_cert; + private static ?Certificate $_cert = null; public static function setUpBeforeClass(): void { diff --git a/tests/X509/Integration/PathValidation/PolicyMappingMapAnyTest.php b/tests/X509/Integration/PathValidation/PolicyMappingMapAnyTest.php index 7dbf10b3..1693000a 100644 --- a/tests/X509/Integration/PathValidation/PolicyMappingMapAnyTest.php +++ b/tests/X509/Integration/PathValidation/PolicyMappingMapAnyTest.php @@ -10,7 +10,9 @@ use SpomkyLabs\Pki\CryptoEncoding\PEM; use SpomkyLabs\Pki\CryptoTypes\AlgorithmIdentifier\Signature\SHA1WithRSAEncryptionAlgorithmIdentifier; use SpomkyLabs\Pki\CryptoTypes\Asymmetric\PrivateKey; +use SpomkyLabs\Pki\CryptoTypes\Asymmetric\PrivateKeyInfo; use SpomkyLabs\Pki\X501\ASN1\Name; +use SpomkyLabs\Pki\X509\Certificate\Certificate; use SpomkyLabs\Pki\X509\Certificate\Extension\BasicConstraintsExtension; use SpomkyLabs\Pki\X509\Certificate\Extension\CertificatePoliciesExtension; use SpomkyLabs\Pki\X509\Certificate\Extension\CertificatePolicy\PolicyInformation; @@ -33,13 +35,13 @@ final class PolicyMappingMapAnyTest extends TestCase public const CERT_NAME = 'cn=EE'; - private static $_caKey; + private static ?PrivateKeyInfo $_caKey = null; - private static $_ca; + private static ?Certificate $_ca = null; - private static $_certKey; + private static ?PrivateKeyInfo $_certKey = null; - private static $_cert; + private static ?Certificate $_cert = null; public static function setUpBeforeClass(): void { diff --git a/tests/X509/Integration/PathValidation/PolicyMappingTest.php b/tests/X509/Integration/PathValidation/PolicyMappingTest.php index 22fea877..bc1b74fd 100644 --- a/tests/X509/Integration/PathValidation/PolicyMappingTest.php +++ b/tests/X509/Integration/PathValidation/PolicyMappingTest.php @@ -9,7 +9,9 @@ use SpomkyLabs\Pki\CryptoEncoding\PEM; use SpomkyLabs\Pki\CryptoTypes\AlgorithmIdentifier\Signature\SHA1WithRSAEncryptionAlgorithmIdentifier; use SpomkyLabs\Pki\CryptoTypes\Asymmetric\PrivateKey; +use SpomkyLabs\Pki\CryptoTypes\Asymmetric\PrivateKeyInfo; use SpomkyLabs\Pki\X501\ASN1\Name; +use SpomkyLabs\Pki\X509\Certificate\Certificate; use SpomkyLabs\Pki\X509\Certificate\Extension\BasicConstraintsExtension; use SpomkyLabs\Pki\X509\Certificate\Extension\CertificatePoliciesExtension; use SpomkyLabs\Pki\X509\Certificate\Extension\CertificatePolicy\PolicyInformation; @@ -32,13 +34,13 @@ final class PolicyMappingTest extends TestCase public const CERT_NAME = 'cn=EE'; - private static $_caKey; + private static ?PrivateKeyInfo $_caKey = null; - private static $_ca; + private static ?Certificate $_ca = null; - private static $_certKey; + private static ?PrivateKeyInfo $_certKey = null; - private static $_cert; + private static ?Certificate $_cert = null; public static function setUpBeforeClass(): void { diff --git a/tests/X509/Integration/PathValidation/PolicyProcessPruneTest.php b/tests/X509/Integration/PathValidation/PolicyProcessPruneTest.php index 7c8b3b70..9e25940f 100644 --- a/tests/X509/Integration/PathValidation/PolicyProcessPruneTest.php +++ b/tests/X509/Integration/PathValidation/PolicyProcessPruneTest.php @@ -9,7 +9,9 @@ use SpomkyLabs\Pki\CryptoEncoding\PEM; use SpomkyLabs\Pki\CryptoTypes\AlgorithmIdentifier\Signature\SHA1WithRSAEncryptionAlgorithmIdentifier; use SpomkyLabs\Pki\CryptoTypes\Asymmetric\PrivateKey; +use SpomkyLabs\Pki\CryptoTypes\Asymmetric\PrivateKeyInfo; use SpomkyLabs\Pki\X501\ASN1\Name; +use SpomkyLabs\Pki\X509\Certificate\Certificate; use SpomkyLabs\Pki\X509\Certificate\Extension\BasicConstraintsExtension; use SpomkyLabs\Pki\X509\Certificate\Extension\CertificatePoliciesExtension; use SpomkyLabs\Pki\X509\Certificate\Extension\CertificatePolicy\PolicyInformation; @@ -31,13 +33,13 @@ final class PolicyProcessPruneTest extends TestCase public const CERT_NAME = 'cn=EE'; - private static $_caKey; + private static ?PrivateKeyInfo $_caKey = null; - private static $_ca; + private static ?Certificate $_ca = null; - private static $_certKey; + private static ?PrivateKeyInfo $_certKey = null; - private static $_cert; + private static ?Certificate $_cert = null; public static function setUpBeforeClass(): void { diff --git a/tests/X509/Integration/PathValidation/SignatureMismatchTest.php b/tests/X509/Integration/PathValidation/SignatureMismatchTest.php index fc1ce438..a0b1841b 100644 --- a/tests/X509/Integration/PathValidation/SignatureMismatchTest.php +++ b/tests/X509/Integration/PathValidation/SignatureMismatchTest.php @@ -9,7 +9,9 @@ use SpomkyLabs\Pki\CryptoEncoding\PEM; use SpomkyLabs\Pki\CryptoTypes\AlgorithmIdentifier\Signature\SHA1WithRSAEncryptionAlgorithmIdentifier; use SpomkyLabs\Pki\CryptoTypes\Asymmetric\PrivateKey; +use SpomkyLabs\Pki\CryptoTypes\Asymmetric\PrivateKeyInfo; use SpomkyLabs\Pki\X501\ASN1\Name; +use SpomkyLabs\Pki\X509\Certificate\Certificate; use SpomkyLabs\Pki\X509\Certificate\TBSCertificate; use SpomkyLabs\Pki\X509\Certificate\Validity; use SpomkyLabs\Pki\X509\CertificationPath\CertificationPath; @@ -27,13 +29,13 @@ final class SignatureMismatchTest extends TestCase public const CERT_NAME = 'cn=EE'; - private static $_caKey; + private static ?PrivateKeyInfo $_caKey = null; - private static $_ca; + private static ?Certificate $_ca = null; - private static $_certKey; + private static ?PrivateKeyInfo $_certKey = null; - private static $_cert; + private static ?Certificate $_cert = null; public static function setUpBeforeClass(): void { diff --git a/tests/X509/Integration/PathValidation/WrapUpPolicyErrorTest.php b/tests/X509/Integration/PathValidation/WrapUpPolicyErrorTest.php index 28b0b790..8c40a44f 100644 --- a/tests/X509/Integration/PathValidation/WrapUpPolicyErrorTest.php +++ b/tests/X509/Integration/PathValidation/WrapUpPolicyErrorTest.php @@ -9,7 +9,9 @@ use SpomkyLabs\Pki\CryptoEncoding\PEM; use SpomkyLabs\Pki\CryptoTypes\AlgorithmIdentifier\Signature\SHA1WithRSAEncryptionAlgorithmIdentifier; use SpomkyLabs\Pki\CryptoTypes\Asymmetric\PrivateKey; +use SpomkyLabs\Pki\CryptoTypes\Asymmetric\PrivateKeyInfo; use SpomkyLabs\Pki\X501\ASN1\Name; +use SpomkyLabs\Pki\X509\Certificate\Certificate; use SpomkyLabs\Pki\X509\Certificate\Extension\BasicConstraintsExtension; use SpomkyLabs\Pki\X509\Certificate\Extension\CertificatePoliciesExtension; use SpomkyLabs\Pki\X509\Certificate\Extension\CertificatePolicy\PolicyInformation; @@ -31,13 +33,13 @@ final class WrapUpPolicyErrorTest extends TestCase public const CERT_NAME = 'cn=EE'; - private static $_caKey; + private static ?PrivateKeyInfo $_caKey = null; - private static $_ca; + private static ?Certificate $_ca = null; - private static $_certKey; + private static ?PrivateKeyInfo $_certKey = null; - private static $_cert; + private static ?Certificate $_cert = null; public static function setUpBeforeClass(): void { diff --git a/tests/X509/Integration/Workflow/RequestToCertTest.php b/tests/X509/Integration/Workflow/RequestToCertTest.php index 79246aa0..ee1b6707 100644 --- a/tests/X509/Integration/Workflow/RequestToCertTest.php +++ b/tests/X509/Integration/Workflow/RequestToCertTest.php @@ -10,6 +10,7 @@ use SpomkyLabs\Pki\CryptoTypes\AlgorithmIdentifier\Signature\ECDSAWithSHA1AlgorithmIdentifier; use SpomkyLabs\Pki\CryptoTypes\AlgorithmIdentifier\Signature\SHA256WithRSAEncryptionAlgorithmIdentifier; use SpomkyLabs\Pki\CryptoTypes\AlgorithmIdentifier\Signature\SHA512WithRSAEncryptionAlgorithmIdentifier; +use SpomkyLabs\Pki\CryptoTypes\Asymmetric\OneAsymmetricKey; use SpomkyLabs\Pki\CryptoTypes\Asymmetric\PrivateKeyInfo; use SpomkyLabs\Pki\X501\ASN1\Name; use SpomkyLabs\Pki\X509\Certificate\Certificate; @@ -30,9 +31,9 @@ */ final class RequestToCertTest extends TestCase { - private static $_issuerKey; + private static ?OneAsymmetricKey $_issuerKey = null; - private static $_subjectKey; + private static ?OneAsymmetricKey $_subjectKey = null; public static function setUpBeforeClass(): void { diff --git a/tests/X509/Unit/Ac/AttCertValidityPeriodTest.php b/tests/X509/Unit/Ac/AttCertValidityPeriodTest.php index c14c7f5d..37f66b89 100644 --- a/tests/X509/Unit/Ac/AttCertValidityPeriodTest.php +++ b/tests/X509/Unit/Ac/AttCertValidityPeriodTest.php @@ -14,9 +14,9 @@ */ final class AttCertValidityPeriodTest extends TestCase { - private static $_nb; + private static ?DateTimeImmutable $_nb = null; - private static $_na; + private static DateTimeImmutable $_na; public static function setUpBeforeClass(): void { diff --git a/tests/X509/Unit/Ac/AttributeCertificateInfoTest.php b/tests/X509/Unit/Ac/AttributeCertificateInfoTest.php index 222ce7ee..cd7c2bed 100644 --- a/tests/X509/Unit/Ac/AttributeCertificateInfoTest.php +++ b/tests/X509/Unit/Ac/AttributeCertificateInfoTest.php @@ -14,6 +14,7 @@ use SpomkyLabs\Pki\CryptoTypes\AlgorithmIdentifier\GenericAlgorithmIdentifier; use SpomkyLabs\Pki\CryptoTypes\AlgorithmIdentifier\Signature\SHA1WithRSAEncryptionAlgorithmIdentifier; use SpomkyLabs\Pki\CryptoTypes\AlgorithmIdentifier\Signature\SHA256WithRSAEncryptionAlgorithmIdentifier; +use SpomkyLabs\Pki\CryptoTypes\Asymmetric\OneAsymmetricKey; use SpomkyLabs\Pki\CryptoTypes\Asymmetric\PrivateKeyInfo; use SpomkyLabs\Pki\X501\ASN1\Name; use SpomkyLabs\Pki\X509\AttributeCertificate\AttCertIssuer; @@ -39,17 +40,17 @@ final class AttributeCertificateInfoTest extends TestCase { final public const ISSUER_DN = 'cn=Issuer'; - private static $_holder; + private static ?Holder $_holder = null; - private static $_issuer; + private static ?AttCertIssuer $_issuer = null; - private static $_validity; + private static ?AttCertValidityPeriod $_validity = null; - private static $_attribs; + private static ?Attributes $_attribs = null; - private static $_extensions; + private static ?Extensions $_extensions = null; - private static $_privKeyInfo; + private static ?OneAsymmetricKey $_privKeyInfo = null; public static function setUpBeforeClass(): void { diff --git a/tests/X509/Unit/Ac/HolderTest.php b/tests/X509/Unit/Ac/HolderTest.php index e6af783f..24223ab7 100644 --- a/tests/X509/Unit/Ac/HolderTest.php +++ b/tests/X509/Unit/Ac/HolderTest.php @@ -20,11 +20,11 @@ */ final class HolderTest extends TestCase { - private static $_issuerSerial; + private static ?IssuerSerial $_issuerSerial = null; - private static $_subject; + private static ?GeneralNames $_subject = null; - private static $_odi; + private static ?ObjectDigestInfo $_odi = null; public static function setUpBeforeClass(): void { diff --git a/tests/X509/Unit/Ac/IssuerSerialTest.php b/tests/X509/Unit/Ac/IssuerSerialTest.php index 839321b5..f82d9c31 100644 --- a/tests/X509/Unit/Ac/IssuerSerialTest.php +++ b/tests/X509/Unit/Ac/IssuerSerialTest.php @@ -18,9 +18,9 @@ */ final class IssuerSerialTest extends TestCase { - private static $_issuer; + private static ?GeneralNames $_issuer = null; - private static $_uid; + private static ?UniqueIdentifier $_uid = null; public static function setUpBeforeClass(): void { diff --git a/tests/X509/Unit/Ac/V2FormTest.php b/tests/X509/Unit/Ac/V2FormTest.php index 6d59bdac..3b30536b 100644 --- a/tests/X509/Unit/Ac/V2FormTest.php +++ b/tests/X509/Unit/Ac/V2FormTest.php @@ -23,7 +23,7 @@ */ final class V2FormTest extends TestCase { - private static $_issuerName; + private static ?GeneralNames $_issuerName = null; public static function setUpBeforeClass(): void { diff --git a/tests/X509/Unit/Certificate/CertificateBundleTest.php b/tests/X509/Unit/Certificate/CertificateBundleTest.php index 695b3567..da4c2bf5 100644 --- a/tests/X509/Unit/Certificate/CertificateBundleTest.php +++ b/tests/X509/Unit/Certificate/CertificateBundleTest.php @@ -20,17 +20,17 @@ */ final class CertificateBundleTest extends TestCase { - private static $_pem1; + private static ?PEM $_pem1 = null; - private static $_cert1; + private static ?Certificate $_cert1 = null; - private static $_pem2; + private static ?PEM $_pem2 = null; - private static $_cert2; + private static ?Certificate $_cert2 = null; - private static $_pem3; + private static ?PEM $_pem3 = null; - private static $_cert3; + private static ?Certificate $_cert3 = null; public static function setUpBeforeClass(): void { diff --git a/tests/X509/Unit/Certificate/CertificateChainTest.php b/tests/X509/Unit/Certificate/CertificateChainTest.php index d3bb1c02..75d11633 100644 --- a/tests/X509/Unit/Certificate/CertificateChainTest.php +++ b/tests/X509/Unit/Certificate/CertificateChainTest.php @@ -16,9 +16,15 @@ */ final class CertificateChainTest extends TestCase { - private static $_pems; + /** + * @var PEM[]|null + */ + private static ?array $_pems = null; - private static $_certs; + /** + * @var Certificate[]|null + */ + private static ?array $_certs = null; public static function setUpBeforeClass(): void { diff --git a/tests/X509/Unit/Certificate/CertificateTest.php b/tests/X509/Unit/Certificate/CertificateTest.php index b6c36098..37890ec5 100644 --- a/tests/X509/Unit/Certificate/CertificateTest.php +++ b/tests/X509/Unit/Certificate/CertificateTest.php @@ -11,6 +11,7 @@ use SpomkyLabs\Pki\CryptoTypes\AlgorithmIdentifier\AlgorithmIdentifier; use SpomkyLabs\Pki\CryptoTypes\AlgorithmIdentifier\GenericAlgorithmIdentifier; use SpomkyLabs\Pki\CryptoTypes\AlgorithmIdentifier\Signature\SHA1WithRSAEncryptionAlgorithmIdentifier; +use SpomkyLabs\Pki\CryptoTypes\Asymmetric\OneAsymmetricKey; use SpomkyLabs\Pki\CryptoTypes\Asymmetric\PrivateKeyInfo; use SpomkyLabs\Pki\CryptoTypes\Signature\Signature; use SpomkyLabs\Pki\X501\ASN1\Name; @@ -25,7 +26,7 @@ */ final class CertificateTest extends TestCase { - private static $_privateKeyInfo; + private static ?OneAsymmetricKey $_privateKeyInfo = null; public static function setUpBeforeClass(): void { diff --git a/tests/X509/Unit/Certificate/CertificateVersionTest.php b/tests/X509/Unit/Certificate/CertificateVersionTest.php index 3262b7f6..996410b6 100644 --- a/tests/X509/Unit/Certificate/CertificateVersionTest.php +++ b/tests/X509/Unit/Certificate/CertificateVersionTest.php @@ -7,6 +7,7 @@ use PHPUnit\Framework\TestCase; use SpomkyLabs\Pki\CryptoEncoding\PEM; use SpomkyLabs\Pki\CryptoTypes\AlgorithmIdentifier\Signature\SHA1WithRSAEncryptionAlgorithmIdentifier; +use SpomkyLabs\Pki\CryptoTypes\Asymmetric\OneAsymmetricKey; use SpomkyLabs\Pki\CryptoTypes\Asymmetric\PrivateKeyInfo; use SpomkyLabs\Pki\X501\ASN1\Name; use SpomkyLabs\Pki\X509\Certificate\Extension\KeyUsageExtension; @@ -20,9 +21,9 @@ */ final class CertificateVersionTest extends TestCase { - private static $_privateKeyInfo; + private static ?OneAsymmetricKey $_privateKeyInfo = null; - private static $_tbsCert; + private static ?TBSCertificate $_tbsCert = null; public static function setUpBeforeClass(): void { diff --git a/tests/X509/Unit/Certificate/Extension/FreshestCRLTest.php b/tests/X509/Unit/Certificate/Extension/FreshestCRLTest.php index 5d9ceba2..87a524b1 100644 --- a/tests/X509/Unit/Certificate/Extension/FreshestCRLTest.php +++ b/tests/X509/Unit/Certificate/Extension/FreshestCRLTest.php @@ -20,7 +20,7 @@ */ final class FreshestCRLTest extends TestCase { - private static $_dp; + private static ?DistributionPoint $_dp = null; public static function setUpBeforeClass(): void { diff --git a/tests/X509/Unit/Certificate/Extension/Target/TargetsTest.php b/tests/X509/Unit/Certificate/Extension/Target/TargetsTest.php index 415bff5f..ab731d86 100644 --- a/tests/X509/Unit/Certificate/Extension/Target/TargetsTest.php +++ b/tests/X509/Unit/Certificate/Extension/Target/TargetsTest.php @@ -18,9 +18,9 @@ */ final class TargetsTest extends TestCase { - private static $_name; + private static ?TargetName $_name = null; - private static $_group; + private static ?TargetGroup $_group = null; public static function setUpBeforeClass(): void { diff --git a/tests/X509/Unit/Certificate/TBSCertificateTest.php b/tests/X509/Unit/Certificate/TBSCertificateTest.php index 831b6298..8955d28b 100644 --- a/tests/X509/Unit/Certificate/TBSCertificateTest.php +++ b/tests/X509/Unit/Certificate/TBSCertificateTest.php @@ -13,6 +13,7 @@ use SpomkyLabs\Pki\CryptoEncoding\PEM; use SpomkyLabs\Pki\CryptoTypes\AlgorithmIdentifier\GenericAlgorithmIdentifier; use SpomkyLabs\Pki\CryptoTypes\AlgorithmIdentifier\Signature\SHA1WithRSAEncryptionAlgorithmIdentifier; +use SpomkyLabs\Pki\CryptoTypes\Asymmetric\OneAsymmetricKey; use SpomkyLabs\Pki\CryptoTypes\Asymmetric\PrivateKeyInfo; use SpomkyLabs\Pki\X501\ASN1\Name; use SpomkyLabs\Pki\X509\Certificate\Certificate; @@ -29,13 +30,13 @@ */ final class TBSCertificateTest extends TestCase { - private static $_subject; + private static ?Name $_subject = null; - private static $_privateKeyInfo; + private static ?OneAsymmetricKey $_privateKeyInfo = null; - private static $_issuer; + private static ?Name $_issuer = null; - private static $_validity; + private static ?Validity $_validity = null; public static function setUpBeforeClass(): void { diff --git a/tests/X509/Unit/CertificationPath/CertificationPathBuildingTest.php b/tests/X509/Unit/CertificationPath/CertificationPathBuildingTest.php index 680888cf..abfbd283 100644 --- a/tests/X509/Unit/CertificationPath/CertificationPathBuildingTest.php +++ b/tests/X509/Unit/CertificationPath/CertificationPathBuildingTest.php @@ -17,11 +17,11 @@ */ final class CertificationPathBuildingTest extends TestCase { - private static $_ca; + private static ?Certificate $_ca = null; - private static $_interm; + private static ?Certificate $_interm = null; - private static $_cert; + private static ?Certificate $_cert = null; public static function setUpBeforeClass(): void { diff --git a/tests/X509/Unit/CertificationPath/CertificationPathTest.php b/tests/X509/Unit/CertificationPath/CertificationPathTest.php index 819d5776..c226fa15 100644 --- a/tests/X509/Unit/CertificationPath/CertificationPathTest.php +++ b/tests/X509/Unit/CertificationPath/CertificationPathTest.php @@ -20,7 +20,10 @@ */ final class CertificationPathTest extends TestCase { - private static $_certs; + /** + * @var Certificate[]|null + */ + private static ?array $_certs = null; public static function setUpBeforeClass(): void { diff --git a/tests/X509/Unit/CertificationPath/Validation/ValidatorStateTest.php b/tests/X509/Unit/CertificationPath/Validation/ValidatorStateTest.php index e2027a6e..aa3d6a78 100644 --- a/tests/X509/Unit/CertificationPath/Validation/ValidatorStateTest.php +++ b/tests/X509/Unit/CertificationPath/Validation/ValidatorStateTest.php @@ -17,7 +17,7 @@ */ final class ValidatorStateTest extends TestCase { - private static $_ca; + private static ?Certificate $_ca = null; public static function setUpBeforeClass(): void { diff --git a/tests/X509/Unit/Csr/CertificationRequestInfoTest.php b/tests/X509/Unit/Csr/CertificationRequestInfoTest.php index 91e49f89..75aa58b8 100644 --- a/tests/X509/Unit/Csr/CertificationRequestInfoTest.php +++ b/tests/X509/Unit/Csr/CertificationRequestInfoTest.php @@ -10,6 +10,7 @@ use SpomkyLabs\Pki\ASN1\Type\Primitive\Integer; use SpomkyLabs\Pki\CryptoEncoding\PEM; use SpomkyLabs\Pki\CryptoTypes\AlgorithmIdentifier\Signature\SHA1WithRSAEncryptionAlgorithmIdentifier; +use SpomkyLabs\Pki\CryptoTypes\Asymmetric\OneAsymmetricKey; use SpomkyLabs\Pki\CryptoTypes\Asymmetric\PrivateKeyInfo; use SpomkyLabs\Pki\X501\ASN1\Name; use SpomkyLabs\Pki\X509\Certificate\Extension\SubjectAlternativeNameExtension; @@ -29,11 +30,11 @@ final class CertificationRequestInfoTest extends TestCase { final public const SAN_DN = 'cn=Alt Name'; - private static $_subject; + private static ?Name $_subject = null; - private static $_privateKeyInfo; + private static ?OneAsymmetricKey $_privateKeyInfo = null; - private static $_attribs; + private static ?Attributes $_attribs = null; public static function setUpBeforeClass(): void { diff --git a/tests/X509/Unit/Csr/CertificationRequestTest.php b/tests/X509/Unit/Csr/CertificationRequestTest.php index 8b5dae81..338de266 100644 --- a/tests/X509/Unit/Csr/CertificationRequestTest.php +++ b/tests/X509/Unit/Csr/CertificationRequestTest.php @@ -10,6 +10,7 @@ use SpomkyLabs\Pki\CryptoEncoding\PEM; use SpomkyLabs\Pki\CryptoTypes\AlgorithmIdentifier\GenericAlgorithmIdentifier; use SpomkyLabs\Pki\CryptoTypes\AlgorithmIdentifier\Signature\SHA256WithRSAEncryptionAlgorithmIdentifier; +use SpomkyLabs\Pki\CryptoTypes\Asymmetric\OneAsymmetricKey; use SpomkyLabs\Pki\CryptoTypes\Asymmetric\PrivateKeyInfo; use SpomkyLabs\Pki\CryptoTypes\Signature\Signature; use SpomkyLabs\Pki\X501\ASN1\Name; @@ -23,9 +24,9 @@ */ final class CertificationRequestTest extends TestCase { - private static $_subject; + private static ?Name $_subject = null; - private static $_privateKeyInfo; + private static ?OneAsymmetricKey $_privateKeyInfo = null; public static function setUpBeforeClass(): void {