Research Article

STQ-SCS: An Efficient and Secure Scheme for Fine-Grained Spatial-Temporal Top- Query in Fog-Based Mobile Sensor-Cloud Systems

Algorithm 3

Completeness verification of the query result .
Ensure:; ; .
Require:.
(1); ; ;
(2)for to do
(3)  if ( contains no pairwise-key-encrypted target locations) then
(4)   Set ; return ;
(5)  end if
(6)  Decrypt all the ciphertext in with ;
(7)  if The end user cannot decrypt the ciphertext normally then
(8)   ; return ;
(9)  end if
(10)  Calculate the value of which is the total number of the queried locations in ;
(11)  for to do
(12)   if is not originally in is a Data-proof Packet corresponding to which is in then
(13)   ; return ;
(14)  end if
(15)  Calculate the value of which is the total number of the sensed data items in ;
(16)  ifthen
(17)   if is originally in in then
(18)    ;
(19)    Continue;
(20)   else if is originally in in then
(21)    Continue;
(22)   else
(23)    ; return ;
(24)   end if
(25)  end if
(26)  ifthen
(27)   ifthen
(28)    ; return ;
(29)   end if
(30)   ;
(31)   Continue;
(32)  end if
(33)  if ( is not included in in ) (no sensed data item in is encrypted with a sequence number) (the sequence numbers encrypted in are not sorted in ascending order from 1) (any sensed data item encrypted in is not originally encrypted with ) ( is not originally included in ) then
(34)  ; return ;
(35)  end if
(36)  if = then
(37)   ifthen
(38)    ; return ;
(39)   else
(40)    ;
(41)   end if
(42)  else if = then
(43)   if ( is included in ) && then
(44)    ; return ;
(45)   end if
(46)   ;
(47)   ;
(48)  else
(49)   ; return ;
(50)  end if
(51)end for
(52)end for
(53)ifthen
(54)  ; return ;
(55)end if
(56)  ifthen
(57)   ; return ;
(58)end if
(59) Return .