Class Encrypt_Engine

Encrypt_Engine

extends Kohana_Encrypt_Engine

package
Kohana/Encrypt
author
Kohana Team
copyright
(c) 2007-2012 Kohana Team
(c) 2016-2018 Koseven Team
license
https://koseven.ga/LICENSE.md


Information

This class is a transparent base class for Kohana_Encrypt_Engine

Constants

  • None

Properties

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);

Do you want to contribute to Koseven?

We need YOUR help!

This project is open source. What does this mean? YOU can help:
  • Found a bug? Report it on Github
  • Need a feature? Add it Here
  • Want to help? Join the Forum
Go to Github