Total Complexity | 5 |
Total Lines | 32 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
23 | final class PublicKeyDelegate implements Verifier |
||
24 | { |
||
25 | private $hash; |
||
26 | |||
27 | /** |
||
28 | * {@inheritdoc} |
||
29 | */ |
||
30 | public function __construct(string $signature, string $path) |
||
31 | { |
||
32 | if (extension_loaded('openssl')) { |
||
33 | $this->hash = new OpenSsl($signature, $path); |
||
34 | } elseif (class_exists('Crypt_RSA')) { |
||
35 | $this->hash = new PhpSeclib($signature, $path); |
||
36 | } else { |
||
37 | throw new RuntimeException('The "openssl" extension and "phpseclib" libraries are not available.'); |
||
38 | } |
||
39 | } |
||
40 | |||
41 | /** |
||
42 | * {@inheritdoc} |
||
43 | */ |
||
44 | public function update(string $data): void |
||
47 | } |
||
48 | |||
49 | /** |
||
50 | * {@inheritdoc} |
||
51 | */ |
||
52 | public function verify(string $signature): bool |
||
57 |