1 | <?php |
||
12 | class RsaKeyStorageHandler implements RsaKeyHandler |
||
13 | { |
||
14 | |||
15 | /** |
||
16 | * Storage path for the Public Key File |
||
17 | * |
||
18 | * @var string |
||
19 | */ |
||
20 | private $public_key_path; |
||
21 | |||
22 | /** |
||
23 | * Storage path for the Private Key File |
||
24 | * |
||
25 | * @var string |
||
26 | */ |
||
27 | private $private_key_path; |
||
28 | |||
29 | /** |
||
30 | * ApplicationKey constructor. |
||
31 | */ |
||
32 | public function __construct() |
||
39 | |||
40 | /** |
||
41 | * Have any RSA keys been generated |
||
42 | * |
||
43 | * @return bool |
||
44 | */ |
||
45 | public function exists() |
||
49 | |||
50 | /** |
||
51 | * A Private key file exists |
||
52 | * |
||
53 | * @return bool |
||
54 | */ |
||
55 | public function hasPrivateKey() |
||
59 | |||
60 | /** |
||
61 | * A Public key file exists |
||
62 | * |
||
63 | * @return bool |
||
64 | */ |
||
65 | public function hasPublicKey() |
||
69 | |||
70 | /** |
||
71 | * Save the generated RSA key to the storage location |
||
72 | * |
||
73 | * @param $public |
||
74 | * @param $private |
||
75 | */ |
||
76 | public function saveKey($public, $private) |
||
81 | |||
82 | /** |
||
83 | * Get the contents of the public key file |
||
84 | * |
||
85 | * @return string |
||
86 | * @throws RSAKeyFileMissing |
||
87 | */ |
||
88 | public function getPublicKey() |
||
96 | |||
97 | /** |
||
98 | * Get the contents of the private key file |
||
99 | * |
||
100 | * @return string |
||
101 | * @throws RSAKeyFileMissing |
||
102 | */ |
||
103 | public function getPrivateKey() |
||
111 | } |
||
112 |