100x-10000x
Typical latency overhead of HE operations versus the equivalent plaintext computation
3
Widely used HE schemes covered here: BFV, BGV (exact integers), and CKKS (approximate reals)
0
Comparisons or arbitrary branching operations natively supported by mainstream HE schemes
2
Major open-source libraries compared: Microsoft SEAL and OpenFHE

SponsoredHorizon3.ai

Proactive Security for the AI Era

NodeZero continuously and autonomously pentests infrastructure, identity, cloud, and now web applications, chaining weaknesses across every domain the way real attackers do. Every finding ships with replayable proof showing exploitable business impact, not theoretical risk.

See NodeZero WebApp in action

Homomorphic encryption gets pitched as the end of the tradeoff between usable data and private data: encrypt everything, hand it to whoever needs to run the computation, and get back a result without that party ever seeing plaintext. The pitch is directionally correct and the cryptography behind it is real, but the practical version of HE available today is narrower than the pitch suggests. If your team is evaluating HE for anything beyond a specific, bounded computation, the two decisions that matter most, scheme selection and parameter sizing, have to happen before you write a line of application code. This guide covers how to actually implement a working computation with Microsoft SEAL or OpenFHE, where HE is realistically viable right now, and where it is not. For the broader cryptographic transition context these projects sit inside, see our guides on the post-quantum cryptography migration and CNSA 2.0 quantum-safe compliance, and for how HE fits into a broader privacy engineering program, see our privacy engineering technical guide.

The problem homomorphic encryption actually solves

The scenario HE is built for is narrow and specific: a computing party needs to run a calculation on your data, and you need a mathematical guarantee, not a policy promise, that the computing party never has access to the plaintext. This is different from encryption at rest or in transit, which protects data while it is stored or moved but requires decryption before any computation can happen. It is also different from most access-control or contractual approaches to data sharing, which rely on the other party behaving correctly rather than on the data being unreadable to them in the first place.

Concretely, HE fits scenarios such as: a healthcare analytics vendor computing aggregate statistics across patient records it must never see in the clear; a third-party auditor summing encrypted financial values without gaining transaction-level visibility; or a cloud provider running a specific scored ML inference (for example, a linear model or a small neural network layer) over an encrypted input vector so the input and the intermediate values stay hidden from the provider's own infrastructure. In every one of these cases, the actual computation being outsourced is a small, well-defined set of arithmetic operations, not a general-purpose program.

That last point is the honest limit to state up front: fully homomorphic encryption (FHE) is computationally expensive enough that it is realistically used today for narrow, bounded computations, sums, weighted averages, dot products, and specific ML inference operations, not arbitrary general-purpose computation at production scale. If your use case needs comparisons, loops with data-dependent bounds, or complex branching logic, HE in its current form is a poor fit, and you should evaluate confidential computing (TEE-based approaches) or secure multi-party computation before committing engineering time to HE.

Prerequisites: scheme choice and noise budget before any code

Choose a scheme based on your data type, not familiarity. BFV and BGV both operate on exact integer arithmetic and produce exact results, which makes them the right choice when correctness cannot tolerate any approximation, for example summing financial amounts. CKKS operates on approximate real-number (fixed-point) arithmetic and is the standard choice for machine learning workloads, since ML computations already tolerate numerical approximation and CKKS is substantially more efficient for real-valued vector operations than trying to force BFV/BGV to emulate fractional values.

Understand multiplicative depth before you design the computation. Every HE ciphertext carries a noise budget that shrinks with each homomorphic operation, and multiplication consumes noise budget far faster than addition. The multiplicative depth of your computation, the longest chain of sequential multiplications the data passes through, directly determines how large your encryption parameters need to be. A computation with a multiplicative depth of 2 (for example, one round of squaring followed by a weighted sum) needs much smaller, faster parameters than a depth-10 computation. Map out the arithmetic circuit of your computation and count multiplicative depth before choosing parameters, because undersized parameters are the single most common reason a working HE prototype produces garbage on real data.

