A CP-ABE Scheme Based on Lattice LWE and Its Security Analysis

In recent years, the research on ciphertext-policy attribute-based encryption (CP-ABE) scheme design based on learning with errors (LWE) has been a challenging problem, and many researchers have made a lot of attempts at it. At EUROCRYPT 2021, Datta, Komargodski, and Waters proposed the first provably secure direct CP-ABE construction that supports NC1 circuit access structures. Improving on their work, we propose a CP-ABE scheme. Technically, we use the new lattice two-stage sampling technique of Lai, Liu, and Wang (EUROCRYPT 2021) in the key generation phase instead of the extended trapdoor sampling technique. In this way, we obtain a CP-ABE scheme, which is at least as secure as the original scheme under the same conditions, and has a shorter ciphertext; we provide an innovative design idea for designing CP-ABE schemes only based on LWE, although this is only a partial theoretical work.


Introduction
In order to better realize the fine-grained access control of encrypted data, attributebased encryption comes into being as a generalization of traditional public key encryption [1]. Attribute encryption has two variants, including ciphertext strategy and key strategy. In the ciphertext policy ABE, that is, the ciphertext is associated with the access policy, and the key is correlated to the attribute. While in the key policy ABE, the position of the access policy and the attribute is exactly opposite. However, there is one consistent point: decryption will be successful only if the attribute meets the access policy.
Since the concept of ABE was founded by Sahai et al. [2,3], it has been widely studied in cryptography and has many potential applications. Therefore, cryptographic researchers all over the world have been widely concerned by the design of the ABE scheme, which has given birth to a series of achievements that, on the whole, pursue various tradeoffs between expression, efficiency, security, and potential assumptions [4][5][6][7][8][9][10][11][12][13][14][15].
Most of the work mentioned above has been based on assumptions associated with bilinear mapping. It is necessary and normal to find structures based on other assumptions. On the one hand, they can not only make us more sure about the existence of the corresponding encryption scheme but also stimulate our enthusiasm for studying and developing new technologies, so as to further deepen our understanding of cryptographic primitives. On the other hand, in view of the known attacks of quantum computing on group-based cryptographic schemes [16], it is important to construct lattice-based attribute encryption to realize the security of quantum computing attacks. To this end, there are indeed several ABE schemes [4,5,8,10,11,14,[17][18][19], which rely on other cryptographic assumptions rather than bilinear mappings as their underlying building blocks.
However, it is an indisputable fact that most of the existing ABE schemes based on LWE are ABE with a key strategy. Until the advent of reference [20], only a few LWE-based CP-ABE schemes had been constructed, and all of them were obtained through a special transformation with the help of the KP-ABE. However, this transformation will inevitably lead to some unsatisfactory results. For more details, please refer to [20].
Under the assumption that there is only LWE, improving the CP-ABE structure based on the general-purpose circuits described above has always been a challenging problem. In order to solve this question, several eye-catching jobs have been completed recently. For example, the work of [6,21,22] depends on LWE and bilinear groups. Work [9] lacks a safety certificate. Recently, a CP-ABE project on the basis of LWE was constructed in [22], although an indispensable part of the scheme remained the general circuit size limit. Reference [20] makes a conceptual contribution to this open and challenging issue. Their excellent work also draws on some innovative ideas from the work of [17,23]. In TCC 2013, Boyen et al. [17] proposed the first lattice-based attribute-based encryption construction (ABE) for NC 1 circuits. Unfortunately, soon after, a loophole was discovered in the security; however, because of its technical novelty, it continues to be widely studied by many scholars. In particular, this is the first lattice-based ABE that uses the linear secret sharing scheme (LSSS) as a key tool to implement access control. In the scheme [23], Agrawal et al. proved that the scheme [17] is actually unsafe, and they gave an idea for repairing the security of the scheme by taking the notion of an admissible LSSS and instantiating it as the class of DNFs. After the work of [23], Datta et al. proposed the first CP-ABE scheme constructed in a direct manner and provided the complete security proof. It is a very innovative and creative work; it not only introduces new methods and techniques in concept but also popularizes and constructs new MA-ABE schemes.
The purpose of this paper is to propose an improved attribute-based encryption scheme based on the ciphertext policy (CP-ABE), which is modified on the basis of [20]. Technically, we use the two-stage sampling technique on the lattice in [24] instead of the extended trapdoor sampling technique in [20]. In this way, we obtain a CP-ABE scheme, which is at least as secure as the original scheme and has a shorter ciphertext.
The organization of the work of this article is listed below. In the second part, the relevant preliminary knowledge is given. In the third part, we give our CP-ABE scheme and the related proof of correctness and security.

Relevant Basic Knowledge
Here, we present several related concepts to facilitate readers to understand the full text. Consider a mapping negl : N → R. If there is a N c > 0 such that the formula of negl(x) < 1/ f (x) is always valid for all f (x) > 0 and x > N c , then negl(x) is called a negligible function. In addition, for convenience, we use [n] to represent the collection {1, . . . , n}.
Let PPT denote the abbreviation of probabilistic polynomial time. Assuming that ψ is a distribution, we will use the symbol x ← ψ to indicate that x is randomly sampled on the basis of the distribution ψ. Assuming that Y is a set, we use the symbol y ← Y to indicate that y is sampled on the elements of the set Y based on uniform distribution. Without losing generality, we use uppercase bold letters to represent matrices and lowercase bold letters to represent column vectors, such as G and d. For convenience, we use G l to represent the l th row of matrix G, and, further, G L represents a matrix that includes the set of G l for all l ∈ L. Suppose b is a vector, we use the symbols b and z ∞ to represent its l 2 norm and l ∞ norm, respectively.

Linear Secret Sharing Schemes with Linear Independence
This section is divided into two parts. In the first part, several essential definitions and characteristics of LSSSs are listed. In the second part, a new LSSS is presented, proposed in reference [25], and its definition will be listed later for the integrity of the article. This new LSSS has some interesting features, which can help us to design a CP-ABE scheme on the basis of the LWE hypothesis for all NC 1 circuits.

Related Contents of LSSS
A secret sharing scheme means that the secret distributor divides the secret d into n parts using a specific algorithm and then distributes n shares to n participants. Authorized subsets of n participants can jointly reconstruct secrets, while other unauthorized subsets cannot.
Definition 1 (Access Structures, [25]). A collection A ⊆ 2 [n] \φ of non-empty subsets of n participants labeled from one to n is called an access structure. The collections that belong to A are named the authorized collections, and the collections that do not belong to A are named the unauthorized collections. An access structure is deemed monotone in the case that the latter condition is satisfied. That is, for any two C, E ∈ 2 [n] , there is E ∈ A if there are C ∈ A and C ⊆ E.
A secret sharing scheme corresponding to a monotone access structure A can be regarded as a randomized algorithm whose input is a secret d and its output is n parts pa 1 , . . . , pa n . These parts satisfy certain restrictions: that is, d can be determined by {pa i } i∈A for arbitrary A ∈ A, while other sets are independent of d.
A secret sharing scheme corresponding to a non-monotone access structure A can be regarded as a randomized algorithm whose input is a secret d, and its output is 2n shares viewed as n pairs (pa 1,0 , pa 1,1 ), ..., (pa n,0 , pa n,1 ), these shares satisfy certain restrictions: that is, d can be determined by {pa i,1 } i∈A ∪ {pa i,0 } i / ∈A for arbitrary A ∈ A, while other sets are independent of d, which can be regarded as a transformation of the above concepts and algorithms.
Definition 2 (Non-monotone LSSS, [25]). Let [n] be a group of participants. Additionally, suppose q ∈ N is a prime power. The scheme described above is called non-monotone LSSS Π over Z q if the following conditions are true:

1.
For ρ ∈ {0, 1} as well as i ∈ {1, . . . , n}, each share pa i,ρ of a secret d ∈ Z q makes up a vector whose input is over Z q .

2.
There must be a share-generating matrix, recorded as G ∈ Z y×t q , and there is also a mapping η from [y] to [2n]; η establishes an one-to-one mapping from the rows of G to the participants derived from [n] and their corresponding negation (represented by {n + 1, ..., 2n}, respectively). This meets the conditions mentioned later, that is: Given a vector v = (d, α 2 , . . . , α t ) ∈ Z t q , then according to Π, for the matrix G described above, there must be a vector representation of y shares of secret d that is equal to pa = G · v ∈ Z y×1 q . For ρ ∈ {0, 1} as well as i ∈ {1, . . . , n}, the part pa i,ρ includes all of the pa l values for which η(l) = n(1 − ρ) + i (in this way, all "1 shares" fall in the first n, and all "0 shares" fall in the last n). Then, (G, η) will be named the LSSS policy about the access structure A.
Based on the analysis of correctness and security in [25], we list the following conclusions. Correctness is achieved through the following condition: if R ∈ [n] is authorized, the vector (1, 0, . . . , 0 ). Security is achieved through the condition that if R ∈ [n] is not authorized, then (1, 0, ..., 0) cannot be expressed linearly by the rows of G R . In addition, in a case without authorization, there is a vector t ∈ Z t q , with the condition that its first components are t 1 = 1 and G R t = 0, of which 0 is the all 0 vector. 1 We present a new non-monotone linear secret sharing scheme proposed in [25], which is suitable for all access structures that can be represented through NC 1 circuits. This scheme possesses some very attractive and practical properties, as shown below:

The Non-Monotone LSSS for NC
-Each element of the corresponding policy matrix is very small, and they all come from The secret can be rebuilt through a series of small coefficients are belong to {0, 1}. - The rows corresponding to the access policy matrix that matches a collection that is not authorized are linearly independent.
The construction: We present the access structure A described by the NC 1 circuit, which is adapted from [25]. The circuit can be represented through a Boolean formula with logarithmic depth, which is represented by AND, OR, and NOT gates. Then, we use De Morgan's law to simplify the Boolean formula to a form with only OR and AND gates, marked by variables or their negation. The next step is to transform each gate node from top to bottom and from left to right, which can be seen as recursive. First, we initialize a global counter variable c = 2 and increase the value of c by one after each door is marked. Next, we consider the specific operation flow of one of the doors. The outputs of wire x are marked as x 1 = (1, 0, . . . , 0) and x 2 = (0, 1, . . . , 0), and its sub-inputs are y (marked as y 1 and y 2 ) and z (marked as z 1 and z 2 ). The marker vectors of y and z are calculated from the marker vector of x according to the type of gate (as listed below). We calculate in turn until all the gate nodes are converted and put each vector of the lowest layer into a matrix G from top to down: AND gate:

The Concept of CP-ABE
A CP-ABE scheme is defined by four PPT algorithms shown below, which have been adapted from the literature [9]: • Setup (1 λ , 1 l ): The setup algorithm is an algorithm whose input is the the security parameter λ, which is the input length l of the function f . Moreover its outputs are a master secret key MSK and a collection of exposed parameters PK. • Encrypt (PK, µ, f ): The encryption program is an algorithm whose inputs are a public key PK, a message µ, and a function f , and the output is a ciphertext CT. • Keygen (MSK, x): The keygen algorithm is an algorithm that outputs the private key SK x corresponding to the attribute x with the input of the MSK and the attribute x. • Decrypt (PK, SK x , CT): The decryption program is an algorithm whose input is the public key PK, a secret key SK x , and a ciphertext CT. If and only if the attribute x satisfies f (x) = 1, it will output the message µ; otherwise, decryption fails.

Definition 3 ([9]).
A CP-ABE scheme is correct if the equation shown below holds. Namely, In fact, CP-ABE schemes that implement the access structure A using an LSSS can be seen as an extension of the above definition. Namely, f is transformed into an access structure over the attribute collection. At the same time, the single attribute x in the definition above becomes a set S. By the same token, decryption can be successful only when certain conditions are met, that is, the attribute set S satisfies the access policy A; otherwise, decryption fails.
Security: Next, we present the security model of CP-ABE through the game between the challenger and the attacker shown below.

Setup.
After receiving the security parameters, the adversary submits an access structure A, and then the challenger runs the setup algorithm and provides the resulting common parameters to the adversary. Phase 1. The adversary initiates a polynomial number of private key queries to the challenger, but a limitation of the attribute set is that the access structure A must not be met, and the challenger responds and gives the matching private key SK ← Keygen(MSK, R).
Challenge. The adversary provides two messages of equal lengths to the challenger, and then the challenger chooses a bit b ∈ {0, 1} with the probability of throwing coins at random and returns the ciphertext CT ← Encrypt(PK, µ b , A) to the adversary. Phase 2. This step is equivalent to the repetition of Phase 1.
Guess. At the end of the game the adversary outputs a guess b about b. The probability advantage of an adversary A in the above game is defined as: Definition 4 ([20]). If for an arbitrary PPT adversary A and all λ ∈ N, there exists a negligible function negl(·) such that Adv Sel A ≤ negl(·) holds, then we call the CP-ABE scheme for LSSSrealizable access structures selectively secure.

Definition 5 ([20]
). If a relaxed setting is made for the key query phase of the above scheme, that is, the rows in the generating matrix G corresponding to the attribute set sent by the adversary each key query must be linearly independent, namely, those attribute sets that do not meet the access policy are queried. Then it is said that the relaxed scheme is selectively secure under linear independence.

The Relevant Knowledge of Lattice
Here, we will give some lattice-related knowledge used in our CP-ABE construction. All of the relevant contents are adapted from the corresponding references. In order to save space, only an overview of lattice and Gaussian distributions is given here. For more details, please refer to [24]. A lattice whose dimension is m is a discrete additive subgroup of R m . For a matrix A ∈ Z n×m q , where n, m, and q are integers greater than 0, Λ ⊥ q (A) = {y ∈ Z m | Ay = 0(mod q)} and Λ u q (A) = {y ∈ Z m | Ay = u(mod q)} are defined. Assume that σ is an arbitrary real number greater than 0. The Gaussian distribution is a distribution interpreted by a probability distribution function ρ(y) = exp(−π y − c /σ 2 ) (where c ∈ Z n ), if a discrete set V ⊆ R m is involved, then ρ σ,c (V) = ∑ y∈V ρ σ,c (y), and then ρ V,σ,c (y) = ρ σ,c (y)/ρ σ,c (V) is defined as a Gaussian distribution whose parameter is σ on the set V, represented by the symbol D V,σ . We useD V,σ to represent the truncated Gaussian distribution, which is statistically indistinguishable from the Gaussian distribution D V,σ . TheD V,σ is the same as the D V,σ except that when the l ∞ norm exceeds √ mσ, it will output 0.
Definition 6 (Decisional LWE [10]). Select a λ as the security parameter, then let n, m, and q be functions of λ and positive integers at the same time. Therefore, suppose there is a probability distribution ψ = ψ(λ) (in general, ψ is a distribution D Z,αq with the condition that α < 1) over Z. The DLWE n,m,q,ψ problem declares that for any m = poly(n), in the case of A ← Z n×m q , s ← Z n q , u ← Z m q , and e ← ψ m , there will be a pair of distributions that are computationally indistinguishable as shown below: [25]). Let n and q be two functions from N to N. Therefore, let m > (n + 1) log q + w(log n) and l = l(n) be a function of n. Then, there are the two distributions shown below are statistically indistinguishable:

