CN115694864A - Express information encryption method based on improved AES algorithm and QR code - Google Patents

Express information encryption method based on improved AES algorithm and QR code Download PDF

Info

Publication number
CN115694864A
CN115694864A CN202210647465.0A CN202210647465A CN115694864A CN 115694864 A CN115694864 A CN 115694864A CN 202210647465 A CN202210647465 A CN 202210647465A CN 115694864 A CN115694864 A CN 115694864A
Authority
CN
China
Prior art keywords
algorithm
improved
express
aes
information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210647465.0A
Other languages
Chinese (zh)
Inventor
辜双佳
张强
牟振平
栗智
张津磊
何道兵
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Chongqing Industry Polytechnic College
Original Assignee
Chongqing Industry Polytechnic College
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Chongqing Industry Polytechnic College filed Critical Chongqing Industry Polytechnic College
Priority to CN202210647465.0A priority Critical patent/CN115694864A/en
Publication of CN115694864A publication Critical patent/CN115694864A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Storage Device Security (AREA)

Abstract

The invention discloses an express information encryption method based on an improved AES algorithm and a QR code, which comprises the following steps: s1: pycharm programming software is installed at a PC end, anaconda is used for environment management, and Python libraries such as Requests library, crypto library, flask library, http library, qrcode library, pyzbar library, PIL library and random library are downloaded and used. According to the express information encryption method based on the improved AES algorithm and the QR code, the Padding Oracle vulnerability principle of the AES algorithm and the reason that the relevance between keys in the key expansion algorithm is too strong are analyzed, and the AES algorithm is improved from the viewpoint of repairing the vulnerability and weakening the relevance between keys. The improved AES algorithm is combined with a QR code technology and introduced into the express industry, an AES encryption system and an AES decryption system are developed, a novel process of encrypting an express bill and sending and receiving the express is provided, the encryption system encrypts and hides the privacy information of the express bill in the plaintext, the decryption system verifies the identity of a pickup person, and the encryption and decryption system protects the property safety and the information safety of express users together.

Description

