From c2f3403b04b911c6cefd49e2f2e1bc48eb424e59 Mon Sep 17 00:00:00 2001 From: Marcel Date: Fri, 30 Sep 2016 10:17:40 +0200 Subject: [PATCH] Fixed Rijndael256 bug --- Encryptors/Rijndael128Encryptor.php | 5 ++--- Encryptors/Rijndael256Encryptor.php | 3 +++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Encryptors/Rijndael128Encryptor.php b/Encryptors/Rijndael128Encryptor.php index 34b3b7fd..5003f098 100644 --- a/Encryptors/Rijndael128Encryptor.php +++ b/Encryptors/Rijndael128Encryptor.php @@ -36,14 +36,13 @@ public function __construct($key) { public function encrypt($data) { if(is_string($data)) { - $test = mcrypt_encrypt( + return trim(base64_encode(mcrypt_encrypt( MCRYPT_RIJNDAEL_128, $this->secretKey, $data, MCRYPT_MODE_ECB, $this->initializationVector - ); - return trim(base64_encode($test)). ""; + ))). ""; } return $data; diff --git a/Encryptors/Rijndael256Encryptor.php b/Encryptors/Rijndael256Encryptor.php index cb2d191d..20d1011c 100644 --- a/Encryptors/Rijndael256Encryptor.php +++ b/Encryptors/Rijndael256Encryptor.php @@ -55,6 +55,9 @@ public function encrypt($data) { public function decrypt($data) { if(is_string($data)) { + + $data = str_replace("", "", $data); + return trim(mcrypt_decrypt( MCRYPT_RIJNDAEL_256, $this->secretKey,