| 1 | <?php |
||
| 11 | class AesEncryption |
||
| 12 | { |
||
| 13 | |||
| 14 | #------------------------------------------------------------------------------------------------------ |
||
| 15 | # Properties |
||
| 16 | #------------------------------------------------------------------------------------------------------ |
||
| 17 | |||
| 18 | const CHIPPER = 'AES256'; |
||
| 19 | const IV = '\'Nl6P0*3\'Nl6P0*3'; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * @var string |
||
| 23 | */ |
||
| 24 | private $secureKey; |
||
| 25 | |||
| 26 | #------------------------------------------------------------------------------------------------------ |
||
| 27 | # Magic methods |
||
| 28 | #------------------------------------------------------------------------------------------------------ |
||
| 29 | |||
| 30 | /** |
||
| 31 | * AesEncryption constructor. |
||
| 32 | * |
||
| 33 | * @param string $aesKey security key to use for encryption and decryption |
||
| 34 | */ |
||
| 35 | 2 | public function __construct(string $aesKey) |
|
| 39 | |||
| 40 | #------------------------------------------------------------------------------------------------------ |
||
| 41 | # Public methods |
||
| 42 | #------------------------------------------------------------------------------------------------------ |
||
| 43 | |||
| 44 | /** |
||
| 45 | * Encrypt the input |
||
| 46 | * |
||
| 47 | * @param string $input |
||
| 48 | * @return string |
||
| 49 | */ |
||
| 50 | 1 | public function encrypt(string $input): string |
|
| 56 | |||
| 57 | /** |
||
| 58 | * Decrypt the input |
||
| 59 | * |
||
| 60 | * @param string $input |
||
| 61 | * @return string |
||
| 62 | */ |
||
| 63 | 1 | public function decrypt(string $input): string |
|
| 69 | } |
||
| 70 |