lithium\storage\session\strategy\Encrypt::_bcDecrypt()

protected method
This method is deprecated.

Decrypt and unserialize a previously encrypted string.

Parameters

  • string $encrypted

    The base64 encoded and encrypted string.

Returns

array

The 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));
	}