Colorful QR code generation method and system based on AES-RSA dual encryption

By employing AES-RSA dual encryption and color QR code generation methods, the problems of insufficient information capacity and security of traditional QR codes are solved, achieving high-security and high-capacity information transmission and adapting to the complex needs of the logistics environment.

CN120915445APending Publication Date: 2025-11-07GUILIN UNIVERSITY OF TECHNOLOGY
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202511194881.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-25
Publication Date
2025-11-07

AI Technical Summary

Technical Problem

Traditional black and white QR codes have limited information capacity, insufficient security, difficulty in balancing encryption efficiency and security, poor environmental adaptability, and lack of comprehensive solutions, failing to meet the needs of large-capacity information transmission and real-time security in logistics environments.

Method used

The AES-RSA dual encryption mechanism is adopted. After data preprocessing, AES encryption and RSA encryption are combined to generate a multi-channel priority-encoded color QR code. The RGB three-channel optimized encoding strategy is used, and check codes and error correction codes are added to improve information storage capacity and security.

Benefits of technology

It significantly improves the security and capacity of information transmission, enhances the recognition capability of QR codes in harsh environments, and ensures secure key transmission and data integrity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120915445A_ABST
    Figure CN120915445A_ABST
Patent Text Reader

Abstract

The invention discloses a color QR code generation method and system based on AES-RSA dual encryption, and relates to the technical field of data encryption, and the method comprises the steps: carrying out the byte filling and segmentation of a preprocessing data package; performing AES encryption operation on each data block based on the AES key and the initialization vector to obtain a complete AES ciphertext; filling the AES key packet by adopting an OAEP filling method; encrypting the key packet filled with the OAEP by adopting an RSA public key to generate an identifier; obtaining a hybrid ciphertext packet based on the complete AES ciphertext, the key packet and the identifier; the mixed ciphertext packet is divided into three equal parts, check codes are added, three sections of mixed ciphertext data with the check codes are obtained, priority coding is carried out, and a QR code dot matrix is generated; and obtaining a final color QR code based on the color mapping function and the QR code dot matrix. According to the invention, the security of data transmission is improved, and the information capacity of data transmission is increased.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application relates to the technical field of data encryption, in particular to a color QR code generation method and system based on AES-RSA double encryption. BACKGROUND

[0002] With the popularization of mobile internet technology and smart terminals, the quick response code (QR code) has become an important carrier of information transmission and interaction, and is widely used in payment, identity verification, product traceability and many other scenarios. In the field of intelligent logistics, AGV robots usually need to scan the two-dimensional code label on the outside of the goods to realize automatic loading and unloading at stations, workbenches and shelves. However, the traditional technology has the following problems:

[0003] 1) Limited information capacity: Traditional black and white QR codes mainly use black and white modes, and the information storage capacity is insufficient, which is difficult to meet the demand of large-capacity information transmission in complex logistics environment. A standard 40 version of black and white QR code can store at most about 3KB of data, which cannot carry detailed goods attributes and complex path planning information.

[0004] 2) Insufficient security: Existing QR codes usually store information in plaintext or only use a single encryption algorithm, which has obvious defects in the face of increasingly complex network attacks. In logistics applications, once the goods information is intercepted or tampered with maliciously, it may cause significant economic losses.

[0005] 3) Difficulty in balancing encryption efficiency and security: In existing encryption technologies, symmetric encryption has the advantage of fast processing speed but has difficulty in key distribution; asymmetric encryption is safe in key management but has low processing efficiency. A single encryption scheme cannot meet the real-time and security requirements in the logistics environment.

[0006] 4) Poor environmental adaptability: QR code recognition in the logistics environment faces challenges such as unstable light and variable angles, and traditional QR codes are prone to recognition failure in poor scanning environments, affecting the running efficiency of AGV.

[0007] 5) Lack of comprehensive solutions: There are few existing technologies that effectively combine double encryption technology with color QR codes, which cannot simultaneously consider security, efficiency and information capacity.

[0008] Therefore, it is necessary to provide a color QR code generation method based on AES-RSA double encryption to solve the above problems. SUMMARY

[0009] The purpose of the present application is to provide a color QR code generation method based on AES-RSA double encryption to improve the security and capacity of information transmission.

[0010] To achieve the above object, the application provides the following scheme:

[0011] In a first aspect, the application provides a color QR code generation method based on AES-RSA double encryption, which comprises:

[0012] Preprocessing the data to be encrypted to obtain a preprocessing data packet;

[0013] Using the PKCS7 padding method, the preprocessing data packet is sequentially byte padded and segmented to obtain a data block set containing multiple data blocks of a predetermined size;

[0014] Randomly generating an AES key and an initialization vector, and performing an AES encryption operation on each data block in the data block set based on the AES key and the initialization vector to obtain complete AES ciphertext;

[0015] Randomly generating a first prime number and a second prime number, and determining an RSA public key and an RSA private key based on the first prime number and the second prime number;

[0016] Using the OAEP padding method, the AES key packet is padded to obtain an OAEP padded key packet; the AES key packet is composed of an AES key and an initialization vector;

[0017] Using the RSA public key, the OAEP padded key packet is encrypted to obtain an RSA encrypted key packet, and based on the RSA encrypted key packet, an RSA key encryption identifier is generated;

[0018] Based on the complete AES ciphertext, the RSA encrypted key packet and the RSA key encryption identifier, a hybrid ciphertext packet is obtained;

[0019] The hybrid ciphertext packet is equally divided according to the number of bytes to obtain multiple segments of hybrid ciphertext data, and a check code is added to each segment of hybrid ciphertext data to obtain multiple segments of hybrid ciphertext data with check codes;

[0020] According to the importance of data, the multiple segments of hybrid ciphertext data with check codes are respectively priority encoded to obtain multiple channels of priority encoded data;

[0021] Based on the multiple channels of priority encoded data, the QR code dot matrix of each channel is generated;

[0022] Defining a color mapping function, and based on the color mapping function and the QR code dot matrix of each channel, the final color QR code of the data to be encrypted is obtained.

[0023] In a second aspect, the application provides a color QR code generation system based on AES-RSA double encryption, which is used to implement the color QR code generation method based on AES-RSA double encryption, and comprises:

[0024] A preprocessing data packet generation unit is configured to preprocess the data to be encrypted to obtain a preprocessing data packet.

[0025] A data block set determination unit is configured to perform byte padding and segmentation on the preprocessing data packet in sequence by using a PKCS7 padding method to obtain a data block set containing a plurality of data blocks of a preset size.

[0026] A complete AES ciphertext determination unit is configured to randomly generate an AES key and an initialization vector, and perform an AES encryption operation on each data block in the data block set based on the AES key and the initialization vector to obtain complete AES ciphertext.

[0027] An RSA public key and RSA private key determination unit is configured to randomly generate a first prime number and a second prime number, and determine an RSA public key and an RSA private key based on the first prime number and the second prime number.

[0028] An OAEP padded key packet determination unit is configured to perform padding on the AES key packet by using an OAEP padding method to obtain an OAEP padded key packet; the AES key packet is composed of the AES key and the initialization vector.

[0029] An identifier generation unit is configured to encrypt the OAEP padded key packet by using the RSA public key to obtain an RSA encrypted key packet, and generate an RSA key encryption identifier based on the RSA encrypted key packet.

[0030] A hybrid ciphertext packet determination unit is configured to obtain a hybrid ciphertext packet based on the complete AES ciphertext, the RSA encrypted key packet, and the RSA key encryption identifier.

[0031] A ciphertext splitting unit is configured to equally divide the hybrid ciphertext packet according to the number of bytes to obtain a plurality of segments of hybrid ciphertext data, and add a check code to each segment of hybrid ciphertext data to obtain a plurality of segments of hybrid ciphertext data with check codes.

[0032] A priority encoding unit is configured to perform priority encoding on the plurality of segments of hybrid ciphertext data with check codes according to the importance of the data to obtain multi-channel priority encoded data.

