## 3 Related Work
### Security of WSN Data Processing  
The task of processing the data sourcing from a network of sensors is usually carried out in an external system, often by relying on cloud services. Therefore, the sensor node data must be transferred to the external system; commonly, the data transmission is protected using Transport Layer Security (TLS). However, the data in a WSN travel through a multi-hop infrastructure-less network, and using TLS could rapidly overload the resource-constrained technology WSNs consist of. Moreover, the processing power of nodes is not utilized, and several studies point out the possibility of discovering associations between TLS traffic patterns and activities in the monitored environment [15; 16; 17]. Additionally, gathering data from all sensor nodes in the WSN may be redundant since closely located sensor nodes might sense the identical event or changes. Data redundancy can be reduced by aggregating readings of closely located sensor nodes. The in-network data aggregation technique works via the aggregation of sensor node's readings as the data travel through routing paths toward the sink node. Therefore, the sink node receives an aggregated value summarizing the state of the monitored area. Several [18] privacy-preserving data aggregation solutions were developed relying on data perturbation, data slicing, hop-by-hop encryption, and Homomorphic Encryption [19]. Data perturbation techniques [20] modify individual sensor reading values to hide specific confidential information but still allowing users to retrieve the correct aggregated value. In [21], twin-keys are used to add or subtract a shadow value to the sensor reading. The aggregated value is correctly computed since any shadow value added by one node during the aggregation process is subtracted by another node that shares the same twin-key. The data slicing consists of slicing single sensor node data into a fixed number of data pieces, all data pieces except one are sent to neighboring nodes. Nodes assemble data pieces including their own piece and send the assembled data to an aggregator node [22; 23]. However, data slicing leads to high communication overhead due to the large number of data pieces sent to neighboring nodes. In hop-by-hop data aggregation, sensor node readings are decrypted and encrypted at each node in the aggregation path. Therefore, aggregator nodes can access the unencrypted data. Several solutions [24; 25] apply a data perturbation technique to protect the unencrypted data from malicious aggregator nodes. The Homomorphic Encryption was used in several solutions [26; 27; 28] since it allows operations to be performed on encrypted data without the need for decryption. However, the Homomorphic Encryption is computationally intensive [29; 30], and reasonable solutions for WSNs are designed to only compute addition and multiplication on encrypted data. Secure Multi-Party Computation (SMC) [31] allows multiple parties to jointly compute a function over their inputs while keeping those inputs private. Several studies propose the SMC technique for privacy preserving data mining since using the SMC for training a data mining model preserves the data privacy of individual data sources. Refs [32; 33] describe an SMC technique for privacy-preserving association rule mining; in [34], an SMC decision-tree-based data classification was proposed; and the authors in [35] proposed a protocol for securely computing a linear regression model. However, traditional solutions relying on SMC require high computation and communication costs, thus being not convenient for application in WSNs. Therefore, the SMC in WSNs is limited to low complexity tasks such as data aggregation [36]. The presented decentralized framework provides data processing security using the General Purpose Data and Query Privacy Preserving Protocol for WSN presented in [37]. The technique uses messages composed of several encryption layers to convey on WSN nodes general-purpose computer code for in situ data processing.