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

public method

Constructor.

Parameters

  • array $config

    Configuration array. You can override the default cipher and mode.

Returns

void

Source

	public function __construct(array $config = array()) {
		if (!static::enabled()) {
			throw new ConfigException("The Mcrypt extension is not installed or enabled.");
		}
		if (!isset($config['secret'])) {
			throw new ConfigException("Encrypt strategy requires a secret key.");
		}
		parent::__construct($config + $this->_defaults);

		$cipher = $this->_config['cipher'];
		$mode = $this->_config['mode'];

		static::$_resource = mcrypt_module_open($cipher, '', $mode, '');
		$this->_config['vector'] = static::_vector();
	}