private static string GetKeyMaterial(string password) { if (string.IsNullOrEmpty(password)) { return(string.Empty); } String hashToCheck = PasswordFunctions.ComputeMasterPasswordHash(password); return(PasswordFunctions.ComputeMasterPasswordHash(password + hashToCheck)); }
public void V1MasterPasswordValidationTest() { // cant use persistence security here, because of initialization depends on newest algorithm string masterHash = PasswordFunctions.ComputeMasterPasswordHash(MASTERPASSWORD); string masterHash2 = PasswordFunctions.ComputeMasterPasswordHash(MASTERPASSWORD); Assert.AreEqual(masterHash, masterHash2); bool isValid = PasswordFunctions.MasterPasswordIsValid(MASTERPASSWORD, masterHash); Assert.IsTrue(isValid, "Couldn't validate stored master password v1"); }
public static Boolean IsMasterPasswordValid(string passwordToCheck) { String hashToCheck = PasswordFunctions.ComputeMasterPasswordHash(passwordToCheck); if (GetMasterPasswordHash() == hashToCheck) { UpdateKeyMaterial(passwordToCheck); return(true); } return(false); }