Dynamic white-box password implementation method based on guide random number
By guiding random numbers to generate an encryption and decryption program, using the secret sharing mechanism of the lookup table pool, the problem of the algorithm program being easily attacked in the implementation of existing white box passwords is solved, and the system security guarantee is achieved when some lookup table entries are leaked. Effectively prevent code porting attacks.
Patent Information
- Application Number
- CN202411105165.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-13
- Publication Date
- 2024-11-22
AI Technical Summary
The existing white box password implementation cannot be effectively protected when an attacker obtains algorithm programs, and the dynamic white box library technology based on packet passwords cannot prevent code transplant attacks, resulting in insufficient system security.
Using a dynamic white box password implementation method based on boot random numbers, the core parameters are determined through negotiation between the encryptor and the decryptor, a lookup table pool is generated and secretly shared. The encrypted and decrypted program is generated using the boot random numbers to ensure the concealment and security of the algorithm program. sex.
It effectively improves the security of white box passwords, and even if some lookup table entries are leaked, it cannot carry out code transplant attacks, which significantly improves the security of the system.
Smart Images

Figure CN119011138A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a technology in the field of information security, in particular to a method for implementing a dynamic white-box cryptography based on a guided random number. Background Art
[0002] The existing white-box cryptographic implementation consists of two parts: a lookup table and an algorithm program. If a white-box attacker obtains both parts at the same time, a code lifting attack can be performed. That is, a white-box attacker can regard the lookup table and algorithm program involved in the white-box cryptographic operation as equivalent "big keys". By completely transplanting all the lookup tables and algorithm programs, the attacker can still implement the functions of the cryptographic algorithm on any device. In the existing white-box cryptographic implementation, the lookup table part is usually large enough or additionally protected so that it cannot be fully obtained by the attacker, but the algorithm program can often be easily obtained by the attacker. Although the existing dynamic white-box library technology based on block cipher white-boxing can use the lookup table to protect the key, it cannot protect the algorithm implementation program. Attackers who obtain part of the lookup table can still perform code lifting attacks. Summary of the invention
[0003] In view of the above-mentioned deficiencies in the prior art, the present invention proposes a dynamic white-box cryptography implementation method based on guided random numbers, which uses a lookup table pool to dynamically generate an algorithm program to ensure that when some items in the lookup table are leaked, the concealment of the algorithm program is still maintained, thereby ensuring the security of the system.
[0004] The present invention is achieved through the following technical solutions:
[0005] The present invention relates to a method for realizing dynamic white-box cryptography based on a boot random number. In the initialization phase, after the encryption party and the decryption party determine the core parameters through negotiation, the encryption party generates a lookup table pool and shares secrets with the decryption party. In the encryption phase, the encryption and decryption party obtains an encryption program through an encryption program generation algorithm according to the same lookup table pool and the generated boot random number, inputs a message plaintext into the encryption program to obtain a message ciphertext, and then sends the message ciphertext and the boot random number to the decryption party. In the decryption phase, the decryption party obtains a decryption program through a decryption program generation algorithm according to the boot random number sent by the encryption party, and then inputs the received message ciphertext into the decryption program to obtain a message plaintext. Technical Effects
[0006] The present invention guides the order of the encryption program and the decryption program calling the lookup table by guiding the random number, and then uniquely binds the implementation process of the encryption program and the decryption program to the guiding random number. Compared with the prior art, the present invention can effectively reduce the difficulty of the white-box attacker to obtain the algorithm program to the difficulty of obtaining the lookup table. Even if some of the lookup table items are exposed, the white-box cryptography cannot be transplanted, which further improves the security of the white-box cryptography implementation. BRIEF DESCRIPTION OF THE DRAWINGS
[0007] Figure 1 It is a flow chart of the present invention;
[0008] Figure 2 It is a schematic diagram of the system structure of the present invention;
[0009] Figure 3 This is the algorithm structure diagram of Example 2. DETAILED DESCRIPTION
[0010] like Figure 2 As shown, this embodiment involves a dynamic white-box cryptographic implementation system based on a boot random number, including: an encryption unit and a decryption unit, wherein: a boot random number and a message plaintext are input into the encryption unit, the encryption unit generates an encryption program instance according to the boot random number, and uses the message plaintext as the input of the encryption program instance to obtain an output that is the message ciphertext; a boot random number and a message ciphertext are input into the decryption unit, the decryption unit generates a decryption program instance according to the boot random number, and uses the message ciphertext as the input of the decryption program instance to obtain an output that is the message plaintext; the encryption unit and the decryption unit are constructed based on the same lookup table pool, and are respectively located at the terminals where the encryption party and the decryption party are located.
[0011] like Figure 1 As shown, this is a method for implementing dynamic white-box cryptography based on the above system in this embodiment, which is implemented through three stages of initialization, encryption and decryption between the encryption party and the decryption party.
[0012] The initialization phase specifically includes:
[0013] Step 1: The encrypting party and the decrypting party negotiate the core parameters of the encryption and decryption algorithms, and then use the core parameters to represent the remaining parameters.
[0014] The core parameters are: packet length len, input length l of the lookup table in , the number of rounds R of the encryption and decryption algorithm and the number s of lookup tables in the lookup table pool.
[0015] The remaining parameters include: the output length of the lookup table The number of lookup tables used in each round of the encryption and decryption algorithm The number of lookup tables used in one execution of the encryption and decryption algorithm Binary length of the leading random number And the total size of the lookup table pool
[0016] Step 2: The encrypting party generates a lookup table pool and shares it with the decrypting party, specifically including:
[0017] 2.1) Let i = 0, and initialize the set P = [];
[0018] 2.2) Randomly generate a key key;
[0019] 2.3) Set Enc key To represent the encryption function with key as the key, use Enc key To calculate the entries in T i in turn, where the j-th entry T i [j] is the high l key bits of Enc * (j||0 out ), j||0 * Means using all 0s to expand j to the input length of Enc key ;
[0020] 2.4) Add T i to the set P, calculate i = i + 1, if i < s, return to step 2.2); otherwise, execute step 2.5);
[0021] 2.5) Return the lookup table set P as the lookup table pool.
[0022] The lookup table pool contains s lookup tables with the same structure {T i |i = 0, 1,..., s - 1}, s is a power of 2, that is, the total size Size of the lookup table pool and l in , l out , s satisfy:
[0023] Considering the actual storage efficiency, this embodiment suggests that l in and l out are both powers of 2, and at the same time, it is suggested that l in does not exceed 32. The following table gives several groups of parameters and the corresponding lookup table pool sizes: <![CDATA[l in ]]> <![CDATA[l out ]]> s size 8 64 <![CDATA[2 5 ]]> 64KB 8 128 <![CDATA[2 12 ]]> 16MB 16 128 <![CDATA[2 12 ]]> 4GB 16 64 <![CDATA[2 16 ]]> 32GB 8 64 <![CDATA[2 25 ]]> 64GB 32 128 <![CDATA[2 8 ]]> 16TB
[0024] Step 3: The encrypting party and the decrypting party respectively initialize the encryption program generation algorithm and the decryption program generation algorithm. Among them: The encryption program generation algorithm and the decryption program generation algorithm output a pair of encryption programs and decryption programs that are inverse operations according to the same leading random number.
[0025] The encryption program generation algorithm includes a first encryption compiler and a second encryption compiler, wherein: the first encryption compiler inputs a boot random number and outputs an intermediate encryption program; the second encryption compiler inputs an intermediate value and outputs a final encryption program.
[0026] The decryption program generation algorithm includes a first encryption compiler and a first decryption compiler, wherein the first encryption compiler is the same as the first encryption compiler in the encryption program generation algorithm, inputs a boot random number, and outputs an intermediate encryption program; the first decryption compiler inputs an intermediate value and outputs a final decryption program.
[0027] The encryption compiler generates a program for calling a lookup table in a lookup table pool and performing encryption calculation according to an input random number having the same length as the boot random number and a selected encryption algorithm.
[0028] The decryption compiler generates a program that calls the lookup table in the lookup table pool in the reverse order of the number of bits of the random number and performs decryption calculations based on the input random number with the same length as the boot random number and the selected decryption algorithm. That is, when the same random number is input, the two programs output by the encryption compiler and the decryption compiler can perform inverse operations.
[0029] The encryption algorithm described herein adopts, but is not limited to, a process of encrypting data by calling a lookup table multiple times, such as Figure 3 shown.
[0030] The first encryption compiler and the second encryption compiler are both specific calls of the encryption compiler.
[0031] The first decryption compiler is a specific call of the decryption compiler.
[0032] The intermediate encryption program is generated by the first encryption compiler, which inputs a guide random number, calls a lookup table in a specific order, encrypts the guide random number, and finally outputs an intermediate value.
[0033] The intermediate value is a value having the same length as the boot random number and is generated by an intermediate encryption program.
[0034] The encryption stage specifically includes: the encrypting party generates a boot random number, inputs the boot random number into the encryption program generation algorithm to obtain the encryption program, inputs the message plaintext into the encryption program to obtain the message ciphertext, and then sends the message ciphertext and the boot random number to the decrypting party.
[0035] The boot random number k g, generated by a random number generator, and its binary length is n·log2s, where s is the number of lookup tables in the lookup table pool, and n is the number of times the lookup table is used in an encryption program.
[0036] The random number generator described herein may be, but is not limited to, a random number generator approved by the State Cryptography Administration.
[0037] In this embodiment, the input X of the encryption program p With output X c The length is equal, and its length len is related to the specifications of the lookup table used, satisfying Among them l in With l out are the input and output lengths of the lookup table used, respectively.
[0038] The decryption stage specifically includes: after the decryption party inputs the guide random number into the decryption program generation algorithm to obtain the decryption program, the received message ciphertext is input into the decryption program to obtain the message plaintext.
[0039] The decryption algorithm is an algorithm that calls the lookup table multiple times to decrypt data, and has a calculation process that is the inverse of the encryption algorithm.
[0040] The final encryption procedure E k With the final decryption program D k Able to perform inverse operations on the input, that is, satisfy D k (E k (X))=X.
[0041] like Figure 3 As shown, this embodiment relates to an algorithm structure that uses a lookup table pool for encryption and decryption. The algorithm structure uses a balanced Feistel network design. p Through R rounds of iterations, we get X c , the input X of each round i Divided into two equal parts X l and X r The operations are performed separately. R rounds of operations use the lookup table n times in total. Each round uses The specific table is: in each round of iterative calculation, let X l =x m-1 ||x m-2 ||…||x1||x0, Where: X i =X l ||X r , X r '=X l , X i+1 =X l '||Xr ',|| represents the concatenation of bit strings, X l With X r Equal length, x0, x1, …, x m-1 Equal length, Indicates calling the kth i·m Lookup Table The x0th item of data. k i·m That is, it is the ith·mth field of the bootstrap random number k, and the binary length of k is n·log2s, where s is the number of lookup tables in the lookup table pool, and n is the number of times the lookup table is used in an encryption program.
[0042] In the encryption algorithm described above, k represents a boot random number, which is essentially just a random number related to k. g Random numbers of equal length, but not necessarily equal.
[0043] In the specific implementation, the first encryption compiler is based on k g An intermediate encryption program is generated. The order in which the intermediate encryption program executes the encryption process and calls the lookup table is determined by k g Boot; then the intermediate encryption program encrypts k g The intermediate value is generated, and the second encryption compiler generates the final encryption program based on this intermediate value. Therefore, the order in which the final encryption program executes the encryption process and calls the lookup table is actually guided by this intermediate value. In this process, k g First, it is used as a boot random number, that is, the input of the first encryption compiler to generate the intermediate encryption program; and then it is used as a message plaintext, that is, the input of the intermediate encryption program to generate its encryption result, that is, the intermediate value. g The use of is completely different in nature, and the purpose of doing so is to protect the true privacy, that is, the secure transmission of intermediate values.
[0044] After specific practical experiments, the white-box attacker can obtain the upper bound of the probability prob. of the correct decryption program when obtaining half of the lookup table entries, as shown in the following table:
[0045] Compared with the existing technology, this method uses a boot random number to protect the algorithm program of the white-box cryptography. It can ensure that the decryption program cannot be successfully obtained when less than half of the lookup table entries are exposed, effectively counteract code transplantation attacks, and effectively ensure the security of the cryptographic algorithm implementation in the white-box attack environment.
[0046] The above-mentioned specific implementation can be partially adjusted in different ways by those skilled in the art without departing from the principle and purpose of the present invention. The protection scope of the present invention shall be based on the claims and shall not be limited by the above-mentioned specific implementation. Each implementation scheme within its scope shall be subject to the constraints of the present invention.
Claims
1. A method for implementing dynamic white-box cryptography based on guided random numbers, characterized in that: In the initialization phase, after the encryption party and the decryption party negotiate and determine the core parameters, the encryption party generates a lookup table pool and shares the secret with the decryption party. In the encryption phase, the encryption and decryption party obtains the encryption program through the encryption program generation algorithm based on the same lookup table pool and the generated boot random number, inputs the message plaintext into the encryption program, obtains the message ciphertext, and then sends the message ciphertext and the boot random number to the decryption party; In the decryption phase, the decryptor obtains the decryption program through the decryption program generation algorithm based on the boot random number sent by the encryptor, and then inputs the received message ciphertext into the decryption program to obtain the message plaintext; The core parameters are: packet length len, input length l of the lookup table in , the number of rounds R of the encryption and decryption algorithm and the number s of the lookup tables in the lookup table pool; The boot random number k g , generated by a random number generator, and its binary length is n·log2s, where s is the number of lookup tables in the lookup table pool, and n is the number of times the lookup table is used in an encryption program.
2. The method for implementing dynamic white-box cryptography based on guided random numbers according to claim 1 is characterized in that: The initialization phase specifically includes: Step 1: The encryption party and the decryption party negotiate the core parameters of the encryption and decryption algorithms, and then use the core parameters to represent the remaining parameters; Step 2: The encryption party generates a lookup table pool and shares it with the decryption party, including: 2.1) Let i = 0, and initialize the set P = [ ]; 2.2} Randomly generate a key; 2.3} Set Enc key Indicates an encryption function with key as the key, using Enc key Calculate T in sequence i The top of the table in which the jth entry T i [j] is Enc kev (j||0 * ) out Bit, j||0 * Indicates that j is expanded to Enc using all 0s key The input length of 2.4} Add T i to set P, calculate i = i + 1, if i < s return to step 2.2}; otherwise execute step 2.5}; 2.5} Return the lookup table set P as the lookup table pool; Step 3: The encryption party and the decryption party respectively initialize the encryption program generation algorithm and the decryption program generation algorithm, wherein: the encryption program generation algorithm and the decryption program generation algorithm output a pair of encryption program and decryption program that are inverse operations of each other based on the same boot random number.
3. The method for implementing dynamic white-box cryptography based on guided random numbers according to claim 2 is characterized in that: The remaining parameters include: the output length of the lookup table The number of lookup tables used in each round of the encryption and decryption algorithm The number of lookup tables used in one execution of the encryption and decryption algorithm Binary length of the bootstrap random number and the total size of the lookup table pool The lookup table pool contains s different lookup tables of the same structure {T i |i=0,1,…,s-1}, s is an integer power of 2, that is, the total size of the lookup table pool Size and l in , l out , s satisfy:
4. The method for implementing dynamic white-box cryptography based on guided random numbers according to claim 1 or 2, characterized in that: The encryption program generation algorithm includes a first encryption compiler and a second encryption compiler, wherein: the first encryption compiler inputs a boot random number and outputs an intermediate encryption program; the second encryption compiler inputs an intermediate value and outputs a final encryption program; The decryption program generation algorithm includes a first encryption compiler and a first decryption compiler, wherein the first encryption compiler is the same as the first encryption compiler in the encryption program generation algorithm, inputs a boot random number, and outputs an intermediate encryption program; the first decryption compiler inputs an intermediate value and outputs a final decryption program; The final encryption procedure E k With the final decryption program D k Able to perform inverse operations on the input, that is, satisfy D k (E k (X))=X.
5. The method for implementing dynamic white-box cryptography based on guided random numbers according to claim 4 is characterized in that: The encryption compiler generates a program for calling a lookup table in a lookup table pool and performing encryption calculation according to an input random number having the same length as the boot random number and a selected encryption algorithm; The decryption compiler generates a program that calls the lookup table in the lookup table pool in reverse order of the number of bits of the random number and performs corresponding encrypted decryption calculations based on the input random number with the same length as the boot random number and the selected decryption algorithm, that is, when the same random number is input, the two programs output by the encryption compiler and the decryption compiler can perform mutually inverse operations; The first encryption compiler and the second encryption compiler are both specific calls of the encryption compiler; The first decryption compiler is a specific call of the decryption compiler; The intermediate encryption program is generated by the first encryption compiler, which inputs a guide random number, calls a lookup table in a specific order, encrypts the guide random number, and finally outputs an intermediate value; The intermediate value is a value with the same length as the boot random number, and is generated by an intermediate encryption program.
6. The method for implementing dynamic white-box cryptography based on guided random numbers according to claim 1 is characterized in that: The encryption stage specifically includes: the encrypting party generates a boot random number, obtains an encryption program by using the boot random number through an encryption program generation algorithm, inputs the message plaintext into the encryption program to obtain the message ciphertext, and then sends the message ciphertext and the boot random number to the decrypting party.
7. The method for implementing dynamic white-box cryptography based on guided random numbers according to claim 1 or 6, characterized in that: The decryption stage specifically includes: after the decryption party obtains the decryption program according to the decryption program generation algorithm by guiding the random number, the received message ciphertext is input into the decryption program to obtain the message plaintext.
8. The method for implementing dynamic white-box cryptography based on guided random numbers according to claim 1 or 4, characterized in that: By balancing the Feistel network, according to the input X p Through R rounds of iterations, we get X c , the input X of each round i Divided into two equal parts X l and X r The operations are performed separately. R rounds of operations use the lookup table n times in total. Each round uses The specific table is: in each round of iterative calculation, let X l =x m-1 ||x m-2 ||…||x1||x0, Where: X i =X l ||X r , X r '=X l , X i+1 =X l '||X r ',|| represents the concatenation of bit strings, X l With X r Equal length, x0, x1, …, x m-1 Equal length, Indicates calling the kth i·m Lookup Table The x0th item of data, k i·m That is, it is the ith·mth field of the bootstrap random number k, and the binary length of k is n·log2s, where s is the number of lookup tables in the lookup table pool, and n is the number of times the lookup table is used in an encryption program.
9. A system for implementing a dynamic white-box cryptography based on a bootstrap random number for implementing any of the methods described in claims 1-8, characterized in that: include: An encryption unit and a decryption unit, wherein: a boot random number and a message plaintext are input into the encryption unit, the encryption unit generates an encryption program instance according to the boot random number, and uses the message plaintext as the input of the encryption program instance to obtain an output that is the message ciphertext; a boot random number and a message ciphertext are input into the decryption unit, the decryption unit generates a decryption program instance according to the boot random number, and uses the message ciphertext as the input of the decryption program instance to obtain an output that is the message plaintext; the encryption unit and the decryption unit are constructed based on the same lookup table pool, and are respectively located at the terminals where the encryption party and the decryption party are located.
