Class Security
Security Library contains utility methods related to security
Copyright: Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
License: License (http://www.opensource.org/licenses/mit-license.php)
Location: Cake/Utility/Security.php
Properties summary
-
$hashType
public staticstring
Default hash method
Method Summary
-
cipher() public static
Encrypts/Decrypts a text using the given key. -
generateAuthKey() public static
Generate authorization hash. -
hash() public static
Create a hash from string using given method. Fallback on next available method.
-
inactiveMins() public static
Get allowed minutes of inactivity based on security level. -
setHash() public static
Sets the default hash method for the Security object. This affects all objects using Security::hash().
-
validateAuthKey() public static
Validate authorization hash.
Method Detail
cipher() public static ¶
cipher( string $text , string $key )
Encrypts/Decrypts a text using the given key.
Parameters
- string $text
- Encrypted string to decrypt, normal string to encrypt
- string $key
- Key to use
Returns
Encrypted/Decrypted string
generateAuthKey() public static ¶
generateAuthKey( )
Generate authorization hash.
Returns
Hash
hash() public static ¶
hash( string $string , string $type = null , boolean $salt = false )
Create a hash from string using given method. Fallback on next available method.
Parameters
- string $string
- String to hash
- string $type optional null
- Method to use (sha1/sha256/md5)
- boolean $salt optional false
If true, automatically appends the application's salt value to $string (Security.salt)
Returns
Hash
inactiveMins() public static ¶
inactiveMins( )
Get allowed minutes of inactivity based on security level.
Returns
Allowed inactivity in minutes
setHash() public static ¶
setHash( string $hash )
Sets the default hash method for the Security object. This affects all objects using Security::hash().
Parameters
- string $hash
- Method to use (sha1/sha256/md5)
See
validateAuthKey() public static ¶
validateAuthKey( string $authKey )
Validate authorization hash.
Parameters
- string $authKey
- Authorization hash
Returns
Success