def decrypt_aes(ciphertext, key):
 from Crypto.Cipher import AES
 def unpad(s):
  return s[:(- ord(s[(-1)]))]
 iv = ciphertext[:AES.block_size]
 cipher = AES.new(key, AES.MODE_CBC, iv)
 plaintext = unpad(cipher.decrypt(ciphertext))[AES.block_size:]
 return plaintext

def decrypt_aes ( ciphertext , key ) : from Crypto . Cipher import AES def unpad ( s ) : return s [ : ( - ord ( s [ ( - 1 ) ] ) ) ] iv = ciphertext [ : AES . block_size ] cipher = AES . new ( key , AES . MODE_CBC , iv ) plaintext = unpad ( cipher . decrypt ( ciphertext ) ) [ AES . block_size : ] return plaintext
decrypts a ciphertext that was aes-encrypted with the given key .