• This repository has been archived on 18/Aug/2020
  • Stars
    star
    225
  • Rank 176,210 (Top 4 %)
  • Language
    C++
  • License
    Other
  • Created almost 7 years ago
  • Updated about 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

This repository is a fork of Microsoft Research's homomorphic encryption implementation, the Simple Encrypted Arithmetic Library (SEAL). This code wraps the SEAL build in a docker container and provides Python API's to the encryption library.

This repository is a proof of concept for adding a Python wrapper to the (Simple Encrypted Arithmetic Library (SEAL))[http://sealcrypto.org/], a homomorphic encryption library, developed by researchers in the Cryptography Research Group at Microsoft Research. Currently, this uses the version 2.3 codebase and dockerizes the library build (including a shared runtime), C++ example build, and Python wrapper build. The Python wrapper is using pybind11.

To build the wrapped Python version of SEAL, first run the executable build-docker.sh. This creates a seal package that can be imported in Python; to see examples of how to use this package in cryptography tasks, run the executable run-docker.sh (which runs the examples implemented in SEALPythonExamples/examples.py).

When using the SEAL library for basic encryption tasks, the first step is to create a new EncryptionParameters object, and to set its modulus attributes. The polynomial modulus should be set to a power-of-2 cyclotomic polynomial (x^(2^n) + 1 for some n), the coefficient modulus should be set to seal.coeff_modulus_128() (a good int argument is 2048), and the plain modulus can be set to any positive integer (using a power of 2 or a prime would be a good choice).

After creating the EncryptionParameters object, we create a SEALContext object to store our parameters, passing in our encryption parameters as the argument in the constructor for the context; the context, among other things, checks the validity of the parameters.

The last objects to instantiate before we can complete various encryption tasks are:

  • KeyGenerator object (which takes in the context as its constructor argument and generates a public/private key pair as well as evaluation keys).
  • Encryptor object (which takes in the context and the public key as its constructor arguments and encrypts plaintext polynomials).
  • Decryptor object (which takes in the context and the secret key as its constructor arguments and decrypts plaintext polynomials).
  • IntegerEncoder object (which takes in the context's plain modulus as its constructor argument and encodes integers as plaintext polynomials and decodes plaintext polnomials as integers).
  • Evaluator object (which takes in the context as its constructor argument, and performs computations on encrypted data and relinearizes encrypted data after multiplication operations).
  • EvaluationKeys object (which requires no arguments for the constructor and is passed to a KeyGenerator to generate evaluation keys and is also passed to an Evaluator when relinearizing).

Once these objects are all instantiated, we can homomorphically encrypt and perform computations on encrypted data as follows:

  • Use the IntegerEncoder object to encode our data as plaintext polynomials.
  • Use the Encryptor object to encrypt the plaintext polynomials obtained above.
  • Use the Evaluator object to perform computations on encrypted data (taking care to relinearize after multiplication operations).
  • Use the Decryptor object to decrypt the encrypted computational output(s).
  • Use the IntegerEncoder object to decode the decrypted output(s) (which are plaintext polynomials) and convert them back into integer data.
  • Due to the homomorphic encryption scheme, the final data obtained with the above procedure should match the output of performing our computations on the raw, unencrypted data we started with, so long as we do not incur excessive corruption with our computations on the encrypted data (to check whether we are safe on this front, we can check to make sure that the noise budget of a given encrypted datum is sufficiently large; the consumption of this noise budget reflects the corruption incurred).

The above protocol is the simplest procedure and use case for SEAL homomorphic encryption, and can be seen in Example Basics: I in our SEALPythonExamples/examples.py file. To see more sophisticated use cases, refer to the later examples in the same file.

Original home: https://www.microsoft.com/en-us/research/project/simple-encrypted-arithmetic-library/

More Repositories

1

sunny-side-up

Sentiment Analysis Challenge
Jupyter Notebook
521
star
2

ipython-spark-docker

Python
146
star
3

hermes

Recommender System Framework
Jupyter Notebook
124
star
4

cyphercat

Implementation of membership inference and model inversion attacks, extracting training data information from an ML model. Benchmarking attacks and defenses.
Jupyter Notebook
98
star
5

Dendrite

People. Places. Things. Graphs.
JavaScript
92
star
6

attalos

Joint Vector Spaces
Jupyter Notebook
89
star
7

Circulo

Community Detection Research Effort
Python
79
star
8

pythia

Supervised learning for novelty detection in text
Jupyter Notebook
79
star
9

survey-community-detection

Market Survey: Community Detection
70
star
10

Magnolia

Jupyter Notebook
45
star
11

pelops

The Pelops car re-ID project
Jupyter Notebook
44
star
12

altair

Assessing Source Code Semantic Similarity with Unsupervised Learning
Python
41
star
13

SkyLine

An Exploration into Graph Databases
Python
28
star
14

soft-boiled

Library for Geo-Inferencing in Twitter Data
Python
28
star
15

magichour

Security log file challenge
Jupyter Notebook
28
star
16

Redwood

A project that implements statistical methods for identifying anomalous files
Python
22
star
17

gestalt

Data storytelling. See link for detailed documentations: http://lab41.github.io/gestalt.
JavaScript
20
star
18

d-script

Writer Identification of Handwritten Documents
Jupyter Notebook
13
star
19

Misc

Miscellaneous utility functions
Jupyter Notebook
11
star
20

graph-generators

Scripts for generating graphs in various formats.
Python
11
star
21

lab41.github.com

Lab41 Blog
HTML
10
star
22

etl-by-example

Java
10
star
23

VOiCES-subset

VOiCES-subset
Jupyter Notebook
9
star
24

MRKronecker

MRKronecker
Java
7
star
25

graphlab-twill

Java
7
star
26

Hemlock

Hemlock is a way of providing a common data access layer.
JavaScript
7
star
27

try41

try41 - a demonstration platform
CSS
7
star
28

Summer2018ML

This repository educates users on the basics of machine learning, from basic linear algebra to backward propagation.
Jupyter Notebook
7
star
29

Rio

gephi <3 blueprints
Java
7
star
30

Hemlock-Frontend

Rails frontend for Hemlock
Ruby
4
star
31

ganymede_nbextension

Ganymede logging extension for the Jupyter Notebook Server
Python
4
star
32

verboten_words

pre-commit hook searches for words you do not want in your repo.
Python
3
star
33

Hemlock-REST

RESTful server for Lab41/Hemlock
Python
3
star
34

Epiphyte

Code for bulk loading data into Titan
Java
3
star
35

Blogs

Code that is relevant to our blog posts.
MATLAB
2
star
36

Papers

Lab41 Submitted Academic Paper
2
star
37

nbhub

Python
2
star
38

hadoop-dev-env

Shell
1
star
39

mediumblog

1
star
40

reading-group-generation-1

Reading group summaries and resources
1
star
41

condo

πŸŒ‡ Simulated codon optimized CDS dataset
Jupyter Notebook
1
star
42

titan-python-tutorial

Python
1
star