QR code dynamic encryption and verification system based on quantum key

By using a quantum key-based QR code dynamic encryption and verification system, the problems of QR code ticketing being easily copied and stolen, insufficient resistance to quantum attacks, and leakage of user privacy have been solved, achieving highly secure dynamic verification and data protection.

CN121902175APending Publication Date: 2026-04-21ANHUI QASKY QUANTUM SCI & TECH CO LTD +3
View PDF 6 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
ANHUI QASKY QUANTUM SCI & TECH CO LTD
Filing Date
2026-01-05
Publication Date
2026-04-21

AI Technical Summary

Technical Problem

In existing technologies, QR code ticketing suffers from problems such as easy copying and theft, insufficient resistance to quantum attacks, lack of dynamic verification mechanisms, and leakage of user privacy.

Method used

A quantum key-based QR code dynamic encryption and verification system is adopted. Multiple sets of quantum symmetric keys are generated through the quantum key management system. The QR code server encrypts and sends multiple sets of QR codes. The user end performs dynamic rotation and the device end performs plaintext data comparison to achieve dynamic verification and short-term timeliness.

Benefits of technology

It effectively prevents QR code copying and theft, enhances resistance to quantum computing cracking, prevents man-in-the-middle attacks and replay attacks, and protects user privacy while improving system security and data privacy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121902175A_ABST
    Figure CN121902175A_ABST
Patent Text Reader

Abstract

The invention relates to electronic ticket information security, in particular to a quantum key-based two-dimensional code dynamic encryption and verification system, which comprises a quantum key management system for regularly generating multiple groups of quantum symmetric keys every day; the two-dimensional code server side imports the quantum symmetric key generated by the quantum key management system every day, generates multiple groups of original data after receiving a two-dimensional code request sent by the user side, encrypts the original data by using the quantum symmetric key and sends the encrypted data to the user side; the user side converts the encrypted data sent by the two-dimensional code server side into a plurality of corresponding two-dimensional codes and performs dynamic carousel on the two-dimensional codes; the device end reads the two-dimensional code displayed by the user end, converts the two-dimensional code into multiple groups of corresponding plaintext data, and compares the multiple groups of plaintext data with the multiple groups of original data in terms of message Hash value to verify whether the two-dimensional code is correct; the method can effectively overcome the defects that copying and embezzlement are likely to happen, the quantum attack resistance is insufficient, a dynamic verification mechanism is lacked, and user privacy is difficult to effectively protect.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to electronic ticketing information security, specifically to a dynamic encryption and verification system for QR codes based on quantum key distribution. Background Technology

[0002] With the rapid development of mobile internet technology, traditional QR code ticketing for public transportation has been widely used in scenarios such as public transport and event ticket checking. However, existing technology has the following significant drawbacks:

[0003] 1) Insufficient security

[0004] Existing encryption algorithms (such as RSA and AES) face the threat of quantum computing, electronic ticketing is at risk of being brute-forced, and electronic ticketing lacks an effective dynamic verification mechanism, cannot prevent man-in-the-middle attacks, and lacks a sound key lifecycle management mechanism.

[0005] 2) Inherent defects of static QR code ticketing

[0006] Static QR codes are fixed once generated and are easily photographed and copied.

[0007] Attackers can obtain the complete QR code through methods such as screenshotting or taking a photo.

[0008] The copied QR code can be used multiple times, resulting in ticket revenue losses.

[0009] Therefore, it can be seen that the existing technology mainly has the following technical problems that need to be solved:

[0010] 1) There is a security risk that it can be easily copied and stolen.

[0011] Once a static QR code is generated, it remains fixed and unchanging, making it susceptible to being screenshotted, photographed, and maliciously copied and stolen. It cannot prevent the illegal theft and reuse of QR code credentials.

[0012] 2) Insufficient resistance to quantum attacks

[0013] Ticket verification systems based on traditional public-key encryption such as RSA and ECC are vulnerable to brute-force attacks using quantum computing, making it difficult to guarantee long-term data security.

[0014] 3) Lack of dynamic verification mechanism

