|
@@ 37-44 (lines=8) @@
|
| 34 |
|
* @param string $iv Initialization vector |
| 35 |
|
* @return string |
| 36 |
|
*/ |
| 37 |
|
protected static function openssl_encrypt(string $input, string $method, string $key, string $iv, string &$tag): string |
| 38 |
|
{ |
| 39 |
|
if (OpensslStatic::tagRequired($method)) { |
| 40 |
|
return \openssl_encrypt($input, $method, $key, OPENSSL_RAW_DATA, $iv, $tag, '', 4); |
| 41 |
|
} else { |
| 42 |
|
return \openssl_encrypt($input, $method, $key, OPENSSL_RAW_DATA, $iv); |
| 43 |
|
} |
| 44 |
|
} |
| 45 |
|
|
| 46 |
|
/** |
| 47 |
|
* OpenSSL decrypt wrapper function |
|
@@ 55-62 (lines=8) @@
|
| 52 |
|
* @param string $iv Initialization vector |
| 53 |
|
* @return string |
| 54 |
|
*/ |
| 55 |
|
protected static function openssl_decrypt(string $input, string $method, string $key, string $iv, string $tag): string |
| 56 |
|
{ |
| 57 |
|
if (OpensslStatic::tagRequired($method)) { |
| 58 |
|
return \openssl_decrypt($input, $method, $key, OPENSSL_RAW_DATA, $iv, $tag, ''); |
| 59 |
|
} else { |
| 60 |
|
return \openssl_decrypt($input, $method, $key, OPENSSL_RAW_DATA, $iv); |
| 61 |
|
} |
| 62 |
|
} |
| 63 |
|
|
| 64 |
|
/** |
| 65 |
|
* Get IV size for specified CIPHER. |