1 | <?php |
||
19 | trait CryptTrait |
||
20 | { |
||
21 | /** |
||
22 | * @var string|Key|null |
||
23 | */ |
||
24 | protected $encryptionKey; |
||
25 | |||
26 | /** |
||
27 | * Encrypt data with encryptionKey. |
||
28 | * |
||
29 | * @param string $unencryptedData |
||
30 | * |
||
31 | * @throws LogicException |
||
32 | * |
||
33 | * @return string |
||
34 | */ |
||
35 | 36 | protected function encrypt($unencryptedData) |
|
51 | |||
52 | /** |
||
53 | * Decrypt data with encryptionKey. |
||
54 | * |
||
55 | * @param string $encryptedData |
||
56 | * |
||
57 | * @throws LogicException |
||
58 | * |
||
59 | * @return string |
||
60 | */ |
||
61 | 30 | protected function decrypt($encryptedData) |
|
77 | |||
78 | /** |
||
79 | * Set the encryption key |
||
80 | * |
||
81 | * @param string|Key $key |
||
82 | */ |
||
83 | 88 | public function setEncryptionKey($key = null) |
|
87 | } |
||
88 |