From 2f79bacefab46fc43cedd70917c50800caaa417a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Tue, 12 Jul 2016 14:02:26 +0200 Subject: [PATCH] Use phpseclib's Crypt module to generate encryption keys MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michal Čihař --- libraries/config/ServerConfigChecks.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libraries/config/ServerConfigChecks.php b/libraries/config/ServerConfigChecks.php index ae57be2fc6..39f7b092f2 100644 --- a/libraries/config/ServerConfigChecks.php +++ b/libraries/config/ServerConfigChecks.php @@ -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);