Private key and public key generation method based on random bit string
Based on the private key and public key generation method based on random bibic string, the existing public key encryption system is easily cracked by quantum, and the characteristics of the 2-out-OF-4SAT problem are used to generate high variable density and controllable controlled controlling The complicated public key realizes the authentication of anti -quantum computing.
Patent Information
- Application Number
- CN202411500088.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-25
- Publication Date
- 2025-01-28
- Estimated Expiration
- 2044-10-25
AI Technical Summary
The existing public key encryption system is easily cracked by quantum computers, and the characteristics of the 2-out-of-4SAT problem cannot be promoted and developed in practical applications.
Adopt a private key and public key generation method based on random bibicin, to obtain N variables, generate clauses, build clause matrix P, and use it as public key, N variables as private keys.
The generated private key and public key have anti -quantum computing capabilities, improve the security of the cryptography system, control the complexity of the public key, make it controllable, and ensure the effectiveness of authentication.
Smart Images

Figure CN119382878A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of cryptography, and in particular to a method for generating a private key and a public key based on a random bit string. Background Art
[0002] Currently known encryption programs include both symmetric and asymmetric encryption programs. In asymmetric encryption programs, data can be encrypted using a public key known to everyone, and the resulting ciphertext can be decrypted using only a usually confidential complementary private key, or a public / private key pair can be used to generate and verify a digital certificate (or signature). In the case of a digital certificate (or signature), a private key is used in a cryptographic operation on a certain data to generate a digital certificate (signature), and a public key is used to verify the identity of the encrypting party. Here, the private key represents the identity of the user and can be used to identify the authenticity of the user.
[0003] The public key may be widely disseminated, but the private key is usually known only to a few parties. The public key can be used to encrypt messages that can only be decrypted using the 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 elliptic curve-based public key encryption relies on the difficulty of discrete logarithms. However, with the development of quantum technology, the most widely used public key cryptosystems, namely RSA and elliptic curve cryptography (ECC), will be cracked by general quantum computers and become no longer secure.
[0004] Non-deterministic polynomial time problems (NP problems) are an important class of computational problems whose solutions can be verified in polynomial time on a non-deterministic Turing machine, but finding the solution may take exponential time. In recent years, the solutions to NP problems have found widespread applications in the field of cryptography, especially cryptography based on the solutions to NP problems, which uses the difficulty of NP problems to build secure authentication mechanisms. For example, the solution to an NP problem can be used as the user's private key, and the problem itself as the public key. A user can prove his identity by providing his private key, while it is difficult for an attacker to 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 the SAT problem, but also gives it unique characteristics, making it potentially valuable for application in fields such as cryptography. It uses a binary bit string selected by the user as a password to generate the 2-out-of-4 SAT problem corresponding to the solution, which can achieve an efficient identity authentication process.
[0006] It can be seen that the above characteristics of the 2-out-of-4SAT problem make it have 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, selects a binary bit string as a password, uses the solution to the problem as a private key, and uses the problem itself as a public key, that is, generates private and public keys based on binary bit strings, which limits its promotion and development in practical applications. Summary of the invention
[0007] Purpose of the invention: The purpose of the present invention is to provide a method for generating private keys and public keys based on random bit strings. The private keys and public keys generated by the present invention have the ability to resist quantum computing, which solves 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 promoted and developed in practical applications.
[0008] Technical solution: The present invention provides a method for generating a private key and a public key based on a random bit string, 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. The n variables are denoted as {a1, a2, …, a n};
[0010] (2) Generate clauses: Generate m clauses based on n variables, and record the m clauses as {C1, C2, …, C m}, and arrange the four variables involved in each clause in the order of the size of the subscript;
[0011] (3) Constructing the clause matrix: Convert the m clauses into a clause matrix P, which is an m×4 matrix. Each matrix element P of the clause matrix P cd ∈[1,n],P cd Represented as the subscript value of the d-th variable involved in the c-th clause, where c∈[1,m], d∈[1,4];
[0012] (4) Output result: Output the clause matrix P in step (3) as the public key, and convert the n variables {a1, a2, …, a n} as a private key and distributed to users who need a private key.
[0013] Furthermore, the specific process steps of generating m clauses based on n variables are:
[0014] 1) Determine a probability parameter p a , the probability parameter p a Used to control the probability of generating clauses, its value range is 0 <p a<1;
[0015] 2) traverse the variable combination of 4 different variables among the n variables obtained in step (1) without repetition, and determine whether the variable combination satisfies the condition that 2 variable values are 1 and 2 variable values are 0. If so, execute the next step; if not, continue traversing;
[0016] 3) In response to selecting a variable combination of 4 different variables that satisfies the condition that 2 variables have a value of 1 and 2 variables have a value of 0, based on the probability parameter p a Determine whether to group the variables as a clause;
[0017] 4) Repeat steps 2) and 3) to count the number of clauses generated. If the count value is less than m, continue executing until the count value of the number of clauses is equal to m.
[0018] Furthermore, the probability parameter p in step 1) a The number of clauses m satisfies the following conditions:
[0019]
[0020] in, ! represents factorial, and n represents the number of variables.
[0021] Furthermore, the process of traversing the variable combinations of 4 different variables among the n variables obtained in step (1) without repetition in step 2) is:
[0022] First, select 4 different variables from n variables as the first variable combination, and judge 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, select 4 different variables from the remaining n-4 variables as the second variable combination, and judge whether the second variable combination satisfies the conditions that 2 variable values are 1 and 2 variable values are 0; and so on.
[0023] Furthermore, the process of traversing the variable combinations of 4 different variables among the n variables obtained in step (1) without repetition in step 2) is:
[0024] First, select 4 different variables from n variables as the first variable combination, and determine whether the first variable combination satisfies the conditions that 2 variable values are 1 and 2 variable values are 0. If so, select 4 different variables from the remaining n-4 variables as the second variable combination next time; if not, put the 4 variables back, and select 4 different variables from n variables again next time as the second variable combination. The second variable combination at this moment is different from the first variable combination, and determine whether the second variable combination satisfies the conditions that 2 variable values are 1 and 2 variable values are 0; and so on.
[0025] Furthermore, in step 3), based on the probability parameter p a Determining whether to group the variables as a clause means:
[0026] When selecting a variable combination of 4 different variables that satisfies the conditions that 2 variables are 1 and 2 variables are 0, a random decimal between 0 and 1 is randomly generated locally, and the random decimal is compared with the probability parameter p. a If the random number is smaller than the probability parameter p a , then the variable combination of the four different variables is taken as a clause; if the random decimal is greater than the probability parameter p a , then abandon the variable combination of the four different variables.
[0027] Furthermore, the four variables involved in each clause are arranged in the order of the size of the subscripts, which means:
[0028] For m clauses {C1,C2,…,C m} in the t-th clause C t , t∈[1,m], let the four variables involved be (a i ,a j ,a k ,a l ), 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 traversing the variable combinations of 4 different variables among the n variables obtained in step (1) without repetition in step 2) is:
[0030] First, select 4 different variables from n variables as the first variable combination, and judge whether the first variable combination meets the conditions that 2 variable values are 1 and 2 variable values are 0; after the judgment is completed, put the 4 variables back, and next time select 4 different variables from n variables as the second variable combination. The second variable combination at this moment is different from the first variable combination, and judge whether the second variable combination meets the conditions that 2 variable values are 1 and 2 variable values are 0; and so on.
[0031] Beneficial effects of the present invention:
[0032] (1) The clause matrix P generated by the present invention has four variables in each row, which has a high variable density. It is difficult for an attacker to find solutions to all clauses of the clause matrix P without a private key.
[0033] (2) The present invention determines n variables as the private key at the initial stage and generates a public key based on the n variables, thereby effectively controlling the complexity of the clause matrix P generated as the public key, so that the clause matrix P has a controllable difficulty;
[0034] (3) The operation of the private key is predetermined so that there is always a private key corresponding to the public key, which provides a guarantee for the validity of the identity authentication operation using the private key and public key pair. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] Figure 1 It is a flow chart of the method for generating private key and public key of the present invention;
[0036] Figure 2 Generate a flow chart for the inventive clause;
[0037] Figure 3 This is a schematic diagram of the clause matrix P structure. DETAILED DESCRIPTION
[0038] The present invention will be further described below in conjunction with the accompanying drawings and embodiments:
[0039] The existing public key encryption system relies on cryptographic algorithms based on mathematical problems. With the development of quantum technology, it will be cracked by general quantum computers and become no longer secure. The 2-out-of-4SAT problem is an NP-complete problem. All current algorithms for solving this problem are of exponential complexity. Therefore, it has potential application value in cryptography and other fields. However, there is currently no method that uses the characteristics of the 2-out-of-4SAT problem to select a binary bit string as a password, use the solution of the problem as a private key, and use the problem itself as a public key, that is, to generate private and public keys based on a binary bit string. This limits its promotion and development in practical applications.
[0040] Therefore, if Figure 1 As shown, the present application proposes a method for generating a private key and a public key based on a random bit string, comprising the following steps:
[0041] (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. The n variables involved are denoted as {a1, a2, …, a n}; Since it is a random bit string, n variables {a1, a2, ..., a n} about half of them are assigned 0 and the other half are assigned 1;
[0042] (2) Generative clause: Figure 2 As shown, m clauses are generated based on n variables, and the m clauses involved are recorded as {C1, C2, …, C m}, and arrange the four variables involved in each clause in the order of the size of the subscript; where the four variables involved in each clause are arranged in the order of the size of the subscript means: for the convenience of description, for m clauses {C1, C2, …, C m} in the t-th clause C t , t∈[1,m], let the four variables involved be (a i ,a j ,a k ,a l ), where i<j<k<l, then the clause is represented as C t (a i ,a j ,a k ,a l ).
[0043] The specific process steps for generating m clauses based on n variables are:
[0044] 1) Determine a probability parameter p a , the probability parameter p a Used to control the probability of generating clauses, its value range is 0 <p a <1;
[0045] The probability parameter p is determined by the following formula a , the probability parameter p a The number of clauses m satisfies the following conditions:
[0046]
[0047] in, ! represents factorial, and n represents the number of variables. The above formula can be used to determine an optimal probability parameter p a, by adjusting the probability parameter p a The value of controls the probability of generating clauses, so as to achieve the effect of controlling the efficiency of generating clauses. Select the probability parameter p that satisfies the above formula. a , which can avoid the probability parameter p a Too large, only a few variable combinations are judged, and m clauses are generated; there will be no probability parameter p a If it is too small, it will take a long time to get m clauses.
[0048] 2) traverse the variable combination of 4 different variables among the n variables obtained in step (1) without repetition, and determine whether the variable combination satisfies the condition that 2 variable values are 1 and 2 variable values are 0. If so, execute the next step; if not, continue traversing;
[0049] The process of traversing the variable combinations of 4 different variables among the n variables obtained in step (1) without repetition is as follows:
[0050] First, select 4 different variables from n variables as the first variable combination, and judge 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, select 4 different variables from the remaining n-4 variables as the second variable combination, and judge 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 traversing the variable combinations of 4 different variables among the n variables obtained in step (1) without repetition may also be:
[0052] First, select 4 different variables from n variables as the first variable combination, and determine whether the first variable combination satisfies the conditions that the values of 2 variables are 1 and the values of 2 variables are 0. If so, select 4 different variables from the remaining n-4 variables as the second variable combination next time; if not, put the 4 variables back, and select 4 different variables from n variables again as the second variable combination next time. The second variable combination at this moment is different from the first variable combination, and determine whether the second variable combination satisfies the conditions that the values of 2 variables are 1 and the values of 2 variables are 0; and so on, put the variables 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 in the subsequent judgment.
[0053] Alternatively, the process of traversing the variable combinations of 4 different variables among the n variables obtained in step (1) without repetition may also be:
[0054] First, select 4 different variables from n variables as the first variable combination, and judge whether the first variable combination meets the conditions that the values of 2 variables are 1 and 2 variables are 0; after the judgment is completed, put the 4 variables back, and select 4 different variables from n variables again as the second variable combination. The second variable combination at this moment is different from the first variable combination, and judge whether the second variable combination meets the conditions that the values of 2 variables are 1 and 2 variables are 0; and so on, put the variables back, and the variable combination selected again is different from the previous variable combination. For example, (a1, a2, a3, a4) is added to the clause, and (a1, a2, a3, a5) can be selected in the subsequent judgment.
[0055] 3) In response to selecting a variable combination of 4 different variables that satisfies the above conditions that 2 variables have values of 1 and 2 variables have values of 0, based on the probability parameter p a Determine whether to group the variables as a clause;
[0056] Specifically, based on the probability parameter p a Determining whether to use the variable combination as a clause means: when the variable combination of the selected 4 different variables satisfies the condition that 2 variable values are 1 and 2 variable values are 0, a random decimal between 0 and 1 is randomly generated locally, and the random decimal is compared with the probability parameter p a If the random number is smaller than the probability parameter p a , then the variable combination of the four different variables is taken as a clause; if the random decimal is greater than the probability parameter p a , then abandon the variable combination of the four different variables.
[0057] 4) Repeat steps 2) and 3) to count the number of clauses generated. If the count value is less than m, continue executing until the count value of the number of clauses is equal to m.
[0058] (3) Constructing the clause matrix: Based on the m clauses, convert the m clauses into the 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 is represented by the subscript value of the dth variable involved in the cth clause, where c∈[1,m], d∈[1,4]; for example, for the tth clause C in (2) above t (a i ,a j ,a k ,a l ), then the 4 matrix elements of the t-th row of the clause matrix P 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 ), then the 4 matrix elements of the t-th row of the clause matrix P are:
[0064] P t1 =1;
[0065] P t2 =7;
[0066] P t3 =11;
[0067] P t4 =12.
[0068] (4) Output result: Output the clause matrix P in step (3) as the public key, and convert the n variables {a1, a2, …, a n} as a private key and distributed to users who need a private key.
[0069] When applied, the private key is mainly used for signing and decryption, which is defined by the user and known only to the user; the public key is used for signature verification and encryption. The user uses the n variables as the private key for digital signature, and the identity authentication end uses the clause matrix P as the public key to verify the identity of the user. Specifically, according to the matrix elements of each row in the clause matrix P, the corresponding variables are obtained from the n variables that serve as the private key. If two of the four elements corresponding to each row in the clause matrix P are 1 and two are 0, the identity authentication is passed.
[0070] It can be seen that the clause matrix P generated by the present invention has four variables in each row, and has a high variable density. It is difficult for an attacker to find solutions to all clauses of the clause matrix P without a private key. Moreover, the present invention determines n variables as private keys at the initial time and generates a public key based on the n variables, so that the complexity of the clause matrix P generated as the public key can be effectively controlled, so that the clause matrix P has a controllable difficulty.
Claims
1. A method for generating a private key and a public key based on a random bit string, characterized in that: The following steps are involved: (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. The n variables are denoted as {a1, a2, …, a n }; (2) Generate clauses: Generate m clauses based on n variables, and record the m clauses as {C1, C2, …, C m }, and arrange the four variables involved in each clause in the order of the size of the subscript; (3) Constructing the clause matrix: Convert the m clauses into a clause matrix P, which is an m×4 matrix. Each matrix element P of the clause matrix P cd ∈[1,n],P cd Represented as the subscript value of the d-th variable involved in the c-th clause, where c∈[1,m], d∈[1,4]; (4) Output result: Output the clause matrix P in step (3) as the public key, and convert the n variables {a1, a2, …, a n } as a private key and distributed to users who need a private key.
2. A method for generating a private key and a public key based on a random bit string according to claim 1, characterized in that: The specific process steps of generating m clauses based on n variables are: 1) Determine a probability parameter p a , the probability parameter p a Used to control the probability of generating clauses, its value range is 0 <p a <1; 2) traverse the variable combination of 4 different variables among the n variables obtained in step (1) without repetition, and determine whether the variable combination satisfies the condition that 2 variable values are 1 and 2 variable values are 0. If so, execute the next step; if not, continue traversing; 3) In response to selecting a variable combination of 4 different variables that satisfies the condition that 2 variables have a value of 1 and 2 variables have a value of 0, based on the probability parameter p a Determine whether to group the variables as a clause; 4) Repeat steps 2) and 3) to count the number of clauses generated. If the count value is less than m, continue executing until the count value of the number of clauses is equal to m.
3. A method for generating a private key and a public key based on a random bit string according to claim 2, characterized in that: The probability parameter p in step 1) a The number of clauses m satisfies the following conditions: in, ! represents factorial, and n represents the number of variables.
4. A method for generating a private key and a public key based on a random bit string according to claim 2, characterized in that: The process of traversing the variable combinations of 4 different variables among the n variables obtained in step (1) without repetition in step 2) is: First, select 4 different variables from n variables as the first variable combination, and judge 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, select 4 different variables from the remaining n-4 variables as the second variable combination, and judge whether the second variable combination satisfies the conditions that 2 variable values are 1 and 2 variable values are 0; and so on.
5. The method for generating a private key and a public key based on a random bit string according to claim 2, characterized in that: The process of traversing the variable combinations of 4 different variables among the n variables obtained in step (1) without repetition in step 2) is: First, select 4 different variables from n variables as the first variable combination, and determine whether the first variable combination satisfies the conditions that 2 variable values are 1 and 2 variable values are 0. If so, select 4 different variables from the remaining n-4 variables as the second variable combination next time; if not, put the 4 variables back, and select 4 different variables from n variables again next time as the second variable combination. The second variable combination at this moment is different from the first variable combination, and determine whether the second variable combination satisfies the conditions that 2 variable values are 1 and 2 variable values are 0; and so on.
6. A method for generating a private key and a public key based on a random bit string according to claim 2, characterized in that: In step 3), based on the probability parameter p a Determining whether to group the variables as a clause means: When selecting a variable combination of 4 different variables that satisfies the conditions that 2 variables are 1 and 2 variables are 0, a random decimal between 0 and 1 is randomly generated locally, and the random decimal is compared with the probability parameter p. a If the random number is smaller than the probability parameter p a , then the variable combination of the four different variables is taken as a clause; if the random decimal is greater than the probability parameter p a , then abandon the variable combination of the four different variables.
7. A method for generating a private key and a public key based on a random bit string according to claim 1, characterized in that: The four variables involved in each clause are arranged in the order of the size of the subscripts: For m clauses {C1,C2,…,C m } in the t-th clause C t , t∈[1,m], let the four variables involved be (a i ,a j ,a k ,a l ), i<j<k<l, then the clause is represented as C t (a i ,a j ,a k ,a l ).
8. A method for generating a private key and a public key based on a random bit string according to claim 2, characterized in that: The process of traversing the variable combinations of 4 different variables among the n variables obtained in step (1) without repetition in step 2) is: First, select 4 different variables from n variables as the first variable combination, and judge whether the first variable combination meets the conditions that 2 variable values are 1 and 2 variable values are 0; after the judgment is completed, put the 4 variables back, and next time select 4 different variables from n variables as the second variable combination. The second variable combination at this moment is different from the first variable combination, and judge whether the second variable combination meets the conditions that 2 variable values are 1 and 2 variable values are 0; and so on.
Citation Information
Patent Citations
Public key cipher encrypting and decrypting method based on neural network chaotic attractor
CN101977112A
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
Identity authentication and shared key generation method
US20120027205A1
Method for generating hard sat and method for implementing sat-based quantum-resistant cryptographic algorithm
WO2024058298A1