Express information encryption method based on improved AES algorithm and QR code
Technical Field
The invention relates to the fields of electronic commerce technology and information security cryptography, in particular to an express information encryption method based on an improved AES algorithm and a QR code.
Background
With the rapid rise of electronic commerce, the express delivery industry presents unprecedented prosperity. In the stage of transporting the express delivery or the stage of discarding the express delivery box with the hand after the express delivery is taken out by the user, a large amount of privacy information of the express delivery user is revealed by the plaintext express bill, and the information security of the express delivery user is threatened. On the other hand, the too simple 'express delivery is taken orally' mode leads to the existence of the phenomenon of impersonating and receiving the express delivery, and the behavior of stealing the express delivery causes property loss of express delivery users.
The QR code is the two-dimensional code which is most widely applied at present, the AES encryption algorithm is the most popular single-key cryptographic algorithm and is a standard encryption algorithm which is selected in a large scale in the technical field, and therefore, the QR code is also an ideal algorithm for encrypting express user plaintext information. The method aims to further improve the security and the time efficiency of the AES algorithm, combines the encryption technology with the QR code technology, is applied to the express industry, protects the property security and the information security of express users, and researches show that the AES algorithm has the defects of PaddingOracle vulnerability and strong correlation of an extended key in a CBC mode.
Disclosure of Invention
Technical problem to be solved
Aiming at the defects of the prior art, the invention provides an express information encryption method based on an improved AES algorithm and a QR code, provides a new filling rule, and repairs the Padding Oracle vulnerability of the AES encryption algorithm in a CBC mode. And a new secret key expansion algorithm is provided, the correlation between the expanded secret keys is effectively weakened, the difficulty of forward and backward derivation is increased, the defect that the correlation between the expanded secret keys is too strong is solved, and finally, an encryption and decryption system is generated based on an improved AES algorithm, and a new flow of encrypting an express bill and sending and receiving the express is provided.
(II) technical scheme
In order to achieve the purpose, the invention provides the following technical scheme: an express information encryption method based on an improved AES algorithm and a QR code comprises the following steps:
s1: installing Pycharm programming software at a PC end, using Anaconda to perform environment management, downloading and using Requests library, crypto library, flask library, http library, qrcode library, pyzbar library, PIL library, random library and other Python libraries;
s2: repairing the Padding Oracle vulnerability by using a newly proposed filling rule, weakening the correlation of round keys by using an improved key expansion algorithm, and realizing the improvement of an AES encryption algorithm;
s3: the improved AES algorithm automatically generates a 6-bit password consisting of upper and lower case letters and numbers;
s4: each set of input test data is: user name, phone, "big address" and detailed address information;
s5: the AES encryption system encrypts input information by using a built-in improved AES algorithm to obtain ciphertext information, encodes the ciphertext to generate a ciphertext QR (quick response) code and completes an encryption process;
s6: during decryption, a tester inputs a 6-bit password in an AES decryption system;
s7: when the input password is wrong, the software interface will output "password error! "prompt information;
s8: when the input password is correct, the 'AES decryption system' decrypts the ciphertext QR code by using a built-in improved AES algorithm, and outputs user name, telephone, 'big address' and detailed address information in a plaintext form to finish the decryption process.
Preferably, 100 groups of data are subjected to a correctness test experiment of the improved AES algorithm, and the experiment result shows that the improved algorithm can perform complete encryption and decryption operations on the test data.
Preferably, 100 avalanche effect safety comparison experiments are respectively carried out on the improved AES algorithm. The plaintext, the key and the ciphertext are respectively 128 bits, avalanche effect experiments are respectively carried out from two aspects of keeping the plaintext value unchanged, changing the key value 1b and the key value 1b, changing the plaintext value 1b, changing the number of changing bits of 100 groups of output ciphertexts of the original AES algorithm and the improved AES algorithm are recorded, and changing variance values are calculated. Wherein, the smaller the variance value, the closer the variation value of the output is to 64b, i.e. the avalanche effect is more satisfied, and the safety is higher. Experimental results show that the improved AES algorithm has smaller variance value and higher safety.
Preferably, the original AES algorithm and the improved AES algorithm are respectively used for carrying out encryption and decryption experiments on the test data of 16B, 1KB, 2KB, 4KB and 8KB, and the experiment result shows that the time consumption of the improved AES algorithm is 4.26% higher than that of the original AES algorithm in encryption and 4.75% higher than that of the original AES algorithm in decryption. Therefore, the improved AES algorithm has higher time efficiency than the original algorithm.
Preferably, the "AES encryption system" functions as: receiving user (sender and receiver) plaintext information input by a sender, storing the user plaintext information in a server, automatically generating an express number and a secret key K for encrypting the receiver information, storing the express number and the secret key K in the server, encrypting a detailed address of the receiver by using a fixed 'town password' to obtain a ciphertext QR code 1, encrypting all information of the receiver by using the secret key K to generate a ciphertext QR code 2, determining and returning functions of express return, generating an entire novel ciphertext express bill and printing.
Preferably, the "AES decryption system" functions as: scanning and identifying the ciphertext QR code 2, automatically filling in an express number, receiving and inputting a secret key K 'provided by a receiver, decrypting the ciphertext QR code 2 by using an improved AES algorithm, judging whether the secret key K' provided by the receiver is an encryption secret key K, and outputting the plaintext information of the receiver with successful decryption or the prompt information of failure decryption.
(III) advantageous effects
Compared with the prior art, the invention provides an express information encryption method based on an improved AES algorithm and a QR code, which has the following beneficial effects:
1. the express information encryption method based on the improved AES algorithm and the QR code analyzes the Padding Oracle vulnerability principle of the AES algorithm and the reason that the relevance between keys is too strong in the key expansion process, strives to improve the AES algorithm from the perspective of repairing the vulnerability and weakening the relevance between the keys, further improves the safety and encryption and decryption speed of the algorithm, introduces the improved AES algorithm into the express industry by combining the QR code technology, develops an AES encryption system and an AES decryption system, and provides a new flow of new encrypted express bills and a new express receiving process, the encryption system encrypts and hides the privacy information of the plaintext express bill, the decryption system verifies the identity of a pickup, and the encryption and decryption system protects the property safety and information safety of an express user.
2. According to the express information encryption method based on the improved AES algorithm and the QR code, the plaintext grouping filling rule of the AES algorithm is improved, the generation of filling errors is fundamentally prevented, an attacker cannot attack based on Padding Oracle, the correctness of the improved algorithm is analyzed from the theoretical perspective, the experimental result further shows that after the ciphertext is modified by bit-by-bit traversal, the server cannot generate the Oracle information, and the improved algorithm is proved to successfully repair the vulnerability from the experimental perspective.
3. According to the express information encryption method based on the improved AES algorithm and the QR code, in order to weaken the correlation between keys, the key expansion algorithm is researched and improved, wherein the randomness of an initial key is increased by a random generator, the latter round of key is obtained by two rounds of keys, the difficulty of key derivation forward and backward is further increased, the advantages of instantaneity, conciseness and high efficiency of the original algorithm are also kept by XOR and line shift operation, and theoretical analysis shows that the number of guesses required for cracking the initial key or the first round of key is 2 96 The guessing times of any round of keys in the nine rounds of keys after the key is cracked is 2 128 The method has no different exhaustion strength, and meanwhile, the experimental result shows that the improved algorithm generates 10 rounds of keys 2.4 times faster than the original algorithm, and the improved key expansion algorithm is safer and more efficient.
Drawings
FIG. 1 is a flow chart of the improved fill rule of the present invention;
FIG. 2 is a flow chart illustrating the process of verifying the correctness of the filling rule according to the present invention;
FIG. 3 is a block diagram of the improved key expansion algorithm K of the present invention 0 And K 1 The generated map of (2);
FIG. 4 is a diagram of the present invention for improved key expansionK of the algorithm 2 ~K 10 Expanding the process diagram;
FIG. 5 is a comparison graph of key expansion averaging of the present invention;
FIG. 6 is a flow chart of the present invention for generating and identifying the QR code stream of the ciphertext;
FIG. 7 is a QR code picture of a user information ciphertext according to the present invention;
FIG. 8 is a graph comparing the change in the number of bits of ciphertext resulting from changing the value of the 1b key of the present invention;
FIG. 9 is a graph comparing the change of the bits of ciphertext obtained by changing the plaintext value of 1b according to the present invention;
FIG. 10 is a diagram of a sender information filling interface of the present invention;
FIG. 11 is a recipient information filling interface diagram in accordance with the present invention;
FIG. 12 is a diagram of a new encrypted courier slip of the present invention;
FIG. 13 is a flow chart of sending an express;
FIG. 14 is a diagram of an AES decryption system of the present invention;
FIG. 15 is a schematic illustration of decryption failure according to the present invention;
FIG. 16 is a diagram illustrating the success of decryption according to the present invention;
fig. 17 is a flow chart of express delivery according to the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be obtained by a person skilled in the art without making any creative effort based on the embodiments in the present invention, belong to the protection scope of the present invention.
Improved fill rule algorithmic description
In order to repair Padding Oracle vulnerability of AES algorithm in CBC mode, the section improves the filling rule of plaintext block. The new filling rule is: the plaintext of the AES algorithm is first grouped according to chunk length 16B, and if the last group is i bytes less than the equal-length chunk, the end is filled with i 0x0i. If the last section of plaintext packet is just the length of the equal-length chunk, no modification is made. The new fill rule flow is shown in fig. 1.
Pseudo code for improving the filling rule is shown in table 1.
TABLE 1 pseudo code to improve fill rules
Figure RE-GDA0004018041290000051
Figure RE-GDA0004018041290000061
Theoretical analysis and experimental verification of bug repair correctness
The improved filling rule is discussed in two aspects of theory and experiment, and the correctness analysis based on the theory and the verification result based on the experiment show that the loophole is effectively repaired, so that the safety of the AES algorithm is further improved.
Theoretical analysis of bug fix correctness
Fig. 2 is a flow chart of the server checking whether the last plaintext block is filled correctly or not. First, the server decrypts the last ciphertext block to obtain the last plaintext block. And then, the server judges whether the filling result of the plaintext block is correct or not according to the tail byte of the plaintext block. Since the AES algorithm after improving the filling rule has two cases of "filling" and "not filling", if the server finds that the end of the plaintext block is filled with i 0x0i, that is, case 1 in the figure, it will obtain the conclusion that the filling is correct, that is, no Oracle prompt message of filling error is generated. If the server finds that the end of the plaintext block is not i 0x0i, which is the case 2 in the figure, the server will not give the Oracle hint information with the filling error, because this is also the case with the correct filling, that is, the last plaintext block in the filling rule is just 16B and does not need to be filled.
That is to say, the AES algorithm after the filling rule is improved has no incorrect filling condition, and no matter how the attacker modifies the intercepted ciphertext, the server does not output the Oracle prompt information with the wrong filling after the judgment, that is, the AES algorithm after the filling method is improved repairs the vulnerability from the source, so that the attacker cannot reversely deduce the corresponding intermediate value and plaintext, and the AES encryption algorithm based on the vulnerability fails to attack.
Vulnerability repair experimental verification
In the experiment, an Anaconda experiment environment is firstly established, pycharm software is installed, and Requests libraries, a Crypto library, a Flask library, an Http library and other Python libraries are used. And then, the original AES encryption algorithm is realized by utilizing Python language, and the vulnerability is accessed and reproduced through a browser. Finally, the process is carried out in a batch,
an improved AES algorithm based on a new plaintext block filling rule is realized by utilizing Python, and experimental results show that the improved AES algorithm avoids the generation of Oracle information from the source and successfully repairs the loophole.
Padding Oracle vulnerability reproduction of original AES algorithm
First, a webpage version encryption and decryption service starting program is run on Pycharm software. And inputs http:// 127.0.0.1. And running an original AES encryption algorithm program on Pycharm to test that the encryption and decryption can be normally completed. A total of 50 experiments were performed, wherein the plain text, cipher text and decryption results of one set of experiments are shown in table 2.
TABLE 2 original AES Algorithm encryption and decryption case
Figure RE-GDA0004018041290000071
Next, it is tested whether the PaddingOracle vulnerability of the original AES algorithm exists. And modifying the ciphertext, and giving feedback prompt information of padding error after the server decrypts the ciphertext to indicate that the original AES algorithm has the loophole.
Then, a plaintext cracking program is run. The program automatically conducts traversal modification on the ciphertext and submits the ciphertext modification result to the server, and the server can return Oracle information for different modified ciphertexts after decryption. And the program successfully decrypts the plaintext by using the prompt information, and finally the algorithm attack is realized. A set of experimental results of the original AES algorithm and its cracked plain text are shown in table 3.
TABLE 3 original AES Algorithm for plaintext decomposition
Figure RE-GDA0004018041290000081
Verification of success of AES algorithm bug repair
And running the webpage version encryption and decryption service starting program on the Pycarm software again and verifying the successful service starting on the Edge browser. And running an improved AES encryption algorithm program on software and carrying out encryption and decryption experiments on the data blocks. The improved algorithm adopts a new plaintext block filling mode, and experimental results show that the improved AES encryption algorithm can carry out normal encryption and decryption operations.
As the filling rule of the plaintext packet is modified by improving the AES algorithm, the server obtains a result of correct filling after decryption, and the ciphertext is subjected to a traversal modification experiment, the experiment result shows that the server cannot generate prompt information of Padding error during decryption, and Padding Oracle vulnerability repair is successful.
Improved key expansion algorithm implementation and analysis
Improved thought
On the one hand, the improvement idea is to start with weakening the correlation between key words. The key of a certain round is not generated by the key of the previous round alone any more, but is obtained based on the joint action of the keys of the previous two rounds. Obviously, the method for generating the new key by two rounds of keys together has weaker key word correlation than the original algorithm for generating the new key by only one round of keys, and changes the bad phenomenon that the next round of keys and the previous round of keys are deduced only by acquiring any round of keys. The idea of generating new keys by two keys increases the difficulty of an attacker in deriving the keys forwards and backwards, thereby improving the safety of the algorithm.
On the other hand, the AES key expansion algorithm has a big advantage of immediacy. The new key generated by each round of the key expansion algorithm can participate in the round key addition operation of the encryption and decryption module immediately, and the encryption and decryption operation is not required to be carried out after all keys are generated. The instantaneity enables the key expansion process and the encryption and decryption operations to be executed in parallel, which is one of the key reasons for ensuring the algorithm to be fast and efficient. Therefore, improvements to the key expansion algorithm should continue to preserve immediacy.
Description of algorithms
Combining the above two considerations, the improved key expansion algorithm consists of two parts. Round 1 Key K 1 Is generated as a first Part1, round 2 key K 2 To the last round of key K 10 Is generated as a second Part2.
Part1 is shown in fig. 3. Wherein the initial key K 0 Four words of W [0 ]]、W[1]、W[2]、W[3]Derived by a random generator. Round 1 key K 1 W4 of the first word]The initial key K is consistent with the original key expansion algorithm 0 First word of (W0)]And a fourth word W [3 ] after T function transformation]And XOR is obtained. K 1 W5 of the second word]From the previous word W4 of the round key]Is subjected to byte substitution to obtain K 1 The third word W [6 ]]From the first two words W4 of the round key]And W [5 ]]Direct XOR to obtain, K 1 The fourth word W [7 ]]From the previous word W6 of the round key]And carrying out byte substitution to obtain the target product. To this end, a first round key K 1 Four words of W4]、W[5]、W[6]、W[7]And finishing the expansion.
Wherein, the 1 st round key K 1 Four words W4]、W[5]、W[6]、W[7]The product is shown as formula (1.1).
Figure RE-GDA0004018041290000091
Part2 is shown in fig. 4. Round 2 key K 2 Four words W8]、W[9]、W[10]、W[11]From the first two rounds of keys (initial key K) 0 And a first round key K 1 ) And carrying out combined operation to obtain the product. Firstly, the 2 nd round key K is matched 2 Previous round of key K 1 Performing a line shift operation inside a round robin function to obtain K 1 ', then by K 0 First one of (1)Word W [0]And K 1 'the first word W' of [4]Direct XOR to K 2 First word W [8 ]]From K by 0 Is the second word W [1 ]]K of (A) and (B) 1 ' s second word W [5]Direct XOR to K 2 Second word of (W9)]From K by 0 W2 of the third word]K of (A) and (B) 1 ' the third word W [6 ]]Direct XOR to K 2 Third word W [10 ]]From K by 0 W3 of the fourth word]K of (A) and (B) 1 ' the fourth word W [7 ]]Direct XOR to K 2 W [11 ] of the fourth word]. To this end, round 2 key K 2 And finishing the expansion.
In the same way, the 3 rd round key K 3 Four characters W12]、W[13]、W[14]、W[15]From the first two rounds of keys (K) 1 And K 2 ) And carrying out combined operation to obtain the product. By analogy, the 10 th round key K 10 Four words of W [40 ]]、W[41]、 W[42]、W[43]From the first two rounds of keys (K) 8 And K 9 ) And carrying out combined operation to obtain the product.
Wherein, K 2 ~K 10 The generation formula of four words corresponding to each round of key is shown as (1.2), i is more than or equal to 8 and less than or equal to 43:
Figure RE-GDA0004018041290000101
wherein W' [ i-4] is shown as (4.4), i is more than or equal to 8 and less than or equal to 43:
W'[i-4]=ShiftRows(W[i-4])(1.3)
in summary, the initial key K 0 Derived from the random generator, 10 rounds of key generation are shown as (1.4).
Figure RE-GDA0004018041290000102
Pseudo code for the improved key expansion algorithm is shown in table 4.
Table 4 pseudo code for improved key expansion algorithm
Figure RE-GDA0004018041290000103
Figure RE-GDA0004018041290000111
Theoretical analysis of security of key cracking strength
The kirchhoff (Kerckhoff) principle specifies that the security of the algorithm is determined by the key of the algorithm. This principle indicates that the analyst can know the internal principles and structure of the cryptographic algorithm, but cannot crack the algorithm without the key. Improving the later key expansion algorithm weakens the correlation between round keys.
If the attacker obtains the initial key K 0 Four words of W [0 ]]、W[1]、W[2]、W[3]Then he goes through 2 32 The first round of key K can be obtained by strong cracking 1 W4 of the first word]Through K 1 W4 of]Then passes through 2 32 Guess K again 1 Second word of (W5)],K 1 The third word W [6 ]]Can be obtained from W4]And W [5 ]]Direct push out according to K 1 The fourth word W [6 ]]Through 2 32 The next guess yields W [7 ]]. Thus, a first round key K is obtained 1 Four words W4]、W[5]、W[6]、W[7]. To sum up, cracking K 0 The second round of keys requires 2 96 Next, the process is carried out.
Similarly, if the attacker obtains the first round key K 1 Four words W4]、W[5]、W[6]、W[7]Then he also passes through 2 96 The initial key K can be guessed 0 Four words of W [0 ]]、W[1]、W[2]、 W[3]. That is, cracking K 1 The previous round of keys of (2) is required 96 Next, the process is carried out. If the attacker obtains the first round key K 1 Four words of W4]、W[5]、W[6]、W[7]To break the next round of key, first 2 is needed 96 Then obtain the initial key K 0 And then further obtain K 2 To instantly crack K 1 The latter round of keys requires 2 96 Next, the process is carried out. To sum up, cracking K 1 Either the previous round of keys or the next round of keys requires 2 96 Next, the process is carried out.
If the attacker intercepts the second round key K 2 Four words W8]、W[9]、W[10]、W[11]The round key is obtained by the two rounds of keys. According to K 2 First word W [8 ]]First exhaustive guess W [0 ]](or W' [ 4]]) Further obtain W' [ 4]](or W0]) Where it is necessary 2 32 Next, the process is carried out. According to K 2 W [9 ] of the second word]First exhaustive guess W [1 ]](or W' [5 ]]) Further obtain W' [5 ]](or W1]) Here, 2 is required 32 Next, the process is carried out. According to K 2 Third word W [10 ]]First exhaustive guess W2](or W' [6 ]]) Further obtain W' [6 ]](or W2]) Here, 2 is required 32 Next, the process is carried out. According to K 2 W [11 ] of the fourth word]First exhaustive guess W3](or W' [7 ]]) Further obtain W' [7](or W3]) Here, 2 is required 32 Next, the process is carried out. Then the obtained W' 4 is subjected to secondary reaction]、W'[5]、W'[6]、W'[7]Performing reverse shift operation once to obtain K 1 Four words W4]、W[5]、W[6]、W[7]. Thus, the attacker is to pass through 2 128 The key K of the previous round can be obtained 1 . Instantly cracking K 2 The previous round of keys of (2) is required 128 Next, the process is carried out.
On the other hand, due to the second round key K 2 The first two rounds of keys of (1) are the initial key K 0 And a first round key K 1 From K we 1 The safety of the algorithm is analyzed according to the angle of a special generation mode. According to K 2 W8 of (A)]First exhaustive guess W' [ 4]]Here, 2 is required 32 Next, the process is carried out. According to K 2 W [11 ] of]First exhaustive guess W' [7 ]]Here, 2 is required 32 Next, the process is carried out. According to K 1 W' 7 of (A)]Guessing W' by reverse byte substitution [6 ]]Here, 2 is required 32 Next, the process is carried out. Finally according to K 1 W' of (1) [ 4]]And W' [6]XOR to obtain W' 5]. Then the obtained W' 4 is subjected to secondary reaction]、W'[5]、W'[6]、W'[7]Performing reverse line shift once to obtain K 1 Four words W4]、W[5]、W[6]、W[7]. From this perspective, therefore, an attacker guessing the previous round of keys still requires 2 128 Next, the process is carried out. Instantly cracking K 2 The previous round of keys of (2) is required 128 Next, the process is carried out.
If the attacker intercepts the second round key K 2 Four words W [8 ]]、W[9]、W[10]、W[11]If one wants to break the next round of key, then one first needs to go through 2 128 Then obtain K 1 Then through K 1 And K 2 To obtain K 3 . Instantly cracking K 2 The second round of keys requires 2 128 Next, the process is carried out. To sum up, cracking K 2 Either the previous round of keys or the next round of keys requires 2 128 Next, the process is carried out.
Similarly, if the key K from the third round to the tenth round is intercepted by the attacker i Four words of W4 i]、 W[4i+1]、W[4i+2]、W[4i+3]Since the key of the round is obtained by the two previous rounds of keys together, the K is cracked i Either the previous round of keys or the next round of keys requires 2 128 Next, the process is carried out.
In summary, if the attacker intercepts the first two rounds of key K 0 Or K 1 2 is needed to break the key of the previous round or the next round 96 Next, the process is carried out. If the attacker intercepts the second to tenth round keys K i Four words of W [4i ]]、W[4i+1]、W[4i+2]、W[4i+3]2 is needed to break the key of the previous round or the next round 128 Next, the process is repeated.
When an attacker intercepts different round keys, the security strength of forward guessing or backward guessing of the original key expansion algorithm and the improved key expansion algorithm is shown in table 5. Because the improved key expansion algorithm consists of two parts, the relevance between round keys is greatly weakened while the instantaneity is kept, and the time complexity of an attacker who intercepts the round keys when guessing the difficulty forwards or backwards is higher than that of the original algorithm by O (2) n ). As the AES-128 key is 128 bits in length, 2 exhaustive experiments are needed for breaking the AES algorithm by violently searching the key 128 Next, the process is carried out. Even the difficulty of the improved algorithm in the second round of key decryption and later decryption is not different from the difficulty of the exhaustive decryption of the algorithm. Therefore, the improved key expansion algorithm has higher security.
TABLE 5 comparison of the number of guesses forward or backward when the original algorithm intercepts different rounds of keys with the improved algorithm
Figure RE-GDA0004018041290000141
Time-efficient experiment of key generation
Efficiencies include time efficiency, which refers to the length of time it takes for an algorithm to execute, and space efficiency. Space efficiency refers to the amount of memory space required for the algorithm to run. Since the AES algorithm occupies a very small memory and is easy to implement on a small device, space efficiency is not discussed here, and it is crucial to discuss improving the time efficiency of the key expansion algorithm to generate 10 rounds of keys.
In terms of the time taken to perform key expansion once and generate 10 rounds of keys, the 100 comparison experiments performed in this section are shown in fig. 5, and in order to make the comparison effect more obvious, the unit of ordinate is E -13 . Wherein the 128-bit initial key of the improved key expansion algorithm and the original algorithm are generated by a random generator. The experimental result shows that the average time consumption for generating the 10 rounds of key original algorithms is 4.6694216E -8 Second, the average elapsed time for the improved algorithm is 1.9422766E -8 And second. It can be seen that the time for generating 10 rounds of keys by the improved key expansion algorithm is 2.4 times faster than that of the original algorithm.
Improved AES algorithm realization and encryption and decryption system
The Python language is the most popular development language at present, is simple and efficient, and has rich and high-quality libraries. The part adopts Python to realize the improved AES encryption algorithm for repairing the bugs and weakening the relevance between round keys, and an encryption and decryption experiment verifies the correct availability of the improved algorithm. The comparison experiment shows that the improved AES algorithm has higher safety and time efficiency. And then, an AES encryption and decryption system is realized by combining a QR code technology, a new flow of encrypting an express bill and sending and receiving an express is provided, and a test result shows that the system has complete and available functions, so that the system has high practical value and effectively protects property safety and information safety of express users.
Implementation process of improved AES algorithm
Pycharm programming software is installed at a PC (personal computer) end, anaconda is used for environment management, requests libraries, crypto libraries, flask libraries, http libraries, qrcode libraries, pyzbar libraries, PIL libraries, random libraries and other Python libraries are downloaded and used, and relevant experimental environments are shown in a table 6.
Table 6 experimental environment configuration
Figure RE-GDA0004018041290000151
And repairing the PaddingOracle vulnerability by using the proposed new filling rule, weakening the round key correlation by using the proposed improved key expansion algorithm, and realizing the improved AES encryption algorithm.
The improved AES algorithm automatically generates a 6-bit password consisting of upper and lower case letters and numbers.
Each set of input test data is: user name, phone, "big address," and detailed address information.
The AES encryption system encrypts input information by using a built-in improved AES algorithm to obtain ciphertext information, encodes the ciphertext to generate a ciphertext QR code, and completes an encryption process.
When in decryption, a tester inputs a 6-bit password in an AES decryption system.
When the input password is wrong, the software interface will output "password error! And prompting information.
When the input password is correct, the 'AES decryption system' decrypts the ciphertext QR code by using a built-in improved AES algorithm, and outputs user name, telephone, 'big address' and detailed address information in a plaintext form to finish the decryption process.
The ciphertext QR code is a two-dimensional code picture obtained by encrypting plaintext information by using an improved AES algorithm and further encoding a ciphertext, skillfully hides key information of an express user, and achieves the effect of protecting the information security of the user. The generation and identification flow of the ciphertext QR code is shown in fig. 6, an AES encryption system corresponds to the left half of the flow chart, the system encrypts private plaintext information with special meaning of an express user by using an improved AES algorithm to obtain ciphertext information which is difficult to be directly read, the ciphertext information is encoded into a QR code, and the final ciphertext QR code is obtained and printed. The 'AES decryption system' corresponds to the right half part, the ciphertext QR code is scanned, the decryption system can identify the QR code, and the ciphertext is decrypted into original plaintext information of the express user by using the key and is output.
The correctness test experiment of the improved AES algorithm is carried out on 100 groups of data, and the experimental result shows that the improved algorithm can carry out complete encryption and decryption operations on test data, wherein a ciphertext QR code generated after one group of data is encrypted is shown in FIG. 7.
Avalanche effect safety test
The avalanche effect refers to a 1-bit modification of the input data, which results in a change of around 50% of the bits of the output data value. Wherein the best effect is that exactly half of the output value changes. If the correlation of keys in each round among the key expansion algorithms is weakened to effectively resist the Square attack, the avalanche effect is the performance of measuring the strength of the AES algorithm to resist various attacks, and the idea and idea of diffusion and confusion are further embodied from the side.
The experiment stipulates that the plaintext, the secret key and the ciphertext are 128 bits respectively, comparison experiments of an original algorithm and an improved AES encryption algorithm are carried out for 100 times from two aspects of keeping a plaintext value unchanged, changing a 1b secret key value and changing a 1b plaintext value, the changing bit number condition of 100 groups of output ciphertexts is recorded, and the changing variance value of the algorithm before and after improvement is calculated. Wherein, the smaller the variance value, the closer the output variation value is to 64b, i.e. the avalanche effect is more satisfied, and the safety is higher.
Fig. 8 is a comparison graph of the change of the number of bits of the statistical output ciphertext by changing the key value of 1b each time the 128-bit plaintext value input by the original algorithm (before improvement) and the improved AES algorithm (after improvement) is kept unchanged. The cipher text change digit of the original algorithm and the improved AES algorithm is near 64b, and both accord with the avalanche effect. However, the variance of the original algorithm is 33.4564, and the variance of the improved key expansion algorithm is 32.7596. Therefore, the improved AES algorithm has higher security than the original algorithm.
Fig. 9 is a comparison graph of the change in the number of bits of the statistical output ciphertext each time the plaintext value of 1b is changed, keeping the input 128-bit key value of the pre-improvement algorithm and the post-improvement algorithm unchanged. The number of changed bits of the ciphertext before and after the improvement is about half, and the avalanche effect is satisfied. From the angle of the variance of the two algorithms, the variance of the original algorithm is 31.3779, and the variance of the improved algorithm is 25.3876. Therefore, improving the AES algorithm further improves security.
Time efficiency experiment for encryption and decryption
16B, 1KB, 2KB, 4KB and 8KB test data are subjected to encryption and decryption experiments by using the original AES algorithm and the improved AES algorithm respectively, and Table 7 shows the comparison of the encryption and decryption time consumption of the two algorithms. Through calculation, the improved AES algorithm is improved by 4.26% in encryption time consumption and 4.75% in decryption time consumption compared with the original AES algorithm. Therefore, the improved AES algorithm has higher time efficiency than the original algorithm.
TABLE 7 comparison of the encryption and decryption time consumption (unit: us) of the original algorithm and the improved AES algorithm for different plaintext lengths
Figure RE-GDA0004018041290000171
Encryption and decryption system implementation and sending and getting express delivery process analysis
When an express user needs to post an express, the user firstly arrives at a post starting point, scans a QR code by a mobile phone, enters an AES encryption system, fills in on-line and submits related information for encryption. The figure is a filling interface of the sender name, the sender telephone, the sender 'major address' and the sender detailed address. Wherein, the 'big address' refers to the address at province, city and district (county) level, and the detailed address refers to the address at the level below the district (county) level, and is detailed to the specific residential district and family house number of the user. It should be noted that the "ok back" button in the upper right corner is used when backing up couriers, as shown in fig. 10.
After the express user writes the sender information, the express user clicks the 'confirm' button, and then enters an information filling interface of the name, the telephone, the 'big address' and the detailed address of the receiver, as shown in the figure. After the recipient information is filled in, an 'encryption' button is clicked, the system starts to encrypt the related information and generates a corresponding ciphertext QR code express bill for printing and pasting, as shown in the following figure 11.
Wherein a set of test information of the addressee and the sender is shown in table 8.
Table 8 test information of addressees and senders
Figure RE-GDA0004018041290000181
After the sender submits the information, the AES encryption system can automatically generate a secret key K for encrypting all information of the receiver and an express number for uniquely identifying the express, and uploads the secret key K, the express number and all plaintext information of an express user to a background server for centralized storage. Meanwhile, the server automatically inquires and returns the town number and the town password corresponding to the recipient detailed address to the system. The AES encryption system uses the town password to encrypt the detailed address of the receiver to obtain a ciphertext QR code 1, and uses the secret key K to encrypt all privacy plaintext information of the receiver to obtain a ciphertext QR code 2.
The whole ciphertext express bill of the mailing point comprises an express company name, an express serial number, a corresponding bar code, a town serial number, a recipient 'large address', a recipient detailed address ciphertext QR code 1 and a recipient all-information ciphertext QR code 2. The recipient detailed address and all information are hidden and protected in the form of two ciphertext QR codes, as shown in FIG. 12.
The express delivery number bar code is used for updating the subsequent transportation of express deliveries. The town number marks the township to which the detailed address of the addressee belongs, so that the courier can sort the detailed address conveniently. According to the express delivery method, the clear text 'big address' (CC district (county) in BB city, AA province) of a recipient guarantees efficient transportation processing of express delivery, the ciphertext QR code 1 is located behind the 'big address', and the ciphertext QR code 2 is located at the lowest part of the whole express delivery bill. The novel encrypted express bill is simple and elegant, useful information contained in the express bill is clear at a glance, and key information is hidden in all directions.
It is worth noting that only the recipient information is provided on the express bill, and the sender information is not provided. Because the express delivery mainly depends on the address information of the addressee for transportation, the design can make the express delivery list more concise and beautiful. Even if the express involves a return operation to the original address, the courier only needs to enter the express number at the upper right of the "AES encryption system" and click on "ok return". The server searches the user information of the express according to the express number, automatically exchanges the information of the sender and the receiver, and displays the information of the new receiver (the sender of the original express) on a receiver information filling interface of an AES encryption system. As with the previous sending operation, the courier clicks an 'encryption' button, and an 'AES encryption system' generates a returned ciphertext express bill, and marks that the express is returned at the upper left corner of the express bill.
The courier prints out the new ciphertext express bill to be pasted on an express box, and the express starts to be transferred and transported based on the plaintext 'big address' of the addressee. The courier scans the bar code by using a 'bargun', and related transportation information can be synchronously updated to the background server. The flow of sending the express by the sender is shown in fig. 13.
When the express reaches the area to which the destination belongs, the couriers of all the districts reach the area distribution center, and all the express in the distribution area which is in charge of the couriers are taken away according to the town number and transported to the town express center. And scanning the ciphertext QR code 1 by a courier of the town express center by using a private decryptor (containing a town password) of the town to obtain a detailed plaintext address of an express recipient, and transporting the express to a nearby express business site according to the address. Express business office couriers scan express serial number bar codes with "bargun" and update transportation information. Meanwhile, the server automatically sends the express serial number and the secret key K to a receiver in a short message mode, and informs the receiver to take the express away in the future.
When the express reaches the area to which the destination belongs, the couriers of all the districts reach the area distribution center, and all the express in the distribution area which is in charge of the couriers are taken away according to the town number and transported to the town express center. And scanning the ciphertext QR code 1 by a courier of the town express center by using a private decryptor (containing a town password) of the town to obtain a detailed plaintext address of an express recipient, and transporting the express to a nearby express business site according to the address. Express delivery business office couriers use "baqian" to scan express delivery serial number bar code and update transportation information. Meanwhile, the server automatically sends the express serial number and the secret key K to a receiver in a short message mode, and informs the receiver to take the express away in the future.
When the express is taken, the express taking person finds the express belonging to the express at the express point according to the express serial number, and informs the secret key K to the courier. The courier scans the ciphertext QR code 2 containing all the information of the addressee on the express box by using an AES decryption system, and the decryption system can automatically fill and write the lengthy serial number into an express serial number column. The courier need only enter the 6-bit key provided by the taker into the decryption system, as shown in fig. 14.
If the secret key is wrong, the decryption system outputs prompt information of 'wrong decryption', and the courier is informed of that the courier may not be the express user himself in a phase change manner. Through this kind of mode, reduced the emergence of impersonating and drawing the express delivery phenomenon, protected express delivery user's property safety, as shown in figure 15.
If the key is correct, the decryption system will output the full plaintext information for the recipient to verify and verify the identity of the taker, as shown in FIG. 16.
The express box can be thrown away without any treatment after the user takes away the express, and only the large address is displayed as plaintext information on the express box, so that the information does not influence the information safety of the user greatly. The key privacy information of the user is hidden and protected by the ciphertext QR code, lawbreakers utilize common QR code scanning software, the identified information is the ciphertext encrypted by an improved AES algorithm, and the information security of express users is protected by the ciphertext QR code.
The whole flow of the recipient taking the express delivery is shown in fig. 17.
The invention has the beneficial effects that: the method is characterized in that the Padding Oracle vulnerability principle of the AES algorithm and the reason that the relevance between keys is too strong in the key expansion process are analyzed, the AES algorithm is improved from the aspects of vulnerability repair and key relevance weakening, the improved AES algorithm is introduced into the express industry, the privacy information of a plaintext express bill is encrypted and hidden, and property safety and information safety of express users are protected. The plaintext block filling rule of the AES algorithm is improved, the generation of filling errors is prevented fundamentally, the attack of an attacker based on Padding Oracle can not be developed, the correctness of the improved algorithm is analyzed from the theoretical perspective, the experimental result shows that the server can not generate the Oracle information after the ciphertext is modified by bit-by-bit traversal,from the experimental angle, the improved algorithm is proved to successfully repair the vulnerability, in order to weaken the correlation between the keys, the key expansion algorithm is researched and improved, wherein the random generator increases the randomness of the initial key, the latter round of key is obtained by the two rounds of keys together, the difficulty of key derivation is further increased forwards and backwards, the advantages of instantaneity, conciseness and high efficiency of the original algorithm are also kept by the XOR and row shift operation, and the theoretical analysis shows that the number of guesses required for cracking the initial key or the first round of key is 2 96 The guessing times of any round of keys in the nine rounds of keys after the key is cracked is 2 128 The method has no different exhaustion strength, and meanwhile, the experimental result shows that the improved algorithm generates 10 rounds of keys 2.4 times faster than the original algorithm, and the improved key expansion algorithm is safer and more efficient.
Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that changes, modifications, substitutions and alterations can be made in these embodiments without departing from the principles and spirit of the invention, the scope of which is defined in the appended claims and their equivalents.

