A key usage method, device, apparatus and storage medium
By distributing the private key shared value among each user, the problems of low decryption efficiency and poor information security of the Lifted ElGamal algorithm are solved, enabling fast encryption and decryption without a trusted central authority, thus improving both information security and decryption efficiency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHANDONG YUNHAI GUOCHUANG CLOUD COMPUTING EQUIP IND INNOVATION CENT CO LTD
- Filing Date
- 2023-07-21
- Publication Date
- 2026-08-04
AI Technical Summary
The Lifted ElGamal algorithm is inefficient in decryption and has poor information security. In traditional public-key cryptography, centralized management of private keys can easily lead to information leakage.
By distributing the shared private key information to each user, a (t,n) threshold cryptography scheme that does not require a trusted center is formed. The target public key and decryption value are calculated using the target user's target private key, enabling fast encryption and decryption.
It improves information security and decryption efficiency, ensuring that all participants can participate in decryption even without a trusted central authority, thus enhancing the security and speed of data processing.
Smart Images

Figure CN116743345B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of cloud computing technology, and in particular to a method, apparatus, device, and storage medium for using a key. Background Technology
[0002] Currently, the Lifted ElGamal algorithm possesses additive homomorphism, making it a threshold cryptographic scheme that exhibits additive homomorphism and does not require a trusted center. However, because the Lifted ElGamal algorithm requires traversal or table lookup during decryption, it suffers from low decryption efficiency when dealing with large amounts of data, leading to overall low decryption efficiency. Furthermore, in traditional public-key cryptosystems, the private key is typically stored by a single user (e.g., a large server). If this user leaks the private key, it can result in serious information leakage and poor information security. Alternatively, if the user loses the private key, normal decryption becomes impossible. Summary of the Invention
[0003] In view of this, the purpose of this invention is to provide a key usage method, apparatus, device, and storage medium that can improve information security and decryption efficiency. The specific solution is as follows:
[0004] Firstly, this application discloses a method for using a key, including:
[0005] Obtain the target private keys corresponding to a preset number of target users, and calculate the target public key based on all the target private keys;
[0006] The target plaintext is encrypted using the target public key to obtain the corresponding ciphertext;
[0007] Calculate the corresponding target decryption value based on the target private key corresponding to the preset number of target users;
[0008] The ciphertext is decrypted based on a preset decryption formula and the target decryption value to obtain the decrypted information.
[0009] Optionally, before obtaining the target private keys corresponding to a preset number of target users, the method further includes:
[0010] Set security parameters, and determine the prime number that occupies the number of bits in the security parameters as the target prime number;
[0011] Obtain the square value corresponding to the target prime number and the primitive root of the square value;
[0012] The target parameters are determined based on the original root and the preset parameter value calculation formula;
[0013] The current user is determined from the preset number of target users, and the secret value selected by the current user from a preset interval and the random number selected by the current user are obtained; wherein, the preset interval is an interval determined based on the target prime number;
[0014] Construct the current polynomial corresponding to the current user based on the random number and the secret value;
[0015] Calculate the preset number of function values based on the current polynomial, and store the current function values corresponding to the current user's position order;
[0016] Secretly send other corresponding function values according to the location sequence of each target user;
[0017] Receive the function values sent by all other target users to obtain a set of target function values;
[0018] The target private key corresponding to the current user is calculated based on the target function value set, the current function value, and the preset private key calculation formula.
[0019] Optionally, calculating the target public key based on all the target private keys includes:
[0020] The current private key is determined from all the target private keys, and the intermediate value of the public key is calculated based on the current private key and the squared value; the intermediate value of the public key is the intermediate value information used when calculating the target public key;
[0021] Obtain the intermediate values of the public keys corresponding to all the target private keys to obtain a set of intermediate values;
[0022] The target public key is calculated based on the set of intermediate values, the squared value, and the preset public key calculation formula.
[0023] Optionally, encrypting the target plaintext using the target public key to obtain the corresponding ciphertext includes:
[0024] A random number is obtained, and the target plaintext is encrypted based on the random number, the square value, the target public key, the target parameter, and a preset encryption formula to obtain the corresponding ciphertext.
[0025] Optionally, the step of decrypting the ciphertext based on a preset decryption formula and the target decryption value to obtain decrypted information includes:
[0026] Obtain all the target decryption values published by the target users according to the preset number, so as to obtain a set of target decryption values;
[0027] Calculate the intermediate decryption value based on the target set of decryption values, the squared value, and the preset intermediate decryption value calculation formula;
[0028] The ciphertext is decrypted based on the intermediate decryption value, the target prime number, and the preset decryption formula to obtain the decrypted information.
[0029] Optionally, before decrypting the ciphertext based on the intermediate decryption value, the target prime number, and the preset decryption formula to obtain the decrypted information, the method further includes:
[0030] The preset decryption formula is determined based on the preset parameter value calculation formula and the binomial theorem.
[0031] Optionally, after obtaining the target private keys corresponding to a preset number of target users, the method further includes:
[0032] The target secret value is calculated based on the target private key corresponding to the preset number of target users and the Lagrange difference formula.
[0033] Secondly, this application discloses a key usage device, comprising:
[0034] The private key acquisition module is used to acquire the target private keys corresponding to a preset number of target users.
[0035] The public key calculation module is used to calculate the target public key based on all the target private keys;
[0036] An encryption module is used to encrypt the target plaintext using the target public key to obtain the corresponding ciphertext;
[0037] The decryption value calculation module is used to calculate the corresponding target decryption value based on the target private key corresponding to the preset number of target users;
[0038] The decryption module is used to decrypt the ciphertext based on a preset decryption formula and the target decryption value to obtain the decrypted information.
[0039] Thirdly, this application discloses an electronic device, including:
[0040] Memory, used to store computer programs;
[0041] A processor for executing the computer program to implement the steps of the key usage method disclosed above.
[0042] Fourthly, this application discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, it implements the key usage method disclosed above.
[0043] As can be seen, this application provides a key usage method, including: obtaining target private keys corresponding to a preset number of target users, and calculating a target public key based on all the target private keys; encrypting target plaintext using the target public key to obtain corresponding ciphertext; calculating a corresponding target decryption value based on the target private keys corresponding to the preset number of target users; and decrypting the ciphertext based on a preset decryption formula and the target decryption value to obtain decrypted information. Therefore, this application calculates the target public key based on the target private keys of all preset number of target users. By distributing the shared value information of the private keys among each user, it forms a cryptography that does not require a trusted central authority. This allows all participants to participate in decryption to obtain the decrypted information, improving information security and decryption efficiency. Attached Figure Description
[0044] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0045] Figure 1 This is a flowchart of a key usage method disclosed in this application;
[0046] Figure 2 This is a flowchart of a specific key usage method disclosed in this application;
[0047] Figure 3 A schematic diagram of the key usage device provided in this application;
[0048] Figure 4 This application provides a structural diagram of an electronic device. Detailed Implementation
[0049] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0050] Currently, the Lifted ElGamal algorithm requires traversal or table lookup during decryption, which leads to low decryption efficiency when dealing with large amounts of data, consequently resulting in low overall password decryption efficiency. Furthermore, in traditional public-key cryptography, the private key is typically stored by a single user (e.g., a large server). If this user leaks the private key, it can cause serious information leakage and compromised information security. Alternatively, if the user loses the private key, normal decryption becomes impossible. Therefore, this application provides a key usage method that improves information security and decryption efficiency.
[0051] This invention discloses a method for using a key, see [link to relevant documentation]. Figure 1 As shown, the method includes:
[0052] Step S11: Obtain the target private keys corresponding to a preset number of target users, and calculate the target public key based on all the target private keys.
[0053] In this embodiment, target private keys corresponding to a preset number of target users are obtained, and target public keys are calculated based on all the target private keys. Before obtaining the target private keys corresponding to the preset number of target users, security parameters are set, and the prime number occupying the number of bits of the security parameters is determined as the target prime number; the square value corresponding to the target prime number and the primitive root of the square value are obtained; the target parameter is determined based on the primitive root and the preset parameter value calculation formula; the current user is determined from the preset number of target users, and the secret value selected by the current user from a preset interval and the random number selected by the current user are obtained; wherein, the preset interval is an interval determined based on the target prime number; the current polynomial corresponding to the current user is constructed based on the random number and the secret value; the preset number of function values are calculated based on the current polynomial, and the current function values corresponding to the position order of the current user are stored; other corresponding function values are secretly sent according to the position order of each target user; the function values sent by all other target users are received to obtain a target function value set; the target private key corresponding to the current user is calculated based on the target function value set, the current function value, and the preset private key calculation formula.
[0054] With the rapid popularization of smart terminal devices, a large amount of personal information data is being collected by various online platforms. In real life, personal information is easily leaked. In terms of privacy and security protection of network communication systems, data encryption is a very effective method to resist data attacks (including active and passive attacks). Among data encryption technologies, homomorphic encryption has the property that performing operations on ciphertext and then decrypting is equivalent to performing operations directly on plaintext. Based on this property, homomorphic encryption is widely used in voting systems, cloud computing, data retrieval, and other fields. In particular, encryption technologies that satisfy homomorphic addition have numerous applications in the field of distributed machine learning. Currently, existing threshold cryptography schemes based on the RSA algorithm require a trusted center; threshold cryptography schemes based on the ElGamal algorithm, which do not require a trusted center, satisfy multiplicative homomorphism. Since the Lifted ElGamal algorithm, a variant of the ElGamal algorithm, has additive homomorphism, a threshold cryptography scheme with additive homomorphism that does not require a trusted center is formed. However, the Lifted ElGamal algorithm requires traversal or table lookup during decryption, which leads to low decryption efficiency when the data to be decrypted is too large, consequently causing low decryption efficiency for corresponding threshold ciphers. The Paillier algorithm is an additive homomorphic encryption algorithm based on the difficult problem of composite residues. When the base for encryption is n+1, the algorithm can quickly encrypt and decrypt. Therefore, this invention designs a (t,n) threshold cipher scheme that does not require a trusted center, satisfies additive homomorphism, and allows for fast encryption and decryption. By distributing the shared private key information among each user, a (t,n) threshold cipher scheme that does not require a trusted center is formed. During decryption, only t+1 participants are needed to correctly decrypt the data, and only simple calculations are required during the decryption process, without the need for table lookup or traversal.
[0055] The existing Lifted ElGamal encryption algorithm is as follows: Set a security parameter λ, select a large prime number p with λ bits and its primitive root g. Select a small prime number ρ. As the private key, calculate the public key b = g a modp; the plaintext to be encrypted is (If m is required to be small, ρ can be quickly solved by traversal or table lookup.) m The discrete logarithm of modp is used to calculate the ciphertext by selecting a random number r.
[0056] C = (C1, C2) = (g r modp, ρ m b r modp);
[0057] In calculation Then, ρ is calculated by traversal or table lookup. m The discrete logarithm m of mod p. It is evident that the drawback of the above algorithm is its low decryption efficiency when calculating the discrete logarithm; if the data to be encrypted is too large, decryption will require a significant amount of time.
[0058] Understandable, Let the set {0, 1, ..., n-1} be represented. Represents a set The set of elements coprime to n, where n is a prime number. amodc is read as a modulo c, representing the remainder when a is divided by c. a≡bmodc means that a and b have the same remainder when divided by c. If ab≡1modc, it means that b is the multiplicative inverse of a modulo c, denoted as b≡a. -1 mod c, where a is also the multiplicative inverse of b modulo c. If g m The smallest positive power m that holds true for ≡1 mod n satisfies m = Φ n If , then g is called a primitive root of n. Where Φ n Let g be the Euler's totient function. When p is a large prime number, g is its primitive root if b ≡ g. a mod p, it is very difficult to solve for a given b, that is, it is difficult to find the discrete logarithm.
[0059] Therefore, in the key generation process, this application sets a security parameter λ, selects a large prime number p (i.e., the target prime number) with λ bits, and p 2 The primitive root g of (i.e., the square of the target prime number). Select ρ = p + 1 (preset parameter value calculation formula, ρ is the target parameter). Participant P i Select As its own secret value ( For secret value, (For the preset interval). Each participant P i Selecting a random secret value Then, participant Pi selects i random numbers. And construct polynomials Each participant P i Calculate the function value f i (j), 1≤j≤n, keep f yourself i (i), and f i (j), j≠i, secretly sent to participant P j In this way, each participant receives a function value from every other participant and also sends a function value to every other participant. Participant P j After receiving function values from other participants, calculate based on all received function values and the function values you have pre-stored. σ j As user P i The target private key.
[0060] It is understandable that p is a large prime number, and g is a prime number of p. 2 The fundamental root, if b≡g a modp 2 You can then get b≡g a mod p, therefore if the generalized discrete logarithm problem is solvable, then the original discrete logarithm problem is also solvable. When ρ = p + 1 is chosen, if S = ρ m modp 2 , where m∈ Combining the binomial theorem, we can obtain S = mp + 1, which can be transformed into the following formula:
[0061]
[0062] The relevant discrete logarithm m is calculated.
[0063] Step S12: Encrypt the target plaintext using the target public key to obtain the corresponding ciphertext.
[0064] In this embodiment, a preset number of target private keys corresponding to target users are obtained. After calculating the target public key based on all the target private keys, the target plaintext is encrypted using the target public key to obtain the corresponding ciphertext. Specifically, a random number is obtained, and the target plaintext is encrypted based on the random number, the square value, the target public key, the target parameter, and a preset encryption formula to obtain the corresponding ciphertext. It can be understood that the target plaintext is encrypted based on the random number, the square value, the target public key, the target parameter, and the preset encryption formula to obtain the corresponding ciphertext. For example, the plaintext to be encrypted is determined as... Select a random number r and encrypt it based on the following preset encryption formula:
[0065] C = (C1, C2) = (g r modp 2 , ρ m b r modp 2 ).
[0066] Step S13: Calculate the corresponding target decryption value based on the target private key corresponding to the preset number of target users.
[0067] In this embodiment, the target plaintext is encrypted using the target public key to obtain the corresponding ciphertext. Then, the corresponding target decryption value is calculated based on the target private keys corresponding to the preset number of target users. It is understood that the number of participants in the decryption process is determined according to different situations. For example, the secret may be split into n parts and distributed to n participants. Any t+1 or more participants together can recover the secret, while any t participants cannot obtain any information from the secret. Furthermore, the condition of t+1 or more participants can be changed according to different situations and is not limited here.
[0068] Step S14: Decrypt the ciphertext based on the preset decryption formula and the target decryption value to obtain the decrypted information.
[0069] In this embodiment, after calculating the corresponding target decryption value based on the target private key corresponding to the preset number of target users, the ciphertext is decrypted based on the preset decryption formula and the target decryption value to obtain the decrypted information. It can be understood that the decryption intermediate value S is calculated based on all the target decryption values, and the specific formula is as follows:
[0070] S=C2·(Π i∈Q S i ) -1 modp 2 ;
[0071] Based on the calculated S and the formula Decrypt the message to obtain the final decrypted information m.
[0072] This invention replaces the process of calculating the discrete logarithm with simple arithmetic operations during decryption, thus improving decryption speed and allowing for the rapid calculation of ρ during encryption. m modp 2 =mp+1, which improves encryption speed.
[0073] For example, let E(m) represent the ciphertext obtained after encrypting plaintext m, and D(C) represent the decrypted information obtained after decrypting ciphertext C = (C1, C2). The above algorithm satisfies additive homomorphism; for two messages m1 and m2, encrypting them yields...
[0074]
[0075]
[0076] Multiplying their corresponding components separately yields:
[0077]
[0078] Therefore, D(E(m1)·E(m2))=m1+m2modp;
[0079] Modulo p, it satisfies additive homomorphism, when m i When +m2<p:
[0080] D(E(m1)·E(m2))=m1+m2.
[0081] Furthermore, in some scenarios, all users must participate in the decryption process to correctly decrypt encrypted data; these are (n, n) threshold cryptographic systems. This invention describes a special case (n, n) threshold cryptographic scheme where all participants must engage in decryption to obtain the secret value. The specific steps are as follows: Set a security parameter λ, select a large prime number p with λ bits, and p... 2 The primitive root g is used to determine ρ = p + 1. Participant P i Select a i (0<a i <p(p-1)) is used as one's own private key, and each participant's key is computed and made public. b based on all participants i The formula for jointly generating a public key is as follows:
[0082]
[0083] The plaintext to be encrypted is determined during encryption. The formula for calculating the ciphertext is as follows: (Select a random number r)
[0084] C = (C1, C2) = (g r modp 2 , ρ m b r modp 2 );
[0085] During joint decryption, each P is calculated. i of And the result S i Published. Participants in the decryption process receive the published result S from other participants. i Then, based on all of S i Calculate S = C2· The ciphertext is then decrypted based on S, using the following formula:
[0086]
[0087] Threshold cryptography enables the following: any user can encrypt data using the public key; ownership of the private key is jointly controlled by multiple designated secret holders, and decryption can only be achieved by the cooperation of a sufficient number of secret holders and the aggregation of decryption fragments.
[0088] As can be seen, this application provides a key usage method, including: obtaining target private keys corresponding to a preset number of target users, and calculating a target public key based on all the target private keys; encrypting target plaintext using the target public key to obtain corresponding ciphertext; calculating a corresponding target decryption value based on the target private keys corresponding to the preset number of target users; and decrypting the ciphertext based on a preset decryption formula and the target decryption value to obtain decrypted information. Therefore, this application calculates the target public key based on the target private keys of all preset number of target users. By distributing the shared value information of the private keys among each user, it forms a cryptography that does not require a trusted central authority. This allows all participants to participate in decryption to obtain the decrypted information, improving information security and decryption efficiency.
[0089] See Figure 2 As shown, this embodiment of the invention discloses a key usage method. Compared with the previous embodiment, this embodiment further explains and optimizes the technical solution.
[0090] Step S21: Obtain the target private keys corresponding to a preset number of target users.
[0091] In this embodiment, after obtaining the target private keys corresponding to a preset number of target users, the target secret value is calculated based on the target private keys corresponding to the preset number of target users and the Lagrange interpolation formula. It can be understood that for any set Q of t+1 participants, the value of secret a0 can be calculated using the Lagrange interpolation formula, as follows:
[0092]
[0093] The polynomial constructed during the calculation of the private key can be viewed as the total polynomial: The secret value to be shared is f(0), which is the constant term of the polynomial f(x). Participant P j σ was calculated j =f(j), when there are t+1 participants in the calculation, we can obtain t+1 equations with t+1 variables, and the coefficient matrix of these equations forms the Vandermonde matrix. Therefore, we can use the Lagrange interpolation formula to solve for the constant term coefficient of f(x), which is the value of the secret a0. The sum of the shared secret values As a key, it enables the secret sharing of keys without a trusted central authority.
[0094] Step S22: Determine the current private key from all the target private keys, and calculate the intermediate value of the public key based on the current private key and the square value; the intermediate value of the public key is the intermediate value information used when calculating the target public key.
[0095] In this embodiment, after obtaining the target private keys corresponding to a preset number of target users, the current private key is determined from all the target private keys, and the intermediate value of the public key is calculated based on the current private key and the squared value; the intermediate value of the public key is the intermediate value information used when calculating the target public key. It can be understood that each participant P in any set of t+1 participants Q... i All calculated b i This is the public key intermediate value, and the calculated b i Announced.
[0096] Step S23: Obtain the intermediate values of the public keys corresponding to all the target private keys to obtain an intermediate value set, and calculate the target public key based on the intermediate value set, the square value and the preset public key calculation formula.
[0097] In this embodiment, after calculating the median value of the public key based on the current private key and the squared value, the median values of the public keys corresponding to all the target private keys are obtained to obtain a set of median values. The target public key is then calculated based on the set of median values, the squared value, and a preset public key calculation formula. The specific preset public key calculation formula is as follows:
[0098] b = Π i∈Q b i modp 2 .
[0099] Step S24: Encrypt the target plaintext using the target public key to obtain the corresponding ciphertext.
[0100] Step S25: Calculate the corresponding target decryption value based on the target private key corresponding to the preset number of target users.
[0101] In this embodiment, the target decryption value is calculated based on the target private key corresponding to the preset number of target users. It can be understood that each participant P in any set Q of t+1 participants... i All participants are calculated to obtain their target decryption value. The specific calculation formula is as follows:
[0102]
[0103] In each participant Pi After obtaining the target decryption value, publish the target decryption value so that other participants can obtain the full target decryption value.
[0104] Step S26: Decrypt the ciphertext based on the preset decryption formula and the target decryption value to obtain the decrypted information.
[0105] In this embodiment, after calculating the corresponding target decryption value based on the target private key corresponding to the preset number of target users, the ciphertext is decrypted based on the preset decryption formula and the target decryption value to obtain the decrypted information. Specifically, all the target decryption values published by the preset number of target users are obtained to obtain a target decryption value set; a decryption intermediate value is calculated based on the target decryption value set, the square value, and the preset decryption intermediate value calculation formula; the ciphertext is decrypted based on the decryption intermediate value, the target prime number, and the preset decryption formula to obtain the decrypted information. It can be understood that before decrypting the ciphertext based on the decryption intermediate value, the target prime number, and the preset decryption formula to obtain the decrypted information, the preset decryption formula is determined based on the preset parameter value calculation formula (i.e., ρ = p + 1) and the binomial theorem.
[0106] Furthermore, the public key obtained during the key generation phase is:
[0107]
[0108] The results obtained during the joint decryption phase were as follows:
[0109]
[0110] The encryption and decryption processes are consistent, ensuring the correctness of encryption and decryption.
[0111] The algorithm of this invention satisfies additive homomorphism. The protocol of this invention does not require a trusted center. Each user randomly selects their own secret value, and the shared secret value is the sum of all secret values. By implementing this secret-sharing scheme, t+1 participants can jointly obtain the secret value, but fewer than t+1 participants cannot obtain any information about the shared secret value. In other words, the key is distributed and stored among multiple users. When decryption is needed, more than a threshold number of users need to collaborate to decrypt the data correctly. During decryption, simple calculations can be used directly without traversal or table lookups, especially when the data to be encrypted is very large (e.g., in the aggregation process of model parameters in federated learning, threshold cryptography can be used to keep the client's local model parameters secret, which requires summing a large number of client local model parameters on the ciphertext and then decrypting the summed ciphertext). This invention effectively improves encryption and decryption speed and information security. This invention addresses the problem of low decryption efficiency of threshold cryptography schemes that satisfy additive homomorphism without a trusted center. Furthermore, the (n,n) threshold cryptography scheme proposed in this invention, which enables fast encryption and decryption, also does not require a trusted center and satisfies additive homomorphism. Additionally, threshold cryptography can be applied to federated learning without a trusted server.
[0112] For details regarding step S24, please refer to the corresponding content disclosed in the foregoing embodiments, which will not be repeated here.
[0113] As can be seen, this application embodiment improves information security and decryption efficiency by obtaining target private keys corresponding to a preset number of target users; determining the current private key from all the target private keys, and calculating the public key intermediate value based on the current private key and the square value; the public key intermediate value is the intermediate value information used when calculating the target public key; obtaining the public key intermediate values corresponding to all the target private keys to obtain an intermediate value set; calculating the target public key based on the intermediate value set, the square value, and a preset public key calculation formula; encrypting target plaintext using the target public key to obtain the corresponding ciphertext; calculating the corresponding target decryption value based on the target private keys corresponding to the preset number of target users; and decrypting the ciphertext based on the preset decryption formula and the target decryption value to obtain the decrypted information.
[0114] See Figure 3 As shown in the embodiments, this application also discloses a key usage device, including:
[0115] Private key acquisition module 11 is used to acquire the target private keys corresponding to a preset number of target users;
[0116] Public key calculation module 12 is used to calculate the target public key based on all the target private keys;
[0117] Encryption module 13 is used to encrypt the target plaintext using the target public key to obtain the corresponding ciphertext;
[0118] The decryption value calculation module 14 is used to calculate the corresponding target decryption value based on the target private key corresponding to the preset number of target users;
[0119] The decryption module 15 is used to decrypt the ciphertext based on a preset decryption formula and the target decryption value to obtain the decrypted information.
[0120] As can be seen, this application includes: obtaining target private keys corresponding to a preset number of target users, and calculating a target public key based on all the target private keys; encrypting target plaintext using the target public key to obtain corresponding ciphertext; calculating a target decryption value based on the target private keys corresponding to the preset number of target users; and decrypting the ciphertext based on a preset decryption formula and the target decryption value to obtain decrypted information. Therefore, this application calculates the target public key based on the target private keys of all preset number of target users. By distributing the shared value information of the private keys among each user, it forms a cryptography that does not require a trusted central authority. This allows all participants to participate in decryption to obtain the decrypted information, improving information security and decryption efficiency.
[0121] In some specific embodiments, the private key acquisition module 11 specifically includes:
[0122] The parameter setting unit is used to set safety parameters;
[0123] A target prime number determination unit is used to determine the prime number occupying the number of bits of the security parameter as the target prime number;
[0124] A square value and primitive root acquisition unit is used to acquire the square value corresponding to the target prime number and the primitive root of the square value;
[0125] The target parameter determination unit is used to determine the target parameter based on the primitive root and the preset parameter value calculation formula.
[0126] The current user determination unit is used to determine the current user from the preset number of target users;
[0127] A numerical acquisition unit is used to acquire the secret value selected by the current user from a preset interval and the random number selected by the current user; wherein, the preset interval is an interval determined based on the target prime number;
[0128] A polynomial construction unit is used to construct the current polynomial corresponding to the current user based on the random number and the secret value.
[0129] A function value calculation unit is used to calculate the preset number of function values based on the current polynomial;
[0130] The current function value storage unit is used to store the current function value corresponding to the current user's position order;
[0131] A function value sending unit is configured to secretly send other corresponding function values according to the location sequence of each target user;
[0132] A function value receiving unit is used to receive the function values sent by all other target users to obtain a target function value set;
[0133] The target private key calculation unit is used to calculate the target private key corresponding to the current user based on the target function value set, the current function value, and the preset private key calculation formula.
[0134] The target private key acquisition unit is used to acquire the target private keys corresponding to a preset number of target users.
[0135] The target secret value calculation unit is used to calculate the target secret value based on the target private key corresponding to the preset number of target users and the Lagrange difference formula.
[0136] In some specific embodiments, the public key calculation module 12 specifically includes:
[0137] The current private key determination unit is used to determine the current private key from all the target private keys;
[0138] A public key intermediate value calculation unit is used to calculate a public key intermediate value based on the current private key and the squared value; the public key intermediate value is intermediate value information used when calculating the target public key;
[0139] An intermediate value set determination unit is used to obtain all the intermediate values of the public keys corresponding to the target private keys to obtain an intermediate value set;
[0140] The target public key calculation unit is used to calculate the target public key based on the intermediate value set, the square value, and the preset public key calculation formula.
[0141] In some specific embodiments, the encryption module 13 specifically includes:
[0142] The random number generation unit is used to generate random numbers.
[0143] An encryption unit is used to encrypt the target plaintext based on the random number, the square value, the target public key, the target parameter, and a preset encryption formula to obtain the corresponding ciphertext.
[0144] In some specific embodiments, the decryption value calculation module 14 specifically includes:
[0145] The target decryption value calculation unit is used to calculate the corresponding target decryption value based on the target private key corresponding to the preset number of target users.
[0146] In some specific embodiments, the decryption module 15 specifically includes:
[0147] The target decryption value set determination unit is used to obtain all the target decryption values published by the target users in the preset number, so as to obtain the target decryption value set;
[0148] The intermediate value decryption calculation unit is used to calculate the intermediate decryption value based on the target set of decryption values, the square value, and a preset intermediate decryption value calculation formula.
[0149] The preset decryption formula determination unit is used to determine the preset decryption formula based on the preset parameter value calculation formula and the binomial theorem.
[0150] The decryption unit is used to decrypt the ciphertext based on the decryption intermediate value, the target prime number, and the preset decryption formula to obtain the decrypted information.
[0151] Furthermore, embodiments of this application also provide an electronic device. Figure 4 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content of the diagram should not be construed as limiting the scope of this application.
[0152] Figure 4 This is a schematic diagram of the structure of an electronic device 20 provided in an embodiment of this application. Specifically, the electronic device 20 may include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 stores a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the key usage method disclosed in any of the foregoing embodiments. Furthermore, the electronic device 20 in this embodiment may specifically be an electronic computer.
[0153] In this embodiment, the power supply 23 is used to provide operating voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and external devices, and the communication protocol it follows can be any communication protocol applicable to the technical solution of this application, and is not specifically limited here; the input / output interface 25 is used to acquire external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs, and is not specifically limited here.
[0154] In addition, the memory 22, as a carrier for resource storage, can be a read-only memory, random access memory, disk or optical disk, etc. The resources stored thereon can include operating system 221, computer program 222, etc., and the storage method can be temporary storage or permanent storage.
[0155] The operating system 221 is used to manage and control the various hardware devices on the electronic device 20 and the computer program 222, which may be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program capable of performing the key usage method executed by the electronic device 20 as disclosed in any of the foregoing embodiments, the computer program 222 may further include a computer program capable of performing other specific tasks.
[0156] Furthermore, this application also discloses a storage medium storing a computer program, which, when loaded and executed by a processor, implements the key usage method steps disclosed in any of the foregoing embodiments.
[0157] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section.
[0158] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0159] The present invention has provided a detailed description of a key usage method, apparatus, device, and storage medium. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A method for using a key, characterized in that, include: Obtain the target private keys corresponding to a preset number of target users, and calculate the target public key based on all the target private keys; The target plaintext is encrypted using the target public key to obtain the corresponding ciphertext; Calculate the corresponding target decryption value based on the target private key corresponding to the preset number of target users; The ciphertext is decrypted based on a preset decryption formula and the target decryption value to obtain the decrypted information; Before obtaining the target private keys corresponding to a preset number of target users, the process also includes: Set security parameters, and determine the prime number that occupies the number of bits in the security parameters as the target prime number; Obtain the square value corresponding to the target prime number and the primitive root of the square value; The target parameters are determined based on the original root and the preset parameter value calculation formula; The current user is determined from the preset number of target users, and the secret value selected by the current user from a preset interval and the random number selected by the current user are obtained; wherein, the preset interval is an interval determined based on the target prime number; Construct the current polynomial corresponding to the current user based on the random number and the secret value; Calculate the preset number of function values based on the current polynomial, and store the current function values corresponding to the current user's position order; Secretly send other corresponding function values according to the location sequence of each target user; Receive the function values sent by all other target users to obtain a set of target function values; Based on the target function value set, the current function value, and the preset private key calculation formula, the target private key corresponding to the current user is calculated; the preset private key calculation formula is: ; in, For the target private key, The function values in the set of objective function values. The current function value is denoted as , and n is the number of target users.
2. The key usage method according to claim 1, characterized in that, The calculation of the target public key based on all the target private keys includes: The current private key is determined from all the target private keys, and the intermediate value of the public key is calculated based on the current private key and the squared value; the intermediate value of the public key is the intermediate value information used when calculating the target public key; Obtain the intermediate values of the public keys corresponding to all the target private keys to obtain a set of intermediate values; The target public key is calculated based on the intermediate value set, the square value, and a preset public key calculation formula; the preset public key calculation formula is: ; in, The public key median value in the median value set. Let b be the square value, b be the target public key, and Q be the set of target users.
3. The key usage method according to claim 1, characterized in that, The step of encrypting the target plaintext using the target public key to obtain the corresponding ciphertext includes: A random number is obtained, and the target plaintext is encrypted based on the random number, the square value, the target public key, the target parameter, and a preset encryption formula to obtain the corresponding ciphertext; the preset encryption formula is: ; Where r is a random number and b is the target public key. The square value, As the root and origin, For the target parameters, The target is plaintext.
4. The key usage method according to claim 1, characterized in that, The process of decrypting the ciphertext based on a preset decryption formula and the target decryption value to obtain decrypted information includes: Obtain all the target decryption values published by the target users according to the preset number, so as to obtain a set of target decryption values; Calculate the intermediate decryption value based on the target set of decryption values, the squared value, and the preset intermediate decryption value calculation formula; The ciphertext is decrypted based on the intermediate decryption value, the target prime number, and the preset decryption formula to obtain the decrypted information; the preset decryption formula is: ; Where S is the intermediate value for decryption, p is the target prime number, and m is the information after decryption.
5. The key usage method according to claim 4, characterized in that, Before decrypting the ciphertext based on the decryption intermediate value, the target prime number, and the preset decryption formula to obtain the decrypted information, the method further includes: The preset decryption formula is determined based on the preset parameter value calculation formula and the binomial theorem.
6. The key usage method according to any one of claims 1 to 5, characterized in that, Also includes: The target secret value is calculated based on the target private key corresponding to the preset number of target users and the Lagrange difference formula. The Lagrange difference formula is as follows: ; in, For the target secret value, Let Q be the target private key, and let Q be the set of target users.
7. A key usage device, characterized in that, The steps for implementing the key usage method as described in any one of claims 1 to 6 include: The private key acquisition module is used to acquire the target private keys corresponding to a preset number of target users. The public key calculation module is used to calculate the target public key based on all the target private keys; An encryption module is used to encrypt the target plaintext using the target public key to obtain the corresponding ciphertext; The decryption value calculation module is used to calculate the corresponding target decryption value based on the target private key corresponding to the preset number of target users; The decryption module is used to decrypt the ciphertext based on a preset decryption formula and the target decryption value to obtain the decrypted information.
8. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor for executing the computer program to implement the steps of the key usage method as described in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, Used to store a computer program; wherein, when the computer program is executed by a processor, it implements the key usage method as described in any one of claims 1 to 6.