[0033] A QR code lattice generation unit is configured to generate a QR code lattice for each channel based on the multi-channel priority encoded data.

[0034] The color QR code generation unit is configured to define a color mapping function and obtain a final color QR code of the data to be encrypted based on the color mapping function and a QR code dot array of each channel.

[0035] According to the embodiments provided in the application, the following technical effects are achieved.

[0036] The application discloses a color QR code generation method and system based on AES-RSA double encryption. BRIEF DESCRIPTION OF DRAWINGS

[0037] In order to more clearly illustrate the technical solutions in the embodiments of the application or the prior art, the following will briefly introduce the drawings needed in the embodiments. Obviously, the drawings in the following description are only some embodiments of the application, and for those skilled in the art, other drawings can be obtained from these drawings without creative labor.

[0038] Figure 1 The application provides a color QR code generation method based on AES-RSA double encryption. DETAILED DESCRIPTION

[0039] The technical solutions in the embodiments of the application will be described clearly and completely below with reference to the drawings in the embodiments of the application. Obviously, the described embodiments are only some of the embodiments of the application, not all the embodiments. Based on the embodiments in the application, all other embodiments obtained by those skilled in the art without creative labor fall within the protection scope of the application.

[0040] In order to make the above purposes, features and advantages of the application more obvious and easy to understand, the application will be further described in detail below with reference to the drawings and specific embodiments.

[0041] In an exemplary embodiment, as shown in Figure 1 A color QR code generation method based on AES-RSA double encryption is provided, including the following steps. Wherein:

[0042] Step S1, pre-processing the data to be encrypted to obtain a pre-processed data packet.

[0043] As an optional implementation, step S1 specifically includes:

[0044] Step S1-1, encrypting the data D original Step S1-2, performing type recognition on the data D raw .

[0045] Step S1-2, performing type recognition on the data D encode .

[0046] Step S1-3, performing type recognition on the data D compressed , and calculating the compression ratio based on the gzip compressed data and the standard encoded data.

[0047] Specifically, the formula for calculating the compression ratio is:

[0048]

[0049] where CR is the compression ratio, |C| is the size of the zip compressed data, and |O| is the size of the standard encoded data.

[0050] The purpose of calculating the compression ratio is to make adaptive decisions and capacity planning.

[0051] (1) Adaptive switch and parameter adjustment: when CR≤0 or lower than the preset threshold, gzip compression can be skipped or the gzip level can be reduced to avoid data expansion and additional delay.

[0052] (2) Capacity planning input: the size of the compressed data is directly used as the basis for selecting the QR version number Vqr and the error correction level Lec in the subsequent step.

[0053] (3) Guidance channel and redundancy configuration: provide the basis for subsequent step three channel allocation and redundancy setting.

[0054] (4) Running and auditing indicators: as Meta / log fields, support subsequent tuning and traceability.

[0055] Step S1-4, when the corresponding compression ratio is greater than the preset compression threshold, adding a data integrity check code to the gzip compressed data to generate a SHA-256 checksum.

[0056] Specifically, the gzip compressed data D compressed is added with a data integrity check code to generate a SHA-256 checksum, as shown in formula (2):

[0057]

[0058] wherein D compressed is the data to be processed; D i is the ηth 512-bit message block obtained by dividing the padded data; n blk is the number of message blocks obtained after padding; f is an abstract representation of SHA-256 compression of the block D η and linking with the intermediate state.

[0059] Step S1-5, merging the gzip compressed data and the SHA-256 checksum to obtain the preprocessed data packet D preprocessed .

[0060] By standardizing the original cargo information (data to be encrypted D original ), the efficiency and security of subsequent processing are improved. By type identification, appropriate encoding strategies are ensured for different data, by compression algorithm, the data volume is reduced, and by SHA-256 check, the data integrity is ensured, and finally a structured preprocessed data packet is formed.

[0061] Step S2, using the PKCS7 padding method, sequentially performing byte padding and division on the preprocessed data packet to obtain a data block set containing multiple data blocks of a predetermined size.

[0062] Specifically, the AES-CBC mode is selected and the PKCS7 padding scheme is set to meet the padding requirements of formula (3), and the padding scheme P scheme is output, the preprocessed data packet D preprocessed is padded according to the padding scheme P scheme , and then divided into fixed-size data blocks P i , each block size is 16 bytes, and the data block set P i is output, the padding scheme P scheme is as follows:

[0063]

[0064] wherein D pad represents the padded data; B val represents the value of the padding byte, and the calculation method is B val =B size -(|D preprocessed |modB size ); wherein |D preprocessed | represents the byte length of the preprocessed data packet; B sizerepresents the size of the encryption block (16 bytes); || represents the byte connection operation; val in the subscript represents "value", size represents "size", and pad represents "padding".

[0065] Step S3, randomly generating an AES key K AES and an initialization vector IV init , and performing an AES encryption operation on each data block in the data block set based on the AES key and the initialization vector, to obtain complete AES ciphertext.

[0066] Specifically, step S3-1, performing AES-CBC encryption on each data block according to formulas (4) and (5) to output a ciphertext data block set C i :

[0067] C blk_0 = IV init (4)

[0068]

[0069] wherein P blk_i represents the i-th data block in the data block set, C blk_i represents the i-th ciphertext data block, blk in the subscript represents "block", and i represents the index number of the block; represents a bitwise XOR operation; represents an AES encryption operation using the key K AES .

[0070] Step S3-2, merging all the encrypted data blocks in the ciphertext data block set C blk_i to form complete AES ciphertext C full =C blk_1 |C blk_2 ||...||C blk_n .

[0071] The AES encryption is responsible for efficient symmetric encryption of the preprocessed data packet, uses the AES-256 encryption algorithm and the CBC working mode, combines the randomly generated initialization vector, ensures that even the same plaintext will produce different ciphertexts, effectively prevents statistical analysis attacks. At the same time, the AES encryption is fast and suitable for processing a large amount of data. In addition, the AES-256 can be replaced by the ChaCha20 algorithm, and the AES-CBC mode can be replaced by the AES-GCM mode to provide authentication encryption features.

[0072] Step S4, randomly generating a first prime number and a second prime number, and determining an RSA public key and an RSA private key based on the first prime number and the second prime number.

[0073] As an optional implementation, step S4 specifically includes:

[0074] Step S4-1: Randomly generate a first prime number and a second prime number, and calculate the RSA modulus based on the first prime number and the second prime number.

[0075] Specifically, a cryptographically secure random number generator is used to generate two independent 1024-bit strong prime numbers: the first prime number P prime Second prime number Q prime (Through multiple rounds of primality testing, ensure P) prime ≠Q prime (and is coprime with the subsequent public key exponent).

[0076] Then calculate the RSA modulus N. mod :

[0077] N mod =P prime ×Q prime (6)

[0078] Where N_mod represents the RSA modulus.

[0079] Step S4-2: Based on the first and second prime numbers, calculate the Euler's totient function corresponding to the RSA modulus. Euler's totient function φ(N) mod The calculation is as follows:

[0080] φ(N mod )=(P prime -1)×(Q prime -1) (7)

[0081] Step S4-3: Select the public key exponent based on the Euler's totient function corresponding to the RSA modulus, and determine the private key exponent based on the public key exponent and the Euler's totient function corresponding to the RSA modulus.

[0082] Specifically, the RSA public key exponent E is selected. pub =65535 (or any of the following conditions must be met) and The value of is given in formula (8):

[0083] E pub ×D priv ≡1(modφ(N mod ))(8)

[0084] in, E represents pub and The greatest common divisor; if Then E is called pub and Mutual elements.

[0085] Calculate the RSA private key exponent Dpriv :

[0086]

[0087] The meaning of formula (8) is to express E under the modulus pub and D priv are the multiplicative inverses of each other, and the equivalent expression is as formula (9), and the condition is: only if the inverse element exists, which ensures the correctness of RSA.

