55 public function get($raw =
false) {
65 if ($this->key[0] ===
'z') {
67 $base64 = strtr(substr($this->key, 1),
'-_',
'+/');
68 $key = base64_decode($base64);
78 return hex2bin($this->key);
90 $secret = $this->
get();
91 if ($secret[0] !==
'z') {
92 $rand_max = getrandmax();
93 if ($rand_max < pow(2, 16)) {
97 if ($rand_max < pow(2, 32)) {
114 $key =
'z' . $this->crypto->getRandomString(31);
116 $this->table->set(self::CONFIG_KEY,
$key);
Manipulates values in the dbprefix_config table.
Thrown when there is a major problem with the installation.
Exception thrown if an error which can only be found on runtime occurs.
Manages a site-specific secret key, encoded as a 32 byte string "secret".
__construct(protected Crypto $crypto, protected ConfigTable $table)
Constructor.
getStrength()
Get the strength of the site secret.
regenerate()
Initialise the site secret (32 bytes: "z" to indicate format + 186-bit key in Base64 URL) and save to...