Skip to content

Commit

Permalink
Test public key from updated vectors, bump minimum PASETO requirement
Browse files Browse the repository at this point in the history
  • Loading branch information
paragonie-security committed Sep 17, 2021
1 parent 21b9bcc commit 7181b76
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
14 changes: 11 additions & 3 deletions tests/KAT/SecretTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
}
}
}

0 comments on commit 7181b76

Please sign in to comment.