From 49a775087aa19bba65253952cc9eaa5c4e30ce78 Mon Sep 17 00:00:00 2001 From: dogeystamp Date: Wed, 4 Jan 2023 15:44:04 -0500 Subject: [PATCH] aes.js: add warnings for excessive PBKDF2 iterations --- scripts/aes.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/aes.js b/scripts/aes.js index 87462a7..dfecd13 100644 --- a/scripts/aes.js +++ b/scripts/aes.js @@ -116,6 +116,9 @@ encButton.handle.addEventListener("click", async function() { let pbkdf2Iters = encPbkdf2Iters.value; if (pbkdf2Iters === undefined) return; + if (pbkdf2Iters > 1000000) { + encPbkdf2Iters.alertBox("alert-info", `PBKDF2 is using ${pbkdf2Iters} iterations: this might take a long time...`); + } if (encManualKey.value) { key = await window.crypto.subtle.importKey( @@ -178,6 +181,8 @@ decButton.handle.addEventListener("click", async function() { pbkdf2Iters = msgEncoded.pbkdf2Iters; if (pbkdf2Iters < 1 || pbkdf2Iters%1 !== 0) { decMsg.alertBox("alert-error", "Invalid PBKDF2 iters setting."); + } else if (pbkdf2Iters > 1000000) { + decMsg.alertBox("alert-info", `PBKDF2 is using ${pbkdf2Iters} iterations: this might take a long time...`); } } catch (e) { decMsg.alertBox("alert-error", "Invalid encrypted payload.");