Ejemplo n.º 1
0
        private static string GetKeyMaterial(string password)
        {
            if (string.IsNullOrEmpty(password))
            {
                return(string.Empty);
            }
            String hashToCheck = PasswordFunctions.ComputeMasterPasswordHash(password);

            return(PasswordFunctions.ComputeMasterPasswordHash(password + hashToCheck));
        }
Ejemplo n.º 2
0
        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");
        }
Ejemplo n.º 3
0
        public static Boolean IsMasterPasswordValid(string passwordToCheck)
        {
            String hashToCheck = PasswordFunctions.ComputeMasterPasswordHash(passwordToCheck);

            if (GetMasterPasswordHash() == hashToCheck)
            {
                UpdateKeyMaterial(passwordToCheck);
                return(true);
            }

            return(false);
        }