[0088] Step S4-4, based on the RSA public key exponent and the RSA modulus, determine the RSA public key, and based on the RSA private key exponent and the RSA modulus, determine the RSA private key.

[0089] Output the RSA public key (E pub , N mod ) and the RSA private key (D priv , N mod ), generate an RSA-2048-bit key pair (E pub , D priv , N mod ), and store the private key securely.

[0090] Step S5, use the OAEP padding method to pad the AES key package to obtain the OAEP padded key package; the AES key package KeqPackage is composed of the AES key and the initialization vector.

[0091] Specifically, use the OAEP padding method to process the AES key package according to formula (10), and output the OAEP padded key package KeyPackage OAEP :

[0092]

[0093] Wherein, KeqPkg represents the AES key package; KeyPkg OAEP represents the OAEP padded key package; G and H are hash functions; R rand represents a random number.

[0094] Step S6, use the RSA public key to encrypt the OAEP padded key package to obtain the RSA encrypted key package, and generate an RSA key encryption identifier based on the RSA encrypted key package.

[0095] Specifically, use the RSA public key to encrypt the OAEP padded key package according to formula (11), and output the RSA encrypted key package E key :

[0096]

[0097] Generate RSA Key Encryption Identifier Key ID For: Key ID = H(E key ) first 8 bytes, H represents a hash function, which is the same as the SHA-256 hash function used in step S1-4, used to map input data of arbitrary length to output value of fixed length.

[0098] RSA Key Protection is responsible for asymmetrically encrypting the AES key and initialization vector, solving the problem of secure transmission of the key. Using RSA-2048 algorithm, combined with OAEP padding mechanism to enhance security, to ensure the confidentiality of the AES key. Even if transmitted over an insecure communication channel, attackers cannot obtain the AES key, thereby ensuring the security of the entire encryption system. In addition, RSA-2048 can be replaced by an elliptic curve encryption algorithm, reducing the key length while maintaining the same security strength.

[0099] Step S7, based on the complete AES ciphertext, the RSA encrypted key package and the RSA key encryption identifier, obtains the hybrid ciphertext package.

[0100] As an optional implementation, step S7 specifically includes:

[0101] Step S7-1, Base64 encodes the complete AES ciphertext to obtain the Base64 encoded ciphertext B64(C). The Base64 encoded ciphertext B64(C) is as follows:

[0102] B64(C) = Base64_Encode(C full )(12)

[0103] Step S7-2, Base64 encodes the RSA encrypted key package to obtain the Base64 encoded key package B64(E key ).

[0104] Step S7-3, create a metadata header, and based on the metadata header, the RSA key encryption identifier, the Base64 encoded ciphertext and the Base64 encoded key package, generate a structured data package D structured according to the preset data structure; the metadata header Meta includes version information, timestamp and security identifier.

[0105] Step S7-4, convert the structured data package to JSON format to obtain the hybrid ciphertext package M.

[0106] Step S8: Divide the mixed ciphertext packet into multiple segments according to the number of bytes to obtain multiple segments of mixed ciphertext data, and add a checksum to each segment of mixed ciphertext data to obtain multiple segments of mixed ciphertext data with checksums.

[0107] Specifically, the mixed ciphertext M is divided into three parts according to formulas (13), (14), and (15), and the mixed ciphertext data M with a checksum is output in channel R. r G channel mixed ciphertext data with checksum M g Channel B contains mixed ciphertext data M with a checksum. b as follows:

[0108]

[0109] Where |M| is the total number of bytes in the mixed ciphertext.

[0110] Add an independent CRC checksum to each data segment. r CRC g CRC b Calculated according to formula (16), the output data with checksum (M) is calculated. r CRC r ), (M g CRC g ), (M b CRC b ):

[0111]

[0112] Among them, CRC(M) q M is the cyclic redundancy check code for channel q; q [μ] represents the channel q data M. q The μ-th element, q = {r, g, b}, L q Let n be the length of the sequence (number of elements, in bytes; if implemented bitwise, n is the number of bits), p be the polynomial indeterminate element, and G(p) be the CRC generator polynomial.

[0113] Encrypted data and encryption keys are combined into a unified hybrid ciphertext package. Base64 encoding ensures secure data transmission across various systems, metadata provides version control and security verification, and a standardized JSON format facilitates subsequent processing and parsing. This entire unit achieves secure binding of data and keys, preparing for subsequent channel separation.

[0114] Step S9: According to the importance of the data, perform priority encoding on the multiple segments of mixed ciphertext data with check codes to obtain multi-channel priority-encoded data.

[0115] As an optional implementation, step S9 specifically includes:

[0116] Step S9-1, 8 bits / pixel encoding depth is allocated to the R channel, and the most important high-priority data is stored to the R channel, and a high level of data redundancy is set for the R channel; the high-priority data includes RSA key encryption identifier, metadata header and key control information. It is ensured that the high-priority data can be recovered preferentially in a harsh environment.

[0117] Step S9-2, 8 bits / pixel encoding depth is allocated to the G channel, and the medium-priority data with medium importance is stored to the G channel, and a medium level of data redundancy is set for the G channel; the medium-priority data includes encrypted data and auxiliary control information. The medium-priority data belongs to secondary but still important information.

[0118] Step S9-3, 8 bits / pixel encoding depth is allocated to the B channel, and the low-priority data with the lowest importance is stored to the B channel, and a low level of data redundancy is set for the B channel; the low-priority data includes a supplementary part of the encrypted data. The low-priority data belongs to a tolerable part of lost data.

[0119] Step S9-4, the data stored in the R channel, the G channel and the B channel is subjected to bit interleaving processing, and the multi-channel priority encoded data is obtained. The burst error resistance is improved.

[0120] The priority division strategy ensures that in a harsh environment such as uneven illumination and partial contamination, even if the complete data cannot be recovered, the most critical information can be ensured not to be lost, so as to maintain the basic function of the system. In addition, the RGB three channels can be extended to the CMYK four channels, further improving the data capacity; HSV color space can be used instead of RGB to improve the recognition rate under different illumination conditions; the transparency channel can be introduced as the fourth channel to increase the information dimension.

[0121] Step S10, based on the multi-channel priority encoded data, the QR code dot matrix of each channel is generated.

[0122] As an optional implementation, step S10 specifically includes:

[0123] Step S10-1, Reed-Solomon code is added to the priority encoded data of each channel, and the multi-channel data with error correction code is obtained. Reed-Solomon code can be replaced by Low-Density Parity-Check (LDPC) code to improve the anti-interference ability; or Turbo code is used as an alternative to further improve the error correction performance.

[0124] Specifically, the optimized encoded data E rThe data E of the G channel after optimized encoding g The data E of the B channel after optimized encoding b Add Reed-Solomon code, calculate according to formula (17):

[0125] RS(p)=M q (p)p t C(M q (p)p t )modG RS (p)(17)

[0126] Wherein, RS(p) is the polynomial expression after adding Reed-Solomon code; M q (p) is the data polynomial expression of channel q (E r , E g or E b ); p is an indefinite element; t is the error correction capability (indicating the number of symbol errors that can be corrected, which is set to different values for R, G and B channels respectively, and the highest value is taken for R channel), G RS (p) is the Reed-Solomon code generating polynomial.

[0127] Step S10-2, based on the error-corrected data of each channel, generate a binary data matrix of each channel by using a preset arrangement mode. That is, based on the error-corrected data RS r , RS g , RS b of three channels, generate three independent binary data matrices D r , D g , D b .

[0128] As an optional implementation, step S10-2 specifically includes:

[0129] Step S10-2-1, respectively, carry out byte-to-bit expansion conversion on the error-corrected data of each channel to obtain a bit sequence of multiple channels. Each byte is converted into 8 bits.

[0130] Step S10-2-2, according to the preset data capacity requirement of QR code, calculate the required matrix dimension of each channel, and determine the corresponding initial matrix. According to the data capacity requirement of QR code, calculate the required matrix dimension n×n of each channel, so that n 2 ≥ the bit length of the data of the respective channel.