[0015] The lack of a dynamic verification mechanism makes it impossible to effectively defend against security threats such as man-in-the-middle attacks and replay attacks.

[0016] 4) User privacy leaks

[0017] User credentials (such as travel information, identity information, etc.) may be exposed in weakly encrypted or plaintext form during data transmission and storage, posing a risk of privacy leakage. Summary of the Invention

[0018] (a) Technical problems to be solved

[0019] In view of the above-mentioned shortcomings of the existing technology, the present invention provides a QR code dynamic encryption and verification system based on quantum key distribution, which can effectively overcome the defects of the existing technology, such as easy copying and theft, insufficient resistance to quantum attacks, lack of dynamic verification mechanism, and difficulty in effectively protecting user privacy.

[0020] (II) Technical Solution

[0021] To achieve the above objectives, the present invention provides the following technical solution:

[0022] A quantum key-based QR code dynamic encryption and verification system includes a quantum key management system, a QR code server, a user terminal, and a device terminal;

[0023] The quantum key management system generates multiple sets of quantum symmetric keys daily at set times.

[0024] On the QR code server side, the quantum symmetric key generated by the quantum key management system is imported daily, and after receiving the QR code request sent by the user, multiple sets of raw data are generated, encrypted using the quantum symmetric key, and sent to the user.

[0025] On the user side, the encrypted data sent by the QR code server is converted into multiple corresponding QR codes, and the QR codes are dynamically rotated.

[0026] On the device side, the QR code displayed on the user terminal is read and converted into multiple sets of plaintext data. The hash values ​​of the multiple sets of plaintext data are compared with the hash values ​​of the multiple sets of original data. If the difference between the timestamp in the QR code and the current time is less than the first preset time interval, and two sets of messages are verified consecutively, the QR code is considered to be correct.

[0027] Preferably, the QR code server imports quantum symmetric keys generated by the quantum key management system daily, including:

[0028] S11. The QR code server requests the first quantum random number R1 from the quantum key management system via the network.

[0029] S12. The quantum key management system generates a first quantum random number R1 and encrypts it using its private key to obtain Cr1:

[0030] Cr1=SM2_Encrypt(KeyPrivate[idx],R1);

[0031] Where KeyPrivate[idx] represents the private key selected from the private key pool KeyPrivate corresponding to the key identifier idx. The key identifier idx is used to indicate the key pair used in this communication. SM2_Encrypt is the encryption function based on the national cryptographic SM2 elliptic curve public key cryptography algorithm.

[0032] The quantum key management system sends Cr and the key identifier idx to the QR code server.

[0033] S13. The QR code server selects the corresponding public key based on the key identifier idx to decrypt Cr and obtain the first quantum random number R1:

[0034] R1=SM2_Decrypt(KeyPublic[idx],Cr);

[0035] Where KeyPublic[idx] represents the public key corresponding to the key identifier idx selected from the public key pool KeyPublic, and SM2_Decrypt is the decryption function based on the national cryptographic SM2 elliptic curve public key cryptography algorithm;

[0036] The QR code server generates a second quantum random number R2, and then uses the public key to encrypt (R1, R2) to obtain Cr2:

[0037] Cr2=SM2_Encrypt(KeyPublic[idx],(R1,R2));

[0038] And send Cr2 and the key identifier idx to the quantum key management system;

[0039] S14. The quantum key management system selects the corresponding private key based on the key identifier idx to decrypt Cr2 and obtain (R1, R2):

[0040] (R1,R2)=SM2_Decrypt(KeyPrivate[idx],Cr2);

[0041] The quantum key management system uses (R1, R2) to verify whether the QR code server is valid. If it is valid, (R1, R2) is used as the symmetric key for communication between the two parties.

[0042] S15. The quantum key management system uses (R1, R2) to encrypt the quantum symmetric key KeySet it generates to obtain Ckey:

[0043] Ckey=SM4_Encrypt((R1,R2),KeySet);

[0044] Among them, SM4_Encrypt is a symmetric encryption function based on the Chinese national standard SM4 block cipher algorithm;

