Skip to content
jeffmur edited this page Feb 16, 2024 · 11 revisions

Fully Homomorphic Encryption Library (FHEL)

At the core of this library is an abstract wrapper around existing FHE libraries via Abstract FHE (Afhe) Layer. The Afhe library exposes a set of basic functionalities around existing libraries. The Dart adapter layer, FHE, acts as a lower level C API interface between Flutter and Afhe. Using Object Oriented Programming (OOP) Dart models itself as a library with basic functionalities of the desired backend library.

Topology

Class Language Description
Seal Dart Entrypoint for end-user API, inherits Afhe
Afhe Dart FHE Adapter from C to Dart
FHE C Expose basic functionalities, passed by reference
SEAL C++ Concrete implementation of AFHE
AFHE C++ Abstract definition of FHE functionalities

Foreign Function Interface (FFI)

Figure 2 demonstrates a simplified example of how Dart, Afhe, performs c calls with the Interface, FHE, and interacts with C objects, SEAL, within the memory stack. The glue between Afhe and FHE uses dart:ffi to facilitate communication between components.

---
title: Figure 2 - Foreign Function Interface from C/C++ Libraries
---

sequenceDiagram
participant Afhe
participant FHE
participant SEAL

%% Data Flow
Afhe->>FHE: init_backend <br> backend_t::seal
FHE->>SEAL: Create Object
activate SEAL
SEAL->>FHE: Memory Address<br>0x12345
note over Afhe,FHE: Store address as a Pointer<br>Referenced on subsequent calls
Afhe->>FHE: generate_context()<br>{polyModDegree, ptMod}
FHE->>SEAL: ContextGen()<br>{4096, 1024}
SEAL->>FHE: Validate Parameters
FHE->>Afhe: success: valid
FHE->>Afhe: [afhe_context] error: reason
Afhe->>FHE: FHE.free()
FHE->>SEAL: Destroy Object
deactivate SEAL
Loading

Clone this wiki locally