[0131] Step S10-2-3, fill the bit sequence of the R channel into the corresponding initial matrix in a zigzag arrangement to form a binary data matrix of the R channel. The zigzag arrangement is to snake from the top left corner first to the right and then down to fill the bit sequence into the n*n matrix to form the binary data matrix D of the R channel r .

[0132] Step S10-2-4, fill the bit sequence of the G channel into the corresponding initial matrix in an N-shaped arrangement to form a binary data matrix of the G channel. The N-shaped arrangement is to zigzag from the top left corner first down and then up to fill the bit sequence into the n*n matrix to form the binary data matrix D of the G channel g .

[0133] Step S10-2-5, fill the bit sequence of the B channel into the corresponding initial matrix in a spiral arrangement to form a binary data matrix of the B channel. The spiral arrangement is to fill from the outside to the inside to fill the bit sequence into the n*n matrix to form the binary data matrix D of the B channel b .

[0134] For the positions in the matrix that are not filled with data, fill in the redundant bits of the error correction code or a specific padding mode.

[0135] Step S10-3, determine the optimal QR code version and error correction level according to the total data amount of the binary data matrix of the multi-channel. In addition, deep learning technology can be introduced to adaptively optimize the QR code generation parameters.

[0136] Specifically, according to the total data amount, determine the optimal QR code version V qr and the error correction level L ec , calculate according to formula (18), and output the optimal QR code version V qr and the error correction level L ec :

[0137] V qr =min{j|C(j,L ec )≥|D r |+|D g |+|D b |}(18)

[0138] Where V qr represents the optimal QR code version number (value range 1-40); j represents the candidate value of the version number; L ec represents the error correction level (L, M, Q, H four levels L level); C(j,L ec ) represents the maximum data capacity (unit: bit) of version j at error correction level L ec ; |Dr |、|D g |、|D b | respectively represent the bit number of the binary data matrix of the red, green and blue channel; min{} represents the minimum j value that makes the inequality true.

[0139] Step S10-4, generating the QR code dot matrix of each channel based on the optimal QR code version, the error correction level and the binary data matrix of each channel.

[0140] As an optional implementation, step S10-4 specifically includes:

[0141] Step S10-4-1, determining the size of the module matrix based on the optimal QR code version. The size S of the module matrix is determined as follows: m = 17 + 4V qr , where V qr ∈ [1, 40].

[0142] Step S10-4-2, creating a blank dot matrix matrix with the same size as the module matrix for each channel, and adding the positioning pattern, the alignment pattern and the timing pattern at the fixed positions of each blank dot matrix matrix to obtain the dot matrix matrix after adding the patterns for each channel.

[0143] Specifically, a blank dot matrix matrix with the size of S m × S m is created for each channel, and the positioning pattern, the alignment pattern and the timing pattern are added at the fixed positions of the three dot matrices according to the QR code specification.

[0144] Step S10-4-3, calculating the mask of each channel based on the binary data matrix of each channel by using the mask transformation function.

[0145] Specifically, the binary data matrix D r , D g , D b of each channel is applied to the mask transformation function M mask (i, j) to calculate the corresponding mask according to the formulas (19), (20) and (21):

[0146]

[0147] where M mask_r , M mask_g , M mask_b are the mask patterns of the three channels, which are defined as:

[0148] M mask_r (i, j) = (i + j) mod 2 (22)

[0149] M mask_g(i,j) = (i x j) mod 2 (23)

[0150] M mask_b (i,j) = ((i x j) + (i + j)) mod 2 (24)

[0151] Step S10-4-4, encode and add the format information and the version information to the specified position of the QR code, and respectively perform the best mask pattern evaluation on the multiple channels to select the best mask pattern; the format information is determined based on the error correction level. The mask pattern is selected to make the QR code most readable.

[0152] wherein the format information FI is composed of the error correction level L ec and the mask pattern index m: first map L ec to two-bit b_ec∈{01(L), 00(M), 11(Q), 10(H)}, and three-bit mask index b m are concatenated to 5-bit (b m is the three-bit binary coding of the mask index m, which is compatible with the QR standard and convenient for extension), and is encoded by BCH(15, 5) and is bitwise XORed with the specified mask R to obtain 15-bit FI q (L ec , m q ), which are respectively written into the format information area of the three channels; the version information VI is only written when V qr ≥ 7, and is encoded by BCH(18, 6) to obtain 18-bit VI (V qr ), which is written into the two version information areas specified by the standard. BCH(18, 6) represents the BCH encoding with the total code length of 18 bits and the information bit length of 6 bits, which is used for error correction encoding of the version information VI.

[0153] Respectively perform the best mask pattern evaluation on the three channels to obtain m r , m g and m b , and respectively update the format information FI r (L ec , m r ), FI g (L ec , m g ) and FI b (L ec , m b ) according to the same.

[0154] wherein FI q represents the “format information” (length 15 bits) of the qth channel, which is composed of the error correction level L ec and the mask index m qcompositions, encoded by BCH (15, 5) and XORed with a prescribed mask R; wherein FI r is the red channel format information, FI g is the green channel format information, FI b is the blue channel format information. The version information VI is an independent field, written only when V qr ≥ 7, sharing the same version number V qr with the three channels. Wherein, BCH (15, 5) represents a BCH encoding with a total code length of 15 bits and an information bit length of 5 bits, used for error correction encoding of the format information FI.

[0155] Step S10-4-5, generating the QR code dot matrix of each channel based on the binary data matrix of each channel, the dot matrix after adding the pattern of each channel, and the optimal mask mode.

[0156] Outputting the QR code dot matrixes Q r , Q g and Q b of the three channels.

[0157] By distributing the mixed ciphertext to the RGB three channels, the information storage capacity is greatly improved. According to the importance of data, intelligent allocation is performed to ensure that critical information is given priority protection. By adding independent check codes and Reed-Solomon error correction codes, the anti-interference ability and recovery ability of data are significantly enhanced, so that the color QR code can still be reliably identified in harsh environments.

[0158] Step S11, defining a color mapping function, and obtaining the final color QR code of the encrypted data based on the color mapping function and the QR code dot matrix of each channel.

[0159] As an optional implementation, in step S11, based on the color mapping function and the QR code dot matrix of each channel, the final color QR code of the encrypted data is obtained, specifically including:

[0160] Step S11-1, merging to generate a color QR code based on the color mapping function and the QR code dot matrix of each channel.

[0161] The expression of the color mapping function F is as follows:

[0162] F(b r ,b g ,b b ) = (γ r ·b r , γ g ·b g , γ b ·b b ) (25)

[0163] Wherein, br , b g , b b is a binary bit value (0 or 1), γ r , γ g , γ b is a gain factor of three channels.

[0164] The formula (26) is applied to combine the three channels of QR code dot matrix to form a color QR code QR color as follows:

[0165] QR color (i,j) = F(Q r (i,j), Q g (i,j), Q b (i,j))(26)

[0166] wherein (i,j) is a pixel point coordinate.

[0167] Step S11-2, an enhanced positioning pattern and an alignment mark are added to the color QR code to obtain a QR code with a positioning pattern.

[0168] The enhanced positioning pattern satisfies the pattern rule of formula (27), and an output QR code QR aligned with a positioning pattern is obtained:

[0169]

[0170] Step S11-3, color correction is performed on the QR code with a positioning pattern to obtain a color-corrected QR code, and a digital watermark is added to the color-corrected QR code to obtain a final color QR code of the to-be-encrypted data.

[0171] Specifically, a color correction algorithm is applied, and the RGB value of the QR code with a positioning pattern is adjusted according to formula (28):

[0172] RGB corrected (i,j) = M corrected × RGB QR_aligned (i,j)(28)

[0173] wherein M corrected is a 3×3 color correction matrix.

[0174] The color-corrected QR code M corrected is added with a digital watermark W, embedded according to formula (29), and an output final color QR code QR watermarked is:

[0175] QR watermarked = QR corrected + α· W(29)

