public void V2UpgradePasswordsTest() { this.UpgradePasswordsTestInitialize(SECURED_CONFIG_FILE, SECURED_CREDENTIALS_FILE, "favoritesSecured.xml"); IPersistence persistence = this.RunUpgrade(); bool masterStillValid = PasswordFunctions2.MasterPasswordIsValid(PasswordTests.MASTERPASSWORD, settings.MasterPasswordHash); Assert.IsTrue(masterStillValid, "Master password upgrade failed."); AssertUserAndCredential(persistence); AssertFavoriteCredentialSet(persistence); }
public void V2MasterPasswordValidationTest() { string stored = PasswordFunctions2.CalculateStoredMasterPasswordKey(MASTERPASSWORD); string stored2 = PasswordFunctions2.CalculateStoredMasterPasswordKey(MASTERPASSWORD); Assert.AreNotEqual(stored, stored2); bool isValid = PasswordFunctions2.MasterPasswordIsValid(MASTERPASSWORD, stored); Assert.IsTrue(isValid, "Unable to validate encrypted master password version 2"); }
public void V2UpgradeNoMasterPasswordConfigTest() { this.UpgradePasswordsTestInitialize(NOMASTER_CONFIG_FILE, NOMASTER_CREDENTIALS_FILE); // simply nothing to upgrade, procedure shouldn't fail. IPersistence persistence = this.RunUpgrade(); Assert.IsFalse(askedForPassword, "Config file shouldn't ask for password"); bool masterStillValid = PasswordFunctions2.MasterPasswordIsValid(string.Empty, settings.MasterPasswordHash); Assert.IsTrue(masterStillValid, "Master password upgrade failed."); AssertUserAndCredential(persistence); }
private Boolean IsMasterPasswordValid(string passwordToCheck) { string storedMasterPassword = this.settings.MasterPasswordHash; bool isValid = PasswordFunctions2.MasterPasswordIsValid(passwordToCheck, storedMasterPassword); if (isValid) { this.KeyMaterial = PasswordFunctions2.CalculateMasterPasswordKey(passwordToCheck, storedMasterPassword); return(true); } return(false); }
private static bool TestDatabasePassword(string connectionStringToTest, string databasePassword) { var storedHash = TryGetMasterPasswordHash(connectionStringToTest); return(PasswordFunctions2.MasterPasswordIsValid(databasePassword, storedHash)); }