Encrypter
class Encrypter implements Encrypter
Properties
protected string | $key | The encryption key. |
|
protected string | $cipher | The algorithm used for encryption. |
Methods
Create a new encrypter instance.
Determine if the given key and cipher combination is valid.
Encrypt the given value.
Encrypt a string without serialization.
Decrypt the given value.
Decrypt the given string without unserialization.
Create a MAC for the given value.
Get the JSON array from the given payload.
Verify that the encryption payload is valid.
Determine if the MAC for the given payload is valid.
Calculate the hash of the given payload.
Get the encryption key.
Details
at line 35
void
__construct(string $key, string $cipher = 'AES-128-CBC')
Create a new encrypter instance.
at line 54
static bool
supported(string $key, string $cipher)
Determine if the given key and cipher combination is valid.
at line 71
string
encrypt(string $value, bool $serialize = true)
Encrypt the given value.
at line 107
string
encryptString(string $value)
Encrypt a string without serialization.
at line 121
string
decrypt(string $payload, bool $unserialize = true)
Decrypt the given value.
at line 147
string
decryptString(string $payload)
Decrypt the given string without unserialization.
at line 159
protected string
hash(string $iv, mixed $value)
Create a MAC for the given value.
at line 172
protected array
getJsonPayload(string $payload)
Get the JSON array from the given payload.
at line 196
protected bool
validPayload(mixed $payload)
Verify that the encryption payload is valid.
at line 209
protected bool
validMac(array $payload)
Determine if the MAC for the given payload is valid.
at line 225
protected string
calculateMac(array $payload, string $bytes)
Calculate the hash of the given payload.
at line 237
string
getKey()
Get the encryption key.