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): ...@@ -6,9 +6,15 @@ def aes_encrypt_cbc(data, key, iv):
6 return cipher.encrypt(data) 6 return cipher.encrypt(data)
7 7
8 def aes_decrypt_cbc(data, key, iv): 8 def aes_decrypt_cbc(data, key, iv):
9 cipher = AES.new(key.encode(), AES.MODE_CBC, iv.encode()) 9 res = ''
10 res = cipher.decrypt(b64decode(data)) 10 try:
11 return res.decode('utf-8') 11 cipher = AES.new(key.encode(), AES.MODE_CBC, iv.encode())
12 res = cipher.decrypt(b64decode(data))
13 res = res.decode('utf-8')
14 except Exception as e:
15 res = ''
16 return res
17
12 18
13 # 示例使用 19 # 示例使用
14 key = 'm0XsOHC52YZ5KtakhpuMSZtF7DhwudmG' # 密钥长度必须是16、24或32字节 20 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!