Security Library contains utility methods related to security
_checkKey( string $key , string $method )
Check the encryption key for proper length.
$key $method InvalidArgumentException_constantEquals( string $hmac , string $compare )
A timing attack resistant comparison that prefers native PHP implementations.
$hmac $compare booleandecrypt( string $cipher , string $key , string|null $hmacSalt null )
Decrypt a value using AES-256.
$cipher $key $hmacSalt optional null stringInvalidArgumentExceptionencrypt( string $plain , string $key , string|null $hmacSalt null )
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.
$plain $key $hmacSalt optional null stringInvalidArgumentExceptionengine( object $instance null )
Get the crypto implementation based on the loaded extensions.
You can use this method to forcibly decide between mcrypt/openssl/custom implementations.
$instance optional null objectInvalidArgumentExceptionhash( string $string , string|null $type null , mixed $salt false )
Create a hash from string using given method.
$string $type optional null Security::$hashType is used.$salt optional false stringrijndael( string $text , string $key , string $operation )
Encrypts/Decrypts a text using the given key using rijndael method.
$text $key $operation stringInvalidArgumentExceptionsalt( string|null $salt null )
Gets or sets the HMAC salt to be used for encryption/decryption routines.
$salt optional null stringsetHash( string $hash )
Sets the default hash method for the Security object. This affects all objects using Security::hash().
$hash Cake\Utility\Security::hash()
© 2005–2016 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.
http://api.cakephp.org/3.1/class-Cake.Utility.Security.html