[0176] Where α is the watermark strength coefficient; W is the digital watermark pattern, which is a two-dimensional matrix of the same size as the QR code, containing a specific invisible pattern used to verify the authenticity and integrity of the QR code.

[0177] The method for generating the digital watermark W is as follows:

[0178] (a) Generate a pseudo-random sequence P based on the key K.

[0179] (b) Transform the pseudo-random sequence P into a two-dimensional matrix with the same size as the QR code.

[0180] (c) The watermark is embedded in the frequency domain by using Discrete Wavelet Transform (DWT) to ensure visual invisibility.

[0181] (d) The watermark intensity coefficient α is adaptively adjusted according to the local characteristics of the QR code image. α is smaller in the edge region and larger in the smooth region.

[0182] The three-channel data is converted into high-quality color QR code images. An optimized color mapping scheme maximizes the differentiation between channels, enhanced positioning patterns improve the scanning recognition rate, color correction ensures stable performance under different lighting conditions, and digital watermarking adds an extra layer of security verification. This allows the color QR code to simultaneously possess high information density and high recognition rate.

[0183] In addition, neural networks can be used to replace traditional image processing algorithms for color QR codes in image preprocessing.

[0184] Furthermore, the corresponding decryption process is described below.

[0185] Step S12: Capture a color QR code using a dedicated scanning application as the original image I to be decrypted.

[0186] Step S13: Perform image preprocessing on the original image I to be decrypted, including denoising, color correction, and perspective transformation, satisfying formula (30), and output the corrected image I. corrected :

[0187] I corrected =T(I)(30)

[0188] Where T is the combined transformation matrix.

[0189] Step S14: Convert the corrected image I obtained in step S13 into a single image. corrected Separate RGB three-channel data I r I g I b The QR code is then binarized according to formula (31) and the corresponding binarized QR code Q′ is output. r Q′ gq' b :

[0190]

[0191] wherein, I q (i,j) represents the pixel value of the pre-processed image at coordinate (i,j) in channel q, with a value range of [0, 255]; θ q is the binary threshold of channel q, which is a critical value for converting the image from grayscale to binary, and the specific value is dynamically determined according to the characteristics of different channels:

[0192] (1) For R channel, θ r is calculated by Otsu adaptive threshold method, which automatically determines the optimal segmentation threshold according to the distribution histogram of R channel pixel values.

[0193] (2) For G channel, θ g is the weighted sum of the median of the image G channel and the local contrast.

[0194] (3) For B channel, θ b is 0.85 times the average value of B channel.

[0195] Step S15: Based on the binary QR code Q' r , Q' g , Q' b , use Reed-Solomon decoding to recover the original data, detect and correct errors according to formula (32), and output the recovered data D' r , D' g , D' b :

[0196]

[0197] wherein, S u is the companion formula (also known as the coefficient of the syndrome or companion polynomial), which is used to detect and locate the error position in the Reed-Solomon code; r v is the received polynomial coefficient, representing the received data sequence that may contain errors; a is a primitive element in the finite field GF(2 8 ); n RS is the codeword length; the value of u ranges from 1 to 2t, and t is the error correction capability.

[0198] Step S16: Based on the recovered data D' r , D' g , D' b obtained in step S15, merge the three-channel decoding results D' r , D' g , D'b , reconstruct the hybrid ciphertext package M', this step completes the conversion from the QR code multi-channel data to the original hybrid ciphertext package, the specific implementation process is as follows:

[0199] (1) First, the recovered three-channel data D' r , D' g , D' b respectively inverse matrix rearrangement:

[0200] a) According to the inverse order of the zigzag arrangement, the R channel data D' r is extracted.

[0201] b) According to the inverse order of the N-shaped arrangement, the G channel data D' g is extracted.

[0202] c) According to the inverse order of the spiral arrangement, the B channel data D' b is extracted.

[0203] (2) Convert the rearranged three-channel binary data back to byte sequence to get RS'r, RS'g, RS'b:

[0204] a) Combine every 8 consecutive bits into a byte.

[0205] b) Remove the redundant check bits added in the Reed-Solomon decoding process to obtain E r , E g , E b .

[0206] (3) According to the three-channel priority encoding rule set in step S9, perform decoding operation:

[0207] a) Perform deinterleaving processing on the high-priority R channel data E r .

[0208] b) Perform deinterleaving processing on the medium-priority G channel data E g .

[0209] c) Perform deinterleaving processing on the ordinary-priority B channel data E b .

[0210] (4) Extract and verify the CRC check code of each channel:

[0211] a) Separate the data part M' r and the check code CRC' r from E r .

[0212] b Separate the data part M' g from E gand check code CRC' g .

[0213] c) from E b separate data part M' b and check code CRC' b .

[0214] d) Calculate the CRC value of M' r , M' g , M' b respectively using formula (16), and compare with the corresponding CRC' r , CRC' g , CRC' b , verify data integrity.

[0215] (5) Reassemble the mixed ciphertext package M' according to the original segmentation ratio:

[0216] a) Merge M' r , M' g , M' b according to the reverse operation in step S8:

[0217] M' = M'_r||M'_g||M'_b b (33)

[0218] b) Verify whether the length of the reassembled mixed ciphertext package M' is consistent with the length of the mixed ciphertext package M output in step S7-4.

[0219] c) If there is partial loss or damage in the transmission process of the data of the three channels but has been corrected, the system will give priority to guarantee the integrity of the R channel data, followed by the G channel, and finally the B channel, which ensures that the most critical information can be recovered first.

[0220] (6) Parse the reconstructed mixed ciphertext package M' into JSON format, and prepare for subsequent data integrity verification and decryption operations.

[0221] Step S17: Based on the mixed ciphertext package M', verify the data integrity, check the CRC check code, and output the verification result V and the valid data M valid ; The specific implementation process is as follows:

[0222] (1) Parse the JSON structure of the mixed ciphertext package M', and extract the following components:

[0223] a) Meta' data header.

[0224] b) Key identifier Key ID '.

[0225] c) Base64 encoded key package B64(Ekey )'.

[0226] d) Base64 encoded ciphertext B64(C)'.

[0227] (2) Perform integrity verification on each extracted component:

[0228] a) Verify that the metadata header Meta' format is correct, version information, timestamp and security identifier are valid.

[0229] b) Verify that the key identifier Key ID ' length is expected to be 8 bytes.

[0230] c) Base64 decode B64(E key )' and B64(C)' to get E key ' and C'.

[0231] d) Calculate the first 8 bytes of the hash value of E key ' and verify if it matches Key ID '.

[0232] (3) Perform overall data consistency check:

[0233] a) Verify that the data structure format defined in step S7-3 is maintained.

[0234] b) Check the reasonableness of the association between fields, such as whether the version number in the metadata is compatible with the data format.

[0235] c) Verify that the JSON format is complete and intact, and all necessary fields exist.

[0236] (4) Generate verification result V, containing the following information:

[0237] a) Verification status code Status: indicates the result of data verification (success, partial success or failure).

[0238] b) Integrity score Integritq_Score: a value between 0 and 100, indicating the percentage of data integrity;

[0239] c) Damage field identifier Damage_Flags: indicates the possible damaged or incomplete data fields.

[0240] d) Verification timestamp Verification_Time: records the time of the verification operation.

[0241] (5) According to the verification result V, generate valid data M valid .

[0242] a) If the verification is completely successful (Status = "success" and Integritq_Score = 100), then M valid is equivalent to the complete M'.

[0243] b) If the verification is partially successful (Status = "partial" and Integritq_Score > threshold), then M valid contains all recoverable valid parts and marks the non-recoverable parts as null or alternative values.

[0244] c) If the verification fails (Status = "failed" or Integritq_Score < threshold), then M valid contains only the possible valid core data fields (mainly high-priority data in the R channel).

[0245] d) For any case, the original verification result V is attached to M valid as part of the metadata, so that the subsequent processing can understand the reliability and integrity status of the data.

