Total Complexity | 6 |
Total Lines | 31 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
15 | final class KeyGeneratorException extends OpenSSLException |
||
16 | { |
||
17 | private function __construct(string $prefix) |
||
18 | { |
||
19 | // collect OpenSSL error messages |
||
20 | $error = $prefix . ':' . PHP_EOL; |
||
21 | while ($message = openssl_error_string()) { |
||
22 | $error .= $message . PHP_EOL; |
||
23 | } |
||
24 | |||
25 | parent::__construct($error); |
||
26 | } |
||
27 | |||
28 | public static function keyCreateError(string $prefix = 'Unable to generate key pair'): self |
||
31 | } |
||
32 | |||
33 | public static function keyExportError(string $prefix = 'Key pair export error'): self |
||
34 | { |
||
35 | return new static($prefix); |
||
36 | } |
||
37 | |||
38 | public static function csrCreateError(string $prefix = 'Unable to generate CSR'): self |
||
39 | { |
||
40 | return new static($prefix); |
||
41 | } |
||
42 | |||
43 | public static function csrExportError(string $prefix = 'CSR export error'): self |
||
46 | } |
||
47 | } |
||
48 |