public string AuthQuery(string path, Dictionary <string, string> postDict) { string nonce = AuthUtility.GetNonceByTicks(); postDict.Add("nonce", nonce); string post = AuthUtility.ToPost(postDict, true); var signText = path + Convert.ToChar(0) + post; string sign = GetSign(signText, AuthKey.PrivateKey); HttpWebRequest webRequest = GetWebRequest(post, path, sign); string json = AuthUtility.GetResponseJson(webRequest); return(json); }
public string AuthQuery(string method, Dictionary <string, string> postDict) { string nonce = AuthUtility.GetNonceByTicks(); postDict.Add("nonce", nonce); postDict.Add("method", method); string post = AuthUtility.ToPost(postDict, true); var sign = AuthUtility.GetSign(post, AuthKey.PrivateKey); byte[] data = Encoding.ASCII.GetBytes(post); HttpWebRequest webRequest = GetWebRequest(data, sign); string json = AuthUtility.GetResponseJson(webRequest); return(json); }
public string AuthQuery(string path, Dictionary <string, string> postDict) { string nonce = AuthUtility.GetNonceByTicks(); string clientId = Setting.Singleton.Option.BitstampClientId; //被签名信息为nonce+clientId+secretKey,签名后需加入到postText中: string signMessage = nonce + clientId + AuthKey.PublicKey; string sign = GetSign(signMessage, AuthKey.PrivateKey); postDict.Add("nonce", nonce.ToString()); postDict.Add("key", AuthKey.PublicKey); postDict.Add("signature", sign); string postText = AuthUtility.ToPost(postDict, true); byte[] postBytes = Encoding.ASCII.GetBytes(postText); HttpWebRequest webRequest = GetWebRequest(postBytes, path, sign); string json = AuthUtility.GetResponseJson(webRequest); return(json); }