Class Mcrypt
Mcrypt implementation of crypto features for Cake\Utility\Security
This class is not intended to be used directly and should only be used in the context of Cake\Utility\Security.
Method Summary
Method Detail
decrypt() public static
decrypt(mixed $cipher, mixed $key)
Decrypt a value using AES-256.
Parameters
-
string
$cipher The ciphertext to decrypt.
-
string
$key The 256 bit/32 byte key to use as a cipher key.
Returns
string
Decrypted data. Any trailing null bytes will be removed.
Throws
InvalidArgumentException
On invalid data or key.
encrypt() public static
encrypt(mixed $plain, mixed $key)
Encrypt a value using AES-256.
Caveat You cannot properly encrypt/decrypt data with trailing null bytes. Any trailing null bytes will be removed on decryption due to how PHP pads messages with nulls prior to encryption.
Parameters
-
string
$plain The value to encrypt.
-
string
$key The 256 bit/32 byte key to use as a cipher key.
Returns
string
Encrypted data.
Throws
InvalidArgumentException
On invalid data or key.
rijndael() public static
rijndael(mixed $text, mixed $key, mixed $operation)
Encrypts/Decrypts a text using the given key using rijndael method.
Parameters
-
string
$text Encrypted string to decrypt, normal string to encrypt
-
string
$key Key to use as the encryption key for encrypted data.
-
string
$operation Operation to perform, encrypt or decrypt
Returns
string
Encrypted binary string data, or decrypted data depending on operation.
Throws
LogicException
When there are errors.
© 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/3.9/class-Cake.Utility.Crypto.Mcrypt.html