On this page
Encrypter
class Encrypter implements Encrypter, StringEncrypter (View source)
Properties
protected string | $key | The encryption key. |
|
protected string | $cipher | The algorithm used for encryption. |
Methods
void | __construct(string $key, string $cipher = 'aes-128-cbc') Create a new encrypter instance. |
|
static bool | supported(string $key, string $cipher) Determine if the given key and cipher combination is valid. |
|
static string | generateKey(string $cipher) Create a new encryption key for the given cipher. |
|
string | encrypt(mixed $value, bool $serialize = true) Encrypt the given value. |
|
string | encryptString(string $value) Encrypt a string without serialization. |
|
mixed | decrypt(string $payload, bool $unserialize = true) Decrypt the given value. |
|
string | decryptString(string $payload) Decrypt the given string without unserialization. |
|
string | hash(string $iv, mixed $value) Create a MAC for the given value. |
|
array | getJsonPayload(string $payload) Get the JSON array from the given payload. |
|
bool | validPayload(mixed $payload) Verify that the encryption payload is valid. |
|
bool | validMac(array $payload) Determine if the MAC for the given payload is valid. |
|
void | ensureTagIsValid(string $tag) Ensure the given tag is a valid tag given the selected cipher. |
|
string | getKey() Get the encryption key that the encrypter is currently using. |
Details
void __construct(string $key, string $cipher = 'aes-128-cbc')
Create a new encrypter instance.
static bool supported(string $key, string $cipher)
Determine if the given key and cipher combination is valid.
static string generateKey(string $cipher)
Create a new encryption key for the given cipher.
string encrypt(mixed $value, bool $serialize = true)
Encrypt the given value.
string encryptString(string $value)
Encrypt a string without serialization.
mixed decrypt(string $payload, bool $unserialize = true)
Decrypt the given value.
string decryptString(string $payload)
Decrypt the given string without unserialization.
protected string hash(string $iv, mixed $value)
Create a MAC for the given value.
protected array getJsonPayload(string $payload)
Get the JSON array from the given payload.
protected bool validPayload(mixed $payload)
Verify that the encryption payload is valid.
protected bool validMac(array $payload)
Determine if the MAC for the given payload is valid.
protected void ensureTagIsValid(string $tag)
Ensure the given tag is a valid tag given the selected cipher.
string getKey()
Get the encryption key that the encrypter is currently using.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/10.x/Illuminate/Encryption/Encrypter.html