Skip to main content
v2026.11,986 entries · CC-BY 4.0

Fully Homomorphic Encryption: Build and Run OpenFHE and SEAL

What fully homomorphic encryption does, how to build OpenFHE and run its BFV example, and which schemes OpenFHE and Microsoft SEAL support.

Written and maintained by CASRAI Editorial Board

Published · Last updated

On this page

Fully homomorphic encryption (FHE) is a family of encryption schemes that let a server add and multiply encrypted numbers and return an encrypted result that only the data owner can decrypt. The practical way to try it today is an open-source library: OpenFHE (BSD-2-Clause) or Microsoft SEAL (MIT) both implement the main schemes, build with CMake, and ship runnable examples. This guide explains what FHE does and does not do, then walks through building OpenFHE and running its integer example, with the matching SEAL route, using the projects’ own documentation as read on 2026-11-12.

What fully homomorphic encryption is

With ordinary encryption, data must be decrypted before anyone can compute on it. With homomorphic encryption, the computation happens on the ciphertext. The Microsoft SEAL README describes its library as one that ‘allows additions and multiplications to be performed on encrypted integers or real numbers.’ Because addition and multiplication are enough to express any arithmetic circuit, schemes that can chain both operations without a fixed limit are called fully homomorphic; schemes limited to a restricted depth are leveled or somewhat homomorphic. In OpenFHE this limit surfaces as a parameter you must choose up front: the example below sets SetMultiplicativeDepth(2), meaning the circuit may chain two multiplications.

The community standard for the security of these schemes is the HomomorphicEncryption.org Security Standard, dated 21 November 2018 (PDF version 1.1). It is a consortium document from industry, government and academia that gives scheme descriptions, security properties and tables of secure parameters; a later draft update dated 7 January 2019 was not adopted. Parameter choices in a real deployment should be checked against it and against the library’s own security notes rather than copied from tutorial code.

What it is used for in research

The SEAL README names three representative workloads: summing encrypted real numbers, evaluating machine-learning models on encrypted data, and computing distances between encrypted locations. In each case a data owner encrypts values, a compute provider evaluates a function on the ciphertexts, and the result stays encrypted until the owner decrypts it. For research teams this is relevant to multi-site analyses and cloud analysis of sensitive datasets, alongside other privacy-enhancing technologies. For healthcare-specific scheme choices see homomorphic encryption in healthcare; for the neighbouring technique that splits computation between parties see secure multiparty computation in healthcare; for hardware-based protection of data in use see confidential computing; for background on the primitives see what is cryptography.

The SEAL README is explicit about limits. Encrypted comparison, sorting and regular expressions are ‘in most cases not feasible’ with this technology, and it is not possible to branch on encrypted data, so only specific privacy-critical parts of a program should run under FHE. It also states that homomorphic encryption cannot be used to circumvent GDPR: results of encrypted computations remain encrypted and can only be decrypted by the data owner, so a cloud service cannot draw insights from encrypted customer data. The README adds that the difference between an efficient and an inefficient implementation can be several orders of magnitude.

Which scheme and which library

The data table below compares which schemes each of the two libraries lists in its own repository documentation. Three families matter most for a first project. BFV and BGV perform exact modular arithmetic on integers. CKKS performs addition and multiplication on real or complex numbers but yields only approximate results; the SEAL README calls it ‘by far the best choice’ for summing real numbers, machine-learning inference and distance computations, and recommends BFV or BGV when exact values are required. The FHEW and TFHE family (DM/FHEW, CGGI/TFHE, LMKCDEY in OpenFHE) targets Boolean circuits and arbitrary functions over larger plaintext spaces through lookup tables.

OpenFHE additionally lists scheme switching between CKKS and FHEW/TFHE, CKKS approximate bootstrapping, threshold FHE for BGV, BFV and CKKS (including interactive bootstrapping for threshold CKKS), and proxy re-encryption. Its repository was at version 1.6.1, released 9 October 2026, when read; the project is community-driven under the openfheorg organisation.

How to install or access it

OpenFHE

Source and releases are at github.com/openfheorg/openfhe-development; the installation guide is on the project’s Read the Docs site. Requirements per the guide: GNU C++ 9 or later, or clang 10 or later, with OpenMP, plus CMake and make. The default build has no external dependencies; GMP/NTL, tcmalloc and Intel HEXL are optional. The documented CI-tested platforms are Ubuntu 18.04 and 20.04, macOS Mojave, CentOS 7, NVIDIA Xavier and MinGW 64 on Windows 10, with user-reported builds on others, including Ubuntu 22.04 and Arch.

