/// <summary> /// 将customerInfo转化为Dictionary,为方便处理,encryptedInfo下面的信息也均转换为customerInfo子域一样方式处理 /// </summary> /// <param name="customerInfoStr">string的customerInfo</param> /// <param name="encoding">编码</param> /// <returns>Dictionary类型结果</returns> public static Dictionary <string, string> ParseCustomerInfo(string customerInfoStr, Encoding encoding, string certPath, string certPwd) { if (customerInfoStr == null || customerInfoStr.Trim().Equals("")) { return(new Dictionary <string, string>()); } string s = null; try { s = encoding.GetString(Convert.FromBase64String(customerInfoStr)); } catch (Exception e) { log.Error("customerInfoStr解析失败,异常:" + e.Message); return(new Dictionary <string, string>()); } s = s.Substring(1, s.Length - 2); Dictionary <string, string> customerInfo = SDKUtil.parseQString(s, encoding); if (customerInfo.Keys.Contains("encryptedInfo")) { string encryptedInfoStr = customerInfo["encryptedInfo"]; customerInfo.Remove("encryptedInfo"); encryptedInfoStr = SecurityUtil.DecryptData(encryptedInfoStr, encoding, certPath, certPwd); Dictionary <string, string> encryptedInfo = SDKUtil.parseQString(encryptedInfoStr, encoding); foreach (KeyValuePair <string, string> pair in encryptedInfo) { customerInfo[pair.Key] = pair.Value; } } return(customerInfo); }
/// <summary> /// 敏感信息解密,多证书 /// </summary> /// <param name="encoder"></param> /// <returns></returns> public static string DecryptData(string data, Encoding encoding, string certPath, string certPwd) { return(SecurityUtil.DecryptData(data, encoding, certPath, certPwd)); }
/// <summary> /// 敏感信息解密 /// </summary> /// <param name="encoder"></param> /// <returns></returns> public static string DecryptData(string data, Encoding encoding) { return(SecurityUtil.DecryptData(data, encoding)); }