workaround for openssl using base64 input to decrypt function

This commit is contained in:
tom--
2015-02-10 17:43:55 -05:00
parent 5736891a0b
commit c854f340ec

View File

@@ -69,8 +69,6 @@ class Security extends Component
*/ */
public $passwordHashStrategy = 'crypt'; public $passwordHashStrategy = 'crypt';
private $_cryptModule;
/** /**
* Encrypts data using a password. * Encrypts data using a password.
@@ -217,8 +215,8 @@ class Security extends Component
$ivSize = 16; $ivSize = 16;
$iv = StringHelper::byteSubstr($data, 0, $ivSize); $iv = StringHelper::byteSubstr($data, 0, $ivSize);
$encrypted = StringHelper::byteSubstr($data, $ivSize, null); $encrypted = base64_encode(StringHelper::byteSubstr($data, $ivSize, null));
$decrypted = openssl_decrypt($encrypted, $this->opensslCipher(), $key, OPENSSL_RAW_DATA, $iv); $decrypted = openssl_decrypt($encrypted, $this->opensslCipher(), $key, OPENSSL_ZERO_PADDING, $iv);
return $this->stripPadding($decrypted); return $this->stripPadding($decrypted);
} }