Exemplo n.º 1
0
 /// <summary>
 /// Returns a salted password
 /// </summary>
 /// <param name="password"></param>
 /// <returns></returns>
 public string CreateSaltedPassword(string password)
 {
     var utilSecurity = new Util.Security();
     var salt = Convert.ToString(Convert.ToInt32(ConfigurationSettings.AppSettings["Salt"].ToString()));
     var userToken = "CAAFbwB9jvhUBAFGwwcvEzYRGtSIVis7RO9dScMbZBbyHZCKjyAY1Q5Fr3i90TbNTlyQyf2W4MWsfsZCuppQ1ZBJFprKBkWB5hLJNk2njlecCA5J4xhiTaoSaPAdxiRnsFujPmHsqrPAH169JDEAd3Q8gxFen1FDp0jCIk6J25ukJzIPMkE5znTBcavYMYYbEvo27F3Ad2QZDZD";
     return  utilSecurity.CreateSaltedPassword(salt, userToken, Convert.ToInt32(ConfigurationSettings.AppSettings["SaltIteration"].ToString()));
 }
Exemplo n.º 2
0
        private static void CreateTestUserAccounts()
        {
            var utilSecurity = new Util.Security();
            string[,] usrList = new string[4, 4] {
                {"Kelli","Trent","password", "*****@*****.**"}
                ,{"Rhonda","Trent","password","*****@*****.**"}
                ,{"Sharon","Peddy","password","*****@*****.**"}
                ,{"Amanda","Weaver","password","*****@*****.**"}
            };

            for (int i = 0; i != 4; i++)
            {
                var salt = Convert.ToString(54);
                var password = usrList[i, 2].ToString();
                var hash = utilSecurity.CreateSaltedPassword(salt, password, _iter);

                var newUsr = CreateUserAccount(usrList[i, 0].ToString(), usrList[i, 1].ToString(), hash, usrList[i, 3].ToString(), "gyfto", null, string.Empty);
                if (newUsr != null)
                {
                    CreateEmailAddress(newUsr.PublicKey, usrList[i, 3].ToString());
                }
            }
        }