public Boolean AuthenticateUserCredential(String userName, String passWord, int groupFlag)
        {
            bool   authenticate = false;
            string fLocation    = null;

            if (groupFlag == MEMBER_XML)
            {
                fLocation = Path.Combine(HttpRuntime.AppDomainAppPath, @"App_Data\" + memberCredentialFile);
            }
            else
            {
                fLocation = Path.Combine(HttpRuntime.AppDomainAppPath, @"App_Data\" + staffCredentialFile);
            }
            if (System.IO.File.Exists(fLocation) && userExists(userName, groupFlag))
            {
                SecretHash  hash         = new SecretHash();
                String      passwordHash = hash.getHashValue(passWord);
                FileStream  fStream      = new FileStream(fLocation, FileMode.Open);
                XmlDocument doc          = new XmlDocument();
                doc.Load(fStream);
                fStream.Close();
                XmlNodeList nodeList = doc.SelectNodes("/credentials/user/username");
                foreach (XmlNode node in nodeList)
                {
                    if (node.InnerText.Equals(userName) && node.NextSibling.InnerText.Equals(passwordHash))
                    {
                        authenticate = true;
                    }
                }
            }
            return(authenticate);
        }
Beispiel #2
0
 private void Write(SecretHash secret)
 {
     Write((byte)secret.Type);
     Write(secret.Hash);
 }
        protected void btnGetHash_Click(object sender, EventArgs e)
        {
            SecretHash obj = new SecretHash();

            txtHashOutput.Text = obj.getHashValue(txtInput.Text);
        }
        private static HashLock CreateHashLock(Internals.HashLock declaration)
        {
            var secretHash = new SecretHash(declaration.SecretHash.Type, new Hash256(Convert.FromBase64String(declaration.SecretHash.Hash)));

            return(new HashLock(secretHash));
        }
Beispiel #5
0
 public HashLockAccount(Address address, SecretHash secret)
 {
     Address    = address;
     SecretHash = secret;
 }