def decryptData(key, data, mode=AESModeOfOperation.ModeOfOperation[u'CBC']):
 key = bytearray(key)
 keysize = len(key)
 assert (keysize in AES.KeySize.values()), (u'invalid key size: %s' % keysize)
 iv = bytearray(data[:16])
 data = bytearray(data[16:])
 moo = AESModeOfOperation()
 decr = moo.decrypt(data, None, mode, key, keysize, iv)
 if (mode == AESModeOfOperation.ModeOfOperation[u'CBC']):
  decr = strip_PKCS7_padding(decr)
 return bytes(decr)

def decryptData ( key , data , mode = AESModeOfOperation . ModeOfOperation [ u'CBC' ] ) : key = bytearray ( key ) keysize = len ( key ) assert ( keysize in AES . KeySize . values ( ) ) , ( u'invalid key size: %s' % keysize ) iv = bytearray ( data [ : 16 ] ) data = bytearray ( data [ 16 : ] ) moo = AESModeOfOperation ( ) decr = moo . decrypt ( data , None , mode , key , keysize , iv ) if ( mode == AESModeOfOperation . ModeOfOperation [ u'CBC' ] ) : decr = strip_PKCS7_padding ( decr ) return bytes ( decr )
module function to decrypt the given data with the given key .