inc\classes\security.phpView Source

Show: PublicProtectedPrivateinherited
Table of Contents
Security tools

Used to implement escaping functions, etc

Author
Sergey Dilong  
License
GPL-2.0  
Package
Temply-Account\Core  

\security

Package: Temply-Account\Core
Security class

Vars checking, token generating, encrypting

Author
Sergey Dilong  
License
GPL-2.0  

Methods

methodpublicclean(mixed $a, boolean $n = false) : mixed
static

Var clean

Make variables clear and correct

Parameters
NameTypeDescription
$amixed

Var to check

$nboolean

Output check. If true - types won't be changed

Returns
TypeDescription
mixedResult
methodpublicdecrypt(string $ciphertext, string $key, string $iv, string $tag, array $o = array()) : string | boolean
static

Decrypt

Decrypts string

Parameters
NameTypeDescription
$ciphertextstring

Encodedtext

$keystring

Key

$ivstring

IV

$tagstring

Tag

$oarray

Options

  • cipher - Encryption method. Default = aes-128-gcm
Returns
TypeDescription
string | booleanResult. If `false` - failed.
methodpublicencrypt(string $plaintext, array $o = array()) : array<mixed,string> | boolean
static

Encrypt

Encrypts text

Parameters
NameTypeDescription
$plaintextstring

Text to encrypt

$oarray

Options

  • key - salt cipher - encryption method. Default = aes-128-gcm
Returns
TypeDescription
array<mixed,string> | booleanReturns `[$encrypted, $iv, $tag, $key ]` or `false` if failed
methodpublicfilter(mixed $a, boolean $n = false) : mixed
static

Var filter

Make variables and arrays secure and clear

Parameters
NameTypeDescription
$amixed

Var to check

$nboolean

Output check. If true - types won't be changed

Returns
TypeDescription
mixedChecked var
Throws
ExceptionDescription
\apiException* [103] Checking failed
Details
See
Cleaning function  
methodpublictoken_str(integer $l = 64) : string
static

Get Token

Generates crypt-secure random string for token (HEX)

Parameters
NameTypeDescription
$linteger

Token length

Returns
TypeDescription
stringToken
Documentation was generated by phpDocumentor v2.9.0.