1 | <?php |
||
14 | trait CryptTrait |
||
15 | { |
||
16 | /** |
||
17 | * @var string |
||
18 | */ |
||
19 | protected $encryptionKey; |
||
20 | |||
21 | /** |
||
22 | * Encrypt data with a private key. |
||
23 | * |
||
24 | * @param string $unencryptedData |
||
25 | * |
||
26 | * @throws \LogicException |
||
27 | * @return string |
||
28 | */ |
||
29 | protected function encrypt($unencryptedData) |
||
37 | |||
38 | /** |
||
39 | * Decrypt data with a public key. |
||
40 | * |
||
41 | * @param string $encryptedData |
||
42 | * |
||
43 | * @throws \LogicException |
||
44 | * @return string |
||
45 | */ |
||
46 | protected function decrypt($encryptedData) |
||
54 | |||
55 | /** |
||
56 | * Set the encryption key |
||
57 | * |
||
58 | * @param string $key |
||
59 | */ |
||
60 | public function setEncryptionKey($key = null) |
||
64 | } |
||
65 |