Lemma 1 (Leftover Hash Lemma
The purpose of the algorithm is to output a matrix B and its corresponding trapdoor T B , when the input is the dimension n, m of the matrix and q. The output matrix B of this algorithm is indistinguishable from the matrix C of the same dimension which is randomly selected evenly in the same number field.

2.
SamplePre(B, T B , δ, u): The goal of the algorithm is that when the input is matrix B and its corresponding trapdoor T B , a parameter δ ∈ R, u, the algorithm can output a vector t ∈ Z m q , and the vector t must satisfy two conditions of B · t = u and t ≤ √ m · δ. The pre-image t output by the algorithm is indistinguishable from the vector d selected according to the Gaussian distribution with parameter δ. [24]). Let m > n, q > 2 and suppose C, D ∈ Z n×m q are two full rank matrices; T C is a trapdoor matrix corresponding to C. For a matrix P ∈ Z n×y q and θ ≥ T C · ω( log m) (whereT C is the Gram-Schmidt orthogonalization T C ), there must be a PPT algorithm SampleLeft (C, T C , D, P, θ) whose output is a matrix Y ∈ Z 2m×y q , and the matrix Y is statistically indistinguishable from the distribution of D Λ P q (C|D),θ . [24]). Let m > n ≥ 1, q ≥ 2, and all are integers. Consider using δ, σ ∈ R and an arbitrary small norm matrix S ∈ Z m×m as inputs, and the sampler operates sequentially according to the following two stages:

