| 1 | <?php |
||
| 6 | class AESEncoder |
||
| 7 | { |
||
| 8 | /** |
||
| 9 | * @param string $text |
||
| 10 | * @param string $key |
||
| 11 | * @param string $iv |
||
| 12 | * @param int $option |
||
| 13 | * |
||
| 14 | * @return string |
||
| 15 | */ |
||
| 16 | public static function encrypt($text, $key, $iv, $option = OPENSSL_RAW_DATA) |
||
| 23 | |||
| 24 | /** |
||
| 25 | * @param string $cipherText |
||
| 26 | * @param string $key |
||
| 27 | * @param string $iv |
||
| 28 | * @param int $option |
||
| 29 | * |
||
| 30 | * @return string |
||
| 31 | */ |
||
| 32 | 6 | public static function decrypt($cipherText, $key, $iv, $option = OPENSSL_RAW_DATA) |
|
| 39 | |||
| 40 | /** |
||
| 41 | * @param string $key |
||
| 42 | * |
||
| 43 | * @return string |
||
| 44 | */ |
||
| 45 | 6 | public static function getMode($key) |
|
| 49 | |||
| 50 | /** |
||
| 51 | * @param string $key |
||
| 52 | */ |
||
| 53 | 6 | public static function validateKey($key) |
|
| 62 | |||
| 63 | /** |
||
| 64 | * @param string $iv |
||
| 65 | * |
||
| 66 | * @throws \InvalidArgumentException |
||
| 67 | */ |
||
| 68 | 6 | public static function validateIv($iv) |
|
| 74 | } |
||
| 75 |