A random bit string-based private key and public key generation method
By generating private and public keys based on random bit strings, and leveraging the complexity of the 2-out-of-4 SAT problem, the problem of quantum computing cracking public-key encryption systems is solved, achieving quantum-resistant authentication. Furthermore, the complexity of the clause matrix P is controllable, thus improving the security of authentication.
Patent Information
- Application Number
- CN202411500088.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-25
- Publication Date
- 2025-11-07
- Estimated Expiration
- 2044-10-25
AI Technical Summary
Existing public-key encryption systems are easily cracked by quantum computers, and the properties of the 2-out-of-4 SAT problem have not been fully utilized in practical cryptographic applications, limiting its promotion and development.
A method based on generating private and public keys using random bit strings is adopted. By obtaining n variables, generating m clauses and constructing a clause matrix P, the n variables are used as the private key and the clause matrix P is used as the public key. The complexity of the 2-out-of-4 SAT problem is used to achieve authentication.
The generated private key is resistant to quantum computing, the public key complexity is controllable, the authentication operation is highly effective, and it is difficult for attackers to crack the private key, thus realizing a secure identity authentication process.
Smart Images

Figure CN119382878B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of cryptography, and particularly relates to a private key and public key generation method based on a random bit string. BACKGROUND
[0002] Various types of encryption programs are known at present, both symmetric and asymmetric. In asymmetric encryption programs, a public key known to everyone can be used to encrypt data, a complementary private key, which is usually kept secret, can be used to decrypt the resulting ciphertext, and a public key / private key pair can be used to generate and verify digital certificates (or signatures). In terms of digital certificates (or signatures), a private key is used in a cryptographic operation on certain data to generate a digital certificate (signature), and a public key is used to verify the identity of the encryptor. Here, the private key is a representative of the user's identity and can be used to identify the authenticity of the user.
[0003] A public key can be widely disseminated, but a private key is usually known only to a few parties. A public key can be used to encrypt a message that can only be decrypted with a private key. Known public key encryption systems rely on cryptographic algorithms based on mathematical problems, for example, the RSA public key encryption system relies on the difficulty of integer factorization, and the public key encryption based on elliptic curves relies on the difficulty of discrete logarithms, but with the development of quantum technology, the most widely used public key cryptography systems, RSA and elliptic curve cryptography (ECC), will be broken by general quantum computers, and they will no longer be secure.
[0004] The non-deterministic polynomial time problem (NP problem) is an important class of computational problems, whose solutions can be verified in polynomial time on a non-deterministic Turing machine, but finding a solution can take exponential time. In recent years, solutions to NP problems have found wide application in the field of cryptography, especially cryptography based on NP problem solutions uses the difficulty of NP problems to construct a secure identity verification mechanism. For example, a solution to an NP problem can be used as a user's private key, and the problem itself can be used as a public key. A user can prove his identity by providing his private key, while an attacker can hardly find the solution to the problem without the private key.
[0005] The satisfiability problem (SAT) is a classic NP problem, and the 2-out-of-4 SAT problem is a special type of SAT problem. It restricts the structure of Boolean formulas, which not only introduces new complexity to SAT problems, but also gives it unique characteristics, making it potentially valuable in fields such as cryptography. It uses a string of binary bit strings selected by the user as a password, generates a 2-out-of-4 SAT problem corresponding to the solution, and can achieve an efficient identity authentication process.
[0006] Therefore, the aforementioned characteristics of the 2-out-of-4SAT problem give it potential application value in the field of cryptography. However, there is currently no method that utilizes the characteristics of the 2-out-of-4SAT problem to select a binary bit string as the cipher, use the solution to the problem as the private key, and use the problem itself as the public key, i.e., to generate private and public keys based on the binary bit string. This limits its promotion and development in practical applications. Summary of the Invention
[0007] Purpose of the invention: The purpose of this invention is to provide a method for generating private and public keys based on random bit strings. The private and public keys generated by this invention have quantum computing resistance, solving the problem that the public and private keys of the current cryptographic system are easily cracked by quantum computers; it also solves the problem that the characteristics of the 2-out-of-4SAT problem cannot be generalized and developed in practical applications.
[0008] Technical solution: This invention provides a method for generating private and public keys based on random bit strings, comprising the following steps:
[0009] (1) Obtain n variables: Obtain a binary random bit string of length n, and assign each bit of the bit string to each of the n variables. Let the n variables be denoted as {a1, a2, ..., a...} n};
[0010] (2) Generating Clauses: Generate m clauses based on n variables, and denote the m clauses as {C1, C2, ..., C...} m} and arrange the four variables involved in each clause in order of their subscript numbers;
[0011] (3) Constructing the clause matrix: Transform the m clauses into a clause matrix P, which is an m×4 matrix. Each element of the clause matrix P is Pm. cd ∈[1,n], P cd Let d be the subscript value of the d-th variable involved in the c-th clause, where c∈[1,m] and d∈[1,4];
[0012] (4) Output results: Output the clause matrix P from step (3) as the public key, and output the n variables {a1,a2,…,a...} n This is used as a private key and distributed to users who need it.
[0013] Furthermore, the specific steps of generating m clauses based on n variables are as follows:
[0014] 1) Determine a probability parameter p a The probability parameter p a Used to control the probability of generating clauses, its value ranges from 0. <p a<1;
[0015] 2) non-repeatedly traverse the variable combination of 4 different variables in the n variables obtained in step (1), determine whether the variable combination satisfies the condition that 2 variable values are 1 and 2 variable values are 0, if it satisfies, execute the next step; if it does not satisfy, continue to traverse;
[0016] 3) in response to the variable combination of 4 different variables satisfying the condition that 2 variable values are 1 and 2 variable values are 0, determine whether the variable combination is selected as a clause based on the probability parameter p a
[0017] 4) repeat steps 2) and 3), count the number of generated clauses, if the count value is less than m, continue to execute until the count value of the number of clauses is equal to m.
[0018] Further, the probability parameter p a and the number of clauses m satisfy the following conditions:
[0019]
[0020] wherein, ! represents factorial, and n represents the number of variables.
[0021] Further, the process of non-repeatedly traversing the variable combination of 4 different variables in the n variables obtained in step (1) in step 2) is as follows:
[0022] First, 4 different variables are randomly selected from the n variables as a first variable combination, and it is determined whether the first variable combination satisfies the condition that 2 variable values are 1 and 2 variable values are 0; after the determination is completed, 4 different variables are randomly selected from the remaining n-4 variables as a second variable combination, and it is determined whether the second variable combination satisfies the condition that 2 variable values are 1 and 2 variable values are 0; and so on.
[0023] Further, the process of non-repeatedly traversing the variable combination of 4 different variables in the n variables obtained in step (1) in step 2) is as follows:
[0024] First, randomly select 4 different variables from n variables to form the first variable combination. Determine if this first variable combination satisfies the condition that 2 variables have a value of 1 and 2 variables have a value of 0. If it does, then next time, randomly select 4 different variables from the remaining n-4 variables to form the second variable combination. If it does not satisfy the condition, then put the 4 variables back and next time randomly select 4 different variables from n variables to form the second variable combination. This second variable combination is different from the first variable combination. Determine if this second variable combination satisfies the condition that 2 variables have a value of 1 and 2 variables have a value of 0. And so on.
[0025] Furthermore, in step 3), the probability parameter p is used as the basis for... a Determining whether to combine the variables as a clause means:
[0026] Given four different variable combinations where two variables have a value of 1 and two variables have a value of 0, generate a random decimal number between 0 and 1 from the local variable list. Compare the random decimal number with the probability parameter p. a The size of the random decimal is less than the probability parameter p. a Then the four different variables are combined into a single clause; if the random decimal is greater than the probability parameter p a If so, then discard the combination of these four different variables.
[0027] Furthermore, the arrangement of the four variables involved in each clause according to the order of their subscript numbers means that:
[0028] For m clauses {C1,C2,…,C…} m The t-th clause C in} t t∈[1,m], let the four variables involved be (a i ,a j ,a k ,a l If i < j < k < l, then the clause is represented as C. t (a i ,a j ,a k ,a l ).
[0029] Furthermore, the process of iterating through the combinations of four different variables among the n variables obtained in step (1) without repetition in step 2) is as follows:
[0030] First, from the n variables, 4 different variables are selected as a first variable combination, and it is determined whether the first variable combination satisfies the condition that 2 variables have a value of 1 and 2 variables have a value of 0; after the determination is completed, the 4 variables are returned, and the next time 4 different variables are selected from the n variables as a second variable combination, which is different from the first variable combination, and it is determined whether the second variable combination satisfies the condition that 2 variables have a value of 1 and 2 variables have a value of 0; and so on.
[0031] Advantages of the present application:
[0032] (1) The clause matrix P generated by the present application contains 4 variables in each row, has a high variable density, and it is difficult for an attacker to find a solution to all the clauses of the clause matrix P without a private key;
[0033] (2) The present application determines the n variables as the private key at the beginning, generates the public key based on the n variables, can effectively control the complexity of the generated public key clause matrix P, and makes the clause matrix P have a controllable difficulty;
[0034] (3) The operation of pre-determining the private key ensures that there is a private key corresponding to the public key, which provides a guarantee for the effectiveness of the identity verification operation using the private key and public key pair. BRIEF DESCRIPTION OF DRAWINGS
[0035] Figure 1 Flow chart for generating private key and public key of the present application;
[0036] Figure 2 Clause generation flow chart of the present application;
[0037] Figure 3 Structure diagram of the clause matrix P. DETAILED DESCRIPTION
[0038] The present application will be further described below in conjunction with the drawings and examples:
[0039] The existing public key encryption system relies on a cryptographic algorithm based on a mathematical problem, which will be cracked by a general quantum computer with the development of quantum technology, and it is no longer secure. The 2-out-of-4 SAT problem belongs to the NP-complete complexity problem, and all algorithms for solving this problem are of exponential complexity, so it has potential application value in the field of cryptography, but there is no method for generating a private key and a public key based on the characteristics of the 2-out-of-4 SAT problem, selecting a binary bit string as a password, taking the solution of the problem as a private key, and taking the problem itself as a public key, which limits its popularization and development in practical applications.
[0040] Therefore, as Figure 1 shown, the application proposes a private key and public key generation method based on random bit string, including the following steps:
[0041] (1) Obtain n variables: obtain a binary random bit string with a length of n, and assign each bit of the bit string to each of the n variables, and the n variables involved are denoted as {a1, a2, …, an};Since it is a random bit string, about half of the n variables {a1, a2, …, an} are assigned as 0, and the other half are assigned as 1; n n
[0042] (2) Generate clauses: as Figure 2 shown, generate m clauses based on n variables, and the m clauses involved are denoted as {C1, C2, …, Cm};And arrange the 4 variables involved in each clause in order of subscript size;Among them, arranging the 4 variables involved in each clause in order of subscript size means: for convenience of description, for the t-th clause C m t∈[1,m] in the m clauses {C1, C2, …, Cm}, let the 4 variables involved be (a m ,a t ,a i ,a j ), where i k j l k t l, then the clause is represented as C i (a j ,a k ,a l ,a a )。
[0043] The specific process steps of generating m clauses based on n variables are as follows:
[0044] 1) Determine a probability parameter p a , which is used to control the probability of generating clauses, and its value range is 0<p a <1;
[0045] The probability parameter p a is determined by the following formula, and the probability parameter p a and the number of clauses m satisfy the following conditions:
[0046]
[0047] Where, ! denotes factorial, and n denotes the number of variables. Through the above formula, an optimal probability parameter p a can be determined.by adjusting the value of the probability parameter p a to control the probability of generating a clause, so as to achieve the effect of controlling the efficiency of generating a clause. Selecting the probability parameter p a that satisfies the above formula can avoid the situation that the probability parameter p a is too large, only a few variable combinations are judged, and m clauses are generated; or the situation that the probability parameter p a is too small, and it takes a long time to obtain m clauses.
[0048] 2) Non-repeatedly traverse the variable combinations of 4 different variables in the n variables obtained in step (1) to judge whether the variable combinations satisfy the conditions that 2 variable values are 1 and 2 variable values are 0, and if so, execute the next step; if not, continue to traverse;
[0049] The process of non-repeatedly traversing the variable combinations of 4 different variables in the n variables obtained in step (1) is as follows:
[0050] First, 4 different variables are randomly selected from the n variables as a first variable combination, and it is judged whether the first variable combination satisfies the conditions that 2 variable values are 1 and 2 variable values are 0; after the judgment is completed, 4 different variables are randomly selected from the remaining n-4 variables as a second variable combination, and it is judged whether the second variable combination satisfies the conditions that 2 variable values are 1 and 2 variable values are 0; and so on.
[0051] Alternatively, the process of non-repeatedly traversing the variable combinations of 4 different variables in the n variables obtained in step (1) can also be as follows:
[0052] First, 4 different variables are randomly selected from the n variables as a first variable combination, and it is judged whether the first variable combination satisfies the conditions that 2 variable values are 1 and 2 variable values are 0; if so, 4 different variables are randomly selected from the remaining n-4 variables as a second variable combination next time; if not, the 4 variables are put back, and 4 different variables are randomly selected from the n variables as a second variable combination next time, which is different from the first variable combination, and it is judged whether the second variable combination satisfies the conditions that 2 variable values are 1 and 2 variable values are 0; and so on, the variables are put back, and the variable combination selected again is different from the previous variable combination. For example, (a1, a2, a3, a4) is not added to the clause, and (a1, a2, a3, a5) can be selected for judgment later.
[0053] Alternatively, the process of non-repeatedly traversing the variable combinations of 4 different variables in the n variables obtained in step (1) can also be as follows:
[0054] First, select four different variables from n variables to form the first variable combination. Determine if this first variable combination satisfies the conditions that two variables have a value of 1 and two variables have a value of 0. After this determination, replace these four variables. Next, select four different variables from n variables again to form the second variable combination. This second variable combination is different from the first variable combination, and again, determine if it satisfies the conditions that two variables have a value of 1 and two variables have a value of 0. Continue this process, replacing the variables and selecting new variable combinations that are different from the previous ones. For example, if (a1, a2, a3, a4) is added to the clause, (a1, a2, a3, a5) can be selected in subsequent evaluations.
[0055] 3) In response to the selection of four different variable combinations satisfying the conditions that two variables have values of 1 and two variables have values of 0, then based on the probability parameter p... a Determine whether to combine the variables into a clause;
[0056] Specifically, based on the probability parameter p a Determining whether to include this variable combination as a clause means: given the selected combinations of four different variables satisfying the condition that two variables have values of 1 and two variables have values of 0, randomly generate a decimal number between 0 and 1 from the local variable list, and compare the random decimal number with the probability parameter p. a The size of the random decimal is less than the probability parameter p. a Then the four different variables are combined into a single clause; if the random decimal is greater than the probability parameter p a If so, then discard the combination of these four different variables.
[0057] 4) Repeat steps 2) and 3) to count the number of generated clauses. If the count is less than m, continue execution until the count of the number of clauses equals m.
[0058] (3) Constructing the clause matrix: Based on m clauses, transform the m clauses into a clause matrix P, such as... Figure 3 As shown, the clause matrix P is represented as an m×4 matrix, and each matrix element P of the clause matrix P... cd ∈[1,n], P cd Let C be the subscript value of the d-th variable involved in the c-th clause, where c∈[1,m] and d∈[1,4]; for example, for the t-th clause C in (2) above. t (a i ,a j ,a k ,a l If the clause matrix P has four elements in the t-th row, then the four elements in the t-th row are:
[0059] Pt1 =i;
[0060] P t2 =j;
[0061] P t3 =k;
[0062] P t4 =l.
[0063] For example, if C t (a i ,a j ,a k ,a l ) = C t (a1,a7,a 11 ,a 12 If the clause matrix P has four elements in the t-th row, then the four elements in the t-th row are:
[0064] P t1 =1;
[0065] P t2 =7;
[0066] P t3 =11;
[0067] P t4 =12.
[0068] (4) Output results: Output the clause matrix P from step (3) as the public key, and output the n variables {a1,a2,…,a...} n This is used as a private key and distributed to users who need it.
[0069] In application, the private key is primarily used for signing and decryption; it is user-defined and known only to the user. The public key is used for signature verification and encryption. The user uses n variables as the private key for digital signatures, and the authentication end uses the clause matrix P as the public key to verify the user's identity. Specifically, based on the matrix elements of each row in the clause matrix P, the corresponding variables are obtained from the n variables used as the private key. If each of the four elements in each row of the clause matrix P has two 1s and two 0s, then the authentication is successful.
[0070] Therefore, it can be seen that the clause matrix P generated by this invention contains 4 variables in each row, which has a high variable density. It is difficult for an attacker to find the solution of all clauses of the clause matrix P without the private key. Moreover, by determining the n variables as the private key at the beginning and generating the public key based on the n variables, this invention can effectively control the complexity of the clause matrix P generated as the public key, making the clause matrix P have controllable difficulty.
Claims
1. A random bit string based private key and public key generation method, characterized by, The method comprises the following steps: (1) obtaining n variables: obtaining a binary random bit string with a length of n, and assigning each bit of the bit string to each of the n variables, and the n variables are denoted as {a1, a2, …, an}; n} (2) Generation of clauses: m clauses are generated based on n variables, denoted as {C1, C2, …, Cm}, and the 4 variables involved in each clause are arranged in order of the size of the subscript; m} (3) constructing a clause matrix: converting the m clauses into a clause matrix P, which is an m x 4 matrix, each matrix element P cd ∈ [1, n], P cd represents the index value of the dth variable involved in the cth clause, where c ∈ [1, m], d ∈ [1, 4]; (4) Output result: The clause matrix P in step (3) is output as a public key, and n variables {a1, a2,..., an} are distributed to users who need the private key. n} as a private key, and distribute to users who need the private key.
2. The random bit string based private key and public key generation method of claim 1, wherein, The specific process steps of generating m clauses based on n variables are: 1) determining a probability parameter p a , the probability parameter p a for controlling the generation of clauses, which takes values in the range 0 < p a < 1 ; 2) Non-repeatedly traverse the variable combination of 4 different variables in the n variables obtained in step (1), judge whether the variable combination meets the condition that 2 variables are 1 and 2 variables are 0, if yes, execute the next step; if not, continue to traverse; 3) in response to the variable combination of the selection of 4 different variables satisfying the condition of 2 variables having a value of 1 and 2 variables having a value of 0, then based on the probability parameter p a determining whether to include the variable combination as a clause; 4) Repeat steps 2) and 3), count the number of generated clauses, if the count value is less than m, continue to execute until the count value of the number of clauses is equal to m.
3. The random bit string based private key and public key generation method of claim 2, wherein, The probability parameter p in the step 1) a The number of clauses m satisfies the following condition: wherein ! denotes factorial, n denotes the number of variables.
4. The random bit string based private key and public key generation method of claim 2, wherein, The process of non-repeatedly traversing the variable combination of 4 different variables in the n variables obtained in step (1) in step 2) is: First, randomly select 4 different variables from the n variables as the first variable combination, judge whether the first variable combination meets the condition that 2 variables are 1 and 2 variables are 0; after the judgment is completed, randomly select 4 different variables from the remaining n-4 variables as the second variable combination, judge whether the second variable combination meets the condition that 2 variables are 1 and 2 variables are 0; and so on.
5. The random bit string based private key and public key generation method of claim 2, wherein, The process of non-repeatedly traversing the variable combination of 4 different variables in the n variables obtained in step (1) in step 2) is: First, randomly select 4 different variables from the n variables as the first variable combination, judge whether the first variable combination meets the condition that 2 variables are 1 and 2 variables are 0, if yes, then next time randomly select 4 different variables from the remaining n-4 variables as the second variable combination; if not, put the 4 variables back, next time randomly select 4 different variables from the n variables as the second variable combination, which is different from the first variable combination, judge whether the second variable combination meets the condition that 2 variables are 1 and 2 variables are 0; and so on.
6. The random bit string based private key and public key generation method of claim 2, wherein, The step 3) based on the probability parameter p a Determining whether to combine the variable group as a clause means: In the case that the variable combination of the 4 different variables satisfies the condition that 2 variables have values of 1 and 2 variables have values of 0, a random decimal between 0 and 1 is randomly generated from the local random number generator, and the random decimal is compared with the size of the probability parameter p a If the random decimal is less than the probability parameter p a , the variable combination of the 4 different variables is taken as a clause; if the random decimal is greater than the probability parameter p a , the variable combination of the 4 different variables is discarded.
7. The random bit string based private key and public key generation method of claim 1, wherein, The arrangement of the 4 variables involved in each clause in order of the size of the subscript is: For m clauses {C1,C2,…,C…} m The t-th clause C in} t t∈[1,m], let the four variables involved be (a i ,a j ,a k ,a l If i < j < k < l, then the clause is represented as C. t (a i ,a j ,a k ,a l ).
8. The random bit string based private key and public key generation method of claim 2, wherein, The process of non-repeatedly traversing the variable combination of 4 different variables in the n variables obtained in step (1) in step 2) is: First, randomly select 4 different variables from the n variables as the first variable combination, judge whether the first variable combination meets the condition that 2 variables are 1 and 2 variables are 0; after the judgment is completed, then put the 4 variables back, next time randomly select 4 different variables from the n variables as the second variable combination, which is different from the first variable combination, judge whether the second variable combination meets the condition that 2 variables are 1 and 2 variables are 0; and so on.
Citation Information
Patent Citations
Semi-tensor product SAT solving device and method based on circuit information
CN114818556A
Post-quantum identification signature generation verification method and system based on symmetric cryptographic primitives
CN116405221A