Decide between SEAL and OpenFHE deliberately. Microsoft SEAL is a C++ library (with a well-known community-maintained .NET wrapper and Node.js bindings via node-seal) implementing BFV, BGV, and CKKS, distributed under the MIT license from Microsoft's Cryptography and Privacy Research group. OpenFHE is a community-governed successor to the PALISADE library, implementing a broader scheme set (BFV, BGV, CKKS, plus the DM/CGGI schemes used for boolean-circuit FHE) with an explicit focus on usability, cross-platform support, and hardware accelerator integration. Neither is a turnkey platform: both are cryptographic libraries that expect you to handle parameter selection, key management, and serialization yourself, and both require a working knowledge of the underlying math to avoid footguns like insufficient noise budget or mismatched encryption parameters between client and server.

Free daily briefing

Briefings like this, every morning before 9am.

Threat intel, active CVEs, and campaign alerts, distilled for practitioners. 50,000+ subscribers. No noise.

Implementation procedure

  1. Install the library. Microsoft SEAL builds from source via CMake on Linux, macOS, and Windows, or installs as a vcpkg/NuGet package for .NET integration; OpenFHE builds from source via CMake as well, with binary packages available for common Linux distributions. Pin a specific release rather than tracking the development branch, since parameter defaults and API surfaces have changed across major versions of both libraries.
  2. Select your scheme and encryption parameters. Choose BFV/BGV for exact integer workloads or CKKS for approximate real-number workloads based on the prerequisites above. Set the polynomial modulus degree (commonly a power of two such as 4096, 8192, or 16384) and the coefficient modulus chain based on your required multiplicative depth: both libraries expose helper functions (SEAL's CoeffModulus::BFVDefault or CoeffModulus::Create, OpenFHE's CCParams builder) that suggest a modulus chain for a target depth, and both will reject or warn on obviously insecure parameter combinations, but neither will tell you if your depth estimate was wrong until you run the actual computation.
  3. Generate the key set. Generate a secret key (held only by the data owner), the corresponding public key (used to encrypt), relinearization keys (used after every ciphertext-ciphertext multiplication to control ciphertext size growth), and, if your computation needs vector rotations, Galois keys. Relinearization and Galois keys can be large; generate only the ones your computation actually needs.
  4. Encrypt client-side. Encode your plaintext values into the library's plaintext format (SEAL's Plaintext/OpenFHE's Plaintext wrap the encoding step, batching multiple values into SIMD slots where the scheme supports it) and encrypt using the public key. Only the resulting ciphertext, never the secret key, leaves the client.
  5. Perform the homomorphic operations server-side. Run the actual computation, additions, scalar multiplications, ciphertext-ciphertext multiplications, on the received ciphertext using only the public key and evaluation keys. Call relinearization immediately after each ciphertext-ciphertext multiplication to keep ciphertext size from growing unboundedly across subsequent operations. For CKKS specifically, track the scale factor after each multiplication and rescale as needed to keep values in range.
  6. Return the encrypted result and decrypt client-side. Send the resulting ciphertext back to the data owner, who decrypts it with the secret key that never left their control. The server at no point holds, generates, or has access to the secret key.

Validation

Test correctness against the equivalent plaintext computation first. Before trusting any HE pipeline, run the identical computation in plaintext on the same test inputs and diff the results (accounting for CKKS's expected approximation error, typically on the order of the scale factor's precision). A mismatch almost always traces back to an encoding error, a scale mismatch in CKKS, or a relinearization step that was skipped or ordered incorrectly.

