Documentation

Encryption extends Base
in package

Class to encrypt and decrypt data.

Table of Contents

$recommendedMethods  : array<string|int, mixed>
$value  : mixed
$mapPasswords  : array<string|int, mixed>
__construct()  : mixed
Constructor.
createHash()  : string
Function to create a hash.
createPasswordHash()  : string
Function to create a password hash.
decrypt()  : string
Function to decrypt data.
encrypt()  : string
Function to encrypt data.
generatePassword()  : string
Generate random password.
generateUserPassword()  : string
Generate user password.
get()  : mixed
Function to get the value for a given key.
getArray()  : array<string|int, mixed>
Function to get the array values for a given key.
getData()  : array<string|int, mixed>
Function to get all the values of the Object.
getForHtml()  : mixed
Function to get the html encoded value for a given key.
getForSql()  : mixed
Function to get the value if its safe to use for SQL Query (column).
getInstance()  : self
Function to get instance.
getKeys()  : array<string|int, string>
Function to get keys.
getLengthVector()  : int
Specifies the length of the vector.
getMethods()  : array<string|int, string>
Returns list method of encryption.
has()  : bool
Function to check if the key exists.
isActive()  : bool
Checks if encrypt or decrypt is possible.
isEmpty()  : bool
Function to check if the key is empty.
recalculatePasswords()  : mixed
Function to change password for encryption.
remove()  : mixed
Function to remove the value.
set()  : $this
Function to set the value for a given key.
setData()  : $this
Function to set all the values.
verifyPasswordHash()  : bool
Check password hash.

Properties

$recommendedMethods

public static array<string|int, mixed> $recommendedMethods = ['aes-256-cbc', 'aes-256-ctr', 'aes-192-cbc', 'aes-192-ctr']

Recommended encryption methods

$value

protected mixed $value

$mapPasswords

private static array<string|int, mixed> $mapPasswords = ['roundcube_users' => ['columnName' => ['password'], 'index' => 'user_id', 'db' => 'base'], 's_#__mail_smtp' => ['columnName' => ['password', 'smtp_password'], 'index' => 'id', 'db' => 'admin'], 'a_#__smsnotifier_servers' => ['columnName' => ['api_key'], 'index' => 'id', 'db' => 'admin'], 'w_#__api_user' => ['columnName' => ['auth'], 'index' => 'id', 'db' => 'webservice'], 'w_#__portal_user' => ['columnName' => ['auth'], 'index' => 'id', 'db' => 'webservice'], 'w_#__servers' => ['columnName' => ['pass', 'api_key'], 'index' => 'id', 'db' => 'webservice'], 'dav_users' => ['columnName' => ['key'], 'index' => 'id', 'db' => 'base'], AppMeetingService::TABLE_NAME => ['columnName' => ['secret'], 'index' => 'id', 'db' => 'admin'], 'i_#__magento_servers' => ['columnName' => ['password'], 'index' => 'id', 'db' => 'admin']]

Passwords to encrypt

Methods

__construct()

Constructor.

public __construct([array<string|int, mixed> $values = [] ]) : mixed
Parameters
$values : array<string|int, mixed> = []
Return values
mixed

createHash()

Function to create a hash.

public static createHash(string $text) : string
Parameters
$text : string
Return values
string

createPasswordHash()

Function to create a password hash.

public static createPasswordHash(string $text, string $pepper) : string
Parameters
$text : string
$pepper : string
Return values
string

decrypt()

Function to decrypt data.

public decrypt(string $encrypted) : string
Parameters
$encrypted : string
Return values
string

encrypt()

Function to encrypt data.

public encrypt(string $decrypted) : string
Parameters
$decrypted : string
Return values
string

generatePassword()

Generate random password.

public static generatePassword([int $length = 10 ][, mixed $type = 'lbd' ]) : string
Parameters
$length : int = 10
$type : mixed = 'lbd'
Return values
string

generateUserPassword()

Generate user password.

public static generateUserPassword([int $length = 10 ]) : string
Parameters
$length : int = 10
Return values
string

get()

Function to get the value for a given key.

public get(string $key) : mixed
Parameters
$key : string
Return values
mixed

Value for the given key

getArray()

Function to get the array values for a given key.

public getArray(string $key[, array<string|int, mixed> $value = [] ]) : array<string|int, mixed>
Parameters
$key : string
$value : array<string|int, mixed> = []
Return values
array<string|int, mixed>

getData()

Function to get all the values of the Object.

public getData() : array<string|int, mixed>
Return values
array<string|int, mixed>

getForHtml()

Function to get the html encoded value for a given key.

public getForHtml(string $key) : mixed
Parameters
$key : string
Return values
mixed

getForSql()

Function to get the value if its safe to use for SQL Query (column).

public getForSql(string $key[, bool $skipEmtpy = true ]) : mixed
Parameters
$key : string
$skipEmtpy : bool = true

Skip the check if string is empty

Return values
mixed

Value for the given key

getInstance()

Function to get instance.

public static getInstance() : self
Return values
self

getKeys()

Function to get keys.

public getKeys() : array<string|int, string>
Return values
array<string|int, string>

getLengthVector()

Specifies the length of the vector.

public static getLengthVector(string $method) : int
Parameters
$method : string
Return values
int

getMethods()

Returns list method of encryption.

public static getMethods() : array<string|int, string>
Return values
array<string|int, string>

has()

Function to check if the key exists.

public has(string $key) : bool
Parameters
$key : string
Return values
bool

isActive()

Checks if encrypt or decrypt is possible.

public isActive() : bool
Return values
bool

isEmpty()

Function to check if the key is empty.

public isEmpty(string $key) : bool
Parameters
$key : string
Return values
bool

recalculatePasswords()

Function to change password for encryption.

public static recalculatePasswords(string $method, string $password, string $vector) : mixed
Parameters
$method : string
$password : string
$vector : string
Tags
throws
Exception
throws
AppException
Return values
mixed

remove()

Function to remove the value.

public remove(string $key) : mixed
Parameters
$key : string
Return values
mixed

set()

Function to set the value for a given key.

public set(string $key, mixed $value) : $this
Parameters
$key : string
$value : mixed
Return values
$this

setData()

Function to set all the values.

public setData(mixed $values) : $this
Parameters
$values : mixed
Return values
$this

verifyPasswordHash()

Check password hash.

public static verifyPasswordHash(string $password, string $hash, string $pepper) : bool
Parameters
$password : string
$hash : string
$pepper : string
Return values
bool

        

Search results