[0246] Step S18: Based on the valid data M valid obtained in step S17, extract the encryption key E key and the encrypted data C' from the hybrid ciphertext package, output E key and C', the specific implementation process is as follows:

[0247] (1) Parse the JSON structure of the valid data M valid , according to the data structure format defined in step S7-3, extract the following key fields:

[0248] a) Get the Base64 encoded key package field B64(E key )'.

[0249] b) Get the Base64 encoded ciphertext field B64(C)'.

[0250] (2) Decode the extracted Base64 encoded data:

[0251] a) Decode B64(E key )' using the standard Base64 decoding algorithm to obtain the encryption key E key in binary form:

[0252] E_keq = Base64_Decode(B64(E key )') (34)

[0253] b) Decode B64(C)' using standard Base64 decoding algorithm to obtain encrypted data C' in binary form: C' = Base64_Decode(B64(C)').

[0254] (3) Verify the integrity and format correctness of the extracted data:

[0255] a) Check the length of E key to conform to the output length of RSA-2048 encryption (256 bytes).

[0256] b) Confirm that the length of C' is an integer multiple of 16 bytes, conforming to the block size requirement of AES-CBC encryption.

[0257] c) If any format abnormalities are found, record error information and take compensatory measures.

[0258] (4) Data processing optimization:

[0259] a) Apply memory alignment optimization to E key to ensure efficient RSA decryption operations.

[0260] b) Buffer C' for subsequent parallel decryption processing.

[0261] (5) Output processing results:

[0262] a) Transfer E key to the RSA private key decryption processor in step S19.

[0263] b) Temporarily store C' in a secure memory area, waiting for the AES decryption key preparation to be completed and then transferred to step S21.

[0264] c) Record the metadata information of E key and C', including size, format version, etc., for subsequent processing.

[0265] Step S19: Take the encrypted key E key obtained in step S18 and the RSA private key (D priv , N mod ) obtained in step S4-4 as input, use the RSA private key decryption key package, and calculate according to formula (35) to obtain the padded key package KeyPackage OAEP :

[0266]

[0267] where D priv is the RSA private key exponent, which is the private part of the RSA key pair generated in step S4-4; D priv and Nmod Together they form the RSA private key, which is used to verify the previously used public key (E). pub N mod Decrypt the encrypted data.

[0268] Step S20: Based on the padded KeyPackage OAEP Extract the AES key K from KeqPackage AES and IV init The specific implementation process is as follows:

[0269] (1) Remove OAEP padding:

[0270] a) Reverse process KeyPkg according to the OAEP filling mechanism used above. OAEP The specific operating steps are as follows:

[0271] 1. Add KeyPkg OAEP It is decomposed into two parts: EM = h||k, where h is the main data part and k is the random number hash part.

[0272] 2. Calculate the seed Where H is the same hash function as mentioned above.

[0273] 3. Restore the original data Where G is the same mask generation function as described above.

[0274] 4. Verify that the OAEP padding format is correct and check that the padding byte sequence matches the expected pattern.

[0275] b) If OAEP fill verification fails, the system will log the error and attempt to use alternative recovery strategies.

[0276] c) If the OAEP padding verification is successful, obtain the de-paddled key packet KeqPkg.

[0277] (2) Separate key data:

[0278] a) Extract the AES key K from KeqPkg according to the key packet format defined above. AES and initialization vector IV init :

[0279] 1. Read the first 32 bytes (256 bits) as the AES-256 key K AES .

[0280] 2. Read the next 16 bytes (128 bits) as the initialization vector IV. init .

[0281] b) Verify the extracted KAES and IV init Are the length and format correct?

[0282] 1. Ensure K AES It is 32 bytes in length.

[0283] 2. Ensure IV init It is 16 bytes in length.

[0284] 3. Check the entropy value to ensure key quality.

[0285] (3) Secure handling of key materials:

[0286] a) Extracting K AES and IV init Apply memory protection measures to prevent memory leaks:

[0287] 1. Use a non-pageable memory region to store the key.

[0288] 2. Securely erase the key material from memory immediately after use.

[0289] b) Verify key strength using Key Derivation Functions (KDF).

[0290] c) Record key usage logs for auditing and security analysis.

[0291] (4) Output the processing results:

[0292] a) Extract the AES key K AES and initialization vector IV init The data is transmitted to the AES decryption processor in step S21.

[0293] b) Keep key materials in a secure memory area to avoid unnecessary copying and transmission.

[0294] c) Generate a key-derived checksum for integrity verification in subsequent operations.

[0295] Step S21: Combine the obtained encrypted data C' and AES key K AES and IV init As input, the encrypted data is decrypted in AES-CBC mode, and the decrypted data block set {P} is output according to formula (36). i}:

[0296]

[0297] Step S722: Based on the decrypted data block set {P blk_iThe system merges data blocks, decompresses and decrypts the data, recovers the original information, verifies data integrity using SHA-256 checksum, and outputs the final recovered original information D. original The specific implementation process is as follows:

[0298] (1) Merge data blocks:

[0299] a) Sequentially process the decrypted data block set {P} obtained in step S22. blk_i Merge into a continuous byte stream: ensure data blocks are concatenated in the correct order, from P blk_1 The data concatenation format is: P combined =P blk_1 ||P blk_2 ||...||P blk_i .

[0300] b) Remove PKCS7 padding: First, check and verify whether the padding pattern of the last block conforms to the PKCS7 specification. Then, determine the number of padding bytes based on the value of the last byte. Finally, remove the padding bytes to obtain D. padded .

[0301] c) If the fill validation fails, log the error and attempt to execute the fill error recovery procedure.

[0302] (2) Parse the preprocessed data packets:

[0303] a) From D padded Extract the merged preprocessed data packet D compressed First, separate the compressed data D_compressed and the SHA-256 checksum H from the merged byte stream. The checksum H is usually located in D. padded The end of the string is 32 bytes (256 bits) long.

[0304] b) Verify the integrity of the compressed data using the extracted SHA-256 checksum H: First, recalculate D. compressed The SHA-256 hash value H' is obtained, and then the calculated H' is compared with the extracted H. If H' does not match H, an integrity error warning is generated, but the process is still attempted to continue.

[0305] (3) Data decompression:

[0306] a) For the verified compressed data D compressed Applying the gzip decompression algorithm: First, initialize the decompression context, set an appropriate buffer size, and then perform the decompression operation to obtain standard encoded data D. encoded Finally, monitor the memory usage and execution time of the decompression process to ensure that they do not exceed the preset threshold.

[0307] b) If an error is encountered during decompression (such as data corruption, format mismatch): First, record the error details and attempt partial recovery, then apply a repair algorithm to the possible partial corruption area, if the repair fails, mark the corresponding data segment as unrecoverable.

[0308] (4) Encoding conversion:

[0309] a) According to the encoding strategy determined above, D encoded is subjected to the corresponding decoding operation: by detecting the encoding type identifier of D encoded , for Base64 encoded binary data, apply Base64 decoding, for UTF-8 encoded text data, apply UTF-8 decoding, for other specific encodings, use the corresponding decoding method.

[0310] b) According to the encoding type, the structure and format of the original data are reconstructed.

[0311] (5) Data type recovery:

[0312] a) According to the type identification information, the decoded data is converted back to the original format: for text data, restore the original character encoding, for binary data, restore the original byte sequence, for structured data, reconstruct the original data structure (such as JSON or pML).

[0313] b) Apply the corresponding data verification rules to ensure that the recovered data conforms to the expected format.

[0314] (6) Output the final result:

[0315] a) According to the above processing steps, the final recovered original data D original (i.e. the encrypted data in the previous text) is generated.

[0316] b) Record the key parameters and performance indicators of the entire decryption and recovery process.

[0317] c) Generate a processing result report containing integrity verification results, recovery status and possible warnings.