[0045] The quantum key management system sends the Ckey to the QR code server.

[0046] S16. The QR code server uses (R1, R2) to decrypt Ckey to obtain the quantum symmetric key KeySet, completing the quantum symmetric key filling:

[0047] KeySet=SM4_Decrypt((R1,R2),Ckey);

[0048] Among them, SM4_Decrypt is a symmetric decryption function based on the SM4 block cipher algorithm.

[0049] Preferably, the QR code server imports quantum symmetric keys generated by the quantum key management system daily, including:

[0050] When the network is unavailable, the quantum symmetric key KeySet generated by the quantum key management system is imported offline daily to the QR code server via an encrypted USB flash drive.

[0051] Preferably, after receiving a QR code request from the user, the QR code server generates multiple sets of raw data, encrypts them using a quantum symmetric key, and then sends them to the user, including:

[0052] S21. When a user registers for the APP on the user's end, the user obtains the public key certificate of the QR code server and sends a QR code request to the QR code server.

[0053] S22. The QR code server generates multiple sets of raw data based on the user ID according to the second preset time interval.

[0054] S23. The QR code server generates a hash value for each set of original data and uses the last two bytes as an index to obtain the common target quantum symmetry key.

[0055] S24. The QR code server uses the target quantum symmetric key to encrypt the corresponding original data to obtain multiple sets of ciphertext. It packages the hash value of the message composed of multiple sets of ciphertext and multiple sets of original data, encrypts it with its own private key, and sends it to the user terminal.

[0056] Preferably, the user terminal converts the encrypted data sent by the QR code server into multiple corresponding QR codes, and dynamically rotates these QR codes, including:

[0057] The user terminal uses the public key certificate of the QR code server to decrypt the encrypted data, obtains the hash value of the message composed of multiple sets of ciphertext and multiple sets of original data, and combines the hash value to convert the multiple sets of ciphertext into corresponding QR codes. At the same time, the QR codes are dynamically rotated at a third preset time interval.

[0058] Preferably, the device reads the QR code displayed on the user terminal and converts it into multiple sets of corresponding plaintext data. The multiple sets of plaintext data are compared with the hash values ​​of the original data. If the difference between the timestamp in the QR code and the current time is less than a first preset time interval, and two consecutive sets of messages pass verification, then the QR code is considered correct. This includes:

[0059] S31. The device reads the QR code displayed on the user terminal, uses the last two bytes of the hash value of the message composed of multiple sets of original data as an index, and sends it to the quantum key management system.

[0060] S32. The quantum key management system obtains the target quantum symmetry key, encrypts it using its own private key, and sends it to the device.

[0061] S33. The device uses the corresponding public key to decrypt and obtain the target quantum symmetric key;

[0062] S34. The device uses the target quantum symmetric key to decrypt multiple sets of ciphertext to obtain multiple sets of plaintext data, and generates the hash value of the message composed of multiple sets of plaintext data. The hash value of the message is compared with that of the original data.

[0063] S35. When the difference between the timestamp in the QR code and the current time is less than the first preset time interval, and two sets of messages are verified consecutively, the QR code is considered to be correct.

[0064] Preferably, in step S35, if the difference between the timestamp in the QR code and the current time is less than a first preset time interval, and two sets of messages are verified consecutively, then the QR code is considered correct, including:

[0065] If the difference between the timestamp in the QR code and the current time is less than 3 seconds, that is, the validity period is less than 3 seconds, and two sets of messages are verified consecutively, then the QR code is considered to be correct.

[0066] Among them, a timeliness of less than 3 seconds indicates that the QR code generated and displayed by the user has a "short-term timeliness," and its design logic includes:

[0067] 1) Automatic refresh mechanism: The user terminal dynamically rotates each QR code at a 2-second time interval, that is, the QR code is automatically refreshed every 2 seconds;

[0068] 2) Principle of two consecutive valid actions: It is difficult for an attacker to complete two screenshot, transmission and terminal scanning actions within 6 seconds.

[0069] (III) Beneficial Effects

