Merge pull request #8153 from JakubOnderka/more-entropy

chg: [cli] Use more entropy when generating new encryption key
pull/8159/head
Jakub Onderka 2022-02-19 18:24:44 +01:00 committed by GitHub
commit 4cac16b757
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 3 deletions

View File

@ -936,7 +936,7 @@ class AdminShell extends AppShell
$new = $this->params['new'] ?? null;
if ($new !== null && strlen($new) < 32) {
$this->error('New key must be at least 32 char long.');
$this->error('New key must be at least 32 chars long.');
}
if ($old === null) {
@ -945,8 +945,7 @@ class AdminShell extends AppShell
if ($new === null) {
// Generate random new key
$randomTool = new RandomTool();
$new = $randomTool->random_str();
$new = rtrim(base64_encode(random_bytes(32)), "=");
}
$this->Server->getDataSource()->begin();