| 1 | <?php |
||
| 7 | class Crypter |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * @var string |
||
| 11 | */ |
||
| 12 | protected $key; |
||
| 13 | |||
| 14 | /** |
||
| 15 | * @var string |
||
| 16 | */ |
||
| 17 | protected $iv; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * @var string |
||
| 21 | */ |
||
| 22 | protected $cipher = 'AES-256-CBC'; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * Crypter constructor. |
||
| 26 | * |
||
| 27 | */ |
||
| 28 | public function __construct() |
||
| 35 | |||
| 36 | /** |
||
| 37 | * @param $data |
||
| 38 | * @return string |
||
| 39 | */ |
||
| 40 | public function encrypt($data) |
||
| 44 | |||
| 45 | /** |
||
| 46 | * @param $data |
||
| 47 | * @return string |
||
| 48 | */ |
||
| 49 | public function decrypt($data) |
||
| 53 | |||
| 54 | /** |
||
| 55 | * @throws IvLengthException |
||
| 56 | * @throws KeyLengthException |
||
| 57 | */ |
||
| 58 | protected function validateKeyAndIv() |
||
| 67 | } |
||
| 68 |