Anti-counterfeiting method, system, readable storage medium and computer device

The QR code anti-counterfeiting system designed by the RSA encryption algorithm and ThinkPHP framework uses public key encryption and private key decryption technology to solve the problem of high anti-counterfeiting cost of QR codes, achieving convenient information reading and security improvement.

CN119578446BActive Publication Date: 2025-07-18WIZCARD TECH +2
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202510130964.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-02-06
Publication Date
2025-07-18
Estimated Expiration
2045-02-06

AI Technical Summary

Technical Problem

Among the existing QR code anti-counterfeiting technology, QR codes do not have anti-counterfeiting functions, which leads to difficulty in reading information and high cost.

Method used

The public and private keys are generated by RSA encryption algorithm, the QR code plain text information is encrypted through the public key, and the information is encrypted and combined in segments on the server and mobile terminals. The encrypted information is decrypted through the ID information, and the web interface and verification code are designed to generate security codes using the ThinkPHP framework.

Benefits of technology

It realizes convenient reading of QR code information, reduces anti-counterfeiting costs, and improves information security and anti-counterfeiting efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119578446B_ABST
    Figure CN119578446B_ABST
Patent Text Reader

Abstract

The present invention provides an anti-counterfeiting method, system, readable storage medium and computer device. The method includes generating a QR code for the selected product; generating a public key and a private key based on the RSA encryption algorithm, storing the private key on the server side, storing the public key on the mobile side, and encrypting the plaintext information of the QR code with the public key; designing an online Web interface and designing a QR code input interface and a QR code verification interface on the online Web interface; loading a verification code at the QR code verification interface based on the private key and generating a security code; adding a set of ID information on the server side and encrypting the ID information; requesting the server side based on the QR code input interface on the online Web interface, retrieving the decryption information corresponding to the ID information through the server side, and decrypting and obtaining the plaintext information of the QR code based on the decryption information and the private key. The present invention can conveniently read QR code information and reduce the anti-counterfeiting cost.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of anti-counterfeiting systems, and particularly to an anti-counterfeiting method, system, readable storage medium and computer device. Background Art

[0002] Two-dimensional code anti-counterfeiting query technology makes full use of the existing functions of smart phones, namely, the photographing function and the mobile network communication function. Consumers use a mobile phone with a photographing function to obtain a two-dimensional code image (containing encrypted information or unencrypted information) pasted or printed on a product, and transmit the photographed bar code image to the server side through the mobile communication network. The server decodes and decrypts the image, and then feeds back the finally processed information to the consumer. The consumer can authenticate the authenticity of the product by comparing the consistency between the product and the information fed back by the query.

[0003] In the prior art, since the two-dimensional code in a product does not have an anti-counterfeiting function, the encoding rule of a certain part of the two-dimensional code is usually modified, so that the information of the two-dimensional code can only be recognized and read by a specific recognition program or instrument. This not only makes it more troublesome to read product information, but also increases the cost in the anti-counterfeiting process. Summary of the Invention

[0004] Based on this, the purpose of the present invention is to provide an anti-counterfeiting method, system, readable storage medium and computer device to solve the deficiencies in the above-mentioned prior art.

[0005] In a first aspect, the present invention provides an anti-counterfeiting method, and the method includes:

[0006] Generate a two-dimensional code for the selected product;

[0007] Generate a public key and a private key based on the RSA encryption algorithm, store the private key on the server side, store the public key on the mobile side, and encrypt the plaintext information of the two-dimensional code with the public key. Among them, the plaintext information is encrypted in segments, and all segment keys in the segment encryption process are combined to obtain a combined key for the plaintext information, and the plaintext information is encrypted based on the combined key;

[0008] Design an online Web interface, and design a two-dimensional code input interface and a two-dimensional code verification interface on the online Web interface;

[0009] Load a verification code on the two-dimensional code verification interface on the online Web interface based on the private key, and generate a security code through the verification code;

