This commit is contained in:
2026-06-15 10:12:55 +08:00
parent c00e453f87
commit b87c0e8f01
+3 -1
View File
@@ -167,7 +167,9 @@ async def wechat_callback(request: Request, db: AsyncSession = Depends(get_db)):
# 使用 AES-GCM 解密
try:
aesgcm = AESGCM(api_v3_key)
# API v3 key 需要转换为字节串
api_v3_key_bytes = api_v3_key.encode('utf-8')
aesgcm = AESGCM(api_v3_key_bytes)
decrypted_str = aesgcm.decrypt(ciphertext, associated_data, nonce_str)
except InvalidTag:
logger.error("WeChat callback decryption failed: Invalid tag")