Example #1
0
        static void Main(string[] args)
        {
            SqlCrud sql = new SqlCrud(GetConnectionString());
            GeneratePasswordAndSalt generatePasswordAndSalt = new GeneratePasswordAndSalt();
            SqlDataAccess           d = new SqlDataAccess();
            VerifyPassword          verifyValidPassword = new VerifyPassword();

            // Creates a user
            Users user = new Users();

            Console.Write("Enter First Name: ");
            user.FirstName = Console.ReadLine();

            Console.Write("Enter Last Name: ");
            user.LastName = Console.ReadLine();


            Console.Write("Enter a password: "******"password and salt:   {Convert.ToBase64String(passwordAndSalt)}");
            Console.WriteLine("Type yoy password again to login");
            string testPassword = Console.ReadLine();
            Console.WriteLine(
                verifyValidPassword.VerifyVerySecurePassword(testPassword, UserSalt, 50000, passwordAndSalt));
            Console.ReadLine();

            #endregion



            //generatePasswordAndSalt.GeneratePassword(user);


            // Creates a user wit password user ans saves it to the database
            sql.CreateUserAndPassword(user);


            Users u = new Users();
            Console.Write("Enter a password To Verify Login: "******"Password: {u.Password} Salt: {u.Salt}");

            Console.WriteLine(verifyValidPassword.VerifyValidPassword(verifyPassword, user, u));


            Console.WriteLine("Hello World!");
        }