[0070] Compared with existing technologies, this invention combines quantum key technology with national cryptographic algorithms to propose a dynamic QR code encryption and verification system that supports short-term validity and dynamic updates. It achieves data encryption, dynamic challenge-response authentication, and key self-destruction mechanism through quantum symmetric keys, effectively solving security problems such as QR code copying and theft, brute-force attacks by quantum computing, man-in-the-middle attacks, and replay attacks faced by traditional solutions. This invention can be widely applied in fields requiring high-security electronic credential verification, significantly improving the system's anti-attack capability and data privacy while ensuring a convenient user experience. Attached Figure Description

[0071] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are merely some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without any creative effort.

[0072] Figure 1 This is a schematic diagram of the quantum symmetric key generation and filling process in this invention;

[0073] Figure 2 This is a schematic diagram of the user registration application QR code process in this invention;

[0074] Figure 3 This is a schematic diagram of the QR code verification process in this invention. Detailed Implementation

[0075] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the scope of protection of the present invention.

[0076] The following section describes the specific functional modules and technical effects of the quantum key-based QR code dynamic encryption and verification system provided by this invention, using concrete examples. The system functional modules include: a quantum key management system, a QR code server, a user terminal, and a device terminal.

[0077] The quantum key management system generates multiple sets of quantum symmetric keys daily (during non-operational periods);

[0078] On the QR code server side, the quantum symmetric key generated by the quantum key management system is imported daily, and after receiving the QR code request sent by the user, multiple sets of raw data are generated, encrypted using the quantum symmetric key, and sent to the user.

[0079] On the user side, the encrypted data sent by the QR code server is converted into multiple corresponding QR codes, and the QR codes are dynamically rotated.

[0080] On the device side, the QR code displayed on the user terminal is read and converted into multiple sets of plaintext data. The hash values ​​of the multiple sets of plaintext data are compared with the hash values ​​of the multiple sets of original data. If the difference between the timestamp in the QR code and the current time is less than the first preset time interval, and two sets of messages are verified consecutively, the QR code is considered to be correct.

[0081] Since the following three stages involve the transmission of multiple keys, in order to ensure the secure transmission of keys, the quantum key management system, QR code server, user terminal and device terminal can be protected by deploying quantum communication encryption or pre-made master keys. The main purpose of the technical solution in this application is to protect the data security of the subway QR code ticketing system itself, and the key transmission protection methods are not described in detail.

[0082] I. Quantum Symmetric Key Generation and Filling Process

[0083] The QR code server imports the quantum symmetric keys generated by the quantum key management system daily (before operations begin), such as... Figure 1 As shown, it includes:

[0084] S11. The QR code server requests the first quantum random number R1 from the quantum key management system via the network.

[0085] S12. The quantum key management system generates a first quantum random number R1 and encrypts it using its private key to obtain Cr1:

[0086] Cr1=SM2_Encrypt(KeyPrivate[idx],R1);

[0087] Where KeyPrivate[idx] represents the private key selected from the private key pool KeyPrivate corresponding to the key identifier idx. The key identifier idx is used to indicate the key pair used in this communication. SM2_Encrypt is the encryption function based on the national cryptographic SM2 elliptic curve public key cryptography algorithm.

[0088] The quantum key management system sends Cr and the key identifier idx to the QR code server.

[0089] S13. The QR code server selects the corresponding public key based on the key identifier idx to decrypt Cr and obtain the first quantum random number R1:

[0090] R1=SM2_Decrypt(KeyPublic[idx],Cr);

[0091] Where KeyPublic[idx] represents the public key corresponding to the key identifier idx selected from the public key pool KeyPublic, and SM2_Decrypt is the decryption function based on the national cryptographic SM2 elliptic curve public key cryptography algorithm;

[0092] The QR code server generates a second quantum random number R2, and then uses the public key to encrypt (R1, R2) to obtain Cr2:

[0093] Cr2=SM2_Encrypt(KeyPublic[idx],(R1,R2));

[0094] And send Cr2 and the key identifier idx to the quantum key management system;

