public bool validatePaswword(string password)
        {
            FileEncryptor.CreateHash(password, passwordSalt);
            string hash = Convert.ToBase64String(FileEncryptor.DES.Key);

            if (passwordHash == hash)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 2
0
        public void TestCreateHash()
        {
            string password = "******";
            int    length   = 10;

            try
            {
                var salt      = FileEncryptor.CreateSalt(length);
                var hash      = FileEncryptor.CreateHash(password, salt);
                var hashBytes = Convert.FromBase64String(hash);
            }
            catch
            {
                Assert.Fail("Hash value does not contain valid base64 characters");
            }
            Assert.Pass("Hash value is valid, contains only base64 characters");
        }
 public void setPassword(string newPassword)
 {
     passwordSalt = FileEncryptor.CreateSalt(10);
     passwordHash = FileEncryptor.CreateHash(newPassword, passwordSalt);
     amcw.WriteToConfigFile(passwordHash, passwordSalt);
 }