# An Improved Ciphertext-Policy Attribute-Based Encryption Scheme in Power Cloud Access Control
## 4 Our Proposed PCAC Scheme
### Detail Procedures in PCAC
#### 4.2.2 Data Collection Stage
After the access tree is generated, it is converted to an LSSS-sharing matrix. Every attribute \(a\) can be denoted as \(M_{a}\in Z^{1\times 1}\), and \(M_{a}=[1]\). Every access structure \(A_{i}\) can be denoted as a matrix \(M_{i}\in Z^{d_{i}\times e_{i}}\). \(C_{i}\) is denoted as the first column of \(M_{i}\); \(R_{i}\) is denoted as all other columns of \(M_{i}\). To handle access structures with \"OR\" door, denoted as \(A_{c}=A_{b}\lor A_{c}\), the generated matrix \(M_{c}\) is denoted as Equation (2):  
\[M_{c}= \begin{array}{ccc}C_{a}&R_{a}&0\\ C_{b}&0&R_{b}\end{array}  \tag{2}\]  
To handle access structure with \"AND\" door, denoted as \(A_{c}=A_{b}\wedge A_{c}\), the generated matrix \(M_{c}\) is denoted as Equation (3):  
\[M_{c}= \begin{array}{ccc}C_{a}&C_{a}&R_{a}&0\\ 0&C_{b}&0&R_{b}\end{array}  \tag{3}\]  
Therefore, in an LSSS share-generating matrix \(M_{\textit{LSSS}}\) with \(l\times n\), the number of specific attributes associated with the access structure, is \(l\) and \(n\) is a value related to the trapped function-parameters. Each row of \(M_{\textit{LSSS}}\) is associated with every attribute in the access structure. Therefore, when \(T_{2}\) changes, the rows associated to attributes, which exist in \(T_{2}\), must change, as shown in Figure 4.  
\(T_{1}=\{\{A,B,C\},D\}\) and \(T_{2}=\{E,F,G\}\), and the final access tree generated in this phase is \(T=\{T_{1},T_{2}\}=\{\{A,B,C\},D,E,F,G\}\). Each row of matrix is associated to attribute {_A,B,C,D,E,F,G_}. **Encrypt**: Encryption algorithm is executed by CKA. Due to the heavy computation overhead of CP-ABE, our PCAC scheme uses symmetric encryption to encrypt the plaintext data \(M_{T}\), and then uses CP-ABE to encrypt the key used to encrypt symmetrically. The DS randomly selects the symmetric key \(k\) and encrypts the data \(M_{T}\) with it, and then sends the ciphertext \(C_{T}\) and \(k\) to the PC and the CKA, respectively. CKA encrypts \(k\) with CP-ABE and shares the secret \(s\) with LSSS. An LSSS scheme can be expressed as \((M_{LSSS},\rho)\), where \(\rho\) is a specific hash function and it maps each row in the M matrix to a specific KS, denoted as \(\rho[i]\) (it can be understood that CKA distributes trapdoors to different KS, for storage by function \(\rho\)). CKA randomly selects a secret s for encrypting the symmetric key \(k\), denoted as \(C=ke(g,g)^{sa}\). In order to hide and share the secret \(s\), we randomly select \(y_{2},y_{3},\cdots,y_{l}\in Z_{p}\) and construct vector \(\overrightarrow{v}=(s,y_{2},y_{3},\in,y_{l})\). Same as the commonly used LSSS scheme, we share the secret \(s\) and send them to specific KSs for storage, denoted as \(\lambda_{i}=M_{LSSS}\); \(\overrightarrow{v}\) (\(M_{LSSSi}\) is the \(i^{th}\) row of sharing-generating \(M_{LSSS}\) and \(i=1,2,\cdots,l\)). Finally, we add a random factor \(r_{1},r_{2},\cdots,r_{l}\in Z_{p}\) as part of the ciphertext. Therefore, our scheme finally calculates the ciphertext CT, as shown in Equation (4). \[CT=\left\{ \begin{array}{l}CK=k(e(g,g)^{\alpha})^{s}\\ C^{\prime}=g^{s}\\ C_{i}=(g^{\beta})^{\lambda_{i}}\cdot Sn_{\rho_{i}}^{-r_{1}},i=1,2,\ldots,l\\ C_{i^{\prime\prime}}=g^{r_{i}},i=1,2,\ldots,l\end{array} \right. \tag{4}\]  
In Equation (4), CK is used to hide the symmetric key \(k\), and \(C^{\prime}\), \(C_{i}\), and \(C_{i}^{\prime\prime}\) are used for decryption. \(C_{i}\) is distributed stored by KSs. After this algorithm, CKA does not hold any part of ciphertext CT, nor does it save the shared secret \(s\). KS only stores part of \(C_{i}\), and single KS cannot recover the secret \(s\).