Total Complexity | 3 |
Total Lines | 28 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php declare(strict_types=1); |
||
8 | trait Algorithm |
||
9 | { |
||
10 | protected static string $name; |
||
11 | |||
12 | /** |
||
13 | * @inheritdoc |
||
14 | */ |
||
15 | public function name(): string |
||
16 | { |
||
17 | return static::$name; |
||
18 | } |
||
19 | |||
20 | protected function algorithm(): int |
||
21 | { |
||
22 | return [ |
||
23 | 'ES256' => OPENSSL_ALGO_SHA256, |
||
24 | 'ES256K' => OPENSSL_ALGO_SHA256, |
||
25 | 'ES384' => OPENSSL_ALGO_SHA512, |
||
26 | ][$this->name()]; |
||
27 | } |
||
28 | |||
29 | protected function keySize(): int |
||
36 | } |
||
37 | } |
||
38 |