The wide application of face recognition technology in the commercial field puts forward higher requirements for the protection of users’ personal privacy data during the recognition process as well as the accuracy of recognition. This paper explains the basic conceptual content of quantum bits and quantum logic gates. Under the theoretical framework, a three-valued XHZ encryption scheme in three-valued quantum states is proposed to complete the construction and optimization of the quantum encryption algorithm. Using the designed quantum encryption algorithm, the public key is generated in the server based on the face feature data, and the private key is used to decrypt in the client, so as to construct the face recognition system based on the quantum encryption algorithm. In the evaluation experiment, the fastest encryption average time is only 2.465ms, and the shortest calculation time for face similarity is only 4.577ms, which shows that the designed system can fully meet the technical requirements of identity authentication while safeguarding the user’s personal privacy and security.