\app\framework\Component\EncryptionEncrypter

Summary

Methods
Properties
Constants
__construct()
supported()
generateKey()
encrypt()
encryptString()
decrypt()
decryptString()
getKey()
No public properties found
No constants found
hash()
getJsonPayload()
validPayload()
validMac()
calculateMac()
$key
$cipher
N/A
No private methods found
No private properties found
N/A

Properties

$key

$key : string

The encryption key

Type

string

$cipher

$cipher : string

The algorithm used for encryption

Type

string

Methods

__construct()

__construct(  $key,   $cipher = \app\framework\Component\Encryption\Ciphers::AES_128_CBC) 

Parameters

$key
$cipher

supported()

supported(string  $key, string  $cipher) : boolean

Determine if the given key and cipher combination is valid.

Parameters

string $key
string $cipher

Returns

boolean

generateKey()

generateKey(string  $cipher) : string

Create a new encryption key for the given cipher.

Parameters

string $cipher

Throws

\Exception

Returns

string

encrypt()

encrypt(  $value, boolean  $serialize = true) : string

Encrypt the given value

Parameters

$value
boolean $serialize

Throws

\Exception

Returns

string

encryptString()

encryptString(  $value) 

Parameters

$value

decrypt()

decrypt(  $payload, boolean  $unserialize = true) : mixed

Parameters

$payload
boolean $unserialize

Throws

\Exception

Returns

mixed

decryptString()

decryptString(  $payload) 

Parameters

$payload

getKey()

getKey() : string

Get the encryption key.

Returns

string

hash()

hash(string  $iv, mixed  $value) : string

Create a MAC for the given value.

Parameters

string $iv
mixed $value

Returns

string

getJsonPayload()

getJsonPayload(string  $payload) : array

Get the JSON array from the given payload.

Parameters

string $payload

Throws

\app\framework\Component\Encryption\DecryptException

Returns

array

validPayload()

validPayload(mixed  $payload) : boolean

Verify that the encryption payload is valid.

Parameters

mixed $payload

Returns

boolean

validMac()

validMac(array  $payload) : boolean

Determine if the MAC for the given payload is valid.

Parameters

array $payload

Throws

\Exception

Returns

boolean

calculateMac()

calculateMac(array  $payload, string  $bytes) : string

Calculate the hash of the given payload.

Parameters

array $payload
string $bytes

Returns

string