# Lightweight and Privacy-Preserving Multi-Keyword Search over Outsourced Data
## 4 Extension  
This section presents an extended PRMS construction, which allows the outsourced document to be attached with multiple types of keywords. * **System setup**: With input security parameters \(\lambda_{1},\lambda_{2},\lambda_{3},\lambda_{4}\), the data owner constructs a dictionary set \(\mathbf{D}=\{D_{1},D_{2},\cdots,D_{z}\}\), where \(D_{\ell}\) (\(1\leq\ell\leq z\)) represents a dictionary of some type of keywords. Without loss of generality, it is assumed that each dictionary \(D_{\ell}\) contains \(n\) keywords. The data owner randomly picks a large prime \(p\) such that \(|p|=\lambda_{2},z\) elements \(s_{\ell}\in_{R}Z_{p}^{*}\) (\(1\leq\ell\leq z\)), and a cryptographic one-way hash function \(H:\{0,1\}^{*}\rightarrow\{0,1\}^{\lambda_{1}}\). Thus, the public parameters are \(para=(\lambda_{1},\lambda_{2},\lambda_{3},\lambda_{4},p,n,H)\), and the data owner keeps \(\mathbf{D}\) and \(\{s_{\ell}:1\leq\ell\leq z\}\) secret. * **Index generation**: For each document \(F\), the data owner encrypts it as ciphertext document \(\vec{F}\) using some secure symmetric encryption algorithm, randomly picks a unique file name \(N\), and calculates the length \(d\) of document \(F\). For each dictionary \(D_{\ell}\) (\(1\leq\ell\leq z\)), the document \(F\) is processed as follows. The data owner computes \(\gamma_{\ell}=H(N,d,\ell)\) and constructs an index vector \(\vec{I}_{\ell}\) such that if the document \(F\) contains the \(i\)-th keyword in dictionary \(D_{\ell}\), then \(I_{\ell,i}=1\), otherwise\(I_{\ell,i}=0\). The data owner further sets \(I_{\ell,n+1}=0\) and \(I_{\ell,n+2}=0\), chooses \(n+2\) random number \(m_{j}\) such that \(\mid m_{\ell,i}\mid=\lambda_{3}\) for \(1\leq i\leq n+2\), and encrypts each \(I_{\ell,i}\) as follows: \[I_{\ell,i}=s_{\ell}\cdot(I_{\ell,i}\cdot\gamma_{\ell}+m_{\ell,i})\mod p\] (8) At last, the data owner outsources the ciphertext index set \(\hat{\hat{I}}=\{\hat{I}_{1},\hat{I}_{2},\cdots,\hat{I}_{z}\}\) and the processed document \(\hat{F}=(\overline{F},\gamma_{1},\gamma_{2},\cdots,\gamma_{z})\) to the cloud server, where \(\hat{I}_{\ell}=(\hat{I}_{\ell,1},\hat{I}_{\ell,2},\cdots,\hat{I}_{\ell,n+2})\) is a ciphertext index vector corresponding to dictionary \(D_{\ell}\), and keeps \((N,d)\) at local. * **Trapdoor generation**: Suppose the data user would like to search the outsourced documents with the keywords in dictionary \(D_{\ell}\in\mathbf{D}\). Data user picks a large random number \(\delta\) such that \(\mid\delta\mid=\lambda_{1}\), and computes \(s^{-1}\mod p\). From the query keyword set \(W\), data user constructs query vector \(\vec{Q}\), where \(Q_{i}=1\) if the query keyword set \(W\) contains the \(i\)-th keyword in the dictionary \(D_{\ell}\), otherwise \(Q_{i}=0\). Data user then sets \(Q_{n+1}=Q_{n+2}=0\), and randomly chooses \(n+2\) numbers \(t_{i}\) such that \(\mid t_{i}\mid=\lambda_{4}\) for \(1\leq i\leq n+2\). Data user constructs the search trapdoor \(\hat{Q}=(\hat{Q}_{1},\hat{Q}_{2},\cdots,\hat{Q}_{n+2})\), where \[\hat{Q}_{i}=s_{\ell}^{-1}\cdot(Q_{i}\cdot\delta+t_{i})\mod p\] (9) Data user sets the search threshold \(\tau\), and submits the search trapdoor \(\hat{Q}\) and \((\ell,\tau,\delta)\) to the cloud server, where \(\ell\) denotes the type of keywords in searching documents. * **Search**: Once received the encrypted search trapdoor \(\hat{Q}\), the cloud server computes the similarity score \(\mathsf{Score}(\hat{I}_{\ell},\vec{Q})\) with the ciphertext index vector \(\hat{I}_{\ell}\) of each outsourced document \(\overline{F}\) as follows.