lithium\storage\session\strategy\Encrypt::_bcDecrypt()
Decrypt and unserialize a previously encrypted string.
Parameters
-
string
$encrypted
The base64 encoded and encrypted string.
Returns
arrayThe cleartext data.
Source
protected function _bcDecrypt($encrypted) {
$secret = $this->_hashSecret($this->_config['secret']);
$vectorSize = strlen(base64_encode(str_repeat(" ", $this->_bcVectorSize())));
$vector = base64_decode(substr($encrypted, -$vectorSize));
$data = base64_decode(substr($encrypted, 0, -$vectorSize));
mcrypt_generic_init($this->_mcryptResource, $secret, $vector);
$decrypted = mdecrypt_generic($this->_mcryptResource, $data);
mcrypt_generic_deinit($this->_mcryptResource);
return unserialize(trim($decrypted));
}