# Efficient and HRA Secure Universal Conditional Proxy Re-Encryption for Cloud-Based Data Sharing
## 5 Instantiation of Our Generic Construction
### Instantiation 2  
We suppose that the delegator is under a RSA encryption scheme denoted by \(\Pi_{f}\). That is, the delegator obtains a pair of keys \((\mathrm{sk}_{f},\mathrm{pk}_{f})\) throught the algorithm \(\text{KeyGen}(1^{\lambda})\) of \(\Pi_{f}\), we set the public key \(\mathrm{pk}_{f}=(e,n)\) and the secret key \(\mathrm{sk}_{f}=(d,n)\). Meanwhile, The delegator generates the ciphertext \(\mathbf{ct}_{f}^{m}\) encrypting the plaintext \(m\) via executing the algorithm \(\text{Enc}(m,\mathrm{pk}_{f})\) of \(\Pi_{f}\), where \(\mathbf{ct}_{f}^{m}=m^{e}\bmod n\). Suppose that the delegate is under a RSA encryption scheme denoted by \(\Pi_{t}\). In other words, the delegate gets a pair of keys \((\mathrm{sk}_{t},\mathrm{pk}_{t})\) throught the algorithm \(\text{KeyGen}(1^{\lambda})\) of \(\Pi_{t}\), we set the public key \(\mathrm{pk}_{t}=(e^{\prime},n^{\prime})\) and the secret key \(\mathrm{sk}_{t}=(d^{\prime},n^{\prime})\). In our system, the proxy can transfer the ciphertext \(\mathbf{ct}_{f}^{m}\) encrypting the plaintext \(m\) under a RSA encryption scheme into the ciphertext \(\mathbf{ct}_{t}^{m}\) under a RSA encryption scheme, as described in the following procedure. * ReKeyGen \((1^{\lambda},\Pi_{f},\Pi_{t},\mathbf{pk}_{t},\mathbf{pk}_{f},\mathbf{sk}_{f}, \mathbf{ct}_{f}^{m})\rightarrow\mathbf{rk}_{f\to t}\): The delegator performs the algorithm \(\text{ReKeyGen}(1^{\lambda},\Pi_{f},\Pi_{t},\Pi_{t},\mathbf{pk}_{t},\mathbf{ct }_{f}^{m})\) to set the re-encryption key \(\mathbf{rk}_{f\to t}\) from the delegator to the delegate, where \(\mathbf{rk}_{f\to t}=(\mathbf{ct}_{f}^{mR},\mathbf{ct}_{t}^{R^{-1}}, \mathbf{hsk}_{f})\). First, the delegator sets the ciphertext \(\mathbf{ct}_{f}^{mR}\) encrypting the message \(mR\) by performing the algorithm \(\text{ScalMul}(\mathbf{pk}_{f},\mathbf{ct}_{f}^{m},R)\) of \(\Pi_{f}\). For the algorithm \(\Pi_{t}\). \(\text{ScalMul}\left(\mathbf{pk}_{f},\mathbf{ct}_{f}^{m},R\right)\), the delegator choose a random \(R\)\((0<R<n-1)\) and sets \(\mathbf{ct}_{f}^{mR}\), where \(\mathbf{ct}_{f}^{mR}=(\mathbf{ct}_{f}^{m})\cdot(R^{e}\bmod n)=m^{e}\bmod n\cdot R ^{e}\bmod n=(mR)^{e}\bmod n\). Second, the delegator generates the ciphertext \(\mathbf{ct}_{t}^{R^{-1}}\) encrypting the message \(R^{-1}\) by executing the algorithm \(\text{Enc}(\mathbf{pk}_{t},R^{-1})\) of \(\Pi_{t}\). For the algorithm \(\Pi_{t}\). \(\text{Enc}(\mathbf{pk}_{t},R^{-1})\), the delegator computes \(\mathbf{ct}_{t}^{R^{-1}}=\left(R^{-1}\right)^{e^{\prime}}\bmod n^{\prime}\). Third, the delegator generates a hidden secret \(\mathbf{hsk}_{f}\) by executing the algorithm \(\text{HiddenSecret}(\mathbf{sk}_{f},\mathbf{ct}_{f}^{mR})\) of \(\Pi_{f}\). For the algorithm \(\Pi_{f}\)HiddenSecret(\(\textbf{sk}_{f},\textbf{ct}_{f}^{mR}\)), we set \(\textbf{hsk}_{f}=(\textbf{ct}_{f}^{mR})^{e-1}d=\left(mR\right)^{d}\text{mod}\,n\) and return \(\textbf{hsk}_{f}\). Finally, the algorithm outputs \(\textbf{rk}_{f\to t}=(\textbf{ct}_{f}^{mR},\textbf{ct}_{t}^{R^{-1}}, \textbf{hsk}_{f})\). * ReEnc \((\Pi_{f},\Pi_{t},\textbf{rk}_{f\to t})\rightarrow\textbf{ct}_{t}^{m}\): The proxy performs the algorithm \(\text{ReEnc}(\Pi_{f},\Pi_{t},\textbf{rk}_{f\to t})\) to generate re-encryption ciphertext **rct**, where \(\textbf{ct}=\textbf{ct}_{t}^{m}\). First, the proxy decrypts the ciphertext \(\textbf{ct}_{t}^{mR}\) by executing the algorithm \(\text{Combine}(\textbf{hsk}_{f},\textbf{ct}_{t}^{mR})\) of \(\Pi_{f}\). For the algorithm \(\Pi_{f}\). \(\text{Combine}(\textbf{hsk}_{f},\textbf{ct}_{t}^{mR})\), the proxy sets \(mR=(\textbf{hsk}_{f})^{e}=\left(mR\right)^{de}\text{mod}\,n=\,mR\). Second, the proxy obtains the ciphertext \(\textbf{ct}_{t}^{m}\) by executing the algorithm \(\text{ScalMul}\) of \(\Pi_{t}\). For the algorithm \(\Pi_{t}\). \(\text{ScalMul}(\textbf{pk}_{t},\textbf{ct}_{t}^{R^{-1}},mR)\), we compute \(\textbf{ct}_{t}^{mR}=\left(mR\right)^{e^{\prime}}\text{mod}\,n^{\prime}\) via encrypting \(mR\).