Definition 7 (New Two-Stage Sampling Method
1. The first stage: (this stage has nothing to do with S).
-Select a matrix at a random A ← Z n×m q ; -Select a vector at a random z ← Z n q ; 2.
The second stage: This is an example of a quote.

Our Ciphertext-Policy ABE Scheme for NC 1 Circuits Based on LWE
Here, we are going to show our CP-ABE scheme, which supports the access structure described through the NC 1 circuit. The specific features and construction have been shown in Section 2.1.2.
First of all, we give the specific restrictions of each parameter in the scheme according to the proof of correctness and security. The Setup algorithm should select the appropriate parameters and noise distributions n, m, σ, q and ψ lwe , ψ 1 , ψ 2 , ψ big , which meet the following conditions (fix any 0 < < 1/2): Select an LWE instance with the appropriate parameters n, m, q, as well as the distribution described above.

2.
Select a vector x ← Z n q and select a series of random matrices {P u } u∈U at the same time.

3.
Run algorithm Output the public parameters and master secret keys: KeyGen(MSK, U): With the master secret key and the collection of attributes U ∈ U as inputs, perform the following steps: 1.
Sample aŵ ← ψ 1 and set the vector For each u ∈ U, sample matrix j u ←D Z m ,δ , at the same time, and, finally, let Enc(PK, µ, (G, η)): With the public parameters PK, a message µ ∈ {0, 1} needs to be encrypted, and an LSSS access policy (G, η), generated from the previous transformation, are the inputs (that is to say, where ). Perform the following steps in order:

2.
In addition, continue to sample q ,ĉ i ∈ Z m q as described below.
Dec(SK, ct): With the private key and a ciphertext as inputs, perform the following algorithm steps in order:

1.
In the case that the vector (1, 0, . . . , 0) cannot be represented by the rows of G correlated to the attribute set U, the decryption will fail.

2.
Conversely, let ∆ be a collection of the row labels of G with the condition that for any

Correctness
Next, we will prove the correctness of the scheme. Given an attribute collection U ⊂ U and an arbitrary access policy (G, η), where U forms an authorized set, calculate the following equation By substituting the specific values of {c i } i∈[y] and {ĉ i } i∈[y] into the above formula, we can obtain Here, let us review the previous key generation process. For each u ∈ U, According to the above description, the formula ∑ i∈∆ ξ i G i,1 = 1 holds. Moreover, for 1 < l ≤ t max , ∑ i∈∆ ξ i G i,l = 0. Additionally, because of w = (1,ŵ), then calculate (s x, 0, . . . , 0)w = s x. Thus, The correctness is based on the fact that the last two terms of the above two equations are very small and will not affect the MSB of s x. In order to achieve this, we must make the following inequalities hold with extremely overwhelming probabilities: 2mσ : This is because the 2m coordinates of e i are selected accordingD Z,σ .
The reason for this is precisely because all the coordinates ofê i are selected according toD Z m ,δ , where δ ≥ σ √ m R · λ w(1) . - holds where (1) the selection of k u g u is based on a distribution that is statistically The reason is that w = (1,ŵ), andŵ is selected by a distributionD Z m−1 ,σ . -Based on the fact that ξ i ∈ {0, 1}, we can obtain:

Security Analysisr
In this part, we will give the security analysis of the scheme in detail. The security proof of our scheme is carried out strictly according to the idea of the security proof in [20]. Theorem 1 ([20]). Under the condition that the LWE hypothesis is true, the CP-ABE scheme we present for all access structures described through NC 1 circuits is selectively secure.

Theorem 2.
Under the condition that the LWE assumption is true, the CP-ABE scheme we present is selectively secure under linear independence restriction.
Proof. To prove the correctness of Theorem 2, we considered a series of hybrid games, which are slightly different from each other. The first hybrid game matches the real choice security game under the linear independent restriction, and the final hybrid scheme is the one in which the advantage of the opponent is zero. By demonstrating that the advantages of the adversaries have only a completely negligible change between different consecutive hybrid games, we have finally proved the correctness of Theorem 2. Next, we will talk about the specific hybridization and analysis process. In order to facilitate the explanation, we first use 12 algorithm graphs to show, in detail, the process of 12 hybridizations in which all the symbols used are as defined above.
Secondly, we analyze the indistinguishability of any two adjacent hybridization processes in detail. For convenience, we introduce a probability function β A,x (λ) : N → [0, 1] for all adversaries A, and any x ∈ {0, 1, . . . , 11} whose input is 1 λ and output is the probability of the opponent A correctly guesses the challenge bit b ∈ {0, 1} in each hybrid program. According to the definition of Algorithm 1, it is known that | β A,0 (λ) − 1/2 |= Adv Sel A (λ) for all λ ∈ N. Furthermore, since the generated challenge ciphertext in Algorithm 12 does not disclose any information about the selection of challenge bits, it is known that β A,11 = 1/2 for all λ ∈ N.
Therefore, through the following series of analysis, we can conclude that for all λ ∈ N, there is obviously Hybrid 0: This is the original selective weak security model of the CP-ABE scheme we constructed.
Hybrid 1: This is similar to Algorithm 1, except for the three parts marked with a wireframe in Algorithm 2, and these changes are only semantic (As in Algorithm 1, {v l } l∈{2,...,t max } ← Z m q , Algorithm 2 replaces the original vector {v l } l∈{2,...,t max } withv l D l , where {v l } l∈{2,...,t max } ← Z n q and {D l } l∈{2,...,tmax } ← Z n×m q . The semantic changes involved later are also similar to the methods here), so there is obviously β A,0 (λ) = β A,1 (λ) for all adversaries A. Hybrid 2: This is similar to Algorithm 2, except for the two parts marked with a wireframe in Algorithm 3, and these changes are only semantic, so there is obviously β A,1 (λ) = β A,2 (λ) for all adversary A. Hybrid 3: This is similar to Algorithm 3, except for those parts marked with a wireframe in Algorithm 4. The indistinguishability of Algorithm 3 and Algorithm 4 stems from the leftover hash lemma (as shown in Lemma 1) and the basic fact that the sum of two random matrices is still a random matrix. So, there is obviously β A,2 (λ) − β A,3 (λ) ≤ negl 3 (λ) for all adversaries A. Hybrid 4: This is similar to Algorithm 4, except for those parts marked with a wireframe in Algorithm 5. It chooses another indistinguishable way to generate {D j } j∈{2,...,tmax } , which stems from the trapdoor lattice sampler. So, there is obviously β A,3 (λ) − β A,4 (λ) ≤ negl 4 (λ) for all adversaries A.
Hybrid 5: This is similar to Algorithm 5, except for several parts marked with wireframes in Algorithm 6, which can be summarized as the way in which k u g u is generated when answering the private key query of the adversary A for all u ∈ U ∩ η(y). This indistinguishably stems from the smudging lemma (Lemma 2), so we can deduce that β A,4 (λ) − β A,5 (λ) |≤ Q key (λ)· | U ∩ η(y) | ·2m · negl smu (λ) ≤ negl 5 (λ) for all adversaries A where negl smu is a negligible function to measure the indistinguishability of two distributions under smudging and Q key represents the number of private key queries made. For example, for all of the m ∈ N and λ ∈ N, (1) ). Hybrid 6: It is basically similar to Algorithm 6, just except the generation method of the vector t is different when answering the adversary A. Here, in order to achieve the same purpose, we use the idea of Hybrid 6 in [20]. Namely, let b = (b 1 , . . . , b t max ) be a vector such that b 1 = 1 and ∑ l∈{2,...,t max } G η −1 (u),l b l = 0 for all u ∈ U. Note that by the game restriction, the set of rows of G with indices in η −1 (U) must be unauthorized with respect to the access policy (G, η), and, hence, the existence of such a vector b is guaranteed. We can find that the indistinguishability of Algorithm 6 and Algorithm 7 comes from the excellent characteristics of the trapdoor sampling of lattice. So, there is obviously β A,5 (λ) − β A,6 (λ) ≤ negl 6 (λ) for all adversaries A. Hybrid 7: This is similar to Algorithm 7, except for several parts marked with wireframes in Algorithm 8. Similar to the methods and goals of Hybrid 7 in [24], here, due to the restrictions of the game, for each secret key query of A corresponding to some attribute set U ⊂ U, the rows of G with indices in ηU are linearly independent. These changes can also be seen as a simple semantic, so they are indistinguishable; therefore, there is obviously p A,6 (λ) − p A,7 (λ) ≤ negl 7 (λ) for all adversaries A. Hybrid 8: This is similar to Algorithm 8, except for several parts marked with wireframes in Algorithm 9, which can be summarized as the way in which k u g u u∈U∩ρ([y]) is generated when answering the private key query of the adversary A. The indistinguishability of Algorithm 8 and Algorithm 9 is derived from the excellent characteristics of the trapdoor sampling of lattice. So, there is obviously p A,7 (λ) − p A,8 (λ) ≤ negl 8 (λ) for all adversaries A. Hybrid 9: This is similar to Algorithm 9, except for the part marked with wireframes in Algorithm 10. Namely, the way to generate the matrices {A u } u∈ρ([y]) has been replaced. The indistinguishability of Algorithm 1 and Algorithm 2 is derived from the excellent characteristics of the trapdoor sampling of lattice as described earlier. So, there is obviously β A,8 (λ) − β A,9 (λ) ≤ negl 9 (λ) for all adversaries A. Hybrid 10: This is similar to Algorithm 10, except for the two parts marked with wireframes in Algorithm 11. Namely, the way to generate the vectorsê i in the {ĉ i } i∈ [y] has been replaced. The indistinguishability of Algorithm 10 and Algorithm 11 is derived from the smudging lemma (Lemma 2). So, there is obviously β A,9 (λ) − β A,10 (λ) ≤ y · m · negl smu ≤ negl 10 (λ) for all adversaries A.
Hybrid 11: This is basically the same as Algorithm 11, except for a few framed parts, which are summarized as different ways of generating ciphertext in the challenge phase.
In Algorithm 11, {c i } i∈[y] resembles a set of LWE n,q,σ samples, and, here, we really want to use LWE to hide s. Assume that for any i ∈ [y], [A u , A u S u ] = [a 1 , . . . , a m , a m+1 , . . . , a 2m ], s[a 1 , . . . , a m , a m+1 , . . . , a 2m ] + e i = [sa 1 + e i,1 , . . . , sa m + e i,m , sa m+1 + e i,m+1 , . . . , sa 2m + e i,2m ]. Because of the decisional LWE, we have that the selection of {c i } i∈ [y] in Algorithm 11 and Algorithm 12 is indistinguishable. In addition, Algorithm 12 makes a semantic transformation withv l = s + v l so that {ĉ i } i∈[y] gets rid of s and has the same distribution as the selection in Algorithm 11. In turn, if we look at sx , because of x ← Z n q , we can make a 2m+1 = x and randomly select e 2m+1 ← D Z,σ . Then, there must be MSB(sx ) = MSB(sx + e 2m+1 ). Then, according to the decisional LWE n,q,σ , we have that the distribution of MSB(sx ) is indistinguishable from that of MSB(τ) (where τ ← Z q ). To sum up, the indistinguishability of Algorithm 11 and Algorithm 12 is derived from the LWE assumption. So, there is obviously β A,10 (λ) − β A,11 (λ) ≤ negl 11 (λ) for all adversaries A. 8: SK f = (w, {hu } u∈U ).
Challenge phase:

