| 1 |
<?php |
| 2 |
|
| 3 |
declare(strict_types=1); |
| 4 |
|
| 5 |
namespace Jose\Component\Encryption\Algorithm\KeyEncryption; |
| 6 |
|
| 7 |
use AESKW\Wrapper as WrapperInterface; |
| 8 |
use RuntimeException; |
| 9 |
|
| 10 |
abstract class AbstractECDHAESKW implements KeyAgreementWithKeyWrapping |
| 11 |
{ |
| 12 |
public function __construct() |
| 13 |
{ |
| 14 |
if (! interface_exists(WrapperInterface::class)) { |
| 15 |
throw new RuntimeException('Please install "spomky-labs/aes-key-wrap" to use AES-KW algorithms'); |
| 16 |
} |
| 17 |
} |
| 18 |
|
| 19 |
public function allowedKeyTypes(): array |
| 20 |
{ |
| 21 |
return ['EC', 'OKP']; |
| 22 |
} |
| 23 |
|
| 24 |
public function getKeyManagementMode(): string |
| 25 |
{ |
| 26 |
return self::MODE_WRAP; |
| 27 |
} |
| 28 |
|
| 29 |
abstract protected function getWrapper(): WrapperInterface; |
| 30 |
|
| 31 |
abstract protected function getKeyLength(): int; |
| 32 |
} |