## 4 ROLQ-TEE Scheme
### Detailed Construction
```  
**Algorithm 3**OptLocQue Algorithm  
```
Input: The encrypted location data set \(c_{i}\), the encrypted query token \(\mathcal{Q}_{\mu}\), the query key \(sk_{\mathcal{DO}}\), the map table \(MT\), and the public system parameters \(mpk\) Output: The encrypted optimal query result \(\mathcal{C}_{res}\) 1: Load the encrypted query token \(\mathcal{Q}_{\mu}=\{\mathcal{CF}_{\mu},\mathcal{CL}_{\mu}\}\);
2: Decrypt \(\mathcal{CF}_{\mu}\) to \(M_{\mathcal{F}_{\mu}}=\frac{\mathcal{CF}_{\mu,1}\cdot e(sk_{\mu,1},\mathcal{CF} _{\mu,2})}{\epsilon(sk_{\mu,2},\mathcal{CL}_{\mu,0})}\);
3: Decrypt \(\mathcal{CL}_{\mu}\) to \(L=\frac{\mathcal{CL}_{\mu,1}\cdot e(sk_{\mu,1},\mathcal{CL}_{\mu,0}),2}{ \epsilon(sk_{\mu,2},\mathcal{CL}_{\mu,0}),2}\);
4:for\(1\leq i\leq n_{\mathcal{MO}}\)do
5:for\(1\leq j\leq n_{\mathcal{MO}}\)do
6:if\(L.H_{1}(y_{\mu,j})=MT.H_{1}(x_{i})\)
7: Load the \(c_{i}\) of \(MT.H_{1}(x_{i})\) and decrypt \(c_{i}\) to \(l_{i}\);
8: Obtain the location intersection set \(U_{I}=\{l_{i}\}\);
9:for\(1\leq\xi\leq s\)do
10:foreach\(l_{i}\)in\(U_{I}\)do
11: Compute the euclidean distance \(d(l_{i},f_{\xi})\) between \(f_{\xi}\) and \(l_{i}\);
12: Compute accumulated value \(\sum=d(l_{i},f_{\xi})\);
13: Select the query type, namely RNNQ, AVGQ, or MAXQ;
14: Obtain the optimal query result _res_;
15: Select a random value \(r_{R}\in Z_{q}^{*}\);
16: Compute encrypted optimal query result \(\mathcal{C}_{res}=\{\mathcal{C}_{res,0}=g^{r_{R}},\mathcal{C}_{res,1}=res\cdot e (H_{1}(rid_{\mu})^{r_{R}},h_{\mu})\), \(\mathcal{C}_{res,2}=H_{2}(T_{t})^{r_{R}}\}\);
17: Send the \(\mathcal{C}_{res}\) to the \(\mathcal{DU}_{\mu}\). ```  
**Algorithm 4**OptLocQue Algorithm  
``` Input: The encrypted location data set \(c_{i}\), the encrypted query token \(\mathcal{Q}_{\mu}\), the query key \(sk_{\mathcal{DO}}\), the map table \(MT\), and the public system parameters \(mpk\) Output: The encrypted optimal query result \(\mathcal{C}_{res}\) 1: Load the encrypted query token \(\mathcal{Q}_{\mu}=\{\mathcal{CF}_{\mu},\mathcal{CL}_{\mu}\}\);
2: Decrypt \(\mathcal{CF}_{\mu}\) to \(M_{\mathcal{F}_{\mu}}=\frac{\mathcal{CF}_{\mu,1}\cdot e(sk_{\mu,1},\mathcal{CF} _{\mu,2})}{\epsilon(sk_{\mu,2},\mathcal{CL}_{\mu,0})}\);
3: Decrypt \(\mathcal{CL}_{\mu}\) to \(L=\frac{\mathcal{CL}_{\mu,1}\cdot e(sk_{\mu,2},\mathcal{CL}_{\mu,0}),2}{ \epsilon(sk_{\mu,2},\mathcal{CL}_{\mu,0}),2}\);
4:for\(1\leq i\leq n_{\mathcal{MO}}\)do
5:for\(1\leq j\leq n_{\mathcal{MO}}\)do
6:if\(L.H_{1}(y_{\mu,j})=MT.H_{1}(x_{i})\)
7: Load the \(c_{i}\) of \(MT.H_{1}(x_{i})\) and decrypt \(c_{i}\) to \(l_{i}\);
8: Obtain the location intersection set \(U_{I}=\{l_{i}\}\);
9:for\(1\leq\xi\leq s\)do
10:foreach\(l_{i}\)in\(U_{I}\)do
11: Compute the euclidean distance \(d(l_{i},f_{\xi})\) between \(f_{\xi}\) and \(l_{i}\);
12: Compute accumulated value \(\sum=d(l_{i},f_

## 5 Security Analysis

We now analyze the security of the ROLQ-TEE scheme. The goal of the adversary is to be able to decrypt ciphertext with the key of a revoked user. Theorem 5.1: _The ROLQ-TEE scheme maintains data privacy if the discrete logarithm problem and the collision resistance of hash functions are hard._

Proof: The query token, customer list, and query result are encrypted with public keys using random numbers, unique identifiers, and timestamps. Under the premise that the adversary \(\mathcal{A}\) does not know the private key, the adversary \(\mathcal{A}\) needs to solve computational problems such as discrete logarithms and the anti-collision of hash functions in probabilistic polynomial time. This contrasts with the issues explored in Sections 3.2 and 3.3. Since the adversary \(\mathcal{A}\) cannot crack the ciphertext of the query token, customer list, and query result, the ROLQ-TEE scheme maintains data privacy.