def getCipher(key, iv): backend = default_backend() return Cipher( algorithms.AES(base64.b64decode(key)), modes.CBC(base64.b64decode(iv)), backend )