PHP Class Horde_Secret, horde

Copyright 1999-2016 Horde LLC (http://www.horde.org/) See the enclosed file COPYING for license information (LGPL). If you did not receive this file, see http://www.horde.org/licenses/lgpl21.
Author: Chuck Hagenbuch ([email protected])
Author: Michael Slusarz ([email protected])
Mostrar archivo Open project: horde/horde Class Usage Examples

Protected Properties

Property Type Description
$_cipherCache array Cipher cache.
$_keyCache array Key cache.
$_params array Configuration parameters.

Public Methods

Method Description
__construct ( array $params = [] ) Constructor.
clearKey ( string $keyname = self::DEFAULT_KEY ) : boolean Clears a secret key entry from the current cookie.
getKey ( string $keyname = self::DEFAULT_KEY ) : string Return a secret key, either from a cookie, or if the cookie isn't there, assume we are using a munged version of a known base value.
read ( string $key, $ciphertext ) : string Decrypt a message encrypted with write().
setKey ( string $keyname = self::DEFAULT_KEY ) : string Generate a secret key (for encryption), either using a random string and storing it in a cookie if the user has cookies enabled, or munging some known values if they don't.
write ( string $key, string $message ) : string Take a small piece of data and encrypt it with a key.

Protected Methods

Method Description
_getCipherOb ( string $key ) : Horde_Crypt_Blowfish Returns the cached crypt object.
_setCookie ( string $keyname, string $key ) Sets the cookie with the given keyname/key.

Method Details

__construct() public method

Constructor.
public __construct ( array $params = [] )
$params array Configuration parameters: - cookie_domain: (string) The cookie domain. - cookie_path: (string) The cookie path. - cookie_ssl: (boolean) Only transmit cookie securely? - session_name: (string) The cookie session name.

_getCipherOb() protected method

Returns the cached crypt object.
protected _getCipherOb ( string $key ) : Horde_Crypt_Blowfish
$key string The key to use for [de|en]cryption. Only the first 56 bytes of this string is used.
return Horde_Crypt_Blowfish The crypt object.

_setCookie() protected method

Sets the cookie with the given keyname/key.
protected _setCookie ( string $keyname, string $key )
$keyname string The name of the key to set.
$key string The key to use for encryption.

clearKey() public method

Clears a secret key entry from the current cookie.
public clearKey ( string $keyname = self::DEFAULT_KEY ) : boolean
$keyname string The name of the key to clear.
return boolean True if key existed, false if not.

getKey() public method

Return a secret key, either from a cookie, or if the cookie isn't there, assume we are using a munged version of a known base value.
public getKey ( string $keyname = self::DEFAULT_KEY ) : string
$keyname string The name of the key to get.
return string The secret key.

read() public method

Decrypt a message encrypted with write().
public read ( string $key, $ciphertext ) : string
$key string The key to use for decryption.
return string The plaintext message.

setKey() public method

Generate a secret key (for encryption), either using a random string and storing it in a cookie if the user has cookies enabled, or munging some known values if they don't.
public setKey ( string $keyname = self::DEFAULT_KEY ) : string
$keyname string The name of the key to set.
return string The secret key that has been generated.

write() public method

Take a small piece of data and encrypt it with a key.
public write ( string $key, string $message ) : string
$key string The key to use for encryption.
$message string The plaintext message.
return string The ciphertext message.

Property Details

$_cipherCache protected_oe property

Cipher cache.
protected array $_cipherCache
return array

$_keyCache protected_oe property

Key cache.
protected array $_keyCache
return array

$_params protected_oe property

Configuration parameters.
protected array $_params
return array