async Task <string> Execute(string cmd, string cmdType, string cmdText, CsLib.RequestType type, string endPoint, string action, string accessKey, string secretKey) { var json = new { cmd = cmd, cmdType = cmdType, cmdText = TranString.EncodeBase64Unicode(cmdText) }; string responseString = string.Empty; try { string jsonCmd = JsonConvert.SerializeObject(json); Task <string> response = new SoaCall().WebApiCall( endPoint, type, action, jsonCmd, accessKey, secretKey ); string temp = await response; if (temp.Length > 0) { JToken jt = JToken.Parse(temp); responseString = jt.ToString(Newtonsoft.Json.Formatting.Indented); } else { responseString = "response is empty..."; } } catch (Exception) { throw; } return(responseString); }
private bool isMatchSignature(string calltype, string action, string timestamp, string accesskey, string sig) { bool bReturn = false; string storedAccessKey = LogClient.Config.Instance.GetValue(LogClient.Category.Api, LogClient.Key.AccessKey); string storedSecureKey = LogClient.Config.Instance.GetValue(LogClient.Category.Api, LogClient.Key.SecretKey); if (!accesskey.Equals(storedAccessKey)) { return(false); } CsLib.RequestType getPostType = calltype == "GET" ? CsLib.RequestType.GET : CsLib.RequestType.POST; string genSig = Auth.Instance.makeSignature(getPostType, action, timestamp, accesskey, storedSecureKey); if (genSig.Equals(sig)) { if (IsMatchTime(timestamp, 600)) { return(true); } } return(bReturn); }