Skip to content

Commit

Permalink
Use phpseclib's Crypt module to generate encryption keys
Browse files Browse the repository at this point in the history
Signed-off-by: Michal Čihař <michal@cihar.com>
  • Loading branch information
nijel committed Jul 12, 2016
1 parent c976baa commit 698ef51
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion libraries/config/ServerConfigChecks.class.php
Expand Up @@ -223,7 +223,12 @@ protected function performConfigChecksServersSetBlowfishSecret(
$blowfishSecret, $cookieAuthServer, $blowfishSecretSet
) {
if ($cookieAuthServer && $blowfishSecret === null) {
$blowfishSecret = uniqid('', true);
if (! function_exists('openssl_random_pseudo_bytes')) {
$blowfishSecret = bin2hex(phpseclib\Crypt\Random::string(16));
} else {
$blowfishSecret = bin2hex(openssl_random_pseudo_bytes(16));
}

$blowfishSecretSet = true;
$this->cfg->set('blowfish_secret', $blowfishSecret);
return array($blowfishSecret, $blowfishSecretSet);
Expand Down

0 comments on commit 698ef51

Please sign in to comment.