- 退款结果通知回调req_info解密按照文档解出来一个奇怪的东西?
语言:Python3.6.2 解密步骤如下: (1)对加密串A做base64解码,得到加密串B import base64 req_info = '+Arp7Ewsvm+/NVFAk9LEBu9F4c......' req_info_b = base64.b64decode(req_info) (2)对商户key做md5,得到32位小写key* import hashlib key = 'a1b2c3......' key_32 = hashlib.md5(key.encode('utf8')).hexdigest().lower() (3)用key*对加密串B做AES-256-ECB解密(PKCS7Padding) from Crypto.Cipher import AES cryptor = AES.new(key_32.encode('utf-8'), AES.MODE_ECB) plain_text = cryptor.decrypt(req_info_b) 打印结果为: b'\xab\xf6\x92C\xf7\x97\xe9~7\xaa\x95\xf3\x89\xd6o\x07&+\x93\x8a<\x1d\xbc\xc0\x11Z\xee\xea\x93\xab%C\xe7\xff\xe......' 这是个什么玩意儿?没法.decode('utf8'),也转换不成微信解密的示例!!谁能告诉我怎么解密呀?
2020-02-17 - 退款结果通知回调req_info解密按照文档解出来一个奇怪的东西?
语言:Python3.6.2 解密步骤如下: (1)对加密串A做base64解码,得到加密串B import base64 req_info = '+Arp7Ewsvm+/NVFAk9LEBu9F4c......' req_info_b = base64.b64decode(req_info) (2)对商户key做md5,得到32位小写key* import hashlib key = 'a1b2c3......' key_32 = hashlib.md5(key_.encode('utf8')).hexdigest().lower() (3)用key*对加密串B做AES-256-ECB解密(PKCS7Padding) from Crypto.Cipher import AES cryptor = AES.new(key_32.encode('utf-8'), AES.MODE_ECB) plain_text = cryptor.decrypt(req_info_b) 打印结果为: b'\xab\xf6\x92C\xf7\x97\xe9~7\xaa\x95\xf3\x89\xd6o\x07&+\x93\x8a<\x1d\xbc\xc0\x11Z\xee\xea\x93\xab%C\xe7\xff\xe......' 这是个什么玩意儿?没法.decode('utf8'),也转换不成微信解密的示例!!谁能告诉我怎么解密呀?
2020-02-17