SEAL is an open-source library from Microsoft Research (code) for performing homomorphic encryption - a way of computing with encrypted data without first having to decrypt it.
sealsharp is a user-friendly .NET API for SEAL. Computations are represented using C# LINQ Expressions to form an abstract syntax tree. Sealsharp then analyzes and compiles this expression tree into calls to the underlying SEAL library.
Define expression:
Expression<Func<long, long, long>> computation = (x, y) => x + (x * y);
Evaluate expression:
Ciphertext encrypted_result = evaluator.CompileAndRun (computation, relin_keys, encrypted_x, encrypted_y);
A full example is in the sealsharp-example directory.
The project is an early proof of concept.
At the moment we have C# bindings for only a small subset of the full SEAL API. More functions and classes are easy to add, but it is work that has not been done yet.
The SEAL Linq Expressions high-level API also only covers a small subset of the possible expressions that you could write.
PRs welcome!
Install cmake
(OSX: brew install cmake
) and
Mono. You will also need a C++
compiler.
-
Make sure to initialize submodules when you first clone or when you pull changes.
git submodule update --init --recursive
-
Run
prepare.sh
to build SEAL and install it into./build/install
./prepare.sh
The above will also compile the SEAL examples into
./external/SEAL/bin/sealexamples
-
Compile the
seal-c
C bindings./seal-c.sh
This will leave a shared library in
./build/install/lib/
namedlibseal-c.so
orlibseal-c.dylib
-
Build the C# bindings and example
msbuild /t:Restore msbuild
-
Run the C# example
mono build/sealsharp-example/bin/Debug/net462/sealsharp-example.exe
The last two steps could also be done from Visual Studio by opening sealsharp.sln
and building from the menus