Method and system for scanning two-dimensional code to bind equipment
By generating multi-layered encrypted values and performing consistency comparisons, the problem of insufficient security and uniqueness in QR code binding technology is solved, achieving security and uniqueness in device binding and improving user experience.
Patent Information
- Application Number
- CN202511182909.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-22
- Publication Date
- 2025-12-12
AI Technical Summary
Existing QR code binding technology lacks dynamic security and uniqueness, posing risks of malicious attacks and duplicate binding, resulting in a poor user experience.
Device binding is achieved by generating multi-layered encrypted values. The encrypted values are calculated using formulas 1-3, and the binding is confirmed through consistency comparison. Multiple verifications are performed by combining device fingerprint and QR code information to enhance the security and uniqueness of the binding.
It improves the security and uniqueness of device binding, and enhances the user experience.
Smart Images

Figure CN121125186A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the technical field of device binding remote debugging, and particularly relates to a method and system for binding a device by scanning a two-dimensional code. BACKGROUND
[0002] Existing two-dimensional code binding technologies are mainly based on fixed format decoding and conventional matching, and lack efficient judgment of dynamic security, binding uniqueness and device authenticity, so there is a risk of malicious attacks or repeated binding. Therefore, a new algorithm model is needed to enhance the security and uniqueness of binding while ensuring the operation efficiency. SUMMARY
[0003] In view of the deficiencies of the prior art, the purpose of the present application is to provide a method and system for binding a device by scanning a two-dimensional code, which aims to solve the problem that the existing technology cannot provide an effective method for binding a device by scanning a two-dimensional code, resulting in easy malicious cracking and repeated binding of the device and poor user experience.
[0004] In one aspect, the present application provides a method for binding a device by scanning a two-dimensional code, the method comprising the following steps:
[0005] Scanning the two-dimensional code of the device to obtain information of the two-dimensional code, generating a first encrypted value according to the information of the two-dimensional code, and sending a binding request;
[0006] Generating a device fingerprint, obtaining the first encrypted value, generating a second encrypted value according to the device fingerprint and the first encrypted value, and generating a third encrypted value according to the second encrypted value;
[0007] After receiving the binding request, obtaining the first encrypted value and the second encrypted value, and generating a fourth encrypted value according to the first encrypted value and the second encrypted value;
[0008] Obtaining the third encrypted value, comparing the consistency of the third encrypted value and the fourth encrypted value, and confirming the binding if the consistency comparison is passed;
[0009] Performing remote debugging on the device.
[0010] The method of the present application, wherein the method further comprises obtaining the first encrypted value according to formula 1;
[0011] Formula 1: Wherein, S1 is the first encryption value, len(Q) is the two-dimensional code data string and length, R is a random seed extracted from the two-dimensional code, T is a timestamp generated by the two-dimensional code, alpha, beta, gamma are used to adjust the length of the first encryption value and the randomness of the seed and the sensitivity of the timestamp in order; log(1+T) is a natural logarithm operation on (1+T).
[0012] The method of the application, wherein the device fingerprint is any one of an IMEI serial number, a MAC address, and a hash value.
[0013] The method of the application, wherein the method further comprises: obtaining the second encryption value according to formula 2.
[0014] Formula 2: Wherein, S2 is the second encryption value, F is the device fingerprint, mod(F, R) is the modulus of F with respect to R, delta, eta are used to balance the weight of the XOR result and the modulus operation result in order.
[0015] The method of the application, wherein the method further comprises: obtaining the third encryption value or the fourth encryption value according to formula 3.
[0016] Formula 3: S3 = lambda * (S2 + R) κ - mu * sin(T); wherein S3 is the third encryption value or the fourth encryption value, lambda, mu, kappa are used to control the amplification of the encryption value and the time disturbance and the exponential intensity in order.
[0017] The method of the application, wherein the method further comprises: taking the absolute value of the third encryption value and the fourth encryption value respectively, eliminating floating-point errors, and taking the first 64 bits to generate a check tag for consistency comparison.
[0018] The method of the application, wherein the remote debugging of the device comprises:
[0019] Online programming generates a script file, remotely downloads the script file to the device, and the device outputs log information in real time.
[0020] In another aspect, the application provides a system for scanning a two-dimensional code to bind a device, the system comprising:
[0021] A user terminal scans the two-dimensional code of the device to obtain information of the two-dimensional code, generates a first encryption value according to the information of the two-dimensional code, and sends a binding request.
[0022] The device end generates a device fingerprint, acquires the first encrypted value, generates a second encrypted value according to the device fingerprint and the first encrypted value, and generates a third encrypted value according to the second encrypted value.
[0023] The server acquires the first encrypted value and the second encrypted value after receiving the binding request, generates a fourth encrypted value according to the first encrypted value and the second encrypted value, acquires the third encrypted value, compares the consistency of the third encrypted value and the fourth encrypted value, and confirms the binding if the consistency comparison is passed.
[0024] The web browser remotely debugs the device.
[0025] The web browser further comprises:
[0026] The programming unit generates an online production script file;
[0027] The downloading unit remotely downloads the script file to the device;
[0028] The log display unit displays the log information in real time;
[0029] The device end further comprises:
[0030] The log output unit remotely outputs the log information in real time.
[0031] In another aspect, the application further provides a non-volatile computer readable storage medium storing computer executable instructions, which, when executed by one or more processors, can cause the one or more processors to perform the method of scanning a two-dimensional code to bind a device.
[0032] In another aspect, the application further provides a computer program product comprising a computer program stored on a non-volatile computer readable storage medium, the computer program comprising program instructions that, when executed by a processor, cause the processor to perform the method of scanning a two-dimensional code to bind a device.
[0033] The application has the beneficial effects that the two-dimensional code of the device is scanned to acquire information of the two-dimensional code, a first encrypted value is generated according to the information of the two-dimensional code, and a binding request is sent; a device fingerprint is generated, the first encrypted value is acquired, a second encrypted value is generated according to the device fingerprint and the first encrypted value, and a third encrypted value is generated according to the second encrypted value; the first encrypted value and the second encrypted value are acquired after receiving the binding request, a fourth encrypted value is generated according to the first encrypted value and the second encrypted value; the third encrypted value is acquired, the consistency of the third encrypted value and the fourth encrypted value is compared, and the binding is confirmed if the consistency comparison is passed; and the device is remotely debugged; thereby improving the security and uniqueness of device binding, and further improving user experience. Attached Figure Description
[0034] Figure 1 This is a flowchart illustrating the implementation of the method for binding a device by scanning a QR code, as provided in Embodiment 1 of the present invention.
[0035] Figure 2 This is a schematic diagram of the system for binding devices by scanning QR codes provided in Embodiment 2 of the present invention. Detailed Implementation
[0036] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.
[0037] The specific implementation of the present invention will be described in detail below with reference to specific embodiments:
[0038] Example One:
[0039] Figure 1 The implementation flow of the method for binding a device by scanning a QR code according to Embodiment 1 of the present invention is shown. For ease of explanation, only the parts related to the embodiments of the present invention are shown, and are described in detail below:
[0040] In step S101, the device's QR code is scanned to obtain the QR code information, a first encrypted value is generated based on the QR code information, and a binding request is sent.
[0041] In an embodiment of the present invention, the method further includes: obtaining a first encrypted value according to Formula 1;
[0042] Formula 1: Where S1 is the first encrypted value, len(Q) is the QR code data string and its length, where Q is the QR code data string, and the longer the length, the greater the contribution to the security value, R is the random seed extracted from the QR code, which is taken as an integer, T is the timestamp of the QR code generation, α, β, and γ are used in order to adjust the length of the first encrypted value, the randomness of the seed, and the sensitivity of the timestamp, respectively, and are algorithm weight parameters; log(1+T) is the natural logarithm operation on (1+T); this formula 1 calculates the initial security verification value by mixing the three elements of the QR code data string and its length, the randomness of the random seed, and the timestamp of the QR code generation, to prevent simple QR code copying attacks.
[0043] In step S102, a device fingerprint is generated, a first encrypted value is obtained, a second encrypted value is generated based on the device fingerprint and the first encrypted value, and a third encrypted value is generated based on the second encrypted value.
[0044] In the embodiments of the present application, the device fingerprint is any one of an IMEI serial number, a MAC address, and a hash value.
[0045] Further, the method further comprises: obtaining the second encrypted value according to Formula 2;
[0046] Formula 2: wherein S2 is the second encrypted value, F is the device fingerprint, mod(F, R) is the modulus of F with respect to R, and the increase in randomness, δ and η are used to balance the weight of the exclusive or result and the modulus operation result in order; this Formula 2 combines the device fingerprint and the two-dimensional code data string and length information, and ensures that even if the two-dimensional code is intercepted, the binding request cannot be forged.
[0047] Further, the method further comprises: obtaining the third encrypted value or the fourth encrypted value according to Formula 3;
[0048] Formula 3: S3 = λ · (S2 + R) κ - μ · sin(T); wherein S3 is the third encrypted value or the fourth encrypted value, λ, μ, κ are used to control the amplification of the encrypted value and the time disturbance and the exponential intensity in order; this Formula 3 enhances the dynamic security of the binding process through exponential operation and sinusoidal disturbance, and even if the attacker obtains part of the parameters, the complete check value cannot be inversely deduced.
[0049] In step S103, after receiving the binding request, the first encrypted value and the second encrypted value are obtained, and the fourth encrypted value is generated according to the first encrypted value and the second encrypted value;
[0050] In the embodiments of the present application,
[0051] In step S104, the third encrypted value is obtained, the consistency of the third encrypted value and the fourth encrypted value is compared, and if the consistency comparison is passed, the binding is confirmed;
[0052] In the embodiments of the present application, the method further comprises: taking the absolute value of the third encrypted value and the fourth encrypted value respectively, eliminating the floating point error, and taking the first 64 bits to generate a check tag before consistency comparison;
[0053] In the embodiments of the present application, the absolute value of the third encrypted value or the fourth encrypted value is taken according to Formula 4;
[0054] Formula 4: wherein, indicates quantization processing;
[0055] Further, after taking the absolute value of the third encrypted value or the fourth encrypted value, the floating point error is eliminated and the first 64-bit integer is taken according to Formula 5.
[0056] Formula 5:
[0057] wherein L represents a check tag, mod2 64 denotes taking the integer part; it is to be noted that because S3 contains sin(T) and power operation, there can be slight differences in cross-platform floating-point details; first use Quantization and then taking 64-bit check tag can avoid errors and reduce bandwidth.
[0058] Further, in the embodiment of the present application, the following parameters are taken:
[0059] Q = "ABCD1234", len(Q) = 8
[0060] R = 529
[0061] T = 1690000000
[0062] F = 983475
[0063] α = 2, β = 3, γ = 1, δ = 4, η = 2, λ = 1, μ = 5, κ = 2
[0064] The first encrypted value is calculated according to Formula 1:
[0065]
[0066]
[0067] S1 ≈ 16 + 3·23 + log(1690000001)
[0068] S1 ≈ 16 + 69 + 21.25 = 106.25
[0069] The second encrypted value is calculated according to Formula 2:
[0070]
[0071] The third encrypted value or the fourth encrypted value is calculated according to Formula 3:
[0072] S3 = λ·(S2 + R) 2 - μ·sin(T)
[0073] S3 = 1·(S2 + 529) 2 - 5·sin(1690000000)
[0074] In step S105, the device is remotely debugged.
[0075] In the embodiment of the present application, remotely debugging the device comprises:
[0076] The online programming generates a script file, remotely downloads the script file to the device, and the device remotely outputs log information in real time.
[0077] In the embodiment of the application, the scanning device acquires information of the two-dimensional code, generates a first encryption value according to the information of the two-dimensional code, and sends a binding request; a device fingerprint is generated, the first encryption value is acquired, a second encryption value is generated according to the device fingerprint and the first encryption value, and a third encryption value is generated according to the second encryption value; after receiving the binding request, the first encryption value and the second encryption value are acquired, a fourth encryption value is generated according to the first encryption value and the second encryption value; the third encryption value is acquired, consistency of the third encryption value and the fourth encryption value is compared, and if the consistency comparison is passed, the binding is confirmed; the device is remotely debugged; thereby the security and uniqueness of the device binding are improved, and the user experience is improved.
[0078] Example Two:
[0079] Figure 2 The structure of the system for binding the device by scanning the two-dimensional code according to the embodiment two of the application is shown, only the parts related to the embodiment of the application are shown for the convenience of description, and the system includes:
[0080] The user end 100 scans the two-dimensional code of the device to acquire information of the two-dimensional code, generates a first encryption value according to the information of the two-dimensional code, and sends a binding request;
[0081] The device end 200 generates a device fingerprint, acquires the first encryption value, generates a second encryption value according to the device fingerprint and the first encryption value, and generates a third encryption value according to the second encryption value;
[0082] The server end 300 acquires the first encryption value and the second encryption value after receiving the binding request, generates a fourth encryption value according to the first encryption value and the second encryption value, acquires the third encryption value, compares the consistency of the third encryption value and the fourth encryption value, and confirms the binding if the consistency comparison is passed;
[0083] The web browser 310 remotely debugs the device.
[0084] The web browser further includes:
[0085] The programming unit 311 generates a script file in online programming;
[0086] The downloading unit 312 remotely downloads the script file to the device;
[0087] The log display unit 313 displays log information in real time;
[0088] The device end 200 further includes:
[0089] The log output unit 210 remotely outputs log information in real time.
[0090] In this embodiment of the invention, each unit of the system for scanning QR codes to bind devices can be implemented by corresponding hardware or software units. Each unit can be an independent hardware or software unit, or it can be integrated into a single hardware or software unit. This is not intended to limit the invention.
[0091] Example Three:
[0092] Embodiment 3 of the present invention provides a non-volatile computer-readable storage medium storing computer-executable instructions that are executed by one or more processors, for example, executing the instructions described above. Figure 1 The method steps S101 to S105.
[0093] As an example, non-volatile storage media can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) as external cache memory. By way of explanation, RAM can be obtained in many forms such as synchronous RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), Synchronous ink DRAM (SLDRAM), and direct Rambus RAM (DRRAM). The memory components or memories disclosed in the operating environment described herein are intended to include one or more of these and / or any other suitable types of memory.
[0094] Example Four:
[0095] Embodiment 4 of the present invention provides a computer program product, which includes a computer program stored on a non-volatile computer-readable storage medium. The computer program includes program instructions, which, when executed by a processor, cause the processor to perform the method of scanning a QR code to bind a device as described in the above-described method embodiment. For example, performing the above-described... Figure 1 The method steps S101 to S105.
[0096] The embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0097] Those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a general hardware platform through the description of the above embodiments, and of course, can also be implemented by hardware. Based on such understanding, the above technical solutions can be embodied in the form of a software product in essence or in the form of a part of the related technology, and the computer software product can exist in a computer readable storage medium, such as a ROM / RAM, a magnetic disk, an optical disk, and the like, and includes a plurality of instructions to make a computer electronic device (which can be a personal computer, a server, or a network electronic device, etc.) execute the methods of each embodiment or some parts of the embodiment.
[0098] What has been described herein in the specification and drawings includes examples of methods and systems that can provide for scanning a two-dimensional code binding device. Of course, not every conceivable combination of elements and / or methods can be described for purposes of describing the various features of the present disclosure, but it will be recognized that many additional combinations and permutations of the disclosed features are possible. Accordingly, it is expressly intended that various modifications, aside from those that have been described herein, can be made to the present disclosure without departing from the scope or spirit of the present disclosure. Further, or in the alternative, other embodiments of the present disclosure can be apparent from consideration of the specification and drawings and practice of the present disclosure as presented herein. It is intended that the examples set forth in the specification and drawings be considered in all respects as illustrative and not limiting. Although specific terms are employed in the description, they are used in a generic and descriptive sense only and not for purposes of limitation.
Claims
1. A method of scanning a two-dimensional code binding device, characterized by, The method includes the following steps: Scan the device's QR code to obtain the QR code information, generate a first encrypted value based on the QR code information, and send a binding request; Generate a device fingerprint, obtain the first encrypted value, generate a second encrypted value based on the device fingerprint and the first encrypted value, and generate a third encrypted value based on the second encrypted value; Upon receiving the binding request, the first encrypted value and the second encrypted value are obtained, and a fourth encrypted value is generated based on the first encrypted value and the second encrypted value; Obtain the third encrypted value and compare its consistency with the fourth encrypted value. If the consistency comparison passes, confirm the binding. The device was remotely debugged.
2. The method of claim 1, wherein, The method further includes: obtaining the first encrypted value according to Formula 1; Formula 1: Wherein, S1 is the first encryption value, len(Q) is the two-dimensional code data string and length, R is a random seed extracted from the two-dimensional code, T is a timestamp generated by the two-dimensional code, and a, β, γ are used to adjust the length of the first encryption value, the randomness of the seed, and the sensitivity of the timestamp in order; log(1+T) is the natural logarithm operation on (1+T).
3. The method of claim 1, wherein, The device fingerprint can be any one of the following: IMEI serial number, MAC address, or hash value.
4. The method of claim 2 or 3, wherein, The method further includes: obtaining the second encrypted value according to formula 2; Equation 2: wherein S2 is the second encryption value, F is the device fingerprint, mod(F, R) is F modulo R, and δ, η are used to balance the weight of the XOR result and the modulo operation result, respectively, in order.
5. The method of claim 4, wherein, The method further includes: obtaining the third encrypted value or the fourth encrypted value according to formula 3; Equation 3: S3 = λ · (S2 + R) k - μ · sin(T); where S3 is the third encryption value or the fourth encryption value, λ, μ, k are used to control the amplification of the encryption value and the time disturbance and the exponential strength in that order.
6. The method of claim 1, wherein, The method further includes: taking the absolute values of the third encrypted value and the fourth encrypted value respectively to eliminate floating-point errors, and taking the first 64 bits to generate a verification tag for consistency comparison.
7. The method of claim 1, wherein, The remote debugging of the device includes: The system generates script files online, downloads the script files remotely to the device, and the device outputs log information remotely in real time.
8. A system for scanning a two-dimensional code binding device, characterized by, The system includes: On the user end, the device scans the QR code to obtain the information of the QR code, generates a first encrypted value based on the information of the QR code, and sends a binding request; On the device side, a device fingerprint is generated, the first encrypted value is obtained, a second encrypted value is generated based on the device fingerprint and the first encrypted value, and a third encrypted value is generated based on the second encrypted value. On the server side, upon receiving the binding request, the server obtains the first encrypted value and the second encrypted value, generates a fourth encrypted value based on the first encrypted value and the second encrypted value, obtains the third encrypted value, and compares the consistency between the third encrypted value and the fourth encrypted value. If the consistency comparison passes, the binding is confirmed. A web browser is used to remotely debug the device. The web browser also includes: Programming unit, online programming to generate script files; The download unit remotely downloads script files to the device. The log display unit displays the log information in real time; The device also includes: The log output unit outputs log information remotely in real time.
9. A non-transitory computer readable storage medium, comprising: The non-volatile computer-readable storage medium stores computer-executable instructions that, when executed by one or more processors, cause the one or more processors to perform the method of scanning a QR code binding device according to any one of claims 1-7.
10. A computer program product, characterised in that, The computer program product includes a computer program stored on a non-volatile computer-readable storage medium, the computer program including program instructions that, when executed by a processor, cause the processor to perform the method of scanning a QR code binding device as described in any one of claims 1-7.