From 7181b76ab95d96b4e7463309ed69ee06155f9f01 Mon Sep 17 00:00:00 2001 From: Paragon Initiative Enterprises Date: Fri, 17 Sep 2021 13:10:26 -0400 Subject: [PATCH] Test public key from updated vectors, bump minimum PASETO requirement --- composer.json | 2 +- tests/KAT/SecretTest.php | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index 3794330..966e84a 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,7 @@ "ext-openssl": "*", "paragonie/easy-ecc": "^0.5", "paragonie/hidden-string": "^1|^2", - "paragonie/paseto": "^2" + "paragonie/paseto": ">=2.1.1" }, "require-dev": { "phpunit/phpunit": "^7|^8|^9", diff --git a/tests/KAT/SecretTest.php b/tests/KAT/SecretTest.php index c285b63..b7a2358 100644 --- a/tests/KAT/SecretTest.php +++ b/tests/KAT/SecretTest.php @@ -49,11 +49,19 @@ protected function genericTest(ProtocolInterface $version, string $name, array $ { foreach ($tests as $test) { if ($version instanceof Version1) { - $publickey = new AsymmetricSecretKey($test['key'], $version); + $secretkey = new AsymmetricSecretKey($test['key'], $version); + $this->assertSame( + $test['public-key'], + $secretkey->getPublicKey()->raw() + ); } else { - $publickey = new AsymmetricSecretKey(Hex::decode($test['key']), $version); + $secretkey = new AsymmetricSecretKey(Hex::decode($test['key']), $version); + $this->assertSame( + $test['public-key'], + Hex::encode($secretkey->getPublicKey()->raw()) + ); } - $this->assertSame($test['paserk'], (new SecretType())->encode($publickey), $test['name']); + $this->assertSame($test['paserk'], (new SecretType())->encode($secretkey), $test['name']); } } }