Methods and systems for cryptographically encrypting and decrypting two-dimensional codes.
Patent Information
- Application Number
- TH1801000550
- Authority / Receiving Office
- TH · TH
- Patent Type
- Patents
- Current Assignee / Owner
- Priority Date
- 2016-07-22
- Filing Date
- 2016-07-22
- Publication Date
- 2026-09-07
- Estimated Expiration
- 2036-07-21
AI Technical Summary
Existing QR code encryption technology has security risks. An attacker can intercept the QR code image and regenerate or modify the user ID and password area, causing the server to be unable to identify authenticity and fakeness, and cannot effectively prevent forgery attacks.
The rules for generating the initial mask pattern are pre-stored in the QR code generation and decoding device, encrypted with a key, and embedded in the target QR code. The encryption and decryption process is only performed inside the generation and decoding device. Through identification and Keys are transferred between servers, ensuring the security of the encryption and decryption process.
It improves the security of QR codes, prevents attackers from intercepting encrypted information for decryption, reduces the burden on the server, and supports the target QR code corresponding to each identification to be unique or used in batches, making the encryption and decryption process convenient.
Abstract
Description
Invention Title: QR Code Mask Encryption and Decryption Method and System Technical Field
[0001] This invention relates to the field of QR code encryption technology, and in particular to a QR code mask encryption and decryption method and system. Background Technology
[0002] QR codes are being used more and more widely, but while they bring convenience to people, they have also gradually created security risks. For example, incidents of people having their phone credit stolen after scanning a QR code have occurred frequently.
[0003] Chinese invention patent CN102243714B discloses a QR code encryption system. The system includes a user terminal device that represents the user ID in a first area of the QR code and the user's password in a second area. A client computer receives the QR code from the user terminal device, decodes the corresponding ID and password, and sends the decoded ID and password to a management server. The management server verifies whether the received ID and password match the data stored in the user database and transmits the verification result to the client computer. The client computer receives the verification result from the management server. Although the user ID and password are added to a designated area of the QR code, an attacker can intercept the target QR code image, retain the area containing the username and password, and regenerate or modify the data, ensuring the username and password remain identical to the original image. In this case, the server cannot distinguish between genuine and fake QR codes, thus failing to prevent counterfeiting attacks.
[0004] Chinese invention patent CN103401679B discloses a method for encrypting and decoding QR codes. The method employs symmetric encryption to encrypt and decode QR codes. Each QR code corresponds to an identifier. Ciphertext, consisting of the identifier added before or after the encrypted original information, is used to generate the QR code. The original information is encrypted before the QR code is generated. Scanning the QR code yields the encrypted original information plus the identifier. However, the encryption database lacks protection measures. If the encryption database is leaked, attackers can easily launch attacks. Technical issues
[0005] The technical problem to be solved by this invention is to provide a highly secure QR code mask encryption and decryption method and system. Solution to the problem Technical solutions
[0006] To solve the above-mentioned technical problems, the technical solution adopted by the present invention is as follows:
[0007] A method for QR code mask encryption and decryption.
[0008] The QR code generation device generates a target QR code containing functional graphics and identifiers, an initial mask graphic, and a key;
[0009] The QR code generating device sends the identifier and key to the server;
[0010] The server receives and stores the identifier and key;
[0011] The QR code generation device uses a key to encrypt the initial mask pattern and then embeds the target QR code to obtain the encrypted QR code;
[0012] The QR code decoding device acquires the encrypted QR code and decodes it to obtain the functional graphic and identifier of the QR code.
[0013] The QR code decoding device sends the identifier to the server;
[0014] The server receives the identifier;
[0015] The server sends a key to the QR code decoding device based on the identifier;
[0016] The QR code decoding device receives the key sent by the server;
[0017] The QR code decoding device generates an initial mask pattern based on the functional graphics and identifiers;
[0018] The QR code decoding device decrypts the encrypted QR code based on the key and the initial mask pattern to obtain the target QR code.
[0019] The beneficial effects of this invention are as follows: The generation rules for generating an initial mask pattern based on the functional graphic of the QR code, the encryption rules for encrypting the initial mask pattern with a key, and the encryption rules for encrypting the target QR code with the encrypted mask pattern are pre-stored in the QR code generation device and the QR code decoding device. Identifiers are used to mark the target QR code and the key. The generation of the initial mask pattern, the encryption of the initial mask pattern with the key, and the encryption of the target QR code with the encrypted mask pattern are all performed within the QR code generation device and the QR code decoding device. Only the identifier and the key are transmitted between the QR code generation device and the server, and between the QR code decoding device and the server, resulting in high security and a low server load.
[0020]
[0021] A QR code mask encryption and decryption method:
[0022] The QR code generation device generates a target QR code containing an identifier, an initial mask pattern, and a key;
[0023] The QR code generation device sends the identifier, initial mask image, and key to the server;
[0024] The server receives and stores the identifier, initial mask pattern, and key;
[0025] The QR code generation device uses a key to encrypt the initial mask pattern and then embeds the target QR code to obtain the encrypted QR code;
[0026] The QR code decoding device acquires the encrypted QR code and decodes it to obtain the identifier;
[0027] The QR code decoding device sends the identifier to the server;
[0028] The server receives the identifier;
[0029] The server sends a key and an initial mask pattern to the QR code decoding device based on the identifier;
[0030] The QR code decoding device receives the key and initial mask pattern sent by the server;
[0031] The QR code decoding device decrypts the encrypted QR code based on the key and the initial mask pattern to obtain the target QR code.
[0032] The beneficial effects of this invention are as follows: Encryption rules for encrypting the initial mask pattern with a key and encrypting the target QR code with the encrypted mask pattern are pre-stored in the QR code generation device and the QR code decoding device. Identifiers are used to mark the target QR code, the initial mask pattern, and the key. Encryption of the initial mask pattern with the key and encryption of the target QR code with the encrypted mask pattern are both performed within the QR code generation device and the QR code decoding device. Only the identifier, the initial mask pattern, and the key are transmitted between the QR code generation device and the server, and between the QR code decoding device and the server, resulting in high security.
[0033]
[0034] A QR code mask encryption and decryption system includes a QR code generation device, a QR code decoding device, and a server. The QR code generation device includes a first generation module, a first sending module, an encryption module, and an embedding module. The QR code decoding device includes an acquisition module, a second sending module, a third receiving module, a second generation module, and a decryption module. The server includes a first receiving module, a second receiving module, and a third sending module.
[0035] The first generation module is used by the QR code generation device to generate a target QR code containing functional graphics and symbols. Initial mask pattern; key;
[0036] The first sending module is used for the QR code generating device to send the identifier and key to the server;
[0037] The first receiving module is used for the server to receive and store the identifier and key;
[0038] The encryption module is used by the QR code generation device to encrypt the initial mask pattern with a key and then embed the target QR code to obtain the encrypted QR code.
[0039] The acquisition module is used by the QR code decoding device to acquire the encrypted QR code and decode it to obtain the functional graphic and identifier of the QR code;
[0040] The second sending module is used for the QR code decoding device to send the identifier to the server;
[0041] The second receiving module is used for the server to receive the identifier;
[0042] The third sending module is used by the server to send a key to the QR code decoding device according to the QR code functional graphic information and identifier;
[0043] The third receiving module is used for the QR code decoding device to receive the key sent by the server;
[0044] The second generation module is used by the QR code decoding device to generate an initial mask pattern based on the functional graphics and identifiers;
[0045] The decryption module is used by the QR code decoding device to decrypt the encrypted QR code according to the key and the initial mask pattern to obtain the target QR code.
[0046] The beneficial effects of this invention are as follows: The QR code generating device sends an identifier and a key to the server, the QR code decoding device sends the identifier to the server, and the server sends the key to the QR code decoding device based on the identifier. The generation and encryption of the initial mask pattern and the encryption of the target QR code are all performed within the QR code generating device and the QR code decoding device. Only the identifier and the key are transmitted between the QR code generating device, the server, and the QR code decoding device, resulting in high security and a low burden on the server. Each identifier can correspond to a unique target QR code or a batch of such codes, making it convenient to use.
[0047]
[0048] A QR code mask encryption and decryption system includes a QR code generation device, a QR code decoding device, and a server. The QR code generation device includes a generation module, a first sending module, an encryption module, and an embedding module. The QR code decoding device includes an acquisition module, a second sending module, a third receiving module, and a decryption module. The server includes a first receiving module, a second receiving module, and a third sending module.
[0049] The generation module is used by the QR code generation device to generate a target QR code containing an identifier, an initial mask graphic, and a key;
[0050] The first sending module is used by the QR code generation device to send the identifier, initial mask graphic, and key to the server;
[0051] The encryption module is used by the QR code generation device to encrypt the initial mask pattern using a key;
[0052] The embedding module is used by the QR code generation device to encrypt the initial mask pattern with a key and then embed the target QR code to obtain the encrypted QR code.
[0053] The acquisition module is used by the QR code decoding device to acquire the encrypted QR code and decode it to obtain the identifier;
[0054] The second sending module is used for the QR code decoding device to send the identifier to the server;
[0055] The third receiving module is used for the QR code decoding device to receive the key and initial mask pattern sent by the server;
[0056] The decryption module is used by the QR code decoding device to decrypt the encrypted QR code according to the key and the initial mask pattern to obtain the target QR code.
[0057] The first receiving module is used by the server to receive and store the identifier, initial mask pattern, and key;
[0058] The second receiving module is used for the server to receive the identifier;
[0059] The third sending module is used by the server to send the key and the initial mask pattern to the QR code decoding device according to the identifier. Beneficial effects of the invention Beneficial effects
[0060] The beneficial effects of this invention are as follows: The QR code generating device sends an identifier, an initial mask pattern, and a key to the server; the QR code decoding device sends the identifier to the server; and the server sends the initial mask pattern and a key to the QR code decoding device based on the identifier. Encryption of the initial mask pattern and encryption of the target QR code are both performed internally within the QR code generating and decoding devices. Only the identifier, the initial mask pattern, and the key are transmitted between the QR code generating device, the server, and the QR code decoding device, resulting in high security. Each identifier can correspond to a unique target QR code or can be generated in batches, making it convenient to use. (Brief description of the accompanying drawings follows.) Attached Figure Description
[0061] Figure 1 is a flowchart of the QR code mask encryption method according to Embodiment 1 of the present invention;
[0062] Figure 2 is a flowchart of the QR code mask encryption method according to Embodiment 2 of the present invention. Detailed Implementation
[0063] To explain the technical content, objectives, and effects of the present invention in detail, the following description is provided in conjunction with the embodiments and accompanying drawings.
[0064] The most crucial concept of this invention is that only the identifier and key, or the initial mask pattern, are transmitted between the QR code generation device, the server, and the QR code decoding device, resulting in high security.
[0065] The specific embodiments of the present invention are as follows:
[0066] Please refer to Figure 1, which illustrates a method for encrypting and decrypting QR codes using a mask.
[0067] The QR code generation device generates a target QR code containing functional graphics and identifiers, an initial mask graphic, and a key;
[0068] The QR code generating device sends the identifier and key to the server;
[0069] The server receives and stores the identifier and key;
[0070] The QR code generation device uses a key to encrypt the initial mask pattern and then embeds the target QR code to obtain the encrypted QR code;
[0071] The QR code decoding device acquires the encrypted QR code and decodes it to obtain the functional graphic and identifier of the QR code.
[0072] The QR code decoding device sends the identifier to the server;
[0073] The server receives the identifier;
[0074] The server sends a key to the QR code decoding device based on the identifier;
[0075] The QR code decoding device receives the key sent by the server;
[0076] The QR code decoding device generates an initial mask pattern based on the functional graphics and identifiers;
[0077] The QR code decoding device decrypts the encrypted QR code based on the key and the initial mask pattern to obtain the target QR code.
[0078]
[0079] Please refer to Figure 2, which illustrates a method for encrypting and decrypting QR codes using a mask:
[0080] The QR code generation device generates a target QR code containing an identifier, an initial mask pattern, and a key;
[0081] The QR code generation device sends the identifier, initial mask image, and key to the server;
[0082] The server receives and stores the identifier, initial mask pattern, and key;
[0083] The QR code generation device uses a key to encrypt the initial mask pattern and then embeds the target QR code to obtain the encrypted QR code;
[0084] The QR code decoding device acquires the encrypted QR code and decodes it to obtain the identifier;
[0085] The QR code decoding device sends the identifier to the server;
[0086] The server receives the identifier;
[0087] The server sends a key and an initial mask pattern to the QR code decoding device based on the identifier;
[0088] The QR code decoding device receives the key and initial mask pattern sent by the server;
[0089] The QR code decoding device decrypts the encrypted QR code based on the key and the initial mask pattern to obtain the target QR code.
[0090]
[0091] Furthermore, it also includes establishing a secure channel between the QR code generation device and the server, specifically:
[0092] The server generates a public key pair and a private key pair, and sends the public key pair to the QR code generating device.
[0093] The QR code generator receives the public key pair;
[0094] The QR code generator encrypts the identity ID and working key using a public key and then sends them to the server.
[0095] The server receives the encrypted identity ID and working key;
[0096] The server uses its private key to decrypt the encrypted identity ID and working key to obtain the identity ID and working key.
[0097] The working key is used to encrypt and decrypt data transmission between the QR code generation device and the server. This creates a safe passage.
[0098] As described above, a secure channel is established between the QR code generator and the server using a public key pair, a private key pair, and a working key. The identity ID and working key transmitted between the QR code generator and the server are encrypted using the public key pair, while decryption of the encrypted identity ID and working key requires the private key pair. Therefore, even if an attacker intercepts the encrypted identity ID and working key and knows the public key, it is very difficult to decrypt the encrypted identity ID and working key, resulting in high security.
[0099] Furthermore, it also includes establishing a secure channel between the QR code decoding device and the server, specifically:
[0100] The server generates a public key pair and a private key pair, and sends the public key pair to the QR code decoding device.
[0101] The QR code decoding device received the public key pair;
[0102] The QR code decoding device encrypts the identity ID and working key using a public key and then sends them to the server;
[0103] The server receives the encrypted identity ID and working key;
[0104] The server uses its private key to decrypt the encrypted identity ID and working key to obtain the identity ID and working key.
[0105] The working key is used to encrypt and decrypt data transmission between the QR code decoding device and the server. This creates a safe passage.
[0106] As described above, a secure channel is established between the QR code decoding device and the server using a public key pair, a private key pair, and a working key. The identity ID and working key transmitted between the QR code decoding device and the server are encrypted using the public key pair, while decryption of the encrypted identity ID and working key requires the private key pair. Therefore, even if an attacker intercepts the encrypted identity ID and working key and knows the public key, it is very difficult to decrypt the encrypted identity ID and working key, resulting in high security.
[0107] Furthermore, the QR code generation device uses a key to encrypt the initial mask pattern and then embeds it into the target QR code to obtain an encrypted QR code, specifically:
[0108] The QR code generation device uses a key to encrypt the initial mask pattern to obtain the encrypted mask pattern;
[0109] The QR code generation device performs an XOR operation between the encrypted mask image and the target QR code to obtain the encrypted QR code;
[0110] The QR code decoding device decrypts the encrypted QR code using a key and an initial mask pattern to obtain the target QR code, specifically:
[0111] The QR code decoding device uses a key to encrypt the initial mask pattern to obtain the encrypted mask pattern;
[0112] The QR code decoding device performs an XOR operation between the encrypted mask image and the encrypted QR code to obtain the target QR code.
[0113] As described above, the QR code generation device encrypts the initial mask pattern with a key and then obtains the encrypted QR code through an XOR operation with the target QR code. The QR code decoding device encrypts the initial mask pattern with a key and then obtains the target QR code through an XOR operation with the encrypted QR code. The encryption and decryption processes of the target QR code are the same. As long as the QR code generation device and the QR code decoding device store the encryption rules in a protocol, the successful encryption and decryption of the QR code can be achieved.
[0114] Furthermore, the initial mask pattern is the same size as the target QR code, and the areas on the mask pattern corresponding to the functional graphics of the target QR code are all set to light colors. The functional graphics of the target QR code include position detection graphics, position detection graphic separators, positioning graphics, correction graphics, auxiliary correction graphics, and identification graphics.
[0115] The QR code generation device uses a key to encrypt the initial mask pattern, specifically:
[0116] The bit data of the initial mask pattern is extracted and formed into an initial data string by sequentially skipping the regions on the mask pattern that correspond to the functional graphics of the target QR code, and the position and number of skipped regions are recorded.
[0117] The initial data string is encrypted using the key to obtain the encrypted data string;
[0118] Based on the position and number of skipped areas, the encrypted data string is sequentially concatenated with the functional areas to form an encrypted mask pattern.
[0119] As described above, the initial mask pattern, serving as the encryption pattern for the target QR code, is the same size as the target QR code and avoids the functional graphics on the target QR code. Its structure is reasonable, facilitating the identification, positioning, and correction of both the target and encrypted QR codes. When encrypting the initial mask pattern, the areas corresponding to the functional graphics of the target QR code need to be skipped to prevent the positioning graphics, correction graphics, auxiliary correction graphics, and identification graphics of the target QR code from being encrypted, thus preventing the target QR code from becoming unrecognizable. Therefore, this method is reasonable and facilitates the identification, positioning, and correction of the target QR code.
[0120] Furthermore, it also includes: a preset time threshold, recording the storage time of the key in the server, and if the storage time exceeds the time threshold, the server will not send the key to the QR code decoding device.
[0121] As described above, a time threshold is preset in the server. If the storage time of the key exceeds the time threshold, it means that the key has expired and the target QR code has become invalid. In this case, the server will not send the key to the QR code decoding device, and the QR code decoding device cannot decrypt the encrypted QR code. The method is reasonable, facilitates the setting of the validity period of the target QR code, and is convenient to use.
[0122]
[0123] Please refer to Figure 1. Embodiment 1 of the present invention is as follows:
[0124] A method for QR code mask encryption and decryption.
[0125] A secure channel is established between the QR code generation device and the server, specifically as follows:
[0126] The server generates a public key pair and a private key pair, and sends the public key pair to the QR code generating device.
[0127] The QR code generator receives the public key pair;
[0128] The QR code generator encrypts the identity ID and working key using a public key and then sends them to the server.
[0129] The server receives the encrypted identity ID and working key;
[0130] The server uses its private key to decrypt the encrypted identity ID and working key to obtain the identity ID and working key.
[0131] The QR code generation device generates a target QR code containing functional graphics and identifiers, an initial mask graphic, and a secret key. key;
[0132] The QR code generating device sends the identifier and key to the server;
[0133] The server receives and stores the identifier and key;
[0134] The QR code generation device uses a key to encrypt the initial mask pattern and then embeds it into the target QR code to obtain the encrypted QR code, specifically:
[0135] The QR code generation device uses a key to encrypt the initial mask pattern to obtain the encrypted mask pattern;
[0136] The QR code generation device performs an XOR operation between the encrypted mask image and the target QR code to obtain the encrypted QR code;
[0137] A secure channel is established between the QR code decoding device and the server, specifically as follows:
[0138] The server generates a public key pair and a private key pair, and sends the public key pair to the QR code decoding device.
[0139] The QR code decoding device received the public key pair;
[0140] The QR code decoding device encrypts the identity ID and working key using a public key and then sends them to the server;
[0141] The server receives the encrypted identity ID and working key;
[0142] The server uses its private key to decrypt the encrypted identity ID and working key to obtain the identity ID and working key.
[0143] The QR code decoding device acquires the encrypted QR code and decodes it to obtain the functional graphic and logo;
[0144] The QR code decoding device sends the identifier to the server;
[0145] The server receives the identifier;
[0146] The server sends a key to the QR code decoding device based on the identifier;
[0147] The QR code decoding device receives the key sent by the server;
[0148] The QR code decoding device generates an initial mask pattern based on the functional graphics and identifiers;
[0149] The QR code decoding device decrypts the encrypted QR code using a key and an initial mask pattern to obtain the target QR code, specifically:
[0150] The QR code decoding device uses a key to encrypt the initial mask pattern to obtain the encrypted mask pattern;
[0151] The QR code decoding device performs an XOR operation between the encrypted mask image and the encrypted QR code to obtain the target QR code.
[0152]
[0153] Please refer to Figure 2. Embodiment 2 of the present invention is as follows:
[0154] A method for QR code mask encryption and decryption.
[0155] A secure channel is established between the QR code generation device and the server, specifically as follows:
[0156] The server generates a public key pair and a private key pair, and sends the public key pair to the QR code generating device.
[0157] The QR code generator receives the public key pair;
[0158] The QR code generator encrypts the identity ID and working key using a public key and then sends them to the server.
[0159] The server receives the encrypted identity ID and working key;
[0160] The server uses its private key to decrypt the encrypted identity ID and working key to obtain the identity ID and working key.
[0161] The QR code generation device generates a target QR code containing an identifier, an initial mask pattern, and a key. The initial mask pattern is the same size as the target QR code, and the areas on the mask pattern corresponding to the functional graphics of the target QR code are all set to light colors. The functional graphics of the target QR code include a position detection graphic, a position detection graphic separator, a positioning graphic, a correction graphic, an auxiliary correction graphic, and an identifier graphic.
[0162] The QR code generation device sends the identifier, initial mask image, and key to the server;
[0163] The server receives and stores the identifier, initial mask pattern, and key;
[0164] The QR code generation device uses a key to encrypt the initial mask pattern and then embeds it into the target QR code to obtain the encrypted QR code, specifically:
[0165] The QR code generation device uses a key to encrypt the initial mask pattern to obtain the encrypted mask pattern:
[0166] The bit data of the initial mask pattern is extracted and formed into an initial data string by sequentially skipping the regions on the mask pattern that correspond to the functional graphics of the target QR code, and the position and number of skipped regions are recorded.
[0167] The initial data string is encrypted using the key to obtain the encrypted data string;
[0168] Based on the position and number of skipped areas, the encrypted data string is sequentially concatenated with the functional area to form an encrypted mask pattern;
[0169] The QR code generation device performs an XOR operation between the encrypted mask image and the target QR code to obtain the encrypted QR code;
[0170] A secure channel is established between the QR code decoding device and the server, specifically as follows:
[0171] The server generates a public key pair and a private key pair, and sends the public key pair to the QR code decoding device.
[0172] The QR code decoding device received the public key pair;
[0173] The QR code decoding device encrypts the identity ID and working key using a public key and then sends them to the server;
[0174] The server receives the encrypted identity ID and working key;
[0175] The server uses its private key to decrypt the encrypted identity ID and working key to obtain the identity ID and working key.
[0176] The QR code decoding device acquires the encrypted QR code and decodes it to obtain the identifier;
[0177] The QR code decoding device sends the identifier to the server;
[0178] The server receives the identifier;
[0179] The server has a preset time threshold and records the storage time of the key in the server. If the storage time exceeds the time threshold, the server will not send the key to the QR code decoding device; if the storage time does not exceed the time threshold, the server sends the key and the initial mask pattern to the QR code decoding device according to the identifier.
[0180] The QR code decoding device receives the key and initial mask pattern sent by the server;
[0181] The QR code decoding device decrypts the encrypted QR code using a key and an initial mask pattern to obtain the target QR code, specifically:
[0182] The QR code decoding device uses a key to encrypt the initial mask pattern to obtain the encrypted mask pattern:
[0183] The bit data of the initial mask pattern is extracted and formed into an initial data string by sequentially skipping the regions on the mask pattern that correspond to the functional graphics of the target QR code, and the position and number of skipped regions are recorded.
[0184] The initial data string is encrypted using the key to obtain the encrypted data string;
[0185] Based on the position and number of skipped areas, the encrypted data string is sequentially concatenated with the functional area to form an encrypted mask pattern;
[0186] The QR code decoding device performs an XOR operation between the encrypted mask image and the encrypted QR code to obtain the target QR code.
[0187]
[0188] A QR code mask encryption and decryption system includes a QR code generation device, a QR code decoding device, and a server. The QR code generation device includes a first generation module, a first sending module, an encryption module, and an embedding module. The QR code decoding device includes an acquisition module, a second sending module, a third receiving module, a second generation module, and a decryption module. The server includes a first receiving module, a second receiving module, and a third sending module.
[0189] The first generation module is used by the QR code generation device to generate a target QR code containing functional graphics and symbols. Initial mask pattern; key;
[0190] The first sending module is used for the QR code generating device to send the identifier and key to the server;
[0191] The first receiving module is used for the server to receive and store the identifier and key;
[0192] The encryption module is used by the QR code generation device to encrypt the initial mask pattern with a key and then embed the target QR code to obtain the encrypted QR code.
[0193] The acquisition module is used by the QR code decoding device to acquire the encrypted QR code and decode it to obtain the functional graphic and identifier of the QR code;
[0194] The second sending module is used for the QR code decoding device to send the identifier to the server;
[0195] The second receiving module is used for the server to receive the identifier;
[0196] The third sending module is used by the server to send a key to the QR code decoding device according to the identifier;
[0197] The third receiving module is used for the QR code decoding device to receive the key sent by the server;
[0198] The second generation module is used by the QR code decoding device to generate an initial mask pattern based on the functional graphics and identifiers;
[0199] The decryption module is used by the QR code decoding device to decrypt the encrypted QR code according to the key and the initial mask pattern to obtain the target QR code.
[0200]
[0201] Embodiment 3 of the present invention is as follows:
[0202] A QR code mask encryption and decryption system includes a QR code generation device, a QR code decoding device, and a server. The QR code generation device includes a first generation module, a first sending module, an encryption module, and an embedding module. The QR code decoding device includes an acquisition module, a second sending module, a third receiving module, a second generation module, and a decryption module. The server includes a first receiving module, a second receiving module, and a third sending module.
[0203] The first generation module is used by the QR code generation device to generate a target QR code containing functional graphics and symbols. Initial mask pattern; key;
[0204] The first sending module is used for the QR code generating device to send the identifier and key to the server;
[0205] The first receiving module is used for the server to receive and store the identifier and key;
[0206] The encryption module is used by the QR code generation device to encrypt the initial mask pattern with a key and then embed the target QR code to obtain the encrypted QR code.
[0207] The acquisition module is used by the QR code decoding device to acquire the encrypted QR code and decode it to obtain the functional graphic and identifier of the QR code;
[0208] The second sending module is used for the QR code decoding device to send the identifier to the server;
[0209] The second receiving module is used for the server to receive the identifier;
[0210] The third sending module is used by the server to send a key to the QR code decoding device according to the identifier;
[0211] The third receiving module is used for the QR code decoding device to receive the key sent by the server;
[0212] The second generation module is used by the QR code decoding device to generate an initial mask pattern based on the functional graphics and identifiers;
[0213] The decryption module is used by the QR code decoding device to decrypt the encrypted QR code according to the key and the initial mask pattern to obtain the target QR code.
[0214]
[0215] A QR code mask encryption and decryption system includes a QR code generation device, a QR code decoding device, and a server. The QR code generation device includes a generation module, a first sending module, an encryption module, and an embedding module. The QR code decoding device includes an acquisition module, a second sending module, a third receiving module, and a decryption module. The server includes a first receiving module, a second receiving module, and a third sending module.
[0216] The generation module is used by the QR code generation device to generate a target QR code containing an identifier, an initial mask graphic, and a key;
[0217] The first sending module is used by the QR code generation device to send the identifier, initial mask graphic, and key to the server;
[0218] The encryption module is used by the QR code generation device to encrypt the initial mask pattern using a key;
[0219] The embedding module is used by the QR code generation device to encrypt the initial mask pattern with a key and then embed the target QR code to obtain the encrypted QR code.
[0220] The acquisition module is used by the QR code decoding device to acquire the encrypted QR code and decode it to obtain the identifier;
[0221] The second sending module is used for the QR code decoding device to send the identifier to the server;
[0222] The third receiving module is used for the QR code decoding device to receive the key and initial mask pattern sent by the server;
[0223] The decryption module is used by the QR code decoding device to decrypt the encrypted QR code according to the key and the initial mask pattern to obtain the target QR code.
[0224] The first receiving module is used by the server to receive and store the identifier, initial mask pattern, and key;
[0225] The second receiving module is used for the server to receive the identifier;
[0226] The third sending module is used by the server to send the key and the initial mask pattern to the QR code decoding device according to the identifier.
[0227] Embodiment four of the present invention is as follows:
[0228] A QR code mask encryption and decryption system includes a QR code generation device, a QR code decoding device, and a server. The QR code generation device includes a generation module, a first sending module, an encryption module, and an embedding module. The QR code decoding device includes an acquisition module, a second sending module, a third receiving module, and a decryption module. The server includes a first receiving module, a second receiving module, and a third sending module.
[0229] The generation module is used by the QR code generation device to generate a target QR code containing an identifier, an initial mask graphic, and a key;
[0230] The first sending module is used by the QR code generation device to send the identifier, initial mask graphic, and key to the server;
[0231] The encryption module is used by the QR code generation device to encrypt the initial mask pattern using a key;
[0232] The embedding module is used by the QR code generation device to encrypt the initial mask pattern with a key and then embed the target QR code to obtain the encrypted QR code.
[0233] The acquisition module is used by the QR code decoding device to acquire the encrypted QR code and decode it to obtain the identifier;
[0234] The second sending module is used for the QR code decoding device to send the identifier to the server;
[0235] The third receiving module is used for the QR code decoding device to receive the key and initial mask pattern sent by the server;
[0236] The decryption module is used by the QR code decoding device to decrypt the encrypted QR code according to the key and the initial mask pattern to obtain the target QR code.
[0237] The first receiving module is used by the server to receive and store the identifier, initial mask pattern, and key;
[0238] The second receiving module is used by the server to receive the identifier;
[0239] The third sending module is used by the server to send the key and the initial mask pattern to the QR code decoding device according to the identifier.
[0240]
[0241] In summary, the QR code mask encryption method and system provided by this invention establish secure channels between the QR code generating device and the server, and between the QR code decoding device and the server, thereby improving the security of the system's operating environment; and enhance the security of the communication between the QR code generating device and the server, and between the QR code decoding device and the server. Only the identifier, key, or initial mask pattern is transmitted. The generation of the initial mask pattern and the encryption of the target QR code are performed in the QR code generation device, and the decryption of the encrypted QR code is performed in the QR code decoding device. The QR code decoding device can also generate the initial mask pattern based on the QR code's functional graphic information, ensuring high security. The validity period of the key can be set in the server, making it convenient to use. Identifiers are used to mark the target QR code, key, QR code functional graphic information, or initial mask pattern. Each identifier can correspond to a unique or batch of target QR codes. The encryption area of the initial mask pattern skips the area corresponding to the functional area of the target QR code, facilitating the identification, positioning, and correction of the target QR code and the encrypted QR code. The system has high security, low server load, and is easy to use.