hmac

中国空气质量在线监测分析平台之JS加密、JS混淆处理

99封情书 提交于 2019-12-18 10:05:46
中国空气质量在线监测分析平台数据爬取分析 页面分析:确定url、请求方式、请求参数、响应数据    1.访问网站首页: https://www.aqistudy.cn/html/city_detail.html ,通过抓包工具分析首页请求并没有获取到页面内的数据信息    2.因此可以确定页面内的数据是动态加载的,通过抓包工具捕获加密的响应对象,    3.加密响应对象是通过post请求携带加密的参数发起(2次)。    4.综上分析可以确定,动态请求时在搜索按钮触发时发起的,因此通过火狐firefox浏览器分析页面搜索按钮的绑定事件以及定位到具体的代码在哪一行。    5.通过标签绑定事件可以确定是触发了getData()函数,因此对应转包工具捕获到的两次请求,进入js代码,找到函数的执行过程。    6。在当前js中搜索找到getAQIData();和getWeatherData();函数,也没发现ajax发起的post请求,但都调用了getServerData函数,只是唯一一个参数不同method = 'GETDETAIL';method = 'GETCITYWEATHER';,因此继续分析getServerData函数。    7.在当前js中为找到getServerData 函数定义,切换到google浏览器对请求响应进行全局搜索,获取函数定义--- js反混淆 。   

Python HMAC-SHA1 vs Java HMAC-SHA1 different results

ぐ巨炮叔叔 提交于 2019-12-18 06:16:29
问题 I borrowed the HMAC-SHA1 Java code from http://tools.ietf.org/html/rfc6238 and adapted slightly to hardcode it to use one known key/message pair with known output. I then tried to write the same code in Python to verify the results, however I'm getting different values in Python and Java. The Java values are known to be good. Java code: import java.lang.reflect.UndeclaredThrowableException; import java.security.GeneralSecurityException; import java.text.DateFormat; import java.text

Crypto algorithm list

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-17 18:28:14
问题 I'm trying to find a list of strings that can be used a a crypto algorithm to fit into this function, replacing SHA256 . crypto.createHmac("SHA256", secret).update(string).digest('base64'), I've come to the understanding that crypto uses openssl , and that the algorithms are specific to each system running node.js. With the following commands you can see a list of all algorithms available for your system. openssl list-cipher-algorithms openssl list-cipher-commands I've outputted the content

How to get digest representation of CryptoJS.HmacSHA256 in JS

旧城冷巷雨未停 提交于 2019-12-17 16:28:37
问题 I have to generate string representation of CryptoJS.HmacSHA256 in digest (bytes representation). I need it because i have to duplicate python code which generate such digest in javascript: print hmac.new("secret", "test", hashlib.sha256).digest() ')�kb��>�y+������:�oΚ��H� ' The goal is to duplicate behaviour of code above in javascript. Could you please suggest me how to do this? 回答1: If you need raw bytes then CryptoJS does not seem to supply code for it. It is mentioned that this is

Need to generate HMAC SHA256 hash in Objective C as in Java

孤者浪人 提交于 2019-12-17 10:34:19
问题 I need to generate a hash using HMAC SHA256. I am using the following code in Java. I need an equivalent code in Objective-C. javax.crypto.Mac mac = javax.crypto.Mac.getInstance(type); javax.crypto.spec.SecretKeySpec secret = new javax.crypto.spec.SecretKeySpec(key.getBytes(), type); mac.init(secret); byte[] digest = mac.doFinal(value.getBytes()); StringBuilder sb = new StringBuilder(digest.length * 2); String s=""; for (byte b: digest) { s = Integer.toHexString(b); if (s.length() == 1) { sb

Need to generate HMAC SHA256 hash in Objective C as in Java

那年仲夏 提交于 2019-12-17 10:34:04
问题 I need to generate a hash using HMAC SHA256. I am using the following code in Java. I need an equivalent code in Objective-C. javax.crypto.Mac mac = javax.crypto.Mac.getInstance(type); javax.crypto.spec.SecretKeySpec secret = new javax.crypto.spec.SecretKeySpec(key.getBytes(), type); mac.init(secret); byte[] digest = mac.doFinal(value.getBytes()); StringBuilder sb = new StringBuilder(digest.length * 2); String s=""; for (byte b: digest) { s = Integer.toHexString(b); if (s.length() == 1) { sb

java equivalent to php's hmac-SHA1

戏子无情 提交于 2019-12-17 06:24:49
问题 I'm looking for a java equivalent to this php call: hash_hmac('sha1', "test", "secret") I tried this, using java.crypto.Mac, but the two do not agree: String mykey = "secret"; String test = "test"; try { Mac mac = Mac.getInstance("HmacSHA1"); SecretKeySpec secret = new SecretKeySpec(mykey.getBytes(),"HmacSHA1"); mac.init(secret); byte[] digest = mac.doFinal(test.getBytes()); String enc = new String(digest); System.out.println(enc); } catch (Exception e) { System.out.println(e.getMessage()); }

How to correctly convert TAG value to the right format so that to Verify HMAC?

帅比萌擦擦* 提交于 2019-12-14 03:26:01
问题 I'm working on HMAC generation and verifying to check data integrity. I can correctly generate the MAC value but when sending it through socket to another program for verification, I faced with formatting mismatch. I appreciate your support. Thanks. unsigned char* MAC(unsigned char* key,unsigned char* message) { unsigned char* result; unsigned int result_len = 32; int i; result = (unsigned char*) malloc(sizeof(char) * result_len); result = HMAC(EVP_sha256 (), key , strlen (key), message ,

Progressive HMAC SHA256 in Objective-C

倖福魔咒の 提交于 2019-12-13 18:23:25
问题 I need to generate a hash using HMAC SHA256. I am using the following code in JavaScript. I need an equivalent code in Objective-C. function serialize( obj ) { return Object.keys(obj).reduce(function(a,k){a.push(k+'='+encodeURIComponent(obj[k]));return a},[]).join('&') } var query = { Action : 'MyAction', SignatureMethod : 'HmacSHA256', }; var hmac = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, 'MYVALUE'); var queryString = ['POST', 'm.service.it', '/api/v2', serialize(sorted)].join('\n');

What to use (best/good practice) for the secret key in HMAC solution?

邮差的信 提交于 2019-12-13 16:29:23
问题 I am implementing a HMAC-like solution based upon specifications provided to me by another company. The hashing parameters and use of the secret key is not an issue, and neither is the distribution of the key itself, since we are in close contact and close geographical location. However - what is best practice for the actual secret key value ? Since both companies are working together, it would seem that c9ac56dd392a3206fc80145406517d02 generated with a Rijndael algorithm and Daisy Daisy give