# Unified Ciphertext-Policy Weighted Attribute-Based Encryption for Sharing Data in Cloud Computing
## 5 Proposed Unified Ciphertext-Policy Weighted Attribute-Based Encryption
### The Design of UCP-WABE
Particularly, \(\forall a_{i}\in\mathbb{S}\), let \(\omega_{i}^{\prime}\) denote the weight of \(a_{i}\), and let \((i,j)\) denote the \(j\)th part of \(a_{i}\), where \(j=1,\cdots,\omega_{i}^{\prime}\). For each \((i,j)\), WAA chooses \(D_{i,j}\in\mathcal{G}_{1}\) and \(r_{i,j}\in\mathbb{Z}_{p}\) randomly. WAA also chooses random values \(r_{i,end_{j}}\in\mathbb{Z}_{p}\). WAA generates \(SK\) components as follows:  
\[MSK=g^{-\alpha}. \tag{2}\]9  
\[f_{c}(x)=\sum_{i=0}^{d_{c}}b_{i}x^{i}, \tag{3}\]0  
```
0:\(PP\): The public parameter. \(M_{1}\): The data that Provider A wants to share. \(\Gamma_{1}\): The weighted access tree of Provider A. \(M1\): The mutual information. 0:\(CT_{1}\): The ciphertext of \(M_{1}\). 1: Create \(\Gamma_{1}\) based on \(\Gamma_{\epsilon}\)
2:for\(\forall\) trunk node \(N_{c}\) above \(N_{\epsilon}\in\Gamma_{1}\)do
3: Calculate \(f_{c}(1)\); select \(d_{c}\) non-constant coefficients randomly; and calculate \(f_{c}(0)\)
4:if\(N_{c}=N_{1}\)then
5: Calculate \(C_{M}\)
6:endif
7:endfor
8:for\(\forall\) non-trunk node \(N_{q}\in\Gamma_{1}\)do
9: Determine \(f_{q}(x)\) the same as MutualInfoGen
10:if\(a_{i}\in Y_{1}\backslash Y_{\epsilon}\)then
11: Calculate \(C_{(i,0),1},C_{(i,0),2}\)
12:for\(j=1\) to \(\omega_{i}\)do
13:if\(j\
eq\omega_{i}\)then
14: Calculate \(C_{(i,j),1},C_{(i,j),2}\)
15:else
16: Set \(s_{i,j}=f_{a_{i}}(0)\), and calculate \(C_{(i,j),1},C_{(i,j),2}\)
17:endif
18:endfor
19: Calculate \(C_{(i,end),1},C_{(i,end),2}\)
20:endif
21:endfor
22:\(CT_{1}=\left\{\Gamma_{1},C_{M},\{C_{(i,j),1},C_{(i,j),2}\}_{\forall a_{i}\in Y _{1},j=1,\cdots,\omega_{i}},\{C_{(i,end),1},C_{(i,end),2}\}_{\forall a_{i}\in Y _{1}}\right\}\)
```  
**Algorithm 2** The encryption algorithm (**Encrypt**). Then, WAA outputs:  
\[f_{c}(x)=\sum_{i=0}^{d_{c}}b_{i}x^{i}, \tag{3}\]1  
**Decrypt\((PP,SK,CT_{1})\)**. Consider that the aforementioned consumer gets \(CT_{1}\), and he/she wants to recover \(M_{1}\). The decryption process is defined as follows. If \(N_{x}\) is a leaf node of \(\Gamma_{1}\) and is associated with attribute \(a_{i}\in\mathbb{S}\) and \(\omega_{i}\leqslant\omega_{i}^{\prime}\), let \(N_{x}\)'s Boolean value be TRUE, and calculate:\[f_{c}(x)=\sum_{i=0}^{d_{c}}b_{i}x^{i}, \tag{3}\]2 \[f_{c}(x)=\sum_{i=0}^{d_{c}}b_{i}x^{i}, \tag{3}\]3 \[f_{c}(x)=\sum_{i=0}^{d_{c}}b_{i}x^{i}, \tag{3}\]4 \[f_{c}(x)=\sum_{i=0}^{d_{c}}b_{i}x^{i}, \tag{3}\]5  
Then, for \(j=1\) to \(\omega_{i}\):  
\[f_{c}(x)=\sum_{i=0}^{d_{c}}b_{i}x^{i}, \tag{3}\]6  
When \(j=1\) to \(\omega_{i}-1\),  
\[f_{c}(x)=\sum_{i=0}^{d_{c}}b_{i}x^{i}, \tag{3}\]7  
When \(j=\omega_{i}\),  
\[f_{c}(x)=\sum_{i=0}^{d_{c}}b_{i}x^{i}, \tag{3}\]8  
Finally, the consumer computes:  
\[f_{c}(x)=\sum_{i=0}^{d_{c}}b_{i}x^{i}, \tag{3}\]9 Figure 3:0 Figure 3:1  
\(a_{i}\) is the attribute of leaf node \(N_{x}\), so \(f_{a_{i}}(\cdot)=f_{x}(\cdot)\), and:  
Figure 3:2  
Equations (22) and (24)-(26) are on the basis of bilinear mapping properties, which were introduced in Section 3.1. If \(a_{i}\in\mathbb{S}\), \(\omega_{i}>\omega_{i}^{\prime}\) or \(a_{i}\
otin\mathbb{S}\), then \(F_{x}=\perp\), and \(\perp\) is a termination signal. For a non-leaf node \(N_{x}\) of \(\Gamma_{1}\), let \(N_{z}\) be the children of \(N_{x}\) and \(S_{x}\) be an arbitrary \(V_{x}\)-size set of \(N_{z}\), where \(F_{z}\
eq\perp\). If \(S_{x}\) does not exist, set \(F_{x}=\perp\), or else, \(N_{x}\)'s Boolean value is TRUE, then compute:  
Figure 3:3 Figure 3:4 Figure 3:5 Figure 3:6 Figure 3:7  
where \(\Delta_{z,S_{x}}(y)=\Pi_{i\in S_{x},i\
eq j}\frac{y-i}{j-i}\) is the Lagrange coefficient polynomial. Therefore, if the access tree \(\Gamma_{1}\) is satisfied by \(\mathbb{S}\), the decryption algorithm begins from the root node \(N_{1}\), and the consumer calculates:Figure 3:8  
Algorithm 3 displays the pseudocode of **Decrypt** algorithm. Figure 4 shows the working process of UCP-WABE for unified encryption. Figure 5 displays the process flow of a consumer for decryption. \(PP\): The public parameter. \(SK\): The secret key of the consumer.