[0095] S14. The quantum key management system selects the corresponding private key based on the key identifier idx to decrypt Cr2 and obtain (R1, R2):

[0096] (R1,R2)=SM2_Decrypt(KeyPrivate[idx],Cr2);

[0097] The quantum key management system uses (R1, R2) to verify whether the QR code server is valid. If it is valid, (R1, R2) is used as the symmetric key for communication between the two parties.

[0098] S15. The quantum key management system uses (R1, R2) to encrypt the quantum symmetric key KeySet it generates to obtain Ckey:

[0099] Ckey=SM4_Encrypt((R1,R2),KeySet);

[0100] Among them, SM4_Encrypt is a symmetric encryption function based on the Chinese national standard SM4 block cipher algorithm;

[0101] The quantum key management system sends the Ckey to the QR code server.

[0102] S16. The QR code server uses (R1, R2) to decrypt Ckey to obtain the quantum symmetric key KeySet, completing the quantum symmetric key filling:

[0103] KeySet=SM4_Decrypt((R1,R2),Ckey);

[0104] Among them, SM4_Decrypt is a symmetric decryption function based on the SM4 block cipher algorithm.

[0105] Meanwhile, the QR code server imports quantum symmetric keys generated by the quantum key management system daily, including:

[0106] When the network is unavailable, the quantum symmetric key KeySet generated by the quantum key management system is imported offline daily to the QR code server via an encrypted USB flash drive.

[0107] The above technical solution enhances resistance to quantum attacks by introducing quantum symmetric keys, and further improves security by periodically generating and updating the quantum symmetric keys (during non-operational periods). When the network is normal, updates can be performed online; when the network is unavailable, offline import can be achieved via encrypted USB drives or similar methods.

[0108] II. User Registration Application QR Code Step

[0109] After receiving a QR code request from the user, the QR code server generates multiple sets of raw data, encrypts them using a quantum symmetry key, and then sends them to the user. For example... Figure 2 As shown, it includes:

[0110] S21. When a user registers for the APP on the user's end, the user obtains the public key certificate of the QR code server and sends a QR code request to the QR code server.

[0111] S22. The QR code server generates multiple sets of raw data based on the user ID according to the second preset time interval (3s);

[0112] S23. The QR code server generates a hash value (SM3) for each set of original data and uses the last two bytes as an index to obtain the common target quantum symmetry key.

[0113] S24. The QR code server uses the target quantum symmetric key to encrypt the corresponding original data (SM4) to obtain multiple sets of ciphertext. It packages the hash value of the message composed of multiple sets of ciphertext and multiple sets of original data, and then encrypts it with its own private key before sending it to the user terminal.

[0114] In the above technical solution, the QR code server generates multiple sets of raw data based on the user ID according to a second preset time interval, including:

[0115] Based on the current time t, generate 4 sets of original data at 3-second intervals: (ID,t), (ID,t+3), (ID,t+6), and (ID,t+9).

[0116] The QR code server records the current time t (e.g., 10:30:00.000).

[0117] Generate 4 sets of raw data at 3-second intervals, with timestamps incremented by 0, 3, 6, and 9 seconds respectively:

[0118] - Group 1: (ID, 10:30:00.000);

[0119] - Second group: (ID, 10:30:03.000);

[0120] - Group 3: (ID, 10:30:06.000);

[0121] - Group 4: (ID, 10:30:09.000).

[0122] The above technical solution introduces different timestamps when the QR code server generates the hash value of each set of original data, and uses the last two bytes of the hash value as an index to reduce the exposure time of the same key and reduce the probability of being reverse engineered.

[0123] The user client converts the encrypted data sent by the QR code server into multiple corresponding QR codes and dynamically rotates these QR codes, such as... Figure 2 As shown, it includes:

[0124] The user terminal uses the public key certificate of the QR code server (the user terminal does not need to obtain the quantum symmetric key during the whole process) to decrypt the encrypted data, and obtains the hash value of the message composed of multiple sets of ciphertext and multiple sets of original data. The user terminal then combines the hash value to convert the multiple sets of ciphertext into corresponding QR codes. At the same time, the user terminal dynamically rotates the QR codes at a third preset time interval (2 seconds) (the user terminal does not need to operate manually, and the QR code interface automatically displays the latest QR code).

