With the increase of data production sources like IoT devices (e.g., smartwatches, smartphones) and data from smart home (health sensor,... Show moreWith the increase of data production sources like IoT devices (e.g., smartwatches, smartphones) and data from smart home (health sensor, energy sensors), truly mind-boggling amounts of data are generated daily. Building a big data as a service system, that combines big data technologies and cloud computing, will enhance the huge value of big data and tremendously boost the economic growth in various areas. Big data as a service has evolved into a booming market, but with the emergence of larger privacy and security challenges. Privacy and security concerns limit the development of big data as a service and increasingly become one of the main reasons why most data are not shared and well utilized. This dissertation aims to build a new incrementally deployable middleware for the current and future big data as a service eco-system in order to guarantee privacy and security. This middleware will retain privacy and security in the data querying and ensure privacy preservation in data analysis. In addition, emerging cloud computing contributes to providing valuable services associated with machine learning (ML) techniques. We consider privacy issues in both traditional queries and ML queries (i.e., ML classification) in this dissertation. The final goal is to design and develop a demonstrable system that can be deployed in the big data as a service system in order to guarantee the privacy of data/ service owners as well as users, enabling secure data analysis and services.Firstly, we consider a private dataset composed of a set of individuals, and the data is outsourced to a remote cloud server. We revisit the classic query auditing problem in the outsourcing scenario. Secondly, we study privacy preserving neural network classification where source data is randomly partitioned. Thirdly, we concern the privacy of confidential training dataset and models which are typically trained in a centralized cloud server but publicly accessible, \ie online ML-as-a-Service (MLaaS). Lastly, we consider the offline MLaaS systems. We design, implement, and evaluate a secure ML framework to enable MLaaS on clients' edge devices, where a ``encrypted'' ML models are stored locally. Show less