Monitor noise budget consumption, not just final output. Both SEAL and OpenFHE expose noise budget inspection (SEAL's Decryptor::invariant_noise_budget) that lets you check remaining noise budget mid-computation during development. Run your actual production computation against this and confirm noise budget stays positive through the last operation with margin to spare, not just barely above zero, since real-world input variance can push a marginal computation over the edge in production even when your test vectors passed.

Benchmark latency and ciphertext size against plaintext computation on your actual hardware. This is usually the deciding factor in whether HE is viable for a given use case. Measure end-to-end latency (encryption, homomorphic computation, decryption) and ciphertext size overhead against the equivalent plaintext computation, using your actual target parameters and target hardware, not a scheme's best-case published benchmark. A computation that takes microseconds in plaintext can take hundreds of milliseconds to seconds under HE, and ciphertexts are routinely tens to hundreds of times larger than the plaintext they encrypt. If that overhead makes the use case impractical at your required throughput or latency, that is a valid outcome of this validation step, not a sign you implemented it wrong.

Failure cases

Noise budget exhaustion. If the computation's actual multiplicative depth exceeds what your chosen parameters support, the noise budget hits zero before decryption and the decrypted output is garbage, not an error message. This is the most common HE implementation failure and the reason multiplicative depth has to be mapped out before parameter selection, not discovered afterward.

Undersized parameters for the wrong reason. Teams sometimes size parameters for the computation as originally scoped, then extend the computation (adding another aggregation step, another model layer) without revisiting the parameter choice. Any change to the computation's arithmetic circuit requires re-checking multiplicative depth against your coefficient modulus chain.

Use cases that need operations HE does not support efficiently. Comparisons (greater-than, sorting, conditional branching on encrypted data) are not natively efficient in BFV/BGV/CKKS; they require workarounds (polynomial approximations of comparison functions, or switching to the DM/CGGI boolean-circuit schemes OpenFHE also implements) that add significant overhead and complexity. Discovering mid-project that your computation needs a comparison step is a sign the use case should be re-scoped, split between HE and a different approach, or reconsidered for a TEE-based confidential computing model instead.

Security tradeoffs

HE protects the confidentiality of data from the party performing the computation. It does not, by itself, provide integrity or authenticity guarantees: a malicious or compromised server can still perform the wrong computation on the ciphertext, or substitute a different ciphertext entirely, and the client has no built-in way to detect this from the ciphertext alone (this is the distinction between HE's standard security model and additional verifiable-computation techniques, which are a separate and generally heavier-weight problem). Treat HE as solving confidentiality-from-the-computing-party specifically, and pair it with the same input validation, access control, and result verification you would apply to any computation whose provider you do not fully trust.

The performance cost is real and scheme-dependent: expect roughly 100x to 10,000x overhead versus the equivalent plaintext computation depending on the operation mix and chosen parameters, which is why HE stays confined to narrow, bounded computations rather than replacing general application logic.

HE is not a drop-in replacement for TLS or at-rest encryption, and treating it as a general privacy upgrade for a whole system rather than a targeted tool for one specific compute-on-encrypted-data problem is the most common way HE projects get over-scoped. Choosing between SEAL, OpenFHE, a dedicated confidential-computing or TEE-based approach, or a purpose-built privacy-preserving analytics platform is a real architecture decision, and the right answer depends on your computation's shape, your latency and throughput budget, and whether you need protection against a malicious-server model or only an honest-but-curious one. Neither SEAL nor OpenFHE will make that decision for you.

The bottom line

Microsoft SEAL and OpenFHE both give you a working, open-source path to real homomorphic encryption, but neither is a turnkey platform and neither makes HE cheap. The technical work that determines success happens before implementation: picking BFV/BGV versus CKKS based on your data type, mapping the multiplicative depth of your actual computation, and sizing parameters to match. Validate correctness against plaintext, watch the noise budget, and benchmark the real overhead on your own hardware, since that overhead is usually what decides whether HE is viable for a given use case at all. Keep the scope narrow: sums, aggregates, and specific ML inference operations are realistic today, arbitrary general-purpose computation is not.

Frequently asked questions

What is the difference between Microsoft SEAL and OpenFHE?

Microsoft SEAL is a C++ library from Microsoft's Cryptography and Privacy Research group implementing BFV, BGV, and CKKS under an MIT license, with community .NET and Node.js bindings. OpenFHE is a community-governed successor to the PALISADE library covering a broader scheme set, including boolean-circuit FHE schemes, with an explicit focus on usability and hardware accelerator integration. Both require you to handle parameter selection and key management yourself.

Should I use BFV, BGV, or CKKS for my computation?

Use BFV or BGV when your computation needs exact integer results with no tolerance for approximation, such as summing financial values. Use CKKS when your computation involves real-number arithmetic that can tolerate small approximation error, which describes most machine learning workloads and is why CKKS is the standard choice for encrypted ML inference.

Can homomorphic encryption run arbitrary general-purpose computation?

Not practically today. Mainstream HE schemes handle addition and multiplication efficiently but do not natively support comparisons, sorting, or data-dependent branching without heavy workarounds. Realistic production use cases are narrow and bounded: sums, weighted averages, dot products, and specific ML inference operations, not arbitrary application logic.

What causes homomorphic encryption to produce garbage output instead of an error?

Noise budget exhaustion is the most common cause. Every ciphertext carries a noise budget consumed by each homomorphic operation, especially multiplication. If your chosen encryption parameters do not support the actual multiplicative depth of the computation, the noise budget hits zero before decryption and the result decrypts to meaningless data rather than throwing a clear error, which is why mapping multiplicative depth before choosing parameters matters.

How much slower is homomorphic encryption than computing on plaintext?

Overhead is typically in the range of 100x to 10,000x versus the equivalent plaintext computation, depending on the scheme, the operations used, and the chosen parameters. This overhead is usually the deciding factor in whether a given use case can adopt HE at all, which is why benchmarking against your actual hardware and target computation is a required validation step, not an afterthought.

Does homomorphic encryption replace TLS or at-rest encryption?

No. HE is a narrow tool for letting a specific party compute on data without seeing the plaintext, not a general encryption upgrade for a whole system. It also does not provide integrity or authenticity guarantees on its own, since a malicious server could still perform the wrong computation on the ciphertext without detection. TLS and at-rest encryption remain necessary for protecting data in transit and storage.

Sources & references

  1. Microsoft SEAL GitHub repository
  2. Microsoft SEAL manual (readthedocs)
  3. OpenFHE documentation
  4. OpenFHE project site
  5. OpenFHE: Open-Source Fully Homomorphic Encryption Library (WAHC '22 paper)
  6. Homomorphic Encryption Standardization Consortium

Free resources

25
Free download

Critical CVE Reference Card 2025–2026

25 actively exploited vulnerabilities with CVSS scores, exploit status, and patch availability. Print it, pin it, share it with your SOC team.

No spam. Unsubscribe anytime.

Free download

Ransomware Incident Response Playbook

Step-by-step 24-hour IR checklist covering detection, containment, eradication, and recovery. Built for SOC teams, IR leads, and CISOs.

No spam. Unsubscribe anytime.

Free newsletter

Get threat intel before your inbox does.

50,000+ security professionals read Decryption Digest for early warnings on zero-days, ransomware, and nation-state campaigns. Free, daily, no spam.

Unsubscribe anytime. We never sell your data.

Eric Bang
Author

Founder & Cybersecurity Evangelist, Decryption Digest

Cybersecurity professional with expertise in threat intelligence, vulnerability research, and enterprise security. Covers zero-days, ransomware, and nation-state operations for 50,000+ security professionals every morning.

Giveaway: InfoSec World 2026 All Access Pass ($3,895 value)

Details →
Daily Briefing

Subscribe to enter the giveaway

Every subscriber is automatically entered. You also get daily threat intel every morning: zero-days, ransomware, and nation-state campaigns. Free. No spam.

Already subscribed? You're already entered.

Giveaway

Win a $3,895 InfoSec World 2026 pass.