| 1 |
<?php |
| 2 |
|
| 3 |
declare(strict_types=1); |
| 4 |
|
| 5 |
namespace Jose\Component\Encryption\Algorithm\KeyEncryption; |
| 6 |
|
| 7 |
use Jose\Component\Core\JWK; |
| 8 |
use LogicException; |
| 9 |
|
| 10 |
final class ECDHSS extends AbstractECDH |
| 11 |
{ |
| 12 |
public function name(): string |
| 13 |
{ |
| 14 |
return 'ECDH-SS'; |
| 15 |
} |
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
public function getAgreementKey( |
| 22 |
int $encryptionKeyLength, |
| 23 |
string $algorithm, |
| 24 |
JWK $recipientKey, |
| 25 |
?JWK $senderKey, |
| 26 |
array $complete_header = [], |
| 27 |
array &$additional_header_values = [] |
| 28 |
): string { |
| 29 |
if ($senderKey === null) { |
| 30 |
throw new LogicException('The sender key shall be set'); |
| 31 |
} |
| 32 |
$agreedKey = parent::getAgreementKey( |
| 33 |
$encryptionKeyLength, |
| 34 |
$algorithm, |
| 35 |
$recipientKey, |
| 36 |
$senderKey, |
| 37 |
$complete_header, |
| 38 |
$additional_header_values |
| 39 |
); |
| 40 |
unset($additional_header_values['epk']); |
| 41 |
|
| 42 |
return $agreedKey; |
| 43 |
} |
| 44 |
} |