This commit is contained in:
aaron 2025-01-26 00:46:23 +08:00
parent 4e4248feb5
commit 925592944b

View File

@ -279,7 +279,7 @@ class WeChatClient:
# Base64解码密文和随机串
ciphertext_bytes = base64.b64decode(ciphertext)
nonce_bytes = base64.b64decode(nonce)
nonce_bytes = nonce.encode('utf-8') # nonce 不需要 base64 解码
# 处理附加数据
associated_data_bytes = associated_data.encode('utf-8') if associated_data else b''
@ -291,6 +291,9 @@ class WeChatClient:
print(f"Nonce长度: {len(nonce_bytes)} bytes")
print(f"密文长度: {len(ciphertext_bytes)} bytes")
print(f"附加数据: {associated_data_bytes}")
print(f"使用的密钥: {self.api_v3_key}") # 仅用于调试,生产环境需要移除
print(f"原始nonce: {nonce}")
print(f"原始associated_data: {associated_data}")
# 解密数据
decrypted_data = aesgcm.decrypt(