CipherFace: A Fully Homomorphic Encryption-Driven Framework for Secure Cloud-Based Facial Recognition
Sefik Serengil, Alper Ozpinar
TL;DR
CipherFace tackles the privacy risks of cloud-based facial recognition by performing distance computations on encrypted embeddings using fully homomorphic encryption, with decryption occurring on the on-premises side. It introduces encrypted distance protocols for both Euclidean and Cosine metrics, including $d^2 = \sum_i (\alpha_i - \beta_i)^2$ for Euclidean and $\theta = 1 - \hat{\alpha} \cdot \hat{\beta}$ for Cosine, where $\hat{\alpha}$ and $\hat{\beta}$ are normalized embeddings. The work delivers a Python-based framework leveraging DeepFace for embeddings and TenSEAL for FHE, and validates the approach across embedding sizes $128d$, $512d$, and $4096d$ with 128-bit security on the LFW dataset. Results show feasible latency with meaningful overhead that grows with embedding size and security level, supporting scalable, privacy-preserving cloud-based facial recognition and broader similarity-search tasks. Future work may further optimize encryption schemes and expand applicability to other privacy-preserving AI use cases.
Abstract
Facial recognition systems rely on embeddings to represent facial images and determine identity by verifying if the distance between embeddings is below a pre-tuned threshold. While embeddings are not reversible to original images, they still contain sensitive information, making their security critical. Traditional encryption methods like AES are limited in securely utilizing cloud computational power for distance calculations. Homomorphic Encryption, allowing calculations on encrypted data, offers a robust alternative. This paper introduces CipherFace, a homomorphic encryption-driven framework for secure cloud-based facial recognition, which we have open-sourced at http://github.com/serengil/cipherface. By leveraging FHE, CipherFace ensures the privacy of embeddings while utilizing the cloud for efficient distance computation. Furthermore, we propose a novel encrypted distance computation method for both Euclidean and Cosine distances, addressing key challenges in performing secure similarity calculations on encrypted data. We also conducted experiments with different facial recognition models, various embedding sizes, and cryptosystem configurations, demonstrating the scalability and effectiveness of CipherFace in real-world applications.