[0125] The QR code generation strategy described above determines the temporal distribution of the QR code sequence while ensuring that users have continuous QR codes available. Four sets of raw data are generated at a time, covering a 12-second time window; subsequently, the user's terminal automatically refreshes the QR codes every 2 seconds, making the four QR codes available for 8 seconds.

[0126] III. QR code verification (transaction) step (no internet connection required)

[0127] The device reads the QR code displayed on the user's device and converts it into multiple sets of plaintext data. It then compares the hash values ​​of these plaintext data sets with those of the original data sets. If the difference between the timestamp in the QR code and the current time is less than a first preset time interval (3 seconds), and two consecutive verifications pass, the QR code is considered correct. Figure 3 As shown, it includes:

[0128] S31. The device reads the QR code displayed on the user terminal, uses the last two bytes of the hash value of the message composed of multiple sets of original data as an index, and sends it to the quantum key management system.

[0129] S32. The quantum key management system obtains the target quantum symmetry key, encrypts it using its own private key, and sends it to the device.

[0130] S33. The device uses the corresponding public key to decrypt and obtain the target quantum symmetric key;

[0131] S34. The device uses the target quantum symmetric key to decrypt multiple sets of ciphertexts (SM4) to obtain multiple sets of plaintext data, and generates a hash value of a message composed of multiple sets of plaintext data (SM3). The hash values ​​of the multiple sets of plaintext data are compared with those of the multiple sets of original data.

[0132] S35. When the difference between the timestamp in the QR code and the current time is less than the first preset time interval, and two sets of messages are verified consecutively, the QR code is considered to be correct.

[0133] Specifically, in S35, if the difference between the timestamp in the QR code and the current time is less than a first preset time interval, and two sets of messages are verified consecutively, then the QR code is considered correct, including:

[0134] If the difference between the timestamp in the QR code and the current time is less than 3 seconds, that is, the validity period is less than 3 seconds, and two sets of messages are verified consecutively (and the ID is the same user), then the QR code is considered to be correct.

[0135] Among them, a timeliness of less than 3 seconds indicates that the QR code generated and displayed by the user has a "short-term timeliness," and its design logic includes:

[0136] 1) Automatic refresh mechanism: The user terminal dynamically rotates each QR code at a 2-second time interval, that is, the QR code is automatically refreshed every 2 seconds;

[0137] 2) Principle of two consecutive valid actions: It is difficult for an attacker to complete two screenshot, transmission and terminal scanning actions within 6 seconds.

[0138] In the above technical solution, when the turnstile (device) verifies a single QR code:

[0139] Scan the QR code and read the timestamp in the QR code (e.g., 10:30:03.000).

[0140] Get the current time of the turnstile (e.g., 10:30:05.500);

[0141] Calculate the difference: 5.500 - 3.000 = 2.500 s;

[0142] Judgment: 2.500s < 3s → Passes timeliness verification.

[0143] The QR code verification strategy described above is used to determine whether a QR code is still valid. Each QR code has its own 3-second validity period. Once the validity period expires (i.e., it fails the timeliness verification), the gate will immediately reject the code and will not perform any further verification. At this time, the user needs to request a new QR code.

[0144] The purpose of timeliness verification is to:

[0145] 1) Preventing screenshot theft: Attackers cannot complete the actions of screenshotting, transmitting, forging, and scanning on the terminal within 3 seconds;

[0146] 2) Preventing replay attacks: To prevent attacks in the form of video recording, the system is set so that "the difference between the timestamp in the QR code and the current time is less than 3 seconds". When two QR codes are recorded, the previous QR code has already expired.

[0147] In the technical solution of this application, although both the first preset time interval and the second preset time interval are 3 seconds, they have obvious differences, as shown in the table below:

[0148] Table 1 Comparison of the First Preset Time Interval and the Second Preset Time Interval

