@@ 18-24 (lines=7) @@ | ||
15 | * |
|
16 | * @return string |
|
17 | */ |
|
18 | public static function encrypt(string $text, string $key, string $iv, int $option = OPENSSL_RAW_DATA): string |
|
19 | { |
|
20 | self::validateKey($key); |
|
21 | self::validateIv($iv); |
|
22 | ||
23 | return openssl_encrypt($text, self::getMode($key), $key, $option, $iv); |
|
24 | } |
|
25 | ||
26 | /** |
|
27 | * @param string $cipherText |
|
@@ 35-41 (lines=7) @@ | ||
32 | * |
|
33 | * @return string |
|
34 | */ |
|
35 | public static function decrypt(string $cipherText, string $key, string $iv, int $option = OPENSSL_RAW_DATA, $method = null): string |
|
36 | { |
|
37 | self::validateKey($key); |
|
38 | self::validateIv($iv); |
|
39 | ||
40 | return openssl_decrypt($cipherText, $method ?: self::getMode($key), $key, $option, $iv); |
|
41 | } |
|
42 | ||
43 | /** |
|
44 | * @param string $key |