CHALLENGE PHASE
1: s ← Z n q .

Comparison
For a long time before, the only known way to implement an LWE-based CP-ABE scheme was to convert a circuit-based KP-ABE scheme into a CP-ABE scheme, in which the access policies and sets of attributes were represented as circuits by using general circuits. However, this transformation essentially results in a CP-ABE with restricted access policy classes, whose parameters are far from ideal.
In recent years, people have tried to make some improvements to the CP-ABE based on the general-purpose circuits described above, while trying to get rid of other assumptions, and have wanted to design solutions only based on LWE. This is a step-by-step process, and, recently, there have been only a few exciting attempts, but these schemes themselves are not very efficient, and they are only attempts at the design level. There has not been too much consideration for specific contents, such as the key size or ciphertext size; therefore, here, we also make a comparison mainly from these levels, as shown below.
The reason why we say that our scheme is at least the same as the scheme [20] under the same parameters is that we can prove that the scheme can indeed achieve selective security. However, also because the use of two-stage sampling technology has been proven able to achieve a strong security, simple function encryption. The so-called strong security means that attackers can decrypt key queries before and after arbitrary challenges are issued in simulated security experiments. Here, we only give proof that the scheme is selectively secure. At the same time, in order to better illustrate the contribution of this scheme, we compare our scheme with some previous CP-ABE schemes, as shown in Table 1 below. Here, under the same parameters, we make a simple comparison between our scheme and the one in [20] in terms of the public key, private key, and ciphertext storage overhead. The results show that the ciphertext can be shortened to a certain extent by two-stage sampling technology. The specific comparison idea is as follows. Since the lengths of parts (G, η) and C = MSB(s x) ⊕ µ in the ciphertext of the two schemes are equal, we only compare parts {c i } i∈[y] and {ĉ i } i∈[y] , as shown in Table 2 (since the value of the parameter "m" in our scheme is half that of the parameter "m" in their scheme, in order to make a unified comparison, we take the parameters in our scheme as the benchmark). In addition, we also find that the sizes of the public key and private key of our scheme are superior to those of the original scheme. However, because the efficiencies of all LWE-based CP-ABEs are relatively low, we mainly pay attention to the innovation of the scheme design itself. However, some other contents, such as key size, encryption cost, decryption cost, and so on, will not be considered for the time being. The performance optimization, computational complexity, and implementation of the scheme will be considered at a later time. Table 2. Comparison between our scheme and the scheme in [20] in terms of storage overhead under the same parameters.

Example of Parameters Selection
In this section, we refer to the six constraints of the scheme parameters in the third section of this paper, and, after a series of strict calculations, we give several groups of reasonable parameter choices, which are not necessarily optimal, for detail, please refer to Table 3 as shown below.

Conclusions
In this paper, the CP-ABE scheme of [20] is improved by using a two-stage sampling algorithm, and a selectively secure CP-ABE scheme with shorter ciphertext is obtained. We prove the correctness of the scheme and give strict proof of security. At the same time, we also give a comparison of the computational cost between this scheme and the one in [20], and, in order to better understand the scheme, we recommend several groups of parameters through a series of strict calculations. Finally, we give a simple example to demonstrate the overall operation process of the algorithm. This scheme may provide some ideas for constructing other CP-ABE and multi-authority attribute encryption schemes, and the two-stage sampling algorithm involved in this scheme may be used in other cryptographic schemes to optimize the existing performance.