def AES_Decrypt(self, aesKey, vi, data):
if len(aesKey) <= 0 or len(vi) <= 0:
print('请输入aesKey或者vi偏移量值!')
else:
try:
data_bit = base64.decodebytes(data.encode('utf-8'))
de_cipher = AES.new(aesKey.encode('utf-8'), AES.MODE_GCM, vi.encode('utf-8'))
decr_value = de_cipher.decrypt(data_bit)
return decr_value.decode('utf-8')
except Exception as e:
print('数据解密产生异常-{}'.format(e))
loggin.log_error(traceback.format_exc())
标签:AES,aesKey,加解密,self,Decrypt,len
From: https://www.cnblogs.com/yanjiahong/p/17693983.html