Skip to content

Commit

Permalink
Fixed Rijndael256 bug
Browse files Browse the repository at this point in the history
  • Loading branch information
dev-marcel committed Sep 30, 2016
1 parent d8ab3c2 commit c2f3403
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 2 additions & 3 deletions Encryptors/Rijndael128Encryptor.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)). "<ENC>";
))). "<ENC>";
}

return $data;
Expand Down
3 changes: 3 additions & 0 deletions Encryptors/Rijndael256Encryptor.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ public function encrypt($data) {
public function decrypt($data) {

if(is_string($data)) {

$data = str_replace("<ENC>", "", $data);

return trim(mcrypt_decrypt(
MCRYPT_RIJNDAEL_256,
$this->secretKey,
Expand Down

0 comments on commit c2f3403

Please sign in to comment.