1
var result=CryptoJS.AES.decrypt(data,name).toString(CryptoJS.enc.Utf8);
我嘗試使用cryptojs
解密json數據。我想在c#中使用這段代碼。爲此需要哪個庫/庫?它給出錯誤CryptoJs does not exist in current context
。哪個庫用於cryptojs
我使用這一個
公共靜態無效的主要(字符串[]參數) {
Class1 class1obj = new Class1();
string baseUrl = "http://www.whatsonindia.com";
WebRequest request = HttpWebRequest.Create(baseUrl);
WebResponse response = request.GetResponse();
string cookiesVals = response.Headers[HttpResponseHeader.SetCookie];
string url = "http://www.whatsonindia.com/appi/user?channelgenre=all&context=applicationname%3Dsourcebits%3Bheadendid%3D0&dateselected=0&mode=getTVGuideInfo&pageno=1&responseformat=json&responselanguage=English&starthour=0&totalhrdata=24&userid=-1";
WebClient client = new WebClient();
client.Headers.Add(HttpRequestHeader.Cookie, cookiesVals);
var data = client.DownloadString(url);
Console.WriteLine(data);
Console.WriteLine("dynamic object....");
Console.ReadLine();
JavaScriptSerializer serializer = new JavaScriptSerializer();
dynamic item = serializer.Deserialize<object>(data);
string name = item["pki"];
//JavaScriptSerializer serializer1 = new JavaScriptSerializer();
var result=CryptoJS.AES.decrypt(data,name).toString(CryptoJS.enc.Utf8);
var obj = (JObject)JsonConvert.DeserializeObject(data);
// var dict = obj.First.First.Children().Cast<JProperty>().ToDictionary();
var dt = (string)obj["data"];
Console.WriteLine(dt);
Console.ReadLine();
}
我有字符串中的數據,並有加密數據,並希望解密它,我使用pki值解密它 – user3363463
好的..更新了答案。 – ShitalShah