Conditions | 2 |
Paths | 2 |
Total Lines | 16 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
12 | public static function generate(): array |
||
13 | { |
||
14 | $pKey = openssl_pkey_new([ |
||
15 | 'private_key_type' => OPENSSL_KEYTYPE_RSA, |
||
16 | 'private_key_bits' => 4096, |
||
17 | ]); |
||
18 | |||
19 | if (!openssl_pkey_export($pKey, $privateKey)) { |
||
20 | throw new LetsEncryptClientException('RSA keypair export failed.'); |
||
21 | } |
||
22 | |||
23 | $details = openssl_pkey_get_details($pKey); |
||
24 | |||
25 | return [ |
||
26 | 'privateKey' => $privateKey, |
||
27 | 'publicKey' => $details['key'], |
||
28 | ]; |
||
31 |