CaMykS  1.0-20231201
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Cryptographer Class Reference

Public Member Functions

 __construct ($params=array())
 
 update_param ($name, $value)
 
 update_params ($params)
 
 check_engineConfiguration ()
 
 encrypt ($data, $base64Encode=true)
 
 decrypt ($data, $base64Decode=true)
 
 get_lastErrorCode ()
 
 get_lastErrorMessage ()
 

Private Member Functions

 set_lastError ($error)
 
 _OpenSSL_check_configuration ()
 
 _OpenSSL_encrypt ($data)
 
 _OpenSSL_decrypt ($data)
 
 _Mcrypt_check_configuration ()
 
 _Mcrypt_encrypt ($data)
 
 _Mcrypt_decrypt ($data)
 
 _Sodium_check_configuration ()
 
 _Sodium_encrypt ($data)
 
 _Sodium_decrypt ($data)
 

Private Attributes

 $engines = array('OpenSSL', 'Mcrypt', 'Sodium')
 Available engines. More...
 
 $params
 Engine parameters. More...
 
 $lastError = 0
 Last error. More...
 

Detailed Description

Cryptographer class.

Constructor & Destructor Documentation

◆ __construct()

Cryptographer::__construct (   $params = array())

Class constructor.

Parameters
array$params
Returns
void

Member Function Documentation

◆ update_param()

Cryptographer::update_param (   $name,
  $value 
)

Update a parameter.

Parameters
string$name
mixed$value
Returns
void

◆ update_params()

Cryptographer::update_params (   $params)

Update some parameters.

Parameters
array$params
Returns
void

◆ check_engineConfiguration()

Cryptographer::check_engineConfiguration ( )

Check engine configuration.

Returns
boolean success

◆ encrypt()

Cryptographer::encrypt (   $data,
  $base64Encode = true 
)

Encrypt data.

Parameters
string$data
integer$base64Encode
Returns
false on failure, string on success

◆ decrypt()

Cryptographer::decrypt (   $data,
  $base64Decode = true 
)

Decrypt data.

Parameters
string$data,.
integer$base64Decode
Returns
false on failure, string on success

◆ get_lastErrorCode()

Cryptographer::get_lastErrorCode ( )

Return last error code.

Returns
integer

◆ get_lastErrorMessage()

Cryptographer::get_lastErrorMessage ( )

Return last error message.

Returns
string

◆ set_lastError()

Cryptographer::set_lastError (   $error)
private

Define last error

Parameters
integer$error
Returns
void

◆ _OpenSSL_check_configuration()

Cryptographer::_OpenSSL_check_configuration ( )
private

Check OpenSSL configuration.

Returns
boolean result

◆ _OpenSSL_encrypt()

Cryptographer::_OpenSSL_encrypt (   $data)
private

Encrypt data using OpenSSL engine.

Parameters
string$data
Returns
string

◆ _OpenSSL_decrypt()

Cryptographer::_OpenSSL_decrypt (   $data)
private

Decrypt data using OpenSSL engine.

Parameters
string$data,.
Returns
string

◆ _Mcrypt_check_configuration()

Cryptographer::_Mcrypt_check_configuration ( )
private

Check Mcrypt configuration.

Returns
boolean result

◆ _Mcrypt_encrypt()

Cryptographer::_Mcrypt_encrypt (   $data)
private

Encrypt data using Mcrypt engine.

Parameters
string$data
Returns
string

◆ _Mcrypt_decrypt()

Cryptographer::_Mcrypt_decrypt (   $data)
private

Decrypt data using Mcrypt engine.

Parameters
string$data,.
Returns
string

◆ _Sodium_check_configuration()

Cryptographer::_Sodium_check_configuration ( )
private

Check Sodium configuration.

Returns
boolean result

◆ _Sodium_encrypt()

Cryptographer::_Sodium_encrypt (   $data)
private

Encrypt data using Sodium engine.

Parameters
string$data
Returns
string

◆ _Sodium_decrypt()

Cryptographer::_Sodium_decrypt (   $data)
private

Decrypt data using Sodium engine.

Parameters
string$data,.
Returns
string

Member Data Documentation

◆ $engines

array Cryptographer::$engines = array('OpenSSL', 'Mcrypt', 'Sodium')
private

Available engines.

◆ $params

array Cryptographer::$params
private
Initial value:
= array(
'engine' => 'OpenSSL',
'cipher' => 'aes-256-cbc',
'mode' => '',
'key' => '',
'iv' => '',
)

Engine parameters.

◆ $lastError

integer Cryptographer::$lastError = 0
private

Last error.


The documentation for this class was generated from the following file: