diff --git a/app/core/wechat.py b/app/core/wechat.py index 225a5f4..5298ddb 100644 --- a/app/core/wechat.py +++ b/app/core/wechat.py @@ -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(