# \[ANN\] SEAL.jl: Fully homomorphic encryption with the BFV and CKKS schemes

**URL:** https://discourse.julialang.org/t/ann-seal-jl-fully-homomorphic-encryption-with-the-bfv-and-ckks-schemes/42210
**Category:** Package Announcements
**Created:** [June 28, 2020, 10:17pm UTC](https://discourse.julialang.org/t/ann-seal-jl-fully-homomorphic-encryption-with-the-bfv-and-ckks-schemes/42210 "2020-06-28T22:17:55Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![sloede](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sloede/32/44787_2.png) [@sloede](https://discourse.julialang.org/u/sloede)
#### Post date: [June 28, 2020, 10:17pm UTC](https://discourse.julialang.org/t/ann-seal-jl-fully-homomorphic-encryption-with-the-bfv-and-ckks-schemes/42210/1 "2020-06-28T22:17:55Z")

</div>

[SEAL.jl](https://github.com/JuliaCrypto/SEAL.jl) is a Julia package that wraps the [SEAL](https://github.com/microsoft/SEAL) library for homomorphic encryption. Homomorphic encryption allows to perform numerical operations directly on _encrypted_ data without having to decrypt the data first, process it, and then re-encrypt the result.

The package supports the Brakerski/Fan-Vercauteren ([BFV](https://eprint.iacr.org/2012/144.pdf)) scheme for exact integer arithmetic and the Cheon-Kim-Kim-Song ([CKKS](https://eprint.iacr.org/2016/421.pdf), also known as HEAAN in literature) scheme for approximate arithmetic with real and complex numbers. Our goal is to expose the homomorphic encryption capabilitites of SEAL in a (mostly) intuitive and Julian way.

Currently, SEAL.jl supports all operations that are used in the examples 1 through 5 of the [SEAL library](https://github.com/microsoft/SEAL/tree/master/native/examples). This includes

- encoding/decoding of raw data
- encryption/decryption
- basic arithmetic operation: addition, multiplication
- rotation
- relinearization and rescaling
- modulus switching

for both the BFV and CKKS schemes.

While most relevant functionality of the SEAL library is already supported in SEAL.jl, there are a few areas where more work is needed, and where community contributions are especially welcome:

- Add missing API implementations
- Add the remaining two examples `6_serialization` and `7_performance`
- Document all examples
- Complete missing docstrings

---

<div class="post-metadata">

### Author: ![oschulz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oschulz/32/2998_2.png) [@oschulz](https://discourse.julialang.org/u/oschulz)
#### Post date: [June 28, 2020, 10:44pm UTC](https://discourse.julialang.org/t/ann-seal-jl-fully-homomorphic-encryption-with-the-bfv-and-ckks-schemes/42210/2 "2020-06-28T22:44:15Z")

</div>

But will it work with Flux? 🙂

Maybe too much to hope for, but it just would be _so_ awesome - generic code couldn’t get much more generic than that …

---

<div class="post-metadata">

### Author: ![simeonschaub](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/simeonschaub/32/216566_2.png) [@simeonschaub](https://discourse.julialang.org/u/simeonschaub)
#### Post date: [June 28, 2020, 11:27pm UTC](https://discourse.julialang.org/t/ann-seal-jl-fully-homomorphic-encryption-with-the-bfv-and-ckks-schemes/42210/3 "2020-06-28T23:27:18Z")

</div>

[https://github.com/JuliaCrypto/ToyFHE.jl/blob/master/examples/encrypted\_mnist/infer.jl](https://github.com/JuliaCrypto/ToyFHE.jl/blob/master/examples/encrypted_mnist/infer.jl) actually already uses Flux. Because Flux is so flexible and can basically integrate with any julia code, this soiuldn’t really be difficult for SEAL.jl.

---

<div class="post-metadata">

### Author: ![sloede](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sloede/32/44787_2.png) [@sloede](https://discourse.julialang.org/u/sloede)
#### Post date: [June 29, 2020, 7:09am UTC](https://discourse.julialang.org/t/ann-seal-jl-fully-homomorphic-encryption-with-the-bfv-and-ckks-schemes/42210/4 "2020-06-29T07:09:56Z")

</div>

As you can see, everything in SEAL.jl is still mighty fresh, and I haven’t tried using it with Flux yet (but as @simeonschaub pointed out, I also don’t see a reason why it wouldn’t work).

However, one of the plans for the future is to make SEAL.jl more user-friendly by hiding some of the implementation details behind a Julian interface. We would still keep the one-to-one correspondence to the SEAL C++ library intact for full flexibility, but add a convenience layer on top of it to allow writing expressions like `cipher3 = cipher1 * cipher2`. Furthermore, there is already an idea floating around to introduce something like a base package for fully homomorphic encryption that exposes multiple HE backends (such as ToyFHE.jl and SEAL.jl) through a common interface. Ideas, discussions & contributions welcome!

---

<div class="post-metadata">

### Author: ![oschulz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oschulz/32/2998_2.png) [@oschulz](https://discourse.julialang.org/u/oschulz)
#### Post date: [June 29, 2020, 10:22am UTC](https://discourse.julialang.org/t/ann-seal-jl-fully-homomorphic-encryption-with-the-bfv-and-ckks-schemes/42210/5 "2020-06-29T10:22:23Z")

</div>

This is what makes Julia (and the community) so amazing!
