Cookie Crypt Trait.
Provides the encrypt/decrypt logic for the CookieComponent.
string[]
Valid cipher names for encrypted cookies.
Explode method to return array from string set in CookieComponent::_implode() Maintains reading backwards compatibility with 1.x CookieComponent::_implode().
_checkCipher(string $encrypt)
Helper method for validating encryption cipher names.
string
$encrypt The cipher name.
RuntimeException
_decode(string $value, mixed $encrypt, ?string $key)
Decodes and decrypts a single value.
string
$value The value to decode & decrypt.
string|false
$encrypt The encryption cipher to use.
string|null
$key Used as the security salt if specified.
string|array
Decoded values.
_decrypt(mixed $values, mixed $mode, ?string $key)
Decrypts $value using public $type method in Security class
string[]|string
$values Values to decrypt
string|false
$mode Encryption mode
string|null
$key optional Used as the security salt if specified.
string|array
Decrypted values
_encrypt(mixed $value, mixed $encrypt, ?string $key)
Encrypts $value using public $type method in Security class
string|array
$value Value to encrypt
string|false
$encrypt Encryption mode to use. False disabled encryption.
string|null
$key optional Used as the security salt if specified.
string
Encoded values
_explode(string $string)
Explode method to return array from string set in CookieComponent::_implode() Maintains reading backwards compatibility with 1.x CookieComponent::_implode().
string
$string A string containing JSON encoded data, or a bare string.
string|array
Map of key and values
_getCookieEncryptionKey()
Returns the encryption key to be used.
string
_implode(array $array)
Implode method to keep keys are multidimensional arrays
array
$array Map of key and values
string
A JSON encoded string.
Valid cipher names for encrypted cookies.
string[]
© 2005–present The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/4.1/trait-Cake.Utility.CookieCryptTrait.html