Kohana_Encrypt_Engine
Properties
-
protected string $_cipher
-
mcrypt cipher
-
Default value:
NULL
-
protected string $_key
-
Encryption key
-
Default value:
NULL
-
protected string $_mode
-
mcrypt mode
-
Default value:
NULL
Methods
public __construct(mixed $key_config [, string $mode = NULL , string $cipher = NULL ] ) (defined in Kohana_Encrypt_Engine)
Creates a new mcrypt wrapper.
Parameters
- mixed $key_config required - Mcrypt key or config array
- string $mode = NULL - Mcrypt mode
- string $cipher = NULL - Mcrypt cipher
Source Code
public function __construct($key_config, $mode = NULL, $cipher = NULL)
{
if (is_array($key_config))
{
if (isset($key_config['key']))
{
$this->_key = $key_config['key'];
}
else
{
// No default encryption key is provided!
throw new Kohana_Exception('No encryption key is defined in the encryption configuration');
}
if (isset($key_config['mode']))
{
$this->_mode = $key_config['mode'];
}
// Mode not specified in config array, use argument
else if ($mode !== NULL)
{
$this->_mode = $mode;
}
if (isset($key_config['cipher']))
{
$this->_cipher = $key_config['cipher'];
}
// Cipher not specified in config array, use argument
else if ($cipher !== NULL)
{
$this->_cipher = $cipher;
}
}
else if (is_string($key_config))
{
// Store the key, mode, and cipher
$this->_key = $key_config;
$this->_mode = $mode;
$this->_cipher = $cipher;
}
else
{
// No default encryption key is provided!
throw new Kohana_Exception('No encryption key is defined in the encryption configuration');
}
}
abstract public decrypt() (defined in Kohana_Encrypt_Engine)
Source Code
abstract public function decrypt($data);
abstract public encrypt() (defined in Kohana_Encrypt_Engine)
Source Code
abstract public function encrypt($data, $iv);