749c5cce by 冯轩

Merge branch 'feature/CHINARPA-5092' into feature/uat-tmp

2 parents 7c4dc1aa c2abe14c
......@@ -6,9 +6,15 @@ def aes_encrypt_cbc(data, key, iv):
return cipher.encrypt(data)
def aes_decrypt_cbc(data, key, iv):
cipher = AES.new(key.encode(), AES.MODE_CBC, iv.encode())
res = cipher.decrypt(b64decode(data))
return res.decode('utf-8')
res = ''
try:
cipher = AES.new(key.encode(), AES.MODE_CBC, iv.encode())
res = cipher.decrypt(b64decode(data))
res = res.decode('utf-8')
except Exception as e:
res = ''
return res
# 示例使用
key = 'm0XsOHC52YZ5KtakhpuMSZtF7DhwudmG' # 密钥长度必须是16、24或32字节
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!