Microsoft SEAL

Source is at github.com/microsoft/SEAL (README for version 4.7). Linux needs Clang++ 5 or later or GNU G++ 6 or later, and CMake 3.22 or later, on a little-endian platform; the README notes that SEAL compiled with Clang++ performs much better than with G++. Two maintenance facts matter: SEAL 4.4 was a critical security update and all users should run 4.4.0 or later, and no further releases are published to NuGet.org, so .NET projects wanting a newer version must build their own package from source.

Step-by-step: build OpenFHE and run an encrypted computation

These commands are those given in the OpenFHE installation guide.

  1. Install a supported compiler (g++ 9+ or clang 10+ with OpenMP), CMake and make.
  2. Clone the openfhe-development repository and enter it.
  3. Create a build directory and configure: mkdir build, then cd build, then cmake ... To install somewhere other than the system default, use cmake -DCMAKE_INSTALL_PREFIX=/your/path ...
  4. Compile with make (the guide recommends parallel jobs with -j).
  5. Install with sudo make install (no sudo needed for a user-owned prefix).
  6. Optionally run the test suite with make testall.
  7. Run the integer example from the build directory: bin/examples/pke/simple-integers.

For SEAL on Linux the README gives cmake -S . -B build, cmake --build build and sudo cmake --install build; on Windows with Visual Studio 2022, cmake -S . -B build -G "Visual Studio 17 2022" -A x64 and cmake --build build --config Release. Its examples (1_bfv_basics.cpp through 8_performance.cpp) are built through the CMake options described in the README.

What the OpenFHE example does

The source of simple-integers.cpp in the repository follows five steps. (1) It sets a BFV context with plaintext modulus 65537 and multiplicative depth 2, then enables the PKE, KEYSWITCH and LEVELEDSHE features. (2) It generates a public/private key pair, a relinearization key (EvalMultKeyGen) and rotation keys for shifts of 1, 2, -1 and -2. (3) It packs three vectors of twelve integers into plaintexts with MakePackedPlaintext and encrypts each with the public key. (4) It evaluates, on ciphertexts only, the sum and the product of the three vectors and four rotations of the first. (5) It decrypts with the secret key and prints plaintexts and results.

Output and how to read it

The program prints the three input plaintexts, then labelled lines: #1 + #2 + #3, #1 * #2 * #3, and left and right rotations of the first vector. The check you should make is that each decrypted line equals the same operation done in the clear. From the input vectors in the source (vector 1 = 1 to 12; vector 2 = 3, 2, 1, 4, 5, 6, 7, 8, 9, 10, 11, 12; vector 3 = 1, 2, 5, 2, 5, 6, 7, 8, 9, 10, 11, 12), slot-wise arithmetic gives these expected values, which the BFV scheme should reproduce exactly because it is an exact-integer scheme and every value is below the modulus 65537:

Slot 1 2 3 4 5 6 7 8 9 10 11 12
Sum of three vectors 5 6 9 10 15 18 21 24 27 30 33 36
Product of three vectors 3 8 15 32 125 216 343 512 729 1000 1331 1728

These expected values are arithmetic on the example’s inputs, not copied program output; compare them with what your own run prints. A product exceeding the plaintext modulus would wrap around modulo 65537, which is why choosing the modulus is part of the design of an integer computation. With CKKS the comparison changes: decrypted values differ from the plaintext result by a small error, so compare within a tolerance, not for equality.

Troubleshooting

  • CMake error persists after installing a dependency (OpenFHE): the guide says to run make clean and configure again.
  • Compiler too old: OpenFHE needs g++ 9+ or clang 10+ with OpenMP; SEAL needs Clang++ 5+ or G++ 6+ and CMake 3.22+.
  • Slower with Intel HEXL (SEAL): the README says HEXL improves performance only on processors with AVX-512; without it most operations are slower, so enable it only for AVX-512 targets.
  • Newer SEAL not available from NuGet: build your own NuGet package from source, as the README instructs.
  • Little-endian requirement (SEAL): the library will not run on big-endian platforms.
  • Decryption output and noise: SEAL’s security notes say decryptions should be treated as private information of the secret-key owner; sharing them can in some cases leak the key. Its Decryptor::invariant_noise_budget must not be invoked on ciphertexts of unverified provenance. Its CKKS implementation targets IND-CPA security only, and any noise-flooding mitigation must be added by the application before a decrypted value crosses a trust boundary.
  • Ciphertexts are not authenticated (SEAL): successfully decrypting a ciphertext does not prove who produced it; integrity and origin authentication belong in the protocol layer. SEAL also does not provide circuit privacy.

