feat: Enforce a minimum TLS size of 2048bit
This commit is contained in:
parent
a7c1dc4520
commit
04943fad79
2 changed files with 14 additions and 0 deletions
|
|
@ -150,6 +150,13 @@ MainWindow::MainWindow()
|
||||||
|
|
||||||
// Force generation of SHA256 for the localhost
|
// Force generation of SHA256 for the localhost
|
||||||
if (Settings::value(Settings::Security::TlsEnabled).toBool()) {
|
if (Settings::value(Settings::Security::TlsEnabled).toBool()) {
|
||||||
|
if (Settings::value(Settings::Security::KeySize).toInt() < 2048) {
|
||||||
|
QMessageBox::information(
|
||||||
|
this, kAppName,
|
||||||
|
tr("Your current TLS key is smaller than the minimum allowed size, A new key 2048-bit key will be generated.")
|
||||||
|
);
|
||||||
|
regenerateLocalFingerprints();
|
||||||
|
}
|
||||||
if (!QFile::exists(Settings::tlsLocalDb())) {
|
if (!QFile::exists(Settings::tlsLocalDb())) {
|
||||||
regenerateLocalFingerprints();
|
regenerateLocalFingerprints();
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,13 @@ bool TlsUtility::generateCertificate()
|
||||||
}
|
}
|
||||||
|
|
||||||
auto length = Settings::value(Settings::Security::KeySize).toInt();
|
auto length = Settings::value(Settings::Security::KeySize).toInt();
|
||||||
|
|
||||||
|
if (length < 2048) {
|
||||||
|
length = 2048;
|
||||||
|
qDebug("selected size too small setting certificate size to 2048");
|
||||||
|
Settings::setValue(Settings::Security::KeySize, 2048);
|
||||||
|
}
|
||||||
|
|
||||||
const auto certificate = Settings::value(Settings::Security::Certificate).toString();
|
const auto certificate = Settings::value(Settings::Security::Certificate).toString();
|
||||||
return m_certificate.generateCertificate(certificate, length);
|
return m_certificate.generateCertificate(certificate, length);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue