Correction so all aes encryption alg. can be used while decrypting.
This commit is contained in:
@@ -87,7 +87,7 @@ class AESCipher(object):
|
||||
return cmsg
|
||||
|
||||
|
||||
def decrypt(self, msg, iv=None, padding="PKCS#7", b64dec=True):
|
||||
def decrypt(self, msg, iv=None, alg="aes_128_cbc", padding="PKCS#7", b64dec=True):
|
||||
"""
|
||||
:param key: The encryption key
|
||||
:param iv: init vector
|
||||
@@ -102,7 +102,7 @@ class AESCipher(object):
|
||||
_iv = data[:AES.block_size]
|
||||
if iv:
|
||||
assert iv == _iv
|
||||
cipher, iv = self.build_cipher(iv)
|
||||
cipher, iv = self.build_cipher(iv, alg=alg)
|
||||
res = cipher.decrypt(data)[AES.block_size:]
|
||||
if padding in ["PKCS#5", "PKCS#7"]:
|
||||
res = res[:-ord(res[-1])]
|
||||
|
Reference in New Issue
Block a user