Claims (6)

1. An express information encryption method based on an improved AES algorithm and a QR code is characterized by comprising the following steps:
s1: installing Pycharm programming software at a PC (personal computer) end, using Anaconda to perform environment management, downloading and using Requests library, cryptoto library, flask library, http library, qrcode library, pyzbar library, PIL library, random library and other Python libraries;
s2: repairing the Padding Oracle vulnerability by using a newly proposed filling rule, weakening the correlation of the round key by using an improved key expansion algorithm, and realizing the improvement of the AES encryption algorithm;
s3: the improved AES algorithm automatically generates a 6-bit password consisting of upper and lower case letters and numbers;
s4: each set of input test data was: user name, phone, "big address" and detailed address information;
s5: the AES encryption system encrypts input information by using a built-in improved AES algorithm to obtain ciphertext information, encodes the ciphertext to generate a ciphertext QR (quick response) code and completes an encryption process;
s6: during decryption, a tester inputs a 6-bit password in an AES decryption system;
s7: when the input password is wrong, the software interface of the AES encryption system outputs password error! "prompt information;
s8: when the input password is correct, the 'AES decryption system' decrypts the ciphertext QR code by using a built-in improved AES algorithm, and outputs user name, telephone, 'big address' and detailed address information in a plaintext form to finish the decryption process.
2. The express delivery information encryption method based on the improved AES algorithm and the QR code according to claim 1, wherein 100 groups of data are subjected to a correctness test experiment of the improved AES algorithm, and the experiment result shows that the improved algorithm can perform correct and complete encryption and decryption operations on test data.
3. The method for encrypting the express delivery information based on the improved AES algorithm and the QR code as claimed in claim 1, wherein 100 avalanche effect security comparison experiments are respectively performed on the improved AES algorithm. The plaintext, the key and the ciphertext are respectively 128 bits, avalanche effect experiments are respectively carried out from two aspects of keeping the plaintext value unchanged, changing the key value 1b and the key value 1b, changing the plaintext value 1b, changing the number of changing bits of 100 groups of output ciphertexts of the original AES algorithm and the improved AES algorithm are recorded, and changing variance values are calculated. Wherein, the smaller the variance value, the closer the variation value of the output is to 64b, i.e. the avalanche effect is more satisfied, and the safety is higher. Experimental results show that the improved AES algorithm has smaller variance value and higher safety.
4. The express delivery information encryption method based on the improved AES algorithm and the QR code as claimed in claim 1, wherein the original AES algorithm and the improved AES algorithm are used for carrying out encryption and decryption experiments on the test data of 16B, 1KB, 2KB, 4KB and 8KB, and the experiment result shows that the time consumption of the improved AES algorithm is increased by 4.26% in comparison with that of the original AES algorithm, and the time consumption of the improved AES algorithm is increased by 4.75% in comparison with that of the original AES algorithm. Therefore, the improved AES algorithm has higher time efficiency than the original algorithm.
5. The express delivery information encryption method based on the improved AES algorithm and the QR code as claimed in claim 1, wherein the AES encryption system has the functions of: receiving user (sender and receiver) plaintext information input by a sender, storing the user plaintext information in a server, automatically generating a express number and a key K for encrypting the receiver information, storing the express number and the key K in the server, encrypting a detailed address of the receiver by using a fixed 'town password' to obtain a ciphertext QR code 1, encrypting all information of the receiver by using the key K to generate a ciphertext QR code 2, determining and returning express return functions, and generating and printing an entire novel ciphertext express bill.
6. The express delivery information encryption method based on the improved AES algorithm and the QR code as claimed in claims 1 to 5, wherein the AES decryption system has the functions of: scanning and identifying the ciphertext QR code 2, automatically filling in an express number, receiving and inputting a secret key K 'provided by a receiver, decrypting the ciphertext QR code 2 by using an improved AES algorithm, judging whether the secret key K' provided by the receiver is an encryption secret key K, and outputting the plaintext information of the receiver with successful decryption or the prompt information of failure decryption.
CN202210647465.0A 2022-06-08 2022-06-08 Express information encryption method based on improved AES algorithm and QR code Pending CN115694864A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210647465.0A CN115694864A (en) 2022-06-08 2022-06-08 Express information encryption method based on improved AES algorithm and QR code

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210647465.0A CN115694864A (en) 2022-06-08 2022-06-08 Express information encryption method based on improved AES algorithm and QR code

