To use this class, you need to have the mcrypt extension enabled.
Example configuration:
{{{
Session::config(array('default' => array(
'adapter' => 'Cookie',
'strategies' => array('Encrypt' => array('secret' => 'foobar'))
)));
}}}
By default, this strategy uses the AES algorithm in the CBC mode. This means that an
initialization vector has to be generated and transported with the payload data. This
is done transparently, but you may want to keep this in mind (the ECB mode doesn't require
an itialization vector but is not recommended to use as it's insecure). You can override this
defaults by passing a different cipher and/or mode to the config like this:
{{{
Session::config(array('default' => array(
'adapter' => 'Cookie',
'strategies' => array('Encrypt' => array(
'cipher' => MCRYPT_RIJNDAEL_128,
'mode' => MCRYPT_MODE_ECB, // Don't use ECB when you don't have to!
'secret' => 'foobar'
))
)));
}}}
Please keep in mind that it is generally not a good idea to store sensitive information in
cookies (or generally on the client side) and this class is no exception to the rule. It allows
you to store client side data in a more secure way, but 100% security can't be achieved.