1 | <?php |
||
26 | final class ECDHES implements KeyAgreementInterface |
||
27 | { |
||
28 | /** |
||
29 | * @var \Mdanter\Ecc\Math\MathAdapterInterface |
||
30 | */ |
||
31 | private $adapter; |
||
32 | |||
33 | public function __construct() |
||
34 | { |
||
35 | $this->adapter = EccFactory::getAdapter(); |
||
36 | } |
||
37 | |||
38 | /** |
||
39 | * {@inheritdoc} |
||
40 | */ |
||
41 | public function getAgreementKey($encryption_key_length, $algorithm, JWKInterface $recipient_key, array $complete_header = [], array &$additional_header_values = []) |
||
69 | |||
70 | /** |
||
71 | * @param \Jose\Object\JWKInterface $private_key |
||
72 | * @param \Jose\Object\JWKInterface $public_key |
||
73 | * |
||
74 | * @throws \InvalidArgumentException |
||
75 | * |
||
76 | * @return int|string|void |
||
77 | */ |
||
78 | public function calculateAgreementKey(JWKInterface $private_key, JWKInterface $public_key) |
||
94 | |||
95 | /** |
||
96 | * {@inheritdoc} |
||
97 | */ |
||
98 | public function getAlgorithmName() |
||
102 | |||
103 | /** |
||
104 | * {@inheritdoc} |
||
105 | */ |
||
106 | public function getKeyManagementMode() |
||
110 | |||
111 | /** |
||
112 | * @param array $complete_header |
||
113 | * |
||
114 | * @return \Jose\Object\JWKInterface |
||
115 | */ |
||
116 | private function getPublicKey(array $complete_header) |
||
126 | |||
127 | /** |
||
128 | * @param \Jose\Object\JWKInterface $key |
||
129 | * @param bool $is_private |
||
130 | */ |
||
131 | private function checkKey(JWKInterface $key, $is_private) |
||
142 | |||
143 | /** |
||
144 | * @param JWKInterface $key |
||
145 | * |
||
146 | * @throws \InvalidArgumentException |
||
147 | * |
||
148 | * @return \Mdanter\Ecc\Primitives\GeneratorPoint |
||
149 | */ |
||
150 | private function getGenerator(JWKInterface $key) |
||
165 | |||
166 | /** |
||
167 | * @param $value |
||
168 | * |
||
169 | * @return int|string |
||
170 | */ |
||
171 | private function convertHexToDec($value) |
||
175 | |||
176 | /** |
||
177 | * @param $value |
||
178 | * |
||
179 | * @return int|string |
||
180 | */ |
||
181 | private function convertBase64ToDec($value) |
||
187 | |||
188 | /** |
||
189 | * @param $value |
||
190 | * |
||
191 | * @return string |
||
192 | */ |
||
193 | private function convertDecToBin($value) |
||
199 | } |
||
200 |