Face authentication method and system based on public block chain
By using Ethereum and IPFS blockchains combined with the HMAC-SHA256 algorithm to generate identity authentication codes in the face authentication system, the centralization and security issues of traditional face authentication systems are solved, achieving decentralized, secure and efficient identity authentication.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHANDONG UNIV
- Filing Date
- 2022-12-14
- Publication Date
- 2026-05-01
AI Technical Summary
Traditional facial recognition systems suffer from problems such as vulnerability of centralized databases to attacks, data tampering, and synchronization difficulties. Furthermore, authentication systems based on private blockchains cannot achieve true decentralization and lack sufficient security.
By employing multiple public blockchains, particularly Ethereum and IPFS, and combining the HMAC-SHA256 algorithm with digital signatures, an identity authentication code is generated and stored in IPFS. Identity is verified through hash values, implementing a multi-step authentication process to prevent unauthorized requests.
It implements a decentralized, highly secure, and efficient identity authentication system that prevents data tampering, reduces storage costs, and can quickly identify illegal requests.
Smart Images

Figure CN116010919B_ABST
Abstract
Description
A face authentication method and system based on public blockchain Technical Field
[0001] This invention relates to the field of blockchain technology, and in particular to a face authentication method and system based on a public blockchain. Background Technology
[0002] The statements in this section are merely background information related to the present invention and do not necessarily constitute prior art.
[0003] Traditional facial recognition-based identity authentication systems have been widely used in various fields, such as identity verification at train stations. However, these systems have several drawbacks. First, they all have a central database, making them vulnerable to hacking or data tampering and loss due to unforeseen circumstances. Second, to handle a large number of concurrent authentication requests, multiple servers using the same database are typically required to provide authentication services simultaneously. This necessitates data updates and synchronization between these database servers, which can lead to performance and other issues with traditional technologies. Third, these systems are generally built on private central databases, making them closed rather than open systems. Finally, while some blockchain-based authentication systems exist, they are typically based on private blockchains or blockchains developed for specific purposes. These systems cannot truly achieve decentralization and cannot guarantee the validity and security of authentication. Summary of the Invention
[0004] To address the shortcomings of existing technologies, the purpose of this invention is to provide a face authentication method and system based on public blockchains, employing multiple public blockchains to achieve more reliable identity authentication. The identity verification process utilizes multi-step basic information verification, enabling rapid identification and processing of unauthorized user verification requests and returning a verification failure message, thus preventing a large number of meaningless network requests.
[0005] To achieve the above objectives, the present invention is implemented through the following technical solution:
[0006] The first aspect of this invention provides a face authentication method based on a public blockchain, comprising the following steps:
[0007] Obtain the face image and user ID provided by the client, calculate the ID iid1 using the HMAC-SHA256 algorithm, and extract the face features;
[0008] An authentication code is generated based on the iid1, the face image, and the face features, and then returned to the client.
[0009] The system performs identity verification based on the authentication code and real-time facial image uploaded by the client, and returns the facial recognition result and authentication result.
[0010] Furthermore, a facial feature extraction algorithm is invoked, taking the submitted facial image as input, to extract facial features.
[0011] Furthermore, the specific steps for generating an identity verification code based on iid1, the face image, and facial features are as follows:
[0012] The iid1, face, and face feature data are concatenated together, and the hash value hash1 is obtained using the SHA256 algorithm;
[0013] Pack hash1 into an Ethereum block and record the transaction ID;
[0014] Digitally sign hash1 to obtain signature sign1;
[0015] Store iid1, face image, face features, sign1, and Ethereum transaction ID into the InterPlanetary File System (IPFS) and obtain the IPFS file hash value hash2. Use hash2 as the authentication code and return it to the client.
[0016] Furthermore, the specific steps for identity verification based on the identity verification code and real-time facial image uploaded by the client are as follows:
[0017] iid2 is obtained by calculating the ID based on the user ID using the HMAC-SHA256 algorithm.
[0018] Based on hash2, query the InterPlanetary File System for the corresponding iid1, face image, face features, sign1, and Ethereum transaction ID;
[0019] The iid1, face image, and face feature data retrieved from the InterPlanetary File System are concatenated together, and the hash value hash3 is obtained using the SHA256 algorithm.
[0020] Obtain hash1 based on the Ethereum transaction ID;
[0021] Compare hash1 and hash3. If the two hash values do not match, return a verification failure page.
[0022] The facial feature extraction algorithm is called to extract facial features from real-time facial images as input;
[0023] The system will retrieve facial features from the InterPlanetary File System and the facial features corresponding to the currently verified real-time facial image for authentication, and return the facial recognition result and authentication result.
[0024] Furthermore, the system queries the InterPlanetary File System based on hash2. If no corresponding result is found, it directly returns an unregistered interface or sends an ID error message to the client.
[0025] Furthermore, it verifies whether the queried iid1 and the obtained iid2 are consistent. If they are inconsistent, it returns an authentication failure page.
[0026] Furthermore, after obtaining the hash value hash3, it verifies whether hash3 matches the signature sign1. If they are invalid, it returns an authentication failure page.
[0027] A second aspect of the present invention provides a face authentication system based on a public blockchain, comprising:
[0028] The face feature extraction module is configured to obtain the face image and user ID provided by the client, calculate the ID iid1 using the HMAC-SHA256 algorithm, and extract the face features;
[0029] The identity authentication code generation module is configured to generate an identity authentication code based on iid1, face image, and face features, and return the identity authentication code to the client.
[0030] The authentication result confirmation module is configured to perform identity authentication based on the identity authentication code and real-time face image uploaded by the client, and return the face recognition result and authentication result.
[0031] A third aspect of the present invention provides a medium on which a program is stored, which, when executed by a processor, implements the steps of the face authentication method based on a public blockchain as described in the first aspect of the present invention.
[0032] A fourth aspect of the present invention provides an apparatus including a memory, a processor, and a program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of the face authentication method based on a public blockchain as described in the first aspect of the present invention.
[0033] The above one or more technical solutions have the following beneficial effects:
[0034] This invention employs multiple public blockchains to achieve a more reliable identity authentication system. Specifically, it uses both Ethereum and IPFS blockchains simultaneously to achieve dual data tamper-proof protection. By using both Ethereum and IPFS blockchains, it separates data content from secondary verification data, improving storage efficiency and reducing storage costs. User IDs are stored in IPFS after passing through HMAC, preventing the privacy of user IDs from being exposed.
[0035] The authentication process of this invention employs multi-step basic information verification, which can quickly identify and process unauthorized user authentication requests and return a verification failure, thus preventing a large number of meaningless network requests.
[0036] This invention provides a face authentication method and system based on a public blockchain. It combines face authentication with a public blockchain to achieve a decentralized face identity authentication system. Firstly, this invention uses blockchain for identity authentication. Due to the decentralized nature of blockchain, there is no need to create a centralized database, effectively avoiding the risk of data loss due to hacking or unforeseen circumstances. Secondly, the consensus mechanism of blockchain ensures the immutability of information, effectively preventing tampering. Thirdly, public blockchains are distributed storage database structures with robust data synchronization capabilities, keeping the data state of blockchain nodes up-to-date, thus guaranteeing data updates and synchronization between each verification server. Finally, this invention implements an identity authentication system based on a public blockchain, thus possessing the advantages of public blockchains: decentralized power, transparency, censorship resistance, and high accessibility.
[0037] Advantages of additional aspects of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. Attached Figure Description
[0038] The accompanying drawings, which form part of this invention, are used to provide a further understanding of the invention. The illustrative embodiments of the invention and their descriptions are used to explain the invention and do not constitute an improper limitation of the invention.
[0039] Figure 1 is a flowchart of the face authentication method based on public blockchain in this invention. Detailed Implementation
[0040] It should be noted that the following detailed descriptions are exemplary and intended to provide further explanation of this application. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains.
[0041] It should be noted that the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the exemplary embodiments according to this application. As used herein, the singular form is intended to include the plural form as well, unless the context clearly indicates otherwise. Furthermore, it should be understood that when the terms "comprising" and / or "including" are used in this specification, they indicate the presence of features, steps, operations, devices, components, and / or combinations thereof.
[0042] Example 1:
[0043] Embodiment 1 of this invention provides a face authentication method based on a public blockchain, implemented through information interaction between various servers and clients, specifically including face registration and face verification steps:
[0044] 1. Face registration
[0045] Step 1: Obtain the face image and user ID provided by the client, calculate the ID (iid1) using the HMAC-SHA256 algorithm, and extract facial features. Specifically, call the facial feature extraction algorithm, taking the submitted face image as input, to extract facial features.
[0046] Step 2: Generate an authentication code based on iid1, face image, and facial features, and return the authentication code to the client.
[0047] Step 2.1: Concatenate iid1, face, and face feature data together, and use the SHA256 algorithm to obtain the hash value hash1;
[0048] The hash1 is packaged and stored in an Ethereum block, and the transaction ID is recorded. In this embodiment, during the face registration stage, each registration generates a different hash1 and stores it in an Ethereum block, generating its own transaction ID.
[0049] Digitally sign hash1 to obtain signature sign1;
[0050] Store iid1, face image, face features, sign1, and Ethereum transaction ID into the InterPlanetary File System (IPFS) and obtain the IPFS file hash value hash2. Use hash2 as the authentication code and return it to the client.
[0051] 2. Facial Recognition
[0052] Step 3: Perform identity verification based on the identity verification code and real-time facial image uploaded by the client, and return the facial recognition result and authentication result.
[0053] Step 3.1: Calculate the ID iid2 using the HMAC-SHA256 algorithm based on the user ID;
[0054] Based on hash2, query the InterPlanetary File System for the corresponding iid1, face image, face features, sign1, and Ethereum transaction ID.
[0055] As a further technical solution, the query is performed using hash2 to the InterPlanetary File System. If no corresponding result is found, the unregistered interface is returned directly or an ID error message is sent to the client.
[0056] Verify whether the queried iid1 and the obtained iid2 are consistent. If they are inconsistent, return the authentication failure page.
[0057] The iid1, face image, and face feature data retrieved from the InterPlanetary File System are concatenated together, and the hash value hash3 is obtained by hashing using the SHA256 algorithm;
[0058] As a further technical solution, after obtaining the hash value hash3, it is verified whether hash3 is consistent with the signature sign1. If they are invalid, an authentication failure interface is returned.
[0059] Obtain hash1 based on the Ethereum transaction ID;
[0060] Compare hash1 and hash3. If the two hash values do not match, return a verification failure page.
[0061] The facial feature extraction algorithm is called to extract facial features from real-time facial images as input;
[0062] The system will retrieve facial features from the InterPlanetary File System and the facial features corresponding to the currently verified real-time facial image for authentication, and return the facial recognition result and authentication result.
[0063] Example 2:
[0064] Embodiment 2 of the present invention provides a face authentication system based on a public blockchain, comprising:
[0065] The face feature extraction module is configured to obtain the face image and user ID provided by the client, calculate the ID iid1 using the HMAC-SHA256 algorithm, and extract the face features;
[0066] The identity authentication code generation module is configured to generate an identity authentication code based on iid1, face image, and face features, and return the identity authentication code to the client.
[0067] The authentication result confirmation module is configured to perform identity authentication based on the identity authentication code and real-time face image uploaded by the client, and return the face recognition result and authentication result.
[0068] Example 3:
[0069] Embodiment 3 of the present invention provides a medium on which a program is stored. When the program is executed by a processor, it implements the steps in the face authentication method based on a public blockchain as described in Embodiment 1 of the present invention.
[0070] Example 4:
[0071] Embodiment 4 of the present invention provides a device including a memory, a processor, and a program stored in the memory and executable on the processor. When the processor executes the program, it implements the steps in the face authentication method based on a public blockchain as described in Embodiment 1 of the present invention.
[0072] The steps and methods involved in Embodiments 2, 3, and 4 above correspond to those in Embodiment 1. For specific implementation details, please refer to the relevant description section of Embodiment 1. The term "computer-readable storage medium" should be understood as a single medium or multiple media including one or more instruction sets; it should also be understood as including any medium capable of storing, encoding, or carrying an instruction set for execution by a processor and enabling the processor to perform any of the methods in this invention.
[0073] Those skilled in the art will understand that the modules or steps of the present invention described above can be implemented using general-purpose computer devices. Optionally, they can be implemented using computer-executable program code, thereby allowing them to be stored in a storage device for execution by a computer device, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. The present invention is not limited to any particular combination of hardware and software.
[0074] While the specific embodiments of the present invention have been described above in conjunction with the accompanying drawings, this is not intended to limit the scope of protection of the present invention. Those skilled in the art should understand that various modifications or variations that can be made by those skilled in the art without creative effort based on the technical solutions of the present invention are still within the scope of protection of the present invention.
Claims
1. A face authentication method based on a public blockchain, characterized in that, Includes the following steps: Obtain the face image and user ID provided by the client, calculate the ID iid1 using the HMAC-SHA256 algorithm, and extract the face features; An authentication code is generated based on iid1, the face image, and facial features, and then returned to the client. The specific steps are as follows: iid1, the face image, and facial feature data are concatenated together, and a hash value (hash1) is obtained using the SHA256 algorithm; hash1 is packaged and stored in an Ethereum block, and the transaction ID is recorded; hash1 is digitally signed to obtain a signature (sign1); iid1, the face image, facial features, sign1, and the Ethereum transaction ID are stored in the InterPlanetary File System (IPFS) and the IPFS file hash value (hash2) is obtained; hash2 is used as the authentication code and returned to the client; the client verifies the identity based on the obtained authentication code and the real-time face image uploaded by the client. The authentication process returns both the face recognition result and the authentication result. The specific steps are as follows: Calculate the ID (iid2) using the HMAC-SHA256 algorithm based on the user ID; query the InterPlanetary File System (IPS) for the corresponding iid1, face image, face features, sign1, and Ethereum transaction ID based on hash2; concatenate the iid1, face image, and face feature data retrieved from the IPS, and hash them using the SHA256 algorithm to obtain the hash value hash3; obtain hash1 based on the Ethereum transaction ID; compare hash1 and hash3; if the two hash values are inconsistent, return a verification failure interface; and call the face feature extraction algorithm to extract face features from the real-time face image as input. The system will retrieve facial features from the InterPlanetary File System and the facial features corresponding to the currently verified real-time facial image for authentication, and return the facial recognition result and authentication result.
2. The face authentication method based on a public blockchain as described in claim 1, characterized in that, The algorithm extracts facial features by taking the submitted face image as input.
3. The face authentication method based on a public blockchain as described in claim 1, characterized in that, If the query is performed using hash2 to access the InterPlanetary File System and no corresponding result is found, the system will either return an unregistered page or send an ID error message to the client.
4. The face authentication method based on a public blockchain as described in claim 1, characterized in that, Verify whether the queried iid1 and the obtained iid2 are consistent. If they are inconsistent, return the authentication failure page.
5. The face authentication method based on a public blockchain as described in claim 1, characterized in that, After obtaining the hash value hash3, verify whether hash3 matches the signature sign1. If they are invalid, return the authentication failure page.
6. A face authentication system based on a public blockchain, characterized in that, include: The face feature extraction module is configured to obtain the face image and user ID provided by the client, calculate the ID iid1 using the HMAC-SHA256 algorithm, and extract the face features; The identity authentication code generation module is configured to generate an identity authentication code based on iid1, face image, and facial features, and return the identity authentication code to the client. The specific steps are as follows: concatenate iid1, face, and facial feature data together, and use the SHA256 algorithm to obtain a hash value hash1; package hash1 into an Ethereum block and record the transaction ID; digitally sign hash1 to obtain a signature sign1; store iid1, face image, facial features, sign1, and Ethereum transaction ID into the InterPlanetary File System and obtain the IPFS file hash value hash2; use hash2 as the identity authentication code and return it to the client. The authentication result confirmation module is configured to perform identity authentication based on the obtained identity authentication code and real-time face image uploaded by the client, and return the face recognition result and authentication result. The specific steps are as follows: calculate the ID iid2 based on the user ID using the HMAC-SHA256 algorithm; query the InterPlanetary File System (IPS) for the corresponding iid1, face image, face features, sign1, and Ethereum transaction ID based on hash2; concatenate the iid1, face image, and face feature data retrieved from the IPS, and hash them together using the SHA256 algorithm to obtain the hash value hash3; obtain hash1 based on the Ethereum transaction ID; compare hash1 and hash3, and if the two hash values are inconsistent, return a verification failure interface; call the face feature extraction algorithm to extract face features from the real-time face image as input. The system will retrieve facial features from the InterPlanetary File System and the facial features corresponding to the currently verified real-time facial image for authentication, and return the facial recognition result and authentication result.
7. A computer-readable storage medium, characterized in that, It stores multiple instructions, which are adapted to be loaded and executed by the processor of the terminal device using the face authentication method based on any one of claims 1-5.
8. A terminal device, characterized in that, It includes a processor and a computer-readable storage medium, the processor being used to implement various instructions; the computer-readable storage medium being used to store multiple instructions, the instructions being adapted to be loaded by the processor and executed by the processor for the face authentication method based on any one of claims 1-5.
Citation Information
Patent Citations
Personal identity authentication method and device based on block chain and IPFS
CN111552955A
Face recognition authentication method and system based on block chain
CN114090994A