Skip to content

Commit

Permalink
Fix compatibility with ECDH AESKW tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kelvinmo committed Jan 28, 2022
1 parent 301625c commit b81f4ec
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tests/ECDH_AESKeyWrapTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
use PHPUnit\Framework\TestCase;

class ECDH_AESKeyWrapTest extends TestCase {
protected function isAlgAvailable() {
protected function isAlgAvailable($alg) {
$ecdh = new ECDH_AESKeyWrap(null);
if (count($ecdh->getSupportedAlgs()) == 0) {
$this->markTestSkipped('Alg not available: ECDH-ES+AxxxKW');
$this->markTestSkipped('Alg not available: ' . $alg);
return false;
} else {
return true;
Expand Down Expand Up @@ -43,6 +43,8 @@ private function getPublicKeySet() {
}

function testECDHES_A128KW() {
if (!$this->isAlgAvailable('ECDH-ES+A128KW')) return;

$key = pack('H*', '00112233445566778899AABBCCDDEEFF');

$alg = new ECDH_AESKeyWrap('ECDH-ES+A128KW');
Expand All @@ -59,6 +61,8 @@ function testECDHES_A128KW() {
}

function testECDHES_A192KW() {
if (!$this->isAlgAvailable('ECDH-ES+A192KW')) return;

$key = pack('H*', '00112233445566778899AABBCCDDEEFF');

$alg = new ECDH_AESKeyWrap('ECDH-ES+A192KW');
Expand All @@ -76,6 +80,8 @@ function testECDHES_A192KW() {
}

function testECDHES_A256KW() {
if (!$this->isAlgAvailable('ECDH-ES+A256KW')) return;

$key = pack('H*', '00112233445566778899AABBCCDDEEFF');

$alg = new ECDH_AESKeyWrap('ECDH-ES+A256KW');
Expand Down

0 comments on commit b81f4ec

Please sign in to comment.