Research Article

Query Privacy Preserving for Data Aggregation in Wireless Sensor Networks

Algorithm 3

The query processing.
Input: query .
Output: decrypted data of each query , .
(1)Begin
(2)For node ()
(3)  If () Then
(4)   Collect the data ;
(5)   Choose a random number from ;
(6)   Select a key ;
(7)   Encrypt the data, ;
(8)   Aggregate the data, ;
(9)  End If
(10)End For
(11)For () at BS
(12)  Decrypt the data, ;
(13)End If
(14)Return
(15)End