public static void SetSign(int id, out string nonce_str, out string timestamp, out string sign) { string sn = new GZH.CL.Config.AgentConfig().GetItem(id).sn; nonce_str = Util.GetRandomString(32, true, true, true, false, ""); timestamp = Util.GetTimestamp(); Hashtable ht = new Hashtable(); ht.Add("nonce_str", nonce_str); ht.Add("timestamp", timestamp); ht.Add("id", id + ""); sign = GetSign(ht, sn); }
public static bool CheckRequestSign(string request_sign, string nonce_str, string timestamp, int id) { bool r = false; string sn = new GZH.CL.Config.AgentConfig().GetItem(id).sn; Hashtable ht = new Hashtable(); ht.Add("nonce_str", nonce_str); ht.Add("timestamp", timestamp); ht.Add("id", id + ""); string svr_sign = AgentSign.GetSign(ht, sn); if (svr_sign == request_sign) { r = true; } return(r); }