【裁判文书网DES3数据解密】逆向分析
点击翻页,出现请求,可以看到请求参数有个ciphertext密文,响应数据也是密文
打上断点,点击翻页,断住
可以看到postData里面的ciphertext已经生成
往前跟栈,可以发现是var ciphertext = cipher();
function cipher() {var date = new Date();var timestamp = date.getTime().toString();var salt = $.WebSite.random(24);var year = date.getFullYear().toString();var month = (date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth()).toString();var day = (date.getDate() < 10 ? "0" + date.getDate() : date.getDate()).toString();var iv = year + month + day;var enc = DES3.encrypt(timestamp, salt, iv).toString();var str = salt + iv + enc;var ciphertext = strTobinary(str);return ciphertext;
}
由该函数生成
var DES3 = {iv: function() {return $.WebSite.formatDate(new Date(), "yyyyMMdd")},encrypt: function(b, c, a) {if (c) {return (CryptoJS.TripleDES.encrypt(b, CryptoJS.enc.Utf8.parse(c), {iv: CryptoJS.enc.Utf8.parse(a || DES3.iv()),mode: CryptoJS.mode.CBC,padding: CryptoJS.pad.Pkcs7})).toString()}return ""},decrypt: function(b, c, a) {if (c) {return CryptoJS.enc.Utf8.stringify(CryptoJS.TripleDES.decrypt(b, CryptoJS.enc.Utf8.parse(c), {iv: CryptoJS.enc.Utf8.parse(a || DES3.iv()),mode: CryptoJS.mode.CBC,padding: CryptoJS.pad.Pkcs7})).toString()}return ""}
};
响应数据解密则是由DES3.decrypt函数实现