[0149] Comparison Dimensions The registration process has a 3-second interval (the second preset time interval). The 3-second interval during the transaction process (first preset time interval) Link When registering as a user / obtaining a QR code When scanning QR code for verification at the gate Operator QR code server Turnstile (equipment end) Time point When generating a QR code When verifying QR codes Purpose Generation strategy: Generate a continuous sequence of QR codes. Verification strategy: Prevent QR code replay object A set of QR codes for the same user Single QR code direction Time advances (t→t+3→t+6...) Time comparison (current time - QR code time < 3s)

[0150] The above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions will not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A dynamic encryption and verification system for QR codes based on quantum key distribution, characterized in that: This includes a quantum key management system, a QR code server, a user terminal, and a device terminal; The quantum key management system generates multiple sets of quantum symmetric keys daily at set times. On the QR code server side, the quantum symmetric key generated by the quantum key management system is imported daily, and after receiving the QR code request sent by the user, multiple sets of raw data are generated, encrypted using the quantum symmetric key, and sent to the user. On the user side, the encrypted data sent by the QR code server is converted into multiple corresponding QR codes, and the QR codes are dynamically rotated. On the device side, the QR code displayed on the user terminal is read and converted into multiple sets of plaintext data. The hash values ​​of the multiple sets of plaintext data are compared with those of the multiple sets of original data. If the difference between the timestamp in the QR code and the current time is less than the first preset time interval, and two sets of messages are verified consecutively, the QR code is considered to be correct.

2. The quantum key-based QR code dynamic encryption and verification system according to claim 1, characterized in that: The QR code server imports quantum symmetric keys generated by the quantum key management system daily, including: S11. The QR code server requests the first quantum random number R1 from the quantum key management system via the network. S12. The quantum key management system generates a first quantum random number R1 and encrypts it using its private key to obtain Cr1: Cr1=SM2_Encrypt(KeyPrivate[idx],R1); Where KeyPrivate[idx] represents the private key selected from the private key pool KeyPrivate corresponding to the key identifier idx. The key identifier idx is used to indicate the key pair used in this communication. SM2_Encrypt is the encryption function based on the national cryptographic SM2 elliptic curve public key cryptography algorithm. The quantum key management system sends Cr and the key identifier idx to the QR code server. S13. The QR code server selects the corresponding public key based on the key identifier idx to decrypt Cr and obtain the first quantum random number R1: R1=SM2_Decrypt(KeyPublic[idx],Cr); Where KeyPublic[idx] represents the public key corresponding to the key identifier idx selected from the public key pool KeyPublic, and SM2_Decrypt is the decryption function based on the national cryptographic SM2 elliptic curve public key cryptography algorithm; The QR code server generates a second quantum random number R2, and then uses the public key to encrypt (R1, R2) to obtain Cr2: Cr2=SM2_Encrypt(KeyPublic[idx],(R1,R2)); And send Cr2 and the key identifier idx to the quantum key management system; S14. The quantum key management system selects the corresponding private key based on the key identifier idx to decrypt Cr2 and obtain (R1, R2): (R1,R2)=SM2_Decrypt(KeyPrivate[idx],Cr2); The quantum key management system uses (R1, R2) to verify whether the QR code server is valid. If it is valid, (R1, R2) is used as the symmetric key for communication between the two parties. S15. The quantum key management system uses (R1, R2) to encrypt the quantum symmetric key KeySet it generates to obtain Ckey: Ckey=SM4_Encrypt((R1,R2),KeySet); Among them, SM4_Encrypt is a symmetric encryption function based on the Chinese national standard SM4 block cipher algorithm; The quantum key management system sends the Ckey to the QR code server. S16. The QR code server uses (R1, R2) to decrypt Ckey to obtain the quantum symmetric key KeySet, completing the quantum symmetric key filling: KeySet=SM4_Decrypt((R1,R2),Ckey); Among them, SM4_Decrypt is a symmetric decryption function based on the SM4 block cipher algorithm.

