| 1 | <?php |
||
| 17 | class OpenSSL |
||
| 18 | {
|
||
| 19 | /** |
||
| 20 | * OpenSSL encrypt wrapper function |
||
| 21 | * |
||
| 22 | * @param string $data |
||
| 23 | * @param string $method |
||
| 24 | * @param string $key |
||
| 25 | * @param string $iv |
||
| 26 | * @return string |
||
| 27 | */ |
||
| 28 | protected static function openssl_encrypt(string $data, string $method, string $key, string $iv): string |
||
| 36 | |||
| 37 | /** |
||
| 38 | * OpenSSL decrypt wrapper function |
||
| 39 | * |
||
| 40 | * @param string $data |
||
| 41 | * @param string $method |
||
| 42 | * @param string $key |
||
| 43 | * @param string $iv |
||
| 44 | * @return string |
||
| 45 | */ |
||
| 46 | protected static function openssl_decrypt(string $data, string $method, string $key, string $iv): string |
||
| 54 | |||
| 55 | /** |
||
| 56 | * Throw an exception if openssl function returns false |
||
| 57 | * |
||
| 58 | * @param string $data |
||
| 59 | * @throws \Exception |
||
| 60 | */ |
||
| 61 | private static function exceptionIfFalse(string $data) |
||
| 67 | } |