static bool ValidateUser(string UserName)
        {
            if (UserName != null)
            {
                StockyDataDataContext DB = new StockyDataDataContext();

                var query = from U in DB.dtUsers
                            where U.UserName == UserName
                            select U;
                if (query.FirstOrDefault().UserName != null)
                {
                    StaticDataReposityory.UserID = query.FirstOrDefault().uID;
                    CurrentPassword = query.FirstOrDefault().PassWord;
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
        static bool ValidatePassword(string password)
        {
            StockyDataDataContext DB = new StockyDataDataContext();

            char[] delimiter  = { ':' };
            var    split      = CurrentPassword.Split(delimiter);
            var    iterations = Int32.Parse(split[IterationIndex]);
            var    salt       = Convert.FromBase64String(split[SaltIndex]);
            var    hash       = Convert.FromBase64String(split[Pbkdf2Index]);

            var testHash = GetPbkdf2Bytes(password, salt, iterations, hash.Length);

            return(SlowEquals(hash, testHash));
        }
Beispiel #3
0
 public RepoBase()
 {
     DB = new StockyDataDataContext();
 }