| @@ 8-14 (lines=7) @@ | ||
| 5 | namespace Encryption\Traits; |
|
| 6 | ||
| 7 | ||
| 8 | trait decryptAeadMode |
|
| 9 | { |
|
| 10 | public function decrypt(string $encryptedText, string $key, string $iv, string $tag): string |
|
| 11 | { |
|
| 12 | return rtrim(openssl_decrypt(base64_decode($encryptedText), static::CIPHER, $key, OPENSSL_RAW_DATA, $iv, $tag)); |
|
| 13 | } |
|
| 14 | } |
|
| 15 | ||
| @@ 8-14 (lines=7) @@ | ||
| 5 | namespace Encryption\Traits; |
|
| 6 | ||
| 7 | ||
| 8 | trait decryptNoIV |
|
| 9 | { |
|
| 10 | public function decrypt(string $encryptedText, string $key): string |
|
| 11 | { |
|
| 12 | return rtrim(openssl_decrypt(base64_decode($encryptedText), static::CIPHER, $key, OPENSSL_RAW_DATA), "\0"); |
|
| 13 | } |
|
| 14 | } |
|
| 15 | ||