CaMykS  1.0-20200201
 All Classes Files Functions Variables Pages
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

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

Class constructor.

Parameters
array$params
Returns
void

Member Function Documentation

Cryptographer::_Mcrypt_check_configuration ( )
private

Check Mcrypt configuration.

Returns
boolean result
Cryptographer::_Mcrypt_decrypt (   $data)
private

Decrypt data using Mcrypt engine.

Parameters
string$data,.
Returns
string
Cryptographer::_Mcrypt_encrypt (   $data)
private

Encrypt data using Mcrypt engine.

Parameters
string$data
Returns
string
Cryptographer::_OpenSSL_check_configuration ( )
private

Check OpenSSL configuration.

Returns
boolean result
Cryptographer::_OpenSSL_decrypt (   $data)
private

Decrypt data using OpenSSL engine.

Parameters
string$data,.
Returns
string
Cryptographer::_OpenSSL_encrypt (   $data)
private

Encrypt data using OpenSSL engine.

Parameters
string$data
Returns
string
Cryptographer::_Sodium_check_configuration ( )
private

Check Sodium configuration.

Returns
boolean result
Cryptographer::_Sodium_decrypt (   $data)
private

Decrypt data using Sodium engine.

Parameters
string$data,.
Returns
string
Cryptographer::_Sodium_encrypt (   $data)
private

Encrypt data using Sodium engine.

Parameters
string$data
Returns
string
Cryptographer::check_engineConfiguration ( )

Check engine configuration.

Returns
boolean success
Cryptographer::decrypt (   $data,
  $base64Decode = true 
)

Decrypt data.

Parameters
string$data,.
integer$base64Decode
Returns
false on failure, string on success
Cryptographer::encrypt (   $data,
  $base64Encode = true 
)

Encrypt data.

Parameters
string$data
integer$base64Encode
Returns
false on failure, string on success
Cryptographer::get_lastErrorCode ( )

Return last error code.

Returns
integer
Cryptographer::get_lastErrorMessage ( )

Return last error message.

Returns
string
Cryptographer::set_lastError (   $error)
private

Define last error

Parameters
integer$error
Returns
void
Cryptographer::update_param (   $name,
  $value 
)

Update a parameter.

Parameters
string$name
mixed$value
Returns
void
Cryptographer::update_params (   $params)

Update some parameters.

Parameters
array$params
Returns
void

Member Data Documentation

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

Available engines.

integer Cryptographer::$lastError = 0
private

Last error.

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

Engine parameters.


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