Warn users about low entropy keys (#7003)

Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
This commit is contained in:
Jonathan Bennett
2025-06-10 06:33:13 -05:00
committed by GitHub
parent c6c2a4d4dd
commit 4bf2dd04ae
3 changed files with 104 additions and 1 deletions

View File

@@ -548,6 +548,19 @@ meshtastic_Routing_Error perhapsEncode(meshtastic_MeshPacket *p)
numbytes += MESHTASTIC_PKC_OVERHEAD;
p->channel = 0;
p->pki_encrypted = true;
// warn the user about a low entropy key
if (nodeDB->keyIsLowEntropy) {
LOG_WARN(LOW_ENTROPY_WARNING);
if (!nodeDB->hasWarned) {
meshtastic_ClientNotification *cn = clientNotificationPool.allocZeroed();
cn->level = meshtastic_LogRecord_Level_WARNING;
cn->time = getValidTime(RTCQualityFromNet);
sprintf(cn->message, LOW_ENTROPY_WARNING);
service->sendClientNotification(cn);
nodeDB->hasWarned = true;
}
}
} else {
if (p->pki_encrypted == true) {
// Client specifically requested PKI encryption