public static string unPackage(string jstr) { JObject obj = new JObject(); string md5; string js = ""; try { obj = (JObject)JsonConvert.DeserializeObject(jstr); md5 = obj["sign"].ToString(); string data = obj["data"].ToString(); js = AESEncrypt.Decrypt(data, key); string checkMD5 = ComMD5.GetMd5Str(js); if (md5 == checkMD5) { return(js); } else { js = ""; } } catch { } return(js); }
public static string Package(string jstr) { string enstr = AESEncrypt.Encrypt(jstr, key); string md5 = ComMD5.GetMd5Str(jstr); JObject obj = new JObject(); obj.Add("sign", md5); obj.Add("data", enstr); string jstring = JsonConvert.SerializeObject(obj); return(jstring); }