会话存档接口设置好公、私密钥后,隔了几天通样的代码居然无法执行,报错:

ERROR RequestId: fbb1bc91-ba03-11ee-b71b-525400389e20 Result: Traceback (most recent call last): File "/var/user/index.py", line 71, in main_handler encrypt_key = cipher.decrypt(base64.b64decode(encrypt_random_key), "ERROR") File "/var/user/Crypto/Cipher/PKCS1_v1_5.py", line 149, in decrypt raise ValueError("Ciphertext with incorrect length (not %d bytes)" % k) ValueError: Ciphertext with incorrect length (not 256 bytes)

问题原因:期间查看过一次后台公钥,导致私钥失效,需重生成私钥。

注意:更新后的私钥只能解密跟新密钥后存档的聊天记录,此前的记录依然需要历史私钥去破解,否则就会报Ciphertext with incorrect length (not 256 bytes)。