3. The quantum key-based QR code dynamic encryption and verification system according to claim 2, characterized in that: The QR code server imports quantum symmetric keys generated by the quantum key management system daily, including: When the network is unavailable, the quantum symmetric key KeySet generated by the quantum key management system is imported offline daily to the QR code server via an encrypted USB flash drive.

4. The quantum key-based QR code dynamic encryption and verification system according to claim 1, characterized in that: After receiving a QR code request from the user, the QR code server generates multiple sets of raw data, encrypts them using a quantum symmetric key, and sends them to the user, including: S21. When a user registers for the APP on the user's end, the user obtains the public key certificate of the QR code server and sends a QR code request to the QR code server. S22. The QR code server generates multiple sets of raw data based on the user ID according to the second preset time interval. S23. The QR code server generates a hash value for each set of original data and uses the last two bytes as an index to obtain the common target quantum symmetry key. S24. The QR code server uses the target quantum symmetric key to encrypt the corresponding original data to obtain multiple sets of ciphertext. It packages the hash value of the message composed of multiple sets of ciphertext and multiple sets of original data, encrypts it with its own private key, and sends it to the user terminal.

5. The quantum key-based QR code dynamic encryption and verification system according to claim 4, characterized in that: The user terminal converts the encrypted data sent by the QR code server into multiple corresponding QR codes, and dynamically rotates these QR codes, including: The user terminal uses the public key certificate of the QR code server to decrypt the encrypted data, obtains the hash value of the message composed of multiple sets of ciphertext and multiple sets of original data, and combines the hash value to convert the multiple sets of ciphertext into corresponding QR codes. At the same time, the QR codes are dynamically rotated at a third preset time interval.

6. The quantum key-based QR code dynamic encryption and verification system according to claim 5, characterized in that: The device reads the QR code displayed on the user terminal and converts it into multiple sets of plaintext data. It then compares the hash values ​​of these plaintext data sets with those of the original data sets. If the difference between the timestamp in the QR code and the current time is less than a first preset time interval, and two consecutive verifications pass, the QR code is considered correct. S31. The device reads the QR code displayed on the user terminal, uses the last two bytes of the hash value of the message composed of multiple sets of original data as an index, and sends it to the quantum key management system. S32. The quantum key management system obtains the target quantum symmetry key, encrypts it using its own private key, and sends it to the device. S33. The device uses the corresponding public key to decrypt and obtain the target quantum symmetric key; S34. The device uses the target quantum symmetric key to decrypt multiple sets of ciphertext to obtain multiple sets of plaintext data, and generates the hash value of the message composed of multiple sets of plaintext data. The hash value of the message is compared with that of the original data. S35. When the difference between the timestamp in the QR code and the current time is less than the first preset time interval, and two sets of messages are verified consecutively, the QR code is considered to be correct.

7. The quantum key-based QR code dynamic encryption and verification system according to claim 6, characterized in that: In S35, if the difference between the timestamp in the QR code and the current time is less than a first preset time interval, and two consecutive sets of messages pass verification, then the QR code is considered correct, including: If the difference between the timestamp in the QR code and the current time is less than 3 seconds, that is, the validity period is less than 3 seconds, and two sets of messages are verified consecutively, then the QR code is considered to be correct. Among them, a timeliness of less than 3 seconds indicates that the QR code generated and displayed by the user has a "short-term timeliness," and its design logic includes: 1) Automatic refresh mechanism: The user terminal dynamically rotates each QR code at a 2-second time interval, that is, the QR code is automatically refreshed every 2 seconds; 2) Principle of two consecutive valid actions: It is difficult for an attacker to complete two screenshot, transmission and terminal scanning actions within 6 seconds.

Citation Information

Patent Citations

  • Data transmission method, device and apparatus

    CN113326711A

  • Two-dimensional code offline verification method and system, and storage medium

    CN117857060A

  • Multi-cloud symmetric key management method and system based on national cryptographic algorithm

    CN117879830A

  • QR code decoding method and system based on quantum key encryption and decryption

    CN119728097A

  • Geological disaster monitoring and early warning network security encryption system

    CN120455003A