コード例 #1
0
        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);
        }
コード例 #2
0
        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");
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        private static bool TestDatabasePassword(string connectionStringToTest, string databasePassword)
        {
            var storedHash = TryGetMasterPasswordHash(connectionStringToTest);

            return(PasswordFunctions2.MasterPasswordIsValid(databasePassword, storedHash));
        }