Use phpseclib's Crypt module to generate encryption keys

Signed-off-by: Michal Čihař <michal@cihar.com>
This commit is contained in:
Michal Čihař 2016-07-12 14:02:26 +02:00
parent 0d57c09bd5
commit 2f79bacefa

View File

@ -214,7 +214,12 @@ class ServerConfigChecks
$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);