Crypt Class
The Crypt class allows encrypt or decrypt a string. The Crypt class is also used internally by for example the Fuel Sessions class.
It uses the encryption and hashing methods provided by PHPSecLib, so it's not dependent on external modules being available, such as mcrypt.
Configuration
The Crypt class is configured through the app/config/crypt.php configuration file. It will be generated and populated with random values when you first use the Crypt class or if one of the required configuration values is missing.
Note that this will require write access to app/config/crypt.php! If this is not possible, make sure all configuration settings are set!
The following configuration settings can be defined:
Param | Type | Default | Description |
---|---|---|---|
crypto_key | string | n/a | Random encryption key value used in the encryption routines. Make sure you set this to something unique and random! |
crypto_iv | string | n/a | Random encryption initialisation vector used in the encryption routines. Make sure you set this to something unique and random! |
crypto_hmac | string | n/a | Random value used in the Hash-based Message Authentication Code (HMAC) routines. Make sure you set this to something unique and random! |
If you assign keys manually, note that they are base64_encoded, and the length must be a multiple of 4 to be able to decode it. Make sure the length is correct!