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' => 'f00bar$l1thium'))
)));
}}}
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_256,
'mode' => MCRYPT_MODE_ECB, // Don't use ECB when you don't have to!
'secret' => 'f00bar$l1thium'
))
)));
}}}
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.
Also note that if you provide a secret that is shorter than the maximum key length of the
algorithm used, the secret will be hashed to make it more secure. This also means that if you
want to use your own hashing algorithm, make sure it has the maximum key length of the algorithm
used. See the `Encrypt::_hashSecret()` method for more information on this.