## 3 Model and Background
### Data Aggregation and Integrity Detection  
When data are transferred to an aggregator, the aggregator can aggregate the data directly for the property of the FHE scheme. Our scheme merely processes addition and multiplication over the integers. Given the (binary) circuit \(C\varepsilon\) with \(d\) inputs, and \(d\) ciphertexts \(c_{i}\) apply the (integer) addition and multiplication gates of \(C\varepsilon\) to the ciphertexts, performing all the operations over the integers, and return the resulting integer \(c\)* which satisfies \(\text{Decrypt}_{\varepsilon}(sk,\ c^{*})=C(m_{1},\...,\ m_{d})\):  
\[c^{*}=\text{Evaluate}_{\varepsilon}(pk,\ C,\ c_{1},\...,\ c_{d}) \tag{5}\]  
After generating the ciphertext \(c\)*, then for \(i\in\{1,...,\ \Theta\}\), set  
\[z_{i}\leftarrow[c^{*}.y_{i}]_{2} \tag{6}\]  
In order to achieve data confidentiality, data integrity and false data detection during data aggregation and data forwarding, we propose a data aggregation and integrity detection algorithm to verify the data integrity and detect any false data injections in the whole network. The basic idea of the data aggregation and integrity detection algorithm is that a monitoring node computes the subMAC of the aggregated fully homomorphic value, and the corresponding forwarding node and neighboring node in the same group verify this subMAC. When data reaches the neighboring node of \(A_{c}\), by calculating the subMAC of the received fully homomorphic value, the neighboring node verifies the integrity during data aggregation which is done by the backward aggregator, therefore enabling the detection of data integrity in the data aggregation process. When data reaches the forwarding node of \(A_{c}\), by calculating the subMAC of the received fully homomorphic value, the forwarding node verifies the integrity during the data transmission process from \(A_{c}\) to this forwarding node, therefore enabling the detection of data integrity in the data transmission process. The detailed process of data aggregation and integrity detection algorithm is shown in Algorithm 3. The general process of this algorithm can be described as follows:  
1. The current aggregator \(A_{c}\) first collects data from its neighboring nodes. In order to detect whether any false data exists in the backward aggregator \(A_{bq}\), \(A_{c}\) broadcasts the data it received to its neighboring nodes, such that the neighboring node of \(A_{c}\) who is in the same MFN-group with the monitoring node of \(A_{bq}\) verifies the data integrity by computing the subMAC. If there is at least one verification fail, \(A_{c}\) discards this data and informs \(A_{bq}\). 2. Aggregator \(A_{c}\) and its \(T\) monitoring nodes aggregate the received data, respectively. \(A_{c}\) computes the subMAC of aggregated data using \(K_{pair}\), monitoring node \(M_{l}\) computes the subMAC of aggregated data using \(K_{group}\), then finally \(T+1\) subMACs are obtained. ```
1:\(A_{c}\) has \(p\) leaf aggregation nodes \(\{A_{b1},\,\ldots,\,A_{bp}\}\), \(s\) neighboring nodes \(\{N_{1},\,\ldots,\,N_{s}\}\), \(T\) monitoring nodes \(\{M_{1},\,\ldots,\,M_{T}\}\) and \(h\) forwarding nodes \(\{F_{1},\,\ldots,\,F_{h}\}\). begin Step 1.\(A_{c}\) and \(N_{i}\) verify the data integrity of \(A_{bq}\) during data aggregation. for(\(q=\)1 to \(p\))do  1: The last forwarding node \(N_{i}\) of \(A_{bq}\) receives the data sent by \(A_{bq}\), then transmits it to \(A_{c}\)  2: \(A_{c}\) receives the data and computes subMAC(FH(\(A_{bq}\))) to verify the data integrity  3: **if** the subMAC(FH(\(A_{bq}\))) computed by \(A_{c}\) and \(A_{bq}\) are not equal  **then**\(A_{c}\) drops the data immediately and informs \(A_{bq}\)  4: **else**\(A_{c}\) broadcasts the data packet to \(N_{i}\)  5: All neighboring nodes of \(A_{c}\), which are the member of MFN-groups, verify the data integrity.