Fhe toolkit installation
PamShao 2021-06-04 10:46:04

What is? FHE-Toolkit?

FHE-Toolkit-linux Is used for Linux Of IBM Holomorphic Encryption Toolkit , The toolkit is based on Linux Of Docker Containers , Can demonstrate the calculation of encrypted data without decryption , The toolkit comes with two demos , It includes fully encrypted machine learning inference using neural network and key value search preserving privacy

github: link

The repository contains install and run as Docker All the scripts required for the container's prepackaged toolkit . These toolkits include IBM Homomorphic encryption library -HElib, Integrated development environment (IDE)【VScode】 And the corresponding workspace , It contains ready-made sample code from various supported toolkit versions . Supported versions are based on Centos,Fedora,Ubuntu or Alpine. Each toolkit version can be accessed through the Web The browser accesses the built-in IDE. For adventurous users , Instructions for building and packaging the toolkit locally are also provided .

Get ready

Environmental Science

Centos8.0( Alibaba cloud )

Before running this toolkit , You must Clone this repository . This tutorial assumes that you are in the system Have normal Internet Connect , Sure In normal operation git  Install as well as running and recent Docker install , And it has the ability to run docker command Required user privileges . Current needs Docker 19 Or later . Known older Docker Version doesn't work on our system , And the maintenance staff didn't plan to support the older Docker edition .

Building a toolkit requires effective Internet Connect , Because some dependencies are obtained from external sources at build time . Again , If the user chooses to use from DockerHub Pre built image of , We need effective Internet Connect .

install docker

yum install docker-ce // install
systemctl start docker // Start the service
docker version // View version number 


clone IBM FHE Toolkit The repository

First , In the terminal window , Issue the following command to clone this git repo:

git clone git://github.com/ibm/fhe-toolkit-linux

Get the kit Docker image

1、 To get a toolkit Docker image , Please go to the clone kit folder first , then cd Go to the toolkit project folder :

cd fhe-toolkit-linux

2、 By calling  FetchDockerImage.sh  And choose a platform to run , To get the tools Toolkit Docker Mirror image :

./FetchDockerImage.sh centos

3、 Check the image  ibmcom/fhe-toolkit-centos  whether Has been successful from Docker Hub download :

Run the toolkit

After extracting the script , start-up FHE Toolkit Containers , And make IDE Run as a daemons , Can pass Web Browser access .

./RunToolkit.sh -p centos

notes : Because I'm a cloud server , First, you need to ip Switch to the server ip, Second, you need to go to the server console - The security group will 8443 Port open , Then we can visit

Visit the toolkit

Turn on the Web browser ( instead of Docker Container instance ), Then browse to  https://IP:8443/. This will allow you to connect to FHE hold-all Docker Running in a container IDE.

Please note that , This connection passed through using a self signed certificate https Protect . therefore , Every time you connect to a new instance of the toolbox , You need to tell your browser to trust it . stay Chrome in , You can click anywhere on the warning text and type “ thisisunsafe” To perform this operation .

Advanced settings - Continue to visit

a !

Configuration Kit

After entering the toolbox , The system will automatically prompt you to choose one for FHE-Workspace The toolbox used . Select a toolkit from the drop-down list . The configuration of the workspace will begin , You will be able to go to “ Output ” See it in the window . You will also notice , The selected toolkit is now displayed at the bottom of the window CMake In the tool status bar .

If you are not automatically prompted to select a toolbox after loading it for a few seconds , Try refreshing your browser . If there is still no hint , Please check the... At the bottom of the window CMake Tool status bar , To see if the kit has been selected . Every time you start a new instance of the toolbox , You need to choose a toolbox

Build your first HElib Example

stay CMake In the tool status bar, click “Build” To generate the selected target :

function HElib Example ( Point and click )

After building , If nothing has been selected ( If this is the first time the toolkit has been run , Will not be ), Please click on the “run”. This will cause the drop-down menu to display available examples on the screen , Select a , It will start running the program :

When I operate , The default is the following , No choice , I have no choice ....

for example :“ BGV Countries of the world / Find sample documents in the regional database ” Contains information about a complete example of running a privacy preserving search against an encrypted database . The database is a repository of key values , It is pre filled with English names of countries and their capitals from all over the world , Selecting a country will search for a matching capital . 

notes : Any changes you make when using the toolkit are saved to the FHE-Toolkit-Workspace Catalog In the local file system in


After using the toolbox instance , Use  ./StopToolkit.sh  From the terminal in the host system Run the program script  , To stop and delete all toolbox instances .


Yes  FHE-Toolkit-Workspace Catalog All the updates made are Keep it where it is , So the next time you run the toolkit, you can start from where you were last interrupted

function HElib Example ( Integrated IDE Console )

Besides using CMake Tools In the status bar “ start-up ” Beyond the button , You can also use integrated terminals .

  • stay IDE Press F1 open / Go to search .
  • type Select Default Shell, To search for options to set the terminal shell .
  • choice Terminal: Select Default Shell entry .
  • choice /usr/bin/bash As your shell .
  • Close and reopen the integrated terminal window , For shell changes to take effect .


In the terminal , go to build Directory and run the sample program :

cd build

Reference resources

1、centos 7.6 Install the latest version docker 19.03

2、IBM FHE Toolkit for Linux introduction

Please bring the original link to reprint ,thank
Similar articles