在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
#region Get Sign Content /// <summary> /// Get Sign Content /// </summary> /// <param name="parameters"></param> /// <returns></returns> private string GetSignContent(IDictionary<string, string> parameters) { // 第一步:把字典按Key的字母顺序排序 IDictionary<string, string> sortedParams = new SortedDictionary<string, string>(parameters); IEnumerator<KeyValuePair<string, string>> dem = sortedParams.GetEnumerator(); // 第二步:把所有参数名和参数值串在一起 StringBuilder query = new StringBuilder(""); while (dem.MoveNext()) { string key = dem.Current.Key; string value = dem.Current.Value; if (!string.IsNullOrEmpty(key) && !string.IsNullOrEmpty(value)) { query.Append(key).Append("=").Append(value).Append("&"); } } string content = query.ToString().Substring(0, query.Length - 1); return content; } #endregion IDictionary<string, string> dics = new Dictionary<string, string>(); dics.Add("dynamicCode", request.DynamicCode); dics.Add("accessToken", request.AccessToken); dics.Add("cardNo", request.CardNo); dics.Add("cerNo", request.CerNo); dics.Add("cardPhone", request.CardPhone); //Sensitive Domain Encryption string snsDataString = GetSignContent(dics);
|
请发表评论