[0010] Add a group of ID information on the server side and encrypt the ID information;

[0011] Request the server based on the QR code input interface on the online web interface, retrieve the decryption information corresponding to the ID information through the server, and decrypt and obtain the plaintext information of the QR code based on the decryption information and the private key.

[0012] Compared with the prior art, the beneficial effects of the present invention are as follows: Encrypt the plaintext information of the QR code with the public key generated by the RSA encryption algorithm, which can encrypt the information in the QR code. Retrieve the corresponding decryption information through the ID information, and decrypt with the private key and the decryption information to obtain the product information contained in the QR code, thereby achieving anti-counterfeiting of the product information. Moreover, the product information can be obtained through the decryption information of the ID information, and then the QR code information can be conveniently read, reducing the anti-counterfeiting cost.

[0013] Further, the steps of generating the QR code of the selected product include:

[0014] Obtain the plaintext information of the selected product and generate a QR code corresponding to the plaintext information;

[0015] Record the plaintext information of the selected product on the server side.

[0016] Further, the steps of designing the online web interface and designing the QR code input interface and the QR code verification interface on the online web interface include:

[0017] Establish an online web interface using the ThinkPHP framework. The online web interface includes a security code interface, a verification success interface, a verification failure interface, and an activity page;

[0018] And design a QR code input interface and a QR code verification interface on the online web interface through the ThinkPHP framework.

[0019] Further, after the step of retrieving the decryption information corresponding to the ID information through the server, the method further includes:

[0020] Transmit the decryption information to the mobile terminal based on the JSON format and store the decryption information in the mobile terminal.

[0021] In a second aspect, the present invention further provides an anti-counterfeiting system, and the system includes:

[0022] A generation module for generating a QR code of the selected product;

[0023] An encryption module, which is used to generate a public key and a private key based on the RSA encryption algorithm, store the private key on the server side, store the public key on the mobile side, and encrypt the plaintext information of the two-dimensional code with the public key. Among them, the plaintext information is encrypted in segments, and all segment keys in the segment encryption process are combined to obtain the combined key of the plaintext information, and the plaintext information is encrypted based on the combined key;

[0024] A design module, which is used to design an online Web interface and design a two-dimensional code input interface and a two-dimensional code verification interface on the online Web interface;

[0025] A loading module, which is used to load a verification code at the two-dimensional code verification interface on the online Web interface based on the private key, and generate a security code through the verification code;

[0026] An adding module, which is used to add a group of ID information on the server side and encrypt the ID information;

[0027] An invoking module, which is used to request the server side based on the two-dimensional code input interface on the online Web interface, retrieve the decrypted information corresponding to the ID information through the server side, and decrypt and obtain the plaintext information of the two-dimensional code based on the decrypted information and the private key.

[0028] Further, the generating module includes:

[0029] An obtaining unit, which is used to obtain the plaintext information of the selected product and generate a two-dimensional code corresponding to the plaintext information;

[0030] A recording unit, which is used to record the plaintext information of the selected product on the server side.

[0031] Further, the design module includes:

[0032] A establishing unit, which is used to establish an online Web interface using the ThinkPHP framework. The online Web interface includes a security code interface, a verification success interface, a verification failure interface, and an activity page;

[0033] A design unit, which is used to design a two-dimensional code input interface and a two-dimensional code verification interface on the online Web interface through the ThinkPHP framework.

[0034] In a third aspect, the present invention also provides a readable storage medium, on which a computer program is stored, and when the program is executed by a processor, the above anti-counterfeiting method is implemented.

[0035] Fourthly, the present invention further provides a computer device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, where the processor implements the above anti-counterfeiting method when executing the computer program. Description of the Drawings

[0036] Figure 1 It is a flowchart of the anti-counterfeiting method in the first embodiment of the present invention;

[0037] Figure 2 It is a structural block diagram of the anti-counterfeiting system in the second embodiment of the present invention;

[0038] Figure 3 It is a structural block diagram of the computer device in the third embodiment of the present invention.

[0039] Main element symbol description:

[0040] 10. Memory; 20. Processor; 30. Computer program;

[0041] 11. Generation module; 12. Encryption module; 13. Design module; 14. Loading module; 15. Adding module; 16. Retrieving module.

[0042] The following specific embodiments will further illustrate the present invention in conjunction with the above drawings. Specific Embodiments

[0043] To facilitate the understanding of the present invention, the present invention will be described more comprehensively below with reference to the relevant drawings. Several embodiments of the present invention are given in the drawings. However, the present invention can be implemented in many different forms and is not limited to the embodiments described herein. On the contrary, these embodiments are provided to make the disclosure of the present invention more thorough and comprehensive.

[0044] It should be noted that when an element is referred to as being "fixed to" another element, it can be directly on the other element or there may also be an intermediate element. When an element is considered to be "connected" to another element, it can be directly connected to the other element or there may be an intermediate element at the same time. The terms "vertical", "horizontal", "left", "right" and similar expressions used herein are only for the purpose of illustration.

[0045] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the technical field to which the present invention belongs. The terms used herein in the description of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. The term "and / or" used herein includes any and all combinations of one or more of the related listed items.

[0046] Embodiment 1

[0047] Please refer to Figure 1 , which shows the anti-counterfeiting method in the first embodiment of the present invention. The method includes steps S1 to S6:

[0048] S1, generate a two-dimensional code for the selected product;

[0049] Specifically, step S1 includes steps S11 to S12:

[0050] S11, obtain the plaintext information of the selected product and generate a two-dimensional code corresponding to the plaintext information;

[0051] S12, record the plaintext information of the selected product on the server side;

[0052] It can be understood that recording the plaintext information of the product on the server side can avoid the loss of the plaintext information corresponding to the two-dimensional code.

[0053] S2, generate a public key and a private key based on the RSA encryption algorithm, store the private key on the server side, store the public key on the mobile terminal, and encrypt the plaintext information of the two-dimensional code with the public key. Among them, the plaintext information is encrypted in segments, and all the segment keys in the segment encryption process are combined to obtain a combined key for the plaintext information, and the plaintext information is encrypted based on the combined key;

[0054] It can be understood that the public key is used to encrypt messages, and messages encrypted with the public key can only be decrypted with the corresponding private key. In this embodiment, a pair of keys can be obtained through the RSA encryption algorithm. The private key in the keys is stored on the server side, and the public key in the keys is stored on the mobile terminal;

[0055] It should be noted that by encrypting the plaintext information in segments, the encryption effect can be improved, and by combining the keys in each segment encryption process in the segment encryption process, a combined key can be obtained, that is, the keys in each segment encryption process are sorted, sorted according to the content of the plaintext information, and then the keys are in one-to-one correspondence with the plaintext information, so as to achieve the effect of segment encryption of the plaintext information. Encrypting the plaintext information in this way can effectively improve the encryption effect.

[0056] S3, design an online Web interface, and design a two-dimensional code input interface and a two-dimensional code verification interface on the online Web interface;

[0057] Specifically, step S3 includes steps S31 to S32:

[0058] S31. Establish an online Web interface using the ThinkPHP framework. The online Web interface includes a security code interface, a verification success interface, a verification failure interface, and an activity page.

[0059] S32. Design a QR code input interface and a QR code verification interface on the online Web interface through the ThinkPHP framework.

[0060] S4. Load a verification code at the QR code verification interface on the online Web interface based on the private key, and generate a security code through the verification code.

[0061] It should be noted that a verification code is loaded at the security code interface and the QR code verification interface on the online Web interface, and a security code is generated based on the verification code. The security code can avoid the problem of information leakage when logging in to the online Web interface.

[0062] S5. Add a set of ID information on the server side and encrypt the ID information.

[0063] It can be understood that encrypting the ID information with the public key can prevent unauthorized personnel from obtaining some plaintext information of the product.

[0064] S6. Request the server side based on the QR code input interface on the online Web interface, retrieve the decryption information corresponding to the ID information through the server side, and decrypt and obtain the plaintext information of the QR code based on the decryption information and the private key.

[0065] Specifically, step S6 includes step S61:

[0066] S61. Transmit the decryption information to the mobile terminal in JSON format and store the decryption information in the mobile terminal.

[0067] It can be understood that when requesting the server side at the QR code input interface on the online Web interface, the decryption information corresponding to the ID information is retrieved through the server side, the decryption information is transmitted to the mobile terminal in JSON format, and finally the plaintext information of the QR code is decrypted based on the decryption information and the corresponding private key, thereby effectively achieving the purpose of anti-counterfeiting.

[0068] In summary, the anti-counterfeiting method in the above embodiments of the present invention encrypts the plaintext information of the two-dimensional code through the public key generated by the RSA encryption algorithm, can encrypt the information in the two-dimensional code, retrieves the corresponding decryption information through the ID information, and decrypts through the private key and the decryption information to obtain the product information contained in the two-dimensional code. Furthermore, it can achieve anti-counterfeiting of product information, and can obtain the product information through the decryption information of the ID information, thereby enabling convenient reading of two-dimensional code information and reducing anti-counterfeiting costs.

[0069] Embodiment 2

[0070] The present invention also provides an anti-counterfeiting system. Please refer to Figure 2 , which shows the anti-counterfeiting system in the second embodiment of the present invention. The system includes:

[0071] A generation module 11 for generating a two-dimensional code of the selected product;

[0072] An encryption module 12 for generating a public key and a private key based on the RSA encryption algorithm, storing the private key on the server side, storing the public key on the mobile side, and encrypting the plaintext information of the two-dimensional code through the public key. Among them, the plaintext information is encrypted in segments, and all segment keys in the segment encryption process are combined to obtain the combined key of the plaintext information, and the plaintext information is encrypted based on the combined key;

[0073] A design module 13 for designing an online Web interface and designing a two-dimensional code input interface and a two-dimensional code verification interface on the online Web interface;

[0074] A loading module 14 for loading a verification code on the two-dimensional code verification interface on the online Web interface based on the private key and generating a security code through the verification code;

[0075] An adding module 15 for adding a group of ID information on the server side and encrypting the ID information;

[0076] A retrieval module 16 for requesting the server side based on the two-dimensional code input interface on the online Web interface, retrieving the decryption information corresponding to the ID information through the server side, and decrypting and obtaining the plaintext information of the two-dimensional code based on the decryption information and the private key.

[0077] In some alternative embodiments, the generation module 11 includes:

[0078] An obtaining unit for obtaining the plaintext information of the selected product and generating a two-dimensional code corresponding to the plaintext information;

[0079] A recording unit for recording the plaintext information of the selected product on the server side.

[0080] In some alternative embodiments, the design module 13 includes:

[0081] An establishment unit for establishing an online Web interface using the ThinkPHP framework, where the online Web interface includes a security code interface, a verification success interface, a verification failure interface, and an activity page;

[0082] A design unit for designing a two-dimensional code input interface and a two-dimensional code verification interface on the online Web interface through the ThinkPHP framework.

[0083] In some alternative embodiments, the retrieval module 16 includes:

[0084] A transmission unit for transmitting the decrypted information to the mobile terminal based on the JSON format and storing the decrypted information in the mobile terminal.

[0085] The functions or operation steps implemented when the above-mentioned modules and units are executed are substantially the same as those in the above method embodiments, and will not be elaborated here.

[0086] The anti-counterfeiting system provided by the embodiments of the present invention has the same implementation principle and technical effects as those in the foregoing method embodiments. For a brief description, for the parts not mentioned in the system embodiments, reference may be made to the corresponding content in the foregoing method embodiments.

[0087] Embodiment III

[0088] The present invention also provides a computer device. Please refer to Figure 3 , showing the computer device in the third embodiment of the present invention, including a memory 10, a processor 20, and a computer program 30 stored on the memory 10 and executable on the processor 20. When the processor 20 executes the computer program 30, the above-mentioned anti-counterfeiting method is implemented.

[0089] Among them, the memory 10 at least includes one type of readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (such as SD or DX memory, etc.), magnetic memory, magnetic disk, optical disk, etc. The memory 10 can be an internal storage unit of a computer device in some embodiments, such as the hard disk of the computer device. The memory 10 can also be an external storage device in other embodiments, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) card, a Flash Card, etc. Further, the memory 10 can also include both the internal storage unit of the computer device and the external storage device. The memory 10 can be used not only to store application software installed in the computer device and various types of data, but also to temporarily store data that has been output or will be output.

[0090] Among them, the processor 20 can be an Electronic Control Unit (ECU, also known as a vehicle computer), a Central Processing Unit (CPU), a controller, a microcontroller, a microprocessor or other data processing chips in some embodiments, and is used to run the program code stored in the memory 10 or process data, such as executing an access restriction program, etc.

[0091] It should be noted that Figure 3 The structure shown does not constitute a limitation on the computer device. In other embodiments, the computer device may include fewer or more components than shown in the figure, or combine some components, or have a different component layout.

[0092] An embodiment of the present invention also provides a readable storage medium, on which a computer program is stored, and when the program is executed by a processor, the anti-counterfeiting method as described above is implemented.

[0093] Those skilled in the art can understand that the logic and / or steps represented in the flowchart or described in other ways herein, for example, can be considered as a definite sequence list of executable instructions for implementing logical functions, and can be specifically implemented in any computer-readable medium for use by an instruction execution system, apparatus or device (such as a computer-based system, a system including a processor, or other systems that can fetch instructions from the instruction execution system, apparatus or device and execute the instructions), or used in combination with these instruction execution systems, apparatus or devices. For the purposes of this specification, a "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by or in combination with an instruction execution system, apparatus or device.

[0094] More specific examples (a non-exhaustive list) of computer-readable media include the following: an electrical connection (electronic device) having one or more wirings, a portable computer diskette (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disc read-only memory (CDROM). Additionally, the computer-readable media can even be paper or other suitable media on which the program can be printed, because the program can be obtained electronically, for example, by optically scanning the paper or other media, then editing, interpreting, or otherwise processing it as appropriate, and then storing it in a computer memory.

[0095] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware, or a combination thereof. In the above-described embodiments, the multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, any one or a combination of the following techniques well known in the art can be used: discrete logic circuits having logic gate circuits for implementing logical functions on data signals, application specific integrated circuits having appropriate combinational logic gate circuits, programmable gate arrays (PGAs), field programmable gate arrays (FPGAs), etc.

[0096] In the description of this specification, the description with reference to terms such as "one embodiment", "some embodiments", "example", "specific example", or "some examples", etc. means that the specific features, structures, materials, or characteristics described in connection with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials, or characteristics described can be combined in any one or more embodiments or examples in a suitable manner.

[0097] The above-described embodiments merely represent several implementation manners of the present invention, and their descriptions are relatively specific and detailed, but should not be construed as limiting the scope of the patent of the present invention. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present invention, several modifications and improvements can still be made, and these all belong to the protection scope of the present invention. Therefore, the protection scope of the patent of the present invention should be subject to the appended claims.

Claims

1. An anti-counterfeiting method, characterized in that, The method includes: Generating a QR code for the selected product; Generating a public key and a private key based on the RSA encryption algorithm, storing the private key on the server side, storing the public key on the mobile side, and encrypting the plaintext information of the QR code with the public key. Among them, the plaintext information is encrypted in segments, and all segment keys in the segment encryption process are combined to obtain the combined key of the plaintext information. The plaintext information is encrypted based on the combined key. Among them, all the segment keys are sorted by key, sorted according to the content of the plaintext information, and all the segment keys are in one-to-one correspondence with the plaintext information; Designing an online Web interface and designing a QR code input interface and a QR code verification interface on the online Web interface; Loading a verification code on the QR code verification interface of the online Web interface based on the private key and generating a security code through the verification code; Adding a set of ID information on the server side and encrypting the ID information; Requesting the server side based on the QR code input interface on the online Web interface, retrieving the decrypted information corresponding to the ID information through the server side, and decrypting and obtaining the plaintext information of the QR code based on the decrypted information and the private key.

2. The anti-counterfeiting method according to claim 1, characterized in that, The step of generating a QR code for the selected product includes: Obtaining the plaintext information of the selected product and generating a QR code corresponding to the plaintext information; Recording the plaintext information of the selected product on the server side.

3. The anti-counterfeiting method according to claim 1, wherein The step of designing an online Web interface and designing a QR code input interface and a QR code verification interface on the online Web interface includes: Establishing an online Web interface using the ThinkPHP framework. The online Web interface includes a security code interface, a verification success interface, a verification failure interface, and an activity page; And designing a QR code input interface and a QR code verification interface on the online Web interface through the ThinkPHP framework.

4. The anti-counterfeiting method according to claim 1, characterized in that, After the step of retrieving the decrypted information corresponding to the ID information through the server side, the method further includes: Transmitting the decrypted information to the mobile side in JSON format and storing the decrypted information in the mobile side.

5. An anti-counterfeiting system, characterized in that, The system includes: A generation module for generating a QR code for the selected product; An encryption module for generating a public key and a private key based on the RSA encryption algorithm, storing the private key on the server side, storing the public key on the mobile side, and encrypting the plaintext information of the QR code with the public key. Among them, the plaintext information is encrypted in segments, and all segment keys in the segment encryption process are combined to obtain the combined key of the plaintext information. The plaintext information is encrypted based on the combined key. Among them, all the segment keys are sorted by key, sorted according to the content of the plaintext information, and all the segment keys are in one-to-one correspondence with the plaintext information; A design module for designing an online Web interface and designing a QR code input interface and a QR code verification interface on the online Web interface; A loading module, configured to load a verification code at the two-dimensional code verification interface on the online Web interface based on the private key, and generate a security code through the verification code; An adding module, configured to add a set of ID information on the server side and encrypt the ID information; A retrieving module, configured to request the server side based on the two-dimensional code input interface on the online Web interface, retrieve decryption information corresponding to the ID information through the server side, and decrypt and obtain the plaintext information of the two-dimensional code based on the decryption information and the private key.

6. The anti-counterfeiting system according to claim 5, wherein The generating module includes: An obtaining unit, configured to obtain the plaintext information of the selected product and generate a two-dimensional code corresponding to the plaintext information; A recording unit, configured to record the plaintext information of the selected product on the server side.

7. The anti-counterfeiting system according to claim 5, wherein The designing module includes: A establishing unit, configured to establish an online Web interface using the ThinkPHP framework, where the online Web interface includes a security code interface, a verification success interface, a verification failure interface, and an activity page; A designing unit, configured to design a two-dimensional code input interface and a two-dimensional code verification interface on the online Web interface through the ThinkPHP framework.

8. A readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by a processor, it implements the anti-counterfeiting method according to any one of claims 1 to 4.

9. A computer device, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the anti-counterfeiting method according to any one of claims 1 to 4.

Citation Information

Patent Citations

  • System and method for tracking and verifying commodity purchased on internet

    CN103325043A

  • Product anti-fake method and system and client terminal

    CN103593773A

  • Block chain-based anti-counterfeiting two-dimensional code generation and verification system and method

    CN114595476A

  • Camera data encryption method and system and storage medium

    CN117807611A