This commit is contained in:
yumoqing 2026-03-03 12:06:02 +08:00
parent db21abbaa6
commit c304f55a49

View File

@ -244,6 +244,12 @@ class WOAHandler:
timestamp = str(int(time.time())) timestamp = str(int(time.time()))
nonce = ''.join([str(random.randint(0, 9)) for _ in range(10)]) nonce = ''.join([str(random.randint(0, 9)) for _ in range(10)])
encrypted_xml_str = self._encrypt_msg(reply_xml, nonce, timestamp) encrypted_xml_str = self._encrypt_msg(reply_xml, nonce, timestamp)
try:
decode_data = self._encrypt_msg(encrypted_xml_str, nonce, timestamp)
debug(f'{decode_data=},{reply_xml=}')
except Exception as e:
exception(f'{e}')
# 构造加密后的返回 XML 包 # 构造加密后的返回 XML 包
final_xml = f""" final_xml = f"""
<xml><Encrypt><![CDATA[{encrypted_xml_str}]]></Encrypt><MsgSignature><![CDATA[{hashlib.sha1((self.token + timestamp + nonce + encrypted_xml_str).encode()).hexdigest()}]]></MsgSignature><TimeStamp>{timestamp}</TimeStamp><Nonce><![CDATA[{nonce}]]></Nonce></xml>""" <xml><Encrypt><![CDATA[{encrypted_xml_str}]]></Encrypt><MsgSignature><![CDATA[{hashlib.sha1((self.token + timestamp + nonce + encrypted_xml_str).encode()).hexdigest()}]]></MsgSignature><TimeStamp>{timestamp}</TimeStamp><Nonce><![CDATA[{nonce}]]></Nonce></xml>"""