Publications (1)

Publication Number Publication Date
CN115694864A true CN115694864A (en) 2023-02-03

Family

ID=85060479

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210647465.0A Pending CN115694864A (en) 2022-06-08 2022-06-08 Express information encryption method based on improved AES algorithm and QR code

Country Status (1)

Country Link
CN (1) CN115694864A (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105574692A (en) * 2015-12-02 2016-05-11 华南农业大学 Anonymous express information security system based on two-dimension code
MX2016001270A (en) * 2016-01-28 2017-07-27 Eduardo Diaz Lopez System and method for reading qr codes.
CN107104969A (en) * 2017-04-27 2017-08-29 山西大学 The method that the individual privacy information in express delivery is protected with dynamic encryption mechanism

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105574692A (en) * 2015-12-02 2016-05-11 华南农业大学 Anonymous express information security system based on two-dimension code
MX2016001270A (en) * 2016-01-28 2017-07-27 Eduardo Diaz Lopez System and method for reading qr codes.
CN107104969A (en) * 2017-04-27 2017-08-29 山西大学 The method that the individual privacy information in express delivery is protected with dynamic encryption mechanism

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
蔡筱箐;黄东洋;康双;尚方静;袁红刚;肖春宝;: "基于加密二维码的防伪技术研究", 科技风, no. 13, 29 April 2020 (2020-04-29) *
辜双佳: "基于AES和QR的快递加密信息加密应用", 计算机科学, 30 December 2021 (2021-12-30), pages 2 - 3 *

Similar Documents

Publication Publication Date Title
Mironov Hash functions: Theory, attacks, and applications
Clark et al. A survey of authentication protocol literature
CN111314089B (en) SM 2-based two-party collaborative signature method and decryption method
US6996712B1 (en) Data authentication system employing encrypted integrity blocks
US20080084996A1 (en) Authenticated encryption method and apparatus
US20170104584A1 (en) Construction and uses of variable-input-length tweakable ciphers
WO2005071881A1 (en) Mixnet system
JP2009531728A (en) Encryption methods for highest security applications
Goots et al. Modern Cryptography Protect your data with fast block CIPHERS
CN102073977A (en) Methods and equipment for generating and authenticating digital signatures and digital signature system
US6941461B2 (en) System and method of uniquely authenticating each replication of a group of soft-copy documents
Alfred et al. Handbook of applied cryptography
Rath et al. Cryptography and network security lecture notes
Pu et al. Post quantum fuzzy stealth signatures and applications
Xiao et al. Klepto for ring-LWE encryption
CN108234108A (en) Weak leakage efficiently takes off sequence encryption method
CN103188271A (en) Secure mail client local data storage and identification methods and devices
JP2004228916A (en) Signcryption method, its device and its program
CN115694864A (en) Express information encryption method based on improved AES algorithm and QR code
Paar et al. More about block ciphers
Cao et al. Abuse-resistant deniable encryption
JP2005114870A (en) Cryptocommunication system
US7512232B2 (en) Generation and validation of short digital signatures with implicit message embedding
Diffie et al. Privacy and Authentication: An Introduction to Cryptography
Rogaway et al. Deterministic authenticated-encryption

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination