Disclosure of Invention
The NFC-based anti-counterfeiting method provided by the application can solve the problems that the anti-counterfeiting method in the prior art brings trouble to the user during verification and a convenient and efficient verification effect cannot be achieved.
The invention provides an NFC-based anti-counterfeiting method, which is applied to an NFC-based anti-counterfeiting system, wherein the system comprises an anti-counterfeiting chip, a mobile terminal with NFC and networking functions and a server, and the method comprises the following steps: the anti-counterfeiting chip establishes a current first communication connection with the mobile terminal; the anti-counterfeiting chip acquires a network address of the server; the anti-counterfeiting chip generates first data according to a preset rule; the anti-counterfeiting chip sends the network address and the first data to the mobile terminal, so that the mobile terminal sends the first data to the server according to the network address, and the server sends the verification result to the mobile terminal according to the first data.
Optionally, the anti-counterfeiting chip generates the first data according to a preset rule, including: the anti-counterfeiting chip generates a first random number; the anti-counterfeiting chip encrypts the first random number according to a first preset algorithm to generate first encrypted data; the anti-counterfeiting chip encrypts the first encrypted data according to a second preset algorithm to generate a first encrypted string; the first data is generated according to the first encrypted data and the first encrypted string.
Optionally, the server sends the verification result to the mobile terminal according to the first data, including: the server decrypts the first encryption string according to the second preset algorithm to obtain first decrypted data; the server judges whether the first encrypted data is consistent with the first decrypted data; when the first encrypted data is consistent with the first decrypted data, the server sends a verification result of verification passing to the mobile terminal; and when the first encrypted data is inconsistent with the first decrypted data, the server sends a verification result that verification is not passed to the mobile terminal.
Optionally, the anti-counterfeiting chip generates the first data according to a preset rule, and further includes: the anti-counterfeiting chip generates first intermediate data according to a first preset rule; the anti-counterfeiting chip establishes a current second communication connection with the mobile terminal; the anti-counterfeiting chip generates second intermediate data according to a second preset rule; the anti-counterfeiting chip generates the first data according to the first intermediate data and the second intermediate data.
Optionally, the anti-counterfeiting chip generates first intermediate data according to a first preset rule, including: the anti-counterfeiting chip acquires the first random number generated during the current first communication connection and the second random number generated during the last communication connection; the anti-counterfeiting chip encrypts the first random number according to the first preset algorithm to generate first encrypted data; the anti-counterfeiting chip encrypts the first encrypted data according to the second preset algorithm to generate the first encrypted string; the anti-counterfeiting chip encrypts the second random number according to the first preset algorithm to generate second encrypted data; the anti-counterfeiting chip encrypts the second encrypted data according to a second preset algorithm to generate a second encrypted string; the anti-counterfeiting chip generates the first intermediate data according to the first encrypted data, the first encrypted string, the second encrypted data and the second encrypted string.
Optionally, the anti-counterfeiting chip generates second intermediate data according to a second preset rule, including: the anti-counterfeiting chip acquires a third random number generated during the current second communication connection and a fourth random number generated during the current first communication connection; the anti-counterfeiting chip encrypts the fourth random number according to the first preset algorithm to generate fourth encrypted data; the anti-counterfeiting chip encrypts the fourth encrypted data according to the second preset algorithm to generate a fourth encrypted string; the anti-counterfeiting chip encrypts the third random number according to the first preset algorithm to generate third encrypted data; the anti-counterfeiting chip encrypts the third encrypted data according to the second preset algorithm to generate a third encrypted string; the anti-counterfeiting chip generates the second intermediate data according to the fourth encrypted data, the fourth encrypted string, the third encrypted data and the third encrypted string.
Optionally, the server sends the verification result to the mobile terminal according to the first data, and the method further includes: the server decrypts the first encryption string, the second encryption string, the third encryption string and the fourth encryption string according to the second preset algorithm, and obtains the first decryption data, the second decryption data, the third decryption data and the fourth decryption data; when the first decrypted data is consistent with the first encrypted data and the third decrypted data is consistent with the third encrypted data, the server judges whether the first decrypted data, the second decrypted data, the third decrypted data and the fourth decrypted data exist and only two same data exist; when there are only two data identical, the server transmits the result of passing the verification to the mobile terminal.
Optionally, the method further comprises: when the first decryption data is inconsistent with the first encryption data or/and the third decryption data is inconsistent with the third encryption data, the server sends a result that verification is not passed to the mobile terminal; or/and, when the first decrypted data, the second decrypted data, the third decrypted data and the fourth decrypted data do not have the same data or more than two data are the same, the server sends a result that the verification is not passed to the mobile terminal.
Optionally, the anti-counterfeiting chip generates the first data according to the first intermediate data and the second intermediate data, including: the anti-counterfeiting chip obtains the time difference between the first intermediate data and the second intermediate data; the anti-counterfeiting chip generates the first data according to the first intermediate data, the second intermediate data and the time difference.
Optionally, the server sends the verification result to the mobile terminal according to the first data, and the method further includes: when the first decryption data, the second decryption data, the third decryption data and the fourth decryption data exist and only two data are the same, the server judges whether the time difference is within a preset range; when the time difference is within a preset range, the server sends a verification passing result to the mobile terminal; and when the time difference is not in the preset range, the server sends a result that the verification is not passed to the mobile terminal.
The invention provides an NFC-based anti-counterfeiting method, which is applied to an NFC-based anti-counterfeiting system, wherein the system comprises an anti-counterfeiting chip, a mobile terminal with NFC and networking functions and a server, and the method comprises the following steps: the anti-counterfeiting chip establishes a current first communication connection with the mobile terminal; the anti-counterfeiting chip acquires a network address of the server; the anti-counterfeiting chip generates first data according to a preset rule; the anti-counterfeiting chip sends the network address and the first data to the mobile terminal, so that the mobile terminal sends the first data to the server according to the network address, and the server sends the verification result to the mobile terminal according to the first data. According to the anti-counterfeiting method provided by the invention, verification is carried out through the mobile terminal with NFC and networking functions, when the mobile terminal approaches to a commodity attached with an anti-counterfeiting chip, the anti-counterfeiting chip sends the network address of the verification server and data generated according to a preset rule to the mobile terminal, so that the mobile terminal sends the data to a corresponding server for verification according to the network address, the server decrypts and verifies the data sent by the anti-counterfeiting chip according to the preset rule, after decryption is successful and verification is successful, verification passing or commodity information is sent to the mobile terminal for a user to check, and when decryption is unsuccessful or verification is unsuccessful, a result of verification failing is sent to the mobile terminal; therefore, the generation end of the verification data is arranged on the anti-counterfeiting chip, the data verification end is arranged on the server, and the mobile terminal can inquire about the anti-counterfeiting by only transferring through web page connection under the condition of connecting with a network, and any auxiliary software is not required to be downloaded.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present application more apparent, the technical solutions of the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application, and it is apparent that the described embodiments are some embodiments of the present application, but not all embodiments of the present application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
Fig. 1 is a flowchart of an anti-counterfeiting method based on NFC provided in an embodiment of the present invention; as shown in fig. 1, the anti-counterfeiting method based on NFC in the embodiment of the present invention is applied in an anti-counterfeiting system based on NFC, where the system includes an anti-counterfeiting chip, a mobile terminal with NFC and networking functions, and a server, and specifically includes the following steps:
Step S101, the anti-counterfeiting chip establishes a current first communication connection with the mobile terminal.
Specifically, the mobile terminal includes, but is not limited to, a mobile phone, a tablet computer and a handheld device with NFC chip and networking functions, the anti-counterfeiting chip may be an active electronic tag or a passive electronic tag attached to an outer package of an article, the anti-counterfeiting chip uses the passive electronic tag as an example, when the mobile phone approaches to the article attached with the passive electronic tag, and when the communication distance between the NFC chip and the passive electronic tag is reached, the passive electronic tag establishes communication connection with the mobile phone.
Step S102, the anti-counterfeiting chip acquires the network address of the server.
Specifically, the data stored in the anti-counterfeiting chip includes, but is not limited to, a chip UID representing a unique chip number, a network address of a server, a server public key representing asymmetric algorithm public key information issued by the server, a tag private key representing asymmetric encryption private key information issued based on a tag, a chip random number representing a random number generated by the chip when the tag is queried each time, a dynamic code representing a dynamic code written in the tag generated by the server, a sales state of a product, manufacturer information, commodity codes, and query verification times representing the electronic tag; therefore, after the anti-counterfeiting chip and the mobile terminal are in communication connection, the network address, such as the URL address, of the corresponding server can be obtained from the stored data.
Step S103, the anti-counterfeiting chip generates first data according to a preset rule.
Specifically, the anti-counterfeiting chip encrypts a stored chip UID, commodity codes, generated random numbers and the like according to rules and algorithms agreed with a server to generate first data, for example, generates a random number digest of the random numbers according to a digest algorithm, encrypts a public key of the random number digest by an asymmetric algorithm to obtain a random number digest signature, and combines the chip UID, the commodity codes, the random number digest and the random number digest signature into the first data.
Step S104, the anti-counterfeiting chip sends the network address and the first data to the mobile terminal, so that the mobile terminal sends the first data to the server according to the network address, and the server sends the verification result to the mobile terminal according to the first data.
Specifically, the anti-counterfeiting chip combines the acquired server network address and first data generated according to a preset rule into a new access address to be sent to the mobile terminal together, a browser of the mobile terminal can send data oriented according to the server network address in the access address to a corresponding server, the server decrypts the received data string according to the preset rule and algorithm, if the decryption is unsuccessful, the identification access chip is not a label matched with the server, the received data is verified after the decryption is successful, for example, a private key of an asymmetric algorithm is carried out on a random number abstract signature in the first data to obtain first decrypted data, the first decrypted data is compared with the received random number abstract, when the two data are identical, the verification is passed, and when the two data are different, the data representing the anti-counterfeiting chip are inconsistent with the data stored by the server, and the verification is failed; the method comprises the steps that a decryption private key stored in a server and an encryption public key stored in an anti-counterfeiting chip are related through a UID in the anti-counterfeiting chip to obtain paired public-private key pairs, namely UID-public keys-private keys are in one-to-one correspondence, so that after a random number generated by the corresponding anti-counterfeiting chip is encrypted through the public key of the server, the random number decrypted by the server through the corresponding private key is identical to the random number generated by the anti-counterfeiting chip, and the tag chip is proved to be not imitated or counterfeited; because the encryption of the random number generated by the anti-counterfeiting chip according to the digest algorithm is an irreversible encryption mode, the server performs verification according to the digest of the random number obtained after decryption, and the random number cannot be compared.
The invention provides an NFC-based anti-counterfeiting method, which is applied to an NFC-based anti-counterfeiting system, wherein the system comprises an anti-counterfeiting chip, a mobile terminal with NFC and networking functions and a server, and the method comprises the following steps: the anti-counterfeiting chip establishes a current first communication connection with the mobile terminal; the anti-counterfeiting chip acquires a network address of the server; the anti-counterfeiting chip generates first data according to a preset rule; the anti-counterfeiting chip sends the network address and the first data to the mobile terminal, so that the mobile terminal sends the first data to the server according to the network address, and the server sends the verification result to the mobile terminal according to the first data. According to the anti-counterfeiting method provided by the invention, verification is carried out through the mobile terminal with NFC and networking functions, when the mobile terminal approaches to a commodity attached with an anti-counterfeiting chip, the anti-counterfeiting chip sends the network address of the verification server and data generated according to a preset rule to the mobile terminal, so that the mobile terminal sends the data to a corresponding server for verification according to the network address, the server decrypts and verifies the data sent by the anti-counterfeiting chip according to the preset rule, after decryption is successful and verification is successful, verification passing or commodity information is sent to the mobile terminal for a user to check, and when decryption is unsuccessful or verification is unsuccessful, a result of verification failing is sent to the mobile terminal; therefore, the generation end of the verification data is arranged on the anti-counterfeiting chip, the data verification end is arranged on the server, and the mobile terminal can inquire about the anti-counterfeiting by only transferring through web page connection under the condition of connecting with a network, and any auxiliary software is not required to be downloaded.
Fig. 2 is a flowchart of an anti-counterfeiting method based on NFC provided in an embodiment of the present invention; as shown in fig. 2, the anti-counterfeiting method based on NFC in the embodiment of the present invention further includes the following steps:
step S201, the anti-counterfeiting chip establishes communication connection with the mobile terminal.
Step S202, the anti-counterfeiting chip generates a first random number.
Step S203, the anti-counterfeit chip encrypts the first random number according to a first preset algorithm to generate first encrypted data.
Step S204, the anti-counterfeiting chip encrypts the first encrypted data according to a second preset algorithm to generate a first encrypted string.
In step S205, the anti-counterfeit chip sends the first encrypted data and the first encrypted string to the server through the mobile terminal.
In step S206, the server decrypts the first encrypted string according to the second preset algorithm, and obtains first decrypted data.
In step S207, the server determines whether the first encrypted data and the first decrypted data are consistent, if not, step S208 is executed, and if so, step S209 is executed.
Step S208, the server sends the verification result that the verification is not passed to the mobile terminal.
Step S209, the server sends the verification result of the verification to the mobile terminal.
Specifically, when the mobile terminal approaches the anti-counterfeiting chip to establish communication connection, the anti-counterfeiting chip automatically generates a random number, and then encrypts the random number according to a preset digest algorithm, wherein the preset digest algorithm can be irreversible encryption, so that the anti-counterfeiting confidentiality is improved, and the anti-counterfeiting chip is not easy to crack; encrypting the first encrypted data obtained after the random number is encrypted according to a preset abstract algorithm for the second time, wherein the second encryption is to obtain a first encrypted string after the encryption according to an asymmetric public key agreed by an anti-counterfeiting chip and a corresponding server, the anti-counterfeiting chip sends the first encrypted data and the first encrypted string to the server together according to a preset rule through a mobile terminal, the server decrypts the first encrypted string by a private key corresponding to the anti-counterfeiting chip, when decryption is unsuccessful, the data source is not a label recorded in the server, and a result that verification is failed is sent to the mobile terminal; after the decryption is successful, judging whether the first encrypted data is consistent with the decrypted first encrypted string data, if not, sending a verification result which is not passed by verification to the mobile terminal, and if so, sending a verification result which is passed by verification to the mobile terminal; therefore, the accuracy of the verification result is ensured through the decryption and verification of the twice encryption algorithm.
Fig. 3 is a flowchart of an anti-counterfeiting method based on NFC provided in an embodiment of the present invention; as shown in fig. 3, in the NFC-based anti-counterfeiting method according to the embodiment of the present invention, the anti-counterfeiting chip generates first data according to a preset rule, and specifically further includes the following steps:
step S301, the anti-counterfeiting chip and the mobile terminal establish the current first communication connection.
Step S302, the anti-counterfeiting chip acquires the first random number generated during the current first communication connection and the second random number generated during the last communication connection.
Step S303, encrypting the first random number according to a first preset algorithm to generate first encrypted data, and encrypting the first encrypted data according to a second preset algorithm to generate a first encrypted string.
Step S304, the second random number is encrypted according to a first preset algorithm to generate the second encrypted data, and the second encrypted data is encrypted according to the second preset algorithm to generate the second encrypted string.
Step S305, the anti-counterfeiting chip establishes a current second communication connection with the mobile terminal.
Step S306, the anti-counterfeiting chip acquires a third random number generated during the current second communication connection and a fourth random number generated during the current first communication connection.
Step S307, generating third encrypted data after encrypting the third random number according to the first preset algorithm, and generating a third encrypted string after encrypting the third encrypted data according to the second preset algorithm.
Step S308, the fourth random number is encrypted according to a first preset algorithm to generate fourth encrypted data, and the fourth encrypted data is encrypted according to a second preset algorithm to generate a fourth encrypted string.
Step S309, transmitting the first encrypted data, the second encrypted data, the third encrypted data, the fourth encrypted data, the first encrypted string, the second encrypted string, the third encrypted string, and the fourth encrypted string to the server.
In one embodiment of the invention, the mobile terminal acquires the twice encrypted data by establishing the twice connection with the anti-counterfeiting chip and then sends the twice encrypted data to the server for verification, and the server can also be separately sent through the encrypted data acquired by establishing the twice communication connection with the anti-counterfeiting chip, and the embodiment takes the twice acquired encrypted data sent to the server for verification as an example; specifically, the random number acquired when the anti-counterfeiting chip establishes connection with the mobile terminal needs to be stored for subsequent reading while being encrypted, so that the random number generated currently and the random number generated last time are encrypted together when the anti-counterfeiting chip establishes the current first communication connection with the mobile terminal, the anti-counterfeiting chip establishes the current second communication connection with the mobile terminal, the random number generated currently and the random number generated when the anti-counterfeiting chip establishes the current second communication connection are encrypted according to the method of the embodiment, and the encrypted data are sent to the server through the mobile terminal for verification.
Fig. 4 is a flowchart of an anti-counterfeiting method based on NFC provided in an embodiment of the present invention; as shown in fig. 4, in the anti-counterfeiting method based on NFC in the embodiment of the present invention, the server sends a verification result to the mobile terminal according to the first data, and specifically further includes the following steps:
In step S401, the server decrypts the first encryption string, the second encryption string, the third encryption string, and the fourth encryption string according to the second preset algorithm, and obtains the first decryption data, the second decryption data, the third decryption data, and the fourth decryption data.
Step S402, determining whether the first decrypted data and the first encrypted data are consistent, if not, executing step S403, and if so, executing step S404.
Step S403, the server sends a result that the verification is not passed to the mobile terminal.
Step S404, determining whether the third decrypted data and the third encrypted data are consistent, if not, executing step S403, and if so, executing step S405.
Step S405, determining whether the first decrypted data, the second decrypted data, the third decrypted data and the fourth decrypted data exist and only two identical data exist, if not, executing step S403, and if so, executing step S406.
Step S406, the server sends the result of the verification to the mobile terminal.
Specifically, the server decrypts the encrypted data sent from the anti-counterfeit chip according to the method provided by the embodiment, and performs data verification one by one after decryption is successful, firstly judges whether the first encrypted data is consistent with the first decrypted data, when the first encrypted data is inconsistent with the first decrypted data, sends a result that verification is failed to the mobile terminal, judges whether the third decrypted data is consistent with the third encrypted data, when the third decrypted data is inconsistent with the third encrypted data, sends a result that verification is failed to the mobile terminal, judges whether the first decrypted data, the second decrypted data, the third decrypted data and the fourth decrypted data have two identical data or not when the first decrypted data, the second decrypted data, the third decrypted data and the fourth decrypted data have two identical data, and sends a result that verification is failed to the mobile terminal when the two identical data do not exist, and sends a result that verification is passed to the mobile terminal when the two identical data exist and only exist.
For example, the anti-counterfeiting chip obtains that the random number generated at the current first communication connection is A, the random number generated at the last time is B, and the random number generated at the current second communication connection is C, so that the anti-counterfeiting chip encrypts the random number pairs formed by A & B and B & C through an algorithm and sends the encrypted random number pairs to a server, then the server decrypts the encrypted random number pairs and compares the two random number pairs, and if two identical data exist in the A & B and the B & C, the other two random numbers are different, the verification is passed; if the random number pairs decrypted by the server are A & B and C & D, the two random number pairs are completely different, and verification fails.
In one embodiment of the present invention, the anti-counterfeit chip generates the first data according to the first intermediate data and the second intermediate data, including: the anti-counterfeiting chip obtains the time difference between the first intermediate data and the second intermediate data; the anti-counterfeiting chip generates the first data according to the first intermediate data, the second intermediate data and the time difference.
The server sends a verification result to the mobile terminal according to the first data, and the method further comprises the following steps: when the first decryption data, the second decryption data, the third decryption data and the fourth decryption data are the same and only two data are the same, the server judges whether the time difference is within a preset range or not; when the time difference is within a preset range, the server sends a verification passing result to the mobile terminal; and when the time difference is not in the preset range, the server sends a result that the verification is not passed to the mobile terminal.
The invention provides an NFC-based anti-counterfeiting method, which is applied to an NFC-based anti-counterfeiting system, wherein the system comprises an anti-counterfeiting chip, a mobile terminal with NFC and networking functions and a server, and the method comprises the following steps: the anti-counterfeiting chip establishes a current first communication connection with the mobile terminal; the anti-counterfeiting chip acquires a network address of the server; the anti-counterfeiting chip generates first data according to a preset rule; the anti-counterfeiting chip sends the network address and the first data to the mobile terminal, so that the mobile terminal sends the first data to the server according to the network address, and the server sends the verification result to the mobile terminal according to the first data. According to the anti-counterfeiting method provided by the invention, verification is carried out through the mobile terminal with NFC and networking functions, when the mobile terminal approaches to a commodity attached with an anti-counterfeiting chip, the anti-counterfeiting chip sends the network address of the verification server and data generated according to a preset rule to the mobile terminal, so that the mobile terminal sends the data to a corresponding server for verification according to the network address, the server decrypts and verifies the data sent by the anti-counterfeiting chip according to the preset rule, after decryption is successful and verification is successful, verification passing or commodity information is sent to the mobile terminal for a user to check, and when decryption is unsuccessful or verification is unsuccessful, a result of verification failing is sent to the mobile terminal; therefore, the generation end of the verification data is arranged on the anti-counterfeiting chip, the data verification end is arranged on the server, and the mobile terminal can inquire about the anti-counterfeiting by only transferring through web page connection under the condition of connecting with a network, and any auxiliary software is not required to be downloaded.
It should be noted that in this document, relational terms such as "first" and "second" and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The foregoing is only a specific embodiment of the invention to enable those skilled in the art to understand or practice the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.