Debian Codegraph @

lib/3rdParty/composer/web-token/jwt-library/Encryption/Algorithm/KeyEncryption/ECDHESAESKW.php

raw symbols SCIP
1 <?php
2
3 declare(strict_types=1);
4
5 namespace Jose\Component\Encryption\Algorithm\KeyEncryption;
6
7 use Jose\Component\Core\JWK;
8
9 abstract class ECDHESAESKW extends AbstractECDHAESKW
10 {
11 /**
12 * @param array<string, mixed> $complete_header
13 * @param array<string, mixed> $additional_header_values
14 */
15 public function wrapAgreementKey(
16 JWK $recipientKey,
17 ?JWK $senderKey,
18 string $cek,
19 int $encryption_key_length,
20 array $complete_header,
21 array &$additional_header_values
22 ): string {
23 $ecdh_es = new ECDHES();
24 $agreement_key = $ecdh_es->getAgreementKey(
25 $this->getKeyLength(),
26 $this->name(),
27 $recipientKey->toPublic(),
28 $senderKey,
29 $complete_header,
30 $additional_header_values
31 );
32 $wrapper = $this->getWrapper();
33
34 return $wrapper::wrap($agreement_key, $cek);
35 }
36
37 /**
38 * @param array<string, mixed> $complete_header
39 */
40 public function unwrapAgreementKey(
41 JWK $recipientKey,
42 ?JWK $senderKey,
43 string $encrypted_cek,
44 int $encryption_key_length,
45 array $complete_header
46 ): string {
47 $ecdh_es = new ECDHES();
48 $agreement_key = $ecdh_es->getAgreementKey(
49 $this->getKeyLength(),
50 $this->name(),
51 $recipientKey,
52 $senderKey,
53 $complete_header
54 );
55 $wrapper = $this->getWrapper();
56
57 return $wrapper::unwrap($agreement_key, $encrypted_cek);
58 }
59 }