Free alternatives

Library Licence Version read (2026-11-12) Languages and builds named in its documentation
OpenFHE BSD-2-Clause 1.6.1 (released 9 October 2026) C++ built with CMake and make
Microsoft SEAL MIT README for 4.7 C++ with CMake; .NET wrapper (64-bit only); WebAssembly, Android and iOS builds

Both are open source and free of licence fees. Choose by scheme coverage first: if you need Boolean-circuit schemes, scheme switching or threshold features, OpenFHE lists them and SEAL’s README does not; if you need only BFV, BGV or CKKS and a .NET path, SEAL covers them.

FAQ

What is fully homomorphic encryption in one sentence?

It is encryption that lets a party compute additions and multiplications on ciphertexts so that, once the owner decrypts the result, it equals the same computation done on the plaintexts.

Which scheme should I start with?

The SEAL README recommends CKKS for real-number work such as summing values or evaluating machine-learning models, and BFV or BGV when exact integer values are needed.

Can a cloud provider analyse my encrypted data?

Not to gain insight. Per the SEAL README, results of encrypted computations remain encrypted and only the data owner can decrypt them.

Is the library code safe to use as-is in production?

The SEAL documentation says commercial applications should be reviewed by cryptography experts familiar with homomorphic encryption security models, and that example code is not optimised for performance or reuse.

Is there a standard for secure parameters?

Yes: the HomomorphicEncryption.org Security Standard of 21 November 2018 provides tables of secure parameters.

Sources

Data: Homomorphic encryption schemes listed by OpenFHE and Microsoft SEAL

Scheme and feature support as each library's own repository README lists it, compiled from the OpenFHE development README (v1.6.1) and the Microsoft SEAL README (v4.7) read on 2026-11-12.

Period covered: 2026.

Homomorphic encryption schemes listed by OpenFHE and Microsoft SEAL
Scheme or featureData typeOpenFHE 1.6.1Microsoft SEAL 4.7
BFVExact integersYesYes
BGVExact integersYesYes
CKKSReal (and complex, in SEAL) numbers, approximateYes (with approximate bootstrapping)Yes
DM/FHEWBoolean circuits and lookup tablesYesNot listed in README
CGGI/TFHEBoolean circuits and lookup tablesYesNot listed in README
LMKCDEYBoolean circuits and lookup tablesYesNot listed in README
CKKS to FHEW/TFHE scheme switchingMixed numeric and BooleanYesNot listed in README
Threshold FHE (BGV, BFV, CKKS)Multi-party key setupYesNot listed in README
Proxy re-encryption (BGV, BFV, CKKS)Delegated decryptionYesNot listed in README

Sources

Compiled by CASRAI from the sources above. Free to reuse under CC BY 4.0 with attribution.

Follow CASRAI

Research-administration guidance, standards updates and independent tool reviews.

Ask CASRAI · free to try

Ask about Fully Homomorphic Encryption: Build and Run OpenFHE and SEAL

2 free questions a day, no account.

An AI assistant for research: funder rules, compliance, methods and publishing. It links the sources behind its answers and labels answers that come from a web search.

Answers draw on CASRAI's guides and dictionary plus the federal and funder documents we index: Federal Register, Grants.gov, Regulations.gov and UKRI.

Works on this site and inside Claude, Cursor and the AI tools you already use.

Everything CASRAI publishes — this page, the dictionary, the guides and the news — stays open to read, with no account and no card.

Referenced across the research world

University of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logoUniversity of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logo
  • University of Cambridge logo
  • Columbia University logo
  • Crossref logo
  • University of Edinburgh logo
  • Harvard University logo
  • University of Oxford logo
  • Princeton University logo
  • Stanford School of Medicine logo
  • University College London logo
  • ORCID logo

View CASRAI adoption →