private bool CheckPassword(IS2G10_DBSSSDataSet.USERPROFILERow userProfile, string sPass)
        {
            var check = _passwordBuilder.CheckPassword(sPass, userProfile.password_hash, userProfile.password_salt);

            //check if password is right
            if (!check)
            {
                _dialogService.CallMessageModal(this, "", SSS_Library.Properties.Resources.IncorrectLoginDetailsMessage);
                PasswordTextBox.Clear();
                UsernameTextBox.Clear();
                UsernameTextBox.Focus();
            }
            return(check);
        }
Пример #2
0
        private bool CheckPassword(SSS_Library.IS2G10_DBSSSDataSet.USERPROFILERow userProfile, string sPass)
        {
            var check = _passwordBuilder.CheckPassword(sPass, userProfile.password_hash, userProfile.password_salt);

            //check if password is right
            if (!check)
            {
                MessageBox.Show(Resources.IncorrectLoginDetailsMessage, Resources.IncorrectLoginDetailsMessage);
                medPassword.Clear();
                medUsername.Clear();
                medUsername.Focus();
            }
            return(check);
        }
        public void TestPasswordHasing()
        {
            //make a password
            string test = "HereBeDragons64";
            string hash;
            string salt;

            _passwordBuilder.CreateHash(test, out hash, out salt);

            //get back

            var returnTest = _passwordBuilder.ComputeHash_ShaSalt(test, StringHandler.GetBytes(salt));
            var testString = Convert.ToBase64String(returnTest);

            Assert.AreEqual(testString, hash);

            //check if check works
            var check = _passwordBuilder.CheckPassword(test, hash, salt);

            Assert.IsTrue(check);
        }