[0318] The decoding and decryption process is embedded on the AGV robot, responsible for scanning, decoding, decrypting and verifying color QR code information. Through high-quality image acquisition and preprocessing to ensure identification accuracy, through channel separation and merging to reconstruct mixed ciphertext, through RSA and AES decryption to recover the original data, through integrity verification to ensure that the data has not been tampered with. Ensures the end-to-end security and reliability of the entire information transmission process.

[0319] The application has the following technical effects: 1) The security is significantly improved: through the AES-256 and RSA-2048 double encryption mechanism, the ciphertext resistance to brute force cracking is improved by at least 10^80 times, and the key can be safely transmitted even in an unsafe channel. Experimental data shows that under the existing computing capacity, the encryption scheme is almost impossible to be cracked.

[0320] 2) The information capacity is greatly increased: the traditional black and white QR code can only store 1 bit of information, and the RGB three-channel color optimization coding technology is used to increase the theoretical storage capacity to 3 bits. In actual tests, the information capacity is increased by 237%, and in the same physical size, the 40 version color QR code can store up to 23KB of encrypted data.

[0321] 3) Processing efficiency is optimized: combined with the high-speed processing capability of AES and the secure key management of RSA, experimental data shows that compared with the pure RSA encryption scheme, the mixed scheme data encryption speed is increased by 97.5%, and especially for large capacity data, the processing time is reduced by 96%.

[0322] 4) Anti-interference ability is enhanced: Reed-Solomon error correction coding and three-channel separate storage strategy make the key data in R channel priority protection, even in the case of complete damage of B channel, still can recover 85% data, test shows that under 40% image damage rate, the decoding success rate still maintains at 98.7%.

[0323] 5) Adaptability and practicability are excellent: suitable for safe and efficient transmission of goods information in AGV logistics environment, can be decoded by using standard RGB camera without special hardware; through color correction algorithm, the recognition rate is maintained above 95% under various lighting conditions, and the scanning response time is less than 0.5 seconds in actual application test.

[0324] 6) The application can be extended to three-dimensional code technology, which realizes higher information capacity through physical structure, time dimension or multi-layer superposition, realizes augmented reality interaction effect by combining with AR technology, and increases the tamper resistance of information by combining with blockchain technology. According to the needs of specific application scenes, flexible selection can be made to realize the best performance and effect.

[0325] Based on the same inventive concept, the embodiments of the present application also provide an AES-RSA double encryption based color QR code generation system for implementing the AES-RSA double encryption based color QR code generation method described above. The implementation scheme for solving the problem provided by the system is similar to the implementation scheme described in the above method, so the specific limitations in one or more AES-RSA double encryption based color QR code generation system embodiments provided below can refer to the limitations of the AES-RSA double encryption based color QR code generation method described above, which will not be repeated here.

[0326] In one exemplary embodiment, an AES-RSA double encryption based color QR code generation system is provided, comprising:

[0327] A pre-processed data packet generation unit is configured to pre-process the data to be encrypted to obtain a pre-processed data packet.

[0328] A data block set determination unit is configured to perform byte padding and segmentation on the pre-processed data packet in sequence using a PKCS7 padding method to obtain a data block set containing a plurality of data blocks of a predetermined size.

[0329] A complete AES ciphertext determination unit is configured to randomly generate an AES key and an initialization vector, and perform an AES encryption operation on each data block in the data block set based on the AES key and the initialization vector to obtain a complete AES ciphertext.

[0330] An RSA public key and RSA private key determination unit is configured to randomly generate a first prime number and a second prime number, and determine an RSA public key and an RSA private key based on the first prime number and the second prime number.

[0331] An OAEP padded key packet determination unit is configured to pad the AES key packet using an OAEP padding method to obtain an OAEP padded key packet; the AES key packet is composed of the AES key and the initialization vector.

[0332] An identifier generation unit is configured to encrypt the OAEP padded key packet using the RSA public key to obtain an RSA encrypted key packet, and generate an RSA key encryption identifier based on the RSA encrypted key packet.

[0333] A hybrid ciphertext packet determination unit is configured to obtain a hybrid ciphertext packet based on the complete AES ciphertext, the RSA encrypted key packet, and the RSA key encryption identifier.

[0334] A ciphertext splitting unit is configured to equally divide the hybrid ciphertext packet according to the number of bytes to obtain a plurality of segments of hybrid ciphertext data, and add a check code to each segment of hybrid ciphertext data to obtain a plurality of segments of hybrid ciphertext data with check codes.

[0335] The priority encoding unit is configured to perform priority encoding on the mixed ciphertext data with the check code according to the importance of the data, to obtain multi-channel priority encoded data.

[0336] The QR code lattice generating unit is configured to generate a QR code lattice of each channel based on the multi-channel priority encoded data.

[0337] The color QR code generating unit is configured to define a color mapping function, and generate a final color QR code of the data to be encrypted based on the color mapping function and the QR code lattice of each channel.

