Elgg
Version 6.1
|
Manages a site-specific secret key, encoded as a 32 byte string "secret". More...
Public Member Functions | |
__construct (protected Crypto $crypto, protected ConfigTable $table) | |
Constructor. More... | |
get ($raw=false) | |
Returns the site secret. More... | |
getStrength () | |
Get the strength of the site secret. More... | |
regenerate () | |
Initialise the site secret (32 bytes: "z" to indicate format + 186-bit key in Base64 URL) and save to config table. More... | |
Public Attributes | |
const | CONFIG_KEY = '__site_secret__' |
Protected Attributes | |
string | $key |
Manages a site-specific secret key, encoded as a 32 byte string "secret".
The key can have two formats:
The hex keys were created with rand() as the only decent source of entropy (the site's creation time is not too difficult to find). As such, systems with a low getrandmax() value created particularly weak keys. You can check key string using getStrength().
Definition at line 24 of file SiteSecret.php.
Elgg\Security\SiteSecret::__construct | ( | protected Crypto | $crypto, |
protected ConfigTable | $table | ||
) |
Constructor.
Definition at line 36 of file SiteSecret.php.
Elgg\Security\SiteSecret::get | ( | $raw = false | ) |
Returns the site secret.
Used to generate difficult to guess hashes for sessions and action tokens.
bool | $raw | If true, a binary key will be returned |
RuntimeException |
Definition at line 55 of file SiteSecret.php.
Elgg\Security\SiteSecret::getStrength | ( | ) |
Get the strength of the site secret.
If "weak" or "moderate" is returned, this assumes we're running on the same system that created the key.
Definition at line 89 of file SiteSecret.php.
Elgg\Security\SiteSecret::regenerate | ( | ) |
Initialise the site secret (32 bytes: "z" to indicate format + 186-bit key in Base64 URL) and save to config table.
Used during installation or regeneration.
Definition at line 113 of file SiteSecret.php.
|
protected |
Definition at line 28 of file SiteSecret.php.
const Elgg\Security\SiteSecret::CONFIG_KEY = '__site_secret__' |
Definition at line 26 of file SiteSecret.php.