Esempio n. 1
0
        public bool VerifyParams(NameValueCollection stringparam)
        {
            if (!String.IsNullOrEmpty(stringparam["ALIAS"]))
            {
                //HasUserAlias(stringparam["ALIAS"], stringparam["CN"]);
                if (!AliasManager.CheckifAliasExist(stringparam["ALIAS"]))
                {
                    AliasManager.Add(AliasManager.Create(
                                         stringparam["ALIAS"],
                                         stringparam["CN"],
                                         stringparam["ED"],
                                         stringparam["CARDNO"]
                                         ));
                }
            }


            StringBuilder sbuilder   = new StringBuilder();
            string        passphrase = "Thisisa16sha-out";
            string        shaout     = "";

            foreach (string key in stringparam.AllKeys.OrderBy(k => k))
            {
                if (key != "SHASIGN")
                {
                    sbuilder.Append(key.ToUpper() + "=" + stringparam[key] + passphrase);
                }
                else
                {
                    shaout = stringparam[key];
                }
            }


            if (shaout.Equals(Crypto.GetSHA256(sbuilder.ToString())))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }