Seal
Seal
• Open-source
• https://github.com/microsoft/SEAL
Microsoft SEAL Homomorphic Encryption Library (2)
• Supports two homomorphic encryption schemes
• BFV (allows homomorphic computations on encrypted integers)
• CKKS or HEAAN (allows homomorphic computations on real numbers)
• Given these three parameters, SEAL will create all necessary parameters
• BFV Hom. Multiplication routine needs extra coefficient modulus
• For a given parameter set, each ciphertext starts with a 'noise budget'
Microsoft SEAL Homomorphic Encryption Library (4)
• BFV Implementation In Microsoft SEAL
• Using given parameters, Microsoft SEAL creates a modulus switching chain
• n = 8192, qis = (set by SEAL), T = 20-bit
EncryptionParameters parms(scheme_type::bfv);
parms.set_poly_modulus_degree(8192);
parms.set_coeff_modulus(CoeffModulus::BFVDefault(poly_modulus_degree));
parms.set_plain_modulus(PlainModulus::Batching(poly_modulus_degree, 20));
• Given these three parameters, SEAL will create all necessary parameters
• For a given parameter set, each ciphertext starts with a 'multiplicative depth'
Microsoft SEAL Homomorphic Encryption Library (6)
• CKKS Implementation In Microsoft SEAL
• Using given parameters, Microsoft SEAL creates a modulus switching chain
• n = 8192, qis = {60-bit, 40-bit, 40-bit, 60-bit}, scale
EncryptionParameters parms(scheme_type::ckks);
parms.set_poly_modulus_degree(8192);
parms.set_coeff_modulus(CoeffModulus::Create(poly_modulus_degree, {60,40,40,60}));
Double scale = pow(2.0, 40);
• When a password is saved, Microsoft Edge should contact a server to check if the
password is in a breached list.
• Neither Microsoft Edge nor a third-party should learn user's password or
username while performing this operation
• For details:
• Chen et al. "Fast Private Set Intersection from Homomorphic Encryption" at
CCS'17
• Chen et al. "Labeled PSI from Fully Homomorphic Encryption with Malicious
Security" at ACM SIGSAC'18
Microsoft SEAL Use Case (3)
• Password Monitor: Safeguarding passwords on Microsoft Edge
• Concrete by ZAMA
• Written in Rust
• Supports TFHE (allows homomorphic computation on gate level)
• https://github.com/zama-ai/concrete
• HElib by IBM
• Supports BGV and CKKS
• https://github.com/HomEnc/HElib
How to install/run Microsoft SEAL (1)
• Installation steps
• Download/Clone Microsoft SEAL from its GitHub repository to a directory
• Use commands below to install SEAL globally on your system with SEAL
Examples (which explains fundamental concepts in homomorphic encryption
and SEAL):
cmake -S . -B build -DSEAL_BUILD_EXAMPLES=ON
cmake --build build
sudo cmake --install build
cmake_minimum_required(VERSION 3.13)
project(SEALTutorial VERSION 1.0)
add_executable(sealtutorial sealtutorial.cpp)
find_package(SEAL 3.7.2)
target_link_libraries(sealtutorial SEAL::seal)
How to use Microsoft SEAL in your code (2)
• You can use following sample CMakeList.txt file with your custom sealtutorial.cpp.
• sealtutorial.cpp
#include "seal/seal.h"
#include <vector>
int main()
{
return 0;
}
How to use Microsoft SEAL in your code (3)
• Finally, you can run your code with:
cmake .
make
./sealtutorial
Exercise (1)
• Comparison of two 2-bit unsigned integers homomorphically using BFV scheme
• A = (a1, a0)
• B = (b1, b0)
• Compute A<B
• Compute A<B
a1 a0
* a1*b1 a0*b0 - b1 - a1*b1 b0 - a0*b0
b1 b0 C
1 -
D
(C>>1) + C * (D >> 1)