From 1ef526f0f0ea664518789c5ab73ed9de140714ad Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Wed, 18 Apr 2018 14:05:21 +0200 Subject: Strengthen the use of the Master Password. - Use 30k iterations instead of 1. - Enforce minimum password length of 8 characters. - Adjust strength meter accordingly. This resolves #82. --- security/nss/lib/softoken/sftkpwd.c | 4 ++-- .../locales/en-US/chrome/mozapps/preferences/changemp.dtd | 2 +- toolkit/mozapps/preferences/changemp.js | 12 +++++++++--- toolkit/mozapps/preferences/changemp.xul | 7 ++++--- 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/security/nss/lib/softoken/sftkpwd.c b/security/nss/lib/softoken/sftkpwd.c index e0d2df9ab..07b6922dc 100644 --- a/security/nss/lib/softoken/sftkpwd.c +++ b/security/nss/lib/softoken/sftkpwd.c @@ -273,7 +273,7 @@ sftkdb_EncryptAttribute(PLArenaPool *arena, SECItem *passKey, RNG_GenerateGlobalRandomBytes(saltData, cipherValue.salt.len); param = nsspkcs5_NewParam(cipherValue.alg, HASH_AlgSHA1, &cipherValue.salt, - 1); + 30000); if (param == NULL) { rv = SECFailure; goto loser; @@ -444,7 +444,7 @@ sftkdb_SignAttribute(PLArenaPool *arena, SECItem *passKey, RNG_GenerateGlobalRandomBytes(saltData, prfLength); /* initialize our pkcs5 parameter */ - param = nsspkcs5_NewParam(signValue.alg, HASH_AlgSHA1, &signValue.salt, 1); + param = nsspkcs5_NewParam(signValue.alg, HASH_AlgSHA1, &signValue.salt, 30000); if (param == NULL) { rv = SECFailure; goto loser; diff --git a/toolkit/locales/en-US/chrome/mozapps/preferences/changemp.dtd b/toolkit/locales/en-US/chrome/mozapps/preferences/changemp.dtd index 1cc7b9621..1b1d5ac55 100644 --- a/toolkit/locales/en-US/chrome/mozapps/preferences/changemp.dtd +++ b/toolkit/locales/en-US/chrome/mozapps/preferences/changemp.dtd @@ -9,5 +9,5 @@ - + diff --git a/toolkit/mozapps/preferences/changemp.js b/toolkit/mozapps/preferences/changemp.js index 82dd20128..71664b3e1 100644 --- a/toolkit/mozapps/preferences/changemp.js +++ b/toolkit/mozapps/preferences/changemp.js @@ -167,8 +167,8 @@ function setPasswordStrength() // length of the password var pwlength=(pw.length); - if (pwlength>5) - pwlength=5; + if (pwlength>10) + pwlength=10; // use of numbers in the password @@ -190,7 +190,7 @@ function setPasswordStrength() upper=3; - var pwstrength=((pwlength*10)-20) + (numeric*10) + (numsymbols*15) + (upper*10); + var pwstrength=((pwlength*5)-20) + (numeric*10) + (numsymbols*15) + (upper*10); // make sure we're give a value between 0 and 100 if ( pwstrength < 0 ) { @@ -227,6 +227,12 @@ function checkPasswords() } } + // Never accept short passwords < 8 chars + if (pw1.length < 8) { + ok.setAttribute("disabled", "true"); + return; + } + if (pw1 == pw2) { ok.setAttribute("disabled", "false"); } else diff --git a/toolkit/mozapps/preferences/changemp.xul b/toolkit/mozapps/preferences/changemp.xul index 14d02295e..b316fa42b 100644 --- a/toolkit/mozapps/preferences/changemp.xul +++ b/toolkit/mozapps/preferences/changemp.xul @@ -34,7 +34,7 @@ - +