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 ab05803a42
commit c8297b4718
2 changed files with 3 additions and 3 deletions

View File

@ -600,8 +600,8 @@ class AuthenticationCookie extends AuthenticationPlugin
{
if (empty($GLOBALS['cfg']['blowfish_secret'])) {
if (empty($_SESSION['auto_blowfish_secret'])) {
// this returns 23 characters
$_SESSION['auto_blowfish_secret'] = uniqid('', true);
// this returns 32 characters
$_SESSION['auto_blowfish_secret'] = crypt_random_string(32);
}
return $_SESSION['auto_blowfish_secret'];
} else {

View File

@ -330,7 +330,7 @@ function perform_config_checks()
$server_name = htmlspecialchars($server_name);
if ($cookie_auth_server && $blowfish_secret === null) {
$blowfish_secret = uniqid('', true);
$blowfish_secret = bin2hex(crypt_random_string(16));
$blowfish_secret_set = true;
$cf->set('blowfish_secret', $blowfish_secret);
}