[0338] It should be noted that the user information (including but not limited to user equipment information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in the present application are all information and data authorized by the user or authorized by all parties, and the collection, use and processing of the related data need to comply with relevant regulations.

[0339] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer readable storage medium. When the computer program is executed, it can include the processes of the above-mentioned embodiments. Any reference to memory, database or other medium used in the embodiments provided by the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical storage, high-density embedded non-volatile memory, resistive memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration but not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc.

[0340] Any technical features in the above embodiments can be combined, and for the sake of brevity, not all possible combinations are described above, however, it should be understood that the application encompasses all possible combinations of the technical features unless such a combination is not technically possible.

[0341] The principles and implementation manners of the present application are described herein by using specific examples, and the above embodiments are only used to help understand the method, system and core idea of the present application; meanwhile, according to the idea of the present application, the specific implementation manners and application range can be changed by those skilled in the art. In conclusion, the content of the present specification should not be understood as a limitation of the present application.

Claims

1. A color QR code generation method based on AES-RSA double encryption, characterized in that, The color QR code generation method based on the AES-RSA double encryption comprises the following steps: Preprocessing the data to be encrypted to obtain a preprocessing data packet; Using a PKCS7 padding method to sequentially perform byte padding and segmentation on the preprocessing data packet to obtain a data block set containing a plurality of data blocks of a preset size; Randomly generating an AES key and an initialization vector, and performing an AES encryption operation on each data block in the data block set based on the AES key and the initialization vector to obtain complete AES ciphertext; Randomly generating a first prime number and a second prime number, and determining an RSA public key and an RSA private key based on the first prime number and the second prime number; Using an OAEP padding method to pad the AES key packet to obtain an OAEP-padded key packet; the AES key packet is composed of the AES key and the initialization vector; Encrypting the OAEP-padded key packet using the RSA public key to obtain RSA-encrypted key packet, and generating an RSA key encryption identifier based on the RSA-encrypted key packet; Based on the complete AES ciphertext, the RSA-encrypted key packet, and the RSA key encryption identifier, a hybrid ciphertext packet is obtained; The hybrid ciphertext packet is equally divided according to the number of bytes to obtain a plurality of mixed ciphertext data segments, and a check code is added to each mixed ciphertext data segment to obtain a plurality of mixed ciphertext data segments with check codes; According to the importance of the data, the mixed ciphertext data segments with check codes are respectively encoded according to priority to obtain multi-channel priority encoded data; Based on the multi-channel priority encoded data, generate QR code dot arrays for each channel; Define a color mapping function, and based on the color mapping function and the QR code dot arrays of each channel, obtain the final color QR code of the data to be encrypted.

2. The AES-RSA double encryption-based color QR code generation method of claim 1, wherein, The preprocessing of the data to be encrypted to obtain a preprocessing data packet comprises the following steps: Type identification is performed on the data to be encrypted to obtain classified data to be encrypted; According to a preset encoding strategy, different types of data to be encrypted in the classified data to be encrypted are respectively encoded to obtain standard encoded data; The standard encoded data is compressed using a gzip compression algorithm to obtain gzip compressed data, and the corresponding compression rate is calculated based on the gzip compressed data and the standard encoded data; When the corresponding compression rate is greater than a preset compression threshold, a data integrity check code is added to the gzip compressed data to generate a SHA-256 checksum; The gzip compressed data and the SHA-256 checksum are merged to obtain the preprocessing data packet.

3. The method of claim 2, wherein the AES-RSA double encryption-based color QR code generation method is characterized by, Randomly generating a first prime number and a second prime number, and determining an RSA public key and an RSA private key based on the first prime number and the second prime number, comprises the following steps: Randomly generating a first prime number and a second prime number, and calculating an RSA modulus based on the first prime number and the second prime number; Based on the first prime number and the second prime number, the Euler function corresponding to the RSA modulus is calculated; Based on the Euler function corresponding to the RSA modulus, the public key exponent is selected, and based on the public key exponent and the Euler function corresponding to the RSA modulus, the private key exponent is determined; Based on the RSA public key exponent and the RSA modulus, the RSA public key is determined, and based on the RSA private key exponent and the RSA modulus, the RSA private key is determined.

4. The method of claim 3, wherein the AES-RSA double encryption-based color QR code generation method is characterized by, Based on the complete AES ciphertext, the RSA encrypted key package and the RSA key encryption identifier, a hybrid ciphertext package is obtained, specifically including: Base64 encoding the complete AES ciphertext to obtain Base64 encoded ciphertext; Base64 encoding the RSA encrypted key package to obtain the Base64 encoded key package; Creating a metadata header and generating a structured data package based on the metadata header, the RSA key encryption identifier, the Base64 encoded ciphertext and the Base64 encoded key package according to a preset data structure; the metadata header includes version information, a timestamp and a security identifier; Converting the structured data package into JSON format to obtain the hybrid ciphertext package.

5. The method of claim 4, wherein the AES-RSA double encryption-based color QR code generation method is characterized by, The multiple channels include R channel, G channel and B channel; According to the data importance, the priority encoding of the multiple segments of hybrid ciphertext data with check code is performed to obtain the priority encoded data of the multiple channels, specifically including: Assigning 8 bits / pixel encoding depth to the R channel, storing the highest importance high-priority data to the R channel, and setting high-level data redundancy for the R channel; the high-priority data includes the RSA key encryption identifier, the metadata header and the key control information; Assigning 8 bits / pixel encoding depth to the G channel, storing the medium importance medium-priority data in the G channel, and setting medium-level data redundancy for the G channel; the medium-priority data includes the encrypted data and the auxiliary control information; Assigning 8 bits / pixel encoding depth to the B channel, storing the lowest importance low-priority data to the B channel, and setting low-level data redundancy for the B channel; the low-priority data includes the supplementary part of the encrypted data; Performing bit interleaving processing on the data stored in the R channel, the G channel and the B channel to obtain the priority encoded data of the multiple channels.

6. The AES-RSA double encryption-based color QR code generation method of claim 5, wherein, Based on the priority encoded data of the multiple channels, the QR code dot matrix of each channel is generated, specifically including: Adding Reed-Solomon code to the priority encoded data of each channel to obtain the data with error correction code of the multiple channels; Based on the data with error correction code of each channel, the binary data matrix of each channel is generated by using a preset arrangement mode; According to the total data amount of the binary data matrix of the multiple channels, the best QR code version and error correction level are determined; Based on the best QR code version, the error correction level and the binary data matrix of each channel, the QR code dot matrix of each channel is generated.

7. The AES-RSA double encryption-based color QR code generation method of claim 6, wherein, Based on the data with error correction code of each channel, the binary data matrix of each channel is generated by using a preset arrangement mode, specifically including: Respectively performing byte-to-bit expansion conversion on the data with error correction code of each channel to obtain the bit sequence of the multiple channels; According to the preset data capacity requirement of the QR code, the matrix dimension required by each channel is calculated to determine the corresponding initial matrix; The bit sequence of the R channel is filled into the corresponding initial matrix by using a zigzag arrangement mode to form the binary data matrix of the R channel; The bit sequence of the G channel is filled into the corresponding initial matrix by using an N-shaped arrangement mode to form the binary data matrix of the G channel; The bit sequence of the B channel is filled into the corresponding initial matrix in a spiral arrangement mode to form a binary data matrix of the B channel.

8. The AES-RSA double encryption-based color QR code generation method of claim 7, wherein, Based on the optimal QR code version, the error correction level, and the binary data matrix of each channel, a QR code dot matrix of each channel is generated, specifically including: Based on the optimal QR code version, the size of the module matrix is determined; A blank dot matrix matrix with the same size as the module matrix is created for each channel, and a positioning pattern, an alignment pattern, and a timing pattern are added to the fixed position of each blank dot matrix matrix to obtain a dot matrix matrix after adding patterns for each channel; Based on the binary data matrix of each channel, the mask of each channel is calculated using a mask transformation function; After the format information and the version information are encoded and added to the specified position of the QR code, the optimal mask mode is selected by performing optimal mask mode evaluation on multiple channels respectively; the format information is determined based on the error correction level; Based on the binary data matrix of each channel, the dot matrix matrix after adding patterns for each channel, and the optimal mask mode, a QR code dot matrix of each channel is generated. 9.The method of claim 8, wherein the AES-RSA double encryption-based color QR code generation method is characterized by, Based on the color mapping function and the QR code dot matrix of each channel, a final color QR code of the data to be encrypted is obtained, specifically including: Based on the color mapping function and the QR code dot matrix of each channel, a color QR code is generated by merging; An enhanced positioning pattern and an alignment mark are added to the color QR code to obtain a QR code with a positioning pattern; Color correction is performed on the QR code with a positioning pattern to obtain a color-corrected QR code, and a digital watermark is added to the color-corrected QR code to obtain a final color QR code of the data to be encrypted.

10. A color QR code generation system based on AES-RSA double encryption, characterized by, The color QR code generation system based on AES-RSA double encryption is used to implement the color QR code generation method based on AES-RSA double encryption of any one of claims 1-9, and the color QR code generation system based on AES-RSA double encryption includes: A preprocessed data packet generation unit is configured to preprocess the data to be encrypted to obtain a preprocessed data packet. A data block set determination unit is configured to perform byte padding and segmentation on the preprocessed data packet in sequence using a PKCS7 padding method to obtain a data block set containing a plurality of data blocks with a preset size. A complete AES ciphertext determination unit is configured to randomly generate an AES key and an initialization vector, and perform AES encryption on each data block in the data block set based on the AES key and the initialization vector to obtain a complete AES ciphertext. An RSA public key and RSA private key determination unit is configured to randomly generate a first prime number and a second prime number, and determine an RSA public key and an RSA private key based on the first prime number and the second prime number. An OAEP padded key packet determination unit is configured to pad the AES key packet using an OAEP padding method to obtain an OAEP padded key packet; the AES key packet is composed of the AES key and the initialization vector. An identifier generation unit is configured to encrypt the OAEP padded key packet using the RSA public key to obtain an RSA encrypted key packet, and generate an RSA key encryption identifier based on the RSA encrypted key packet. The hybrid ciphertext package determination unit is configured to obtain a hybrid ciphertext package based on the complete AES ciphertext, the RSA-encrypted key package, and the RSA key encryption identifier; The ciphertext splitting unit is configured to split the hybrid ciphertext package according to the number of bytes to obtain multiple pieces of hybrid ciphertext data, and add a check code to each piece of hybrid ciphertext data to obtain multiple pieces of hybrid ciphertext data with check codes; The priority encoding unit is configured to perform priority encoding on the multiple pieces of hybrid ciphertext data with check codes according to data importance to obtain multiple channels of priority-encoded data; The QR code dot array generation unit is configured to generate a QR code dot array of each channel based on the multiple channels of priority-encoded data; The color QR code generation unit is configured to define a color mapping function, and obtain a final color QR code of the data to be encrypted based on the color mapping function and the QR code dot array of each channel.

Citation Information

Cited By

  • Controllable one-way non-contact protective data transmission method and system

    CN121309232A