## 5 Proposed Scheme
### Ciphertext Calculations and Policy Update  
To initialize and update the policy matrix, the alignment of bias \(b\) and random number \(r\) is needed. For a pair of converted ciphertexts for \(m_{1}\) and \(m_{2}\) like (19):  
\[\begin{split} c_{1}^{{}^{\prime}}=&(m_{1}-b_{1}, \beta_{1})\\ =&(m_{1}-b_{1},(g^{r*}mod\ N^{2},g^{r*s_{KGC}}(1+b_{1 }N)mod\ N^{2}))\\ c_{2}^{{}^{\prime}}=&(m_{2}-b_{2},\beta_{2})\\ =&(m_{2}-b_{2},(g^{r*}mod\ N^{2},g^{r*s_{KGC}}(1+b_{ 2}N)mod\ N^{2}))\end{split} \tag{19}\]  
In order to verify whether the corresponding plaintext \(m_{1}\) and \(m_{2}\) are equal to each other only by action on their ciphertexts \(c_{1}^{{}^{\prime}}\) and \(c_{2}^{{}^{\prime}}\) safely, the server firstly aligns the first part of \(c_{1}\) and \(c_{2}\) to a unified value \(a_{0}\) as is introduced in Section 3.3. The server realigns the first part of \(c_{2}^{{}^{\prime}}\) and \(c_{1}^{{}^{\prime}}\) to \(a_{0}\) as follows:  
\[\begin{split}\delta_{1}=& b_{1}+(m_{1}-b_{1})-a_{0} \\ c_{1}^{{}^{\prime}}=&(a_{0},\beta_{1}\hat{+}Enc( \delta_{2}))\\ \delta_{2}=& b_{2}+(m_{2}-b_{2})-a_{0}\\ c_{2}^{{}^{\prime}}=&(a_{0},\beta_{2}\hat{+}Enc( \delta_{2}))\end{split} \tag{20}\]  
If the plaintext values corresponding to \(c_{1}^{{}^{\prime}}\) and \(c_{2}^{{}^{\prime}}\) are equal to each other, the plaintext corresponding to \(\beta_{1}\hat{+}Enc(\delta_{1})\) should be equal to that corresponding to \(\beta_{2}\hat{+}Enc(\delta_{2})\). But they are encrypted with different \(r\), so whether they are equal to each other is still invisible. Assume a pair of \(\beta_{1}\hat{+}Enc(\delta_{1})\) and \(\beta_{2}\hat{+}Enc(\delta_{2})\) as (21):  
\[\begin{split}\beta_{1}\hat{+}Enc(\delta_{1})=&(g^{ r^{{}^{\prime}}}mod\ N^{2},g^{r^{{}^{\prime}}s_{KGC}}(1+m_{1}^{{}^{\prime}}N) mod\ N^{2})\\ \beta_{1}\hat{+}Enc(\delta_{1})=&(g^{r^{{}^{\prime} }}mod\ N^{2},g^{r^{{}^{\prime}}s_{KGC}}(1+m_{2}^{{}^{\prime}}N)mod\ N^{2}) \end{split} \tag{21}\]  
To unify the random number \(r_{a}^{{}^{\prime}}\) and \(r_{b}^{{}^{\prime}}\) used in these two ciphertext, the server should send all the first part of ciphertext \(\beta_{i}\hat{+}Enc(\delta_{i})\) to Key Generation Center for help. The Key Generation Center can use its secret key \(s_{KGC}\) to get \(g^{r^{{}^{\prime}}s_{KGC}}\) and \(g^{r^{{}^{\prime}}s_{KGC}}\). To make the equation of \(m_{1}^{{}^{\prime}}\) and \(m_{2}^{{}^{\prime}}\) visible, Key Generation Center can calculate \(\Delta r_{1}\) and \(\Delta r_{1}\) so that (22) is meeted, the unified result of \(U_{KGC}\) is kept by the Key Generation Center.  
\[\begin{split}(g^{r^{{}^{\prime}}s_{KGC}}\cdot\Delta r_{a})mod\ N^{2}=& (g^{r^{{}^{\prime}}s^{{}^{\prime}}s_{KGC}}\cdot\Delta r_{b})mod\ N^{2}\\ =& U_{KGC}\end{split} \tag{22}\]  
Receiving \(\Delta r_{b}\) and \(\Delta r_{b}\), the Server can infer those ciphertexts whose corresponding plaintext the same with the same Second part of ciphertext for the aligned bias. For more ciphertexts the needed \(\Delta r_{i}\) can be as many as the amount of ciphertexts.  
Finally Server can count the number of every encrypted \((s,a)\) pairs and update the policy matrix. After traversing \(n\) attempt histories, the policy matrix would updates \(n\) times. More updates finished, the policy can become usable.