Skip to content
This repository was archived by the owner on Aug 5, 2024. It is now read-only.

Commit 81cf00f

Browse files
committed
Pulled in additions from lab guide
1 parent 9fd0851 commit 81cf00f

File tree

1 file changed

+88
-16
lines changed

1 file changed

+88
-16
lines changed

automation/Getting_Started.md

Lines changed: 88 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,23 @@
22

33
The following steps walk you through how to get a pre-built fhe-toolkit docker image into a Hyper Protect Server container.
44

5-
### Preparing my system to handle a HPVS connection
5+
### Prerequisites
66

77
* You can use any Linux or Unix based (Mac will work) computer that the ibm cloud supports
88

9+
* If the deploy script will be run on MacOS:
10+
* Requires a `python` installation
11+
* Install `gpg`
12+
* MacOS with homebrew: `brew install gpg`
13+
* To install homebrew: `/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"`
14+
* MasOS without homebrew: download from https://gpgtools.org/
15+
16+
* Install `pyenv`
17+
* MacOS with homebrew: `brew install pyenv`
18+
* MacOS without homebrew: `curl https://pyenv.run | bash`
19+
* Otherwise, install these dependencies with your Linux distro's package manager
20+
21+
### Creating an IBM Cloud account
922
* Create an IBM Cloud account if you have never done so. To do this, go to [https://cloud.ibm.com/login](https://cloud.ibm.com/login) in your web browser.
1023

1124
If you don't have an account, select the "Create an account" link. [https://cloud.ibm.com/registration](https://cloud.ibm.com/registration)
@@ -22,7 +35,11 @@ The following steps walk you through how to get a pre-built fhe-toolkit docker i
2235
2336
* Click Show. Once you have that key, copy and save it somewhere that you won't forget or delete it. Alternatively you can download it as a JSON file from the prompt on screen.
2437

25-
* Update or install `ibmcloud` CLI on local machine & on the S390 machine you will be using. Its good to have it working on another non-S390x machine because there are some things that you can't do
38+
* An example API key looks like this `k-y2lsNxfeKbaidcCG6kQVypLDR_WjmDPe-2Uuq_PTYx`
39+
40+
41+
42+
* Update or install `ibmcloud` CLI on the machine you will be using.
2643
[https://cloud.ibm.com/docs/cli?topic=cli-getting-started](https://cloud.ibm.com/docs/cli?topic=cli-getting-started)
2744

2845
NOTE: If you have a mac, you can just open a terminal and issue the following command:
@@ -86,11 +103,11 @@ Space:
86103
```
87104

88105

89-
* Update to the latest container plugin (not sure this is available on S390)
106+
* Update to the latest container plugin
90107

91108
`ibmcloud plugin update container-registry`
92109

93-
* Also install the hpvs plugin as well (this is definitely NOT on S390)
110+
* Install the hpvs plugin as well
94111

95112
`ibmcloud plugin install hpvs`
96113

@@ -100,22 +117,57 @@ Space:
100117

101118
Login to cloud.ibm.com -> `Manage -> Account -> Account Resources -> Resource Groups -> Create`
102119

103-
* If the deploy script will be run on MacOS:
104-
* Requires a `python` installation
105-
* Install `gpg`
106-
* MacOS with homebrew: `brew install gpg`
107-
* To install homebrew: `/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"`
108-
* MasOS without homebrew: download from https://gpgtools.org/
120+
#### The Keys
121+
To sign and deploy an image to HPVS, we need three to four sets of keys:
122+
1. Root key; root of content trust for an image tag
123+
2. Repository key (aka "target key"); allows you to sign image tags and manage delegations (including delegated keys or permitted delegation paths)
124+
3. Encryption key for the HPVS registration definition file
125+
4. Vendor key, required for signing the HPVS registration definition file
126+
5. Delegation key (optional); allows you to delegate signing image tags to other publishers without having to share your repository key
127+
128+
Before you can run `DeployToHPVS.sh`, you must tell it:
129+
1. The passphrase to use for the root key
130+
2. The passphrase to use for the repository key
131+
3. The name and location of the GPG vendor key (both public and private)
132+
4. The name and location of the delegation key (optional)
109133

110-
* Install `pyenv`
111-
* MacOS with homebrew: `brew install pyenv`
112-
* MacOS without homebrew: `curl https://pyenv.run | bash`
134+
##### Automatic key generation
135+
If `DeployToHPVS.sh` called with the `-c` option, the interactive wizard will walk you through the process of key generation.
113136

114-
* Login onto the S390x machine (see greg for credentials if you dont have them)
137+
The root and repository keys are generated automatically by `docker trust`, which is invoked by `DeployToHPVS.sh`. The HPVS registration encryption key is hardcoded into `DeployToHPVS.sh`. The other keys (the vendor and delegation keys) must be generated ahead of time.
115138

116-
* Clone the fhe-toolkit repo `https://github.com/IBM/fhe-toolkit-linux.git`
139+
##### Vendor key
140+
141+
To generate a vendor keypair, create a GPG batch file with the following contents:
142+
```
143+
%echo Generating registration definition key
144+
Key-Type: RSA
145+
Key-Length: 4096
146+
Subkey-Type: RSA
147+
Subkey-Length: 4096
148+
Name-Real: fhe_user
149+
Expire-Date: 0
150+
Passphrase: <passphrase>
151+
%echo done
152+
```
153+
Then run the following to generate a new keypair as the `fhe_user` identity:
154+
```
155+
gpg -a --batch --generate-key <batchfile>
156+
```
157+
158+
##### Delegation keys
159+
Delegations in Docker Content Trust (DCT) allow you to control who can and cannot sign an image tag. A delegation will have a pair of private and public delegation keys. A delegation could contain multiple pairs of keys and contributors in order to allow multiple users to be part of a delegation, and to support key rotation.
160+
161+
If `delegationkey` is `false` or commented-out in your configuration file, then the repository key will be used to sign your image. Thereafter, any changes to your image can only be made using the repository key.
162+
163+
Delegation keys can be generated using `docker trust`:
164+
```
165+
docker trust key generate <yourkeyname>
166+
```
117167

118-
* Checkout the hpvs_work_integration branch `git checkout hpvs_work_integration`
168+
169+
### Running the HPVS Deploy script
170+
* Clone the fhe-toolkit repo `https://github.com/IBM/fhe-toolkit-linux.git`
119171

120172
* cd into the main folder `cd fhe-toolkit-linux` and build a local image `./BuildDockerImage ubuntu` If you want to test with fedora change `ubuntu` to `fedora` in the command
121173

@@ -132,6 +184,26 @@ Space:
132184
133185
Everything should run from here. Please note where the script gets stuck and errors out (if it does)
134186

187+
### Accessing the toolkit
188+
When the deploy script has run successfully...
189+
190+
* Log on to the Dashboard section of https://cloud.ibm.com.
191+
192+
* Expand services in the resource list, click on the image and then click on "View Full Details" to access the public IP address, and copy it to your browser adding the port 8443. It will look like: https://xxx.xx.xx.xx:8443/
193+
194+
* Acknowledge that the server is using a self-signed certificate, accept risk and continue
195+
196+
### Running the toolkit
197+
* Once the toolkit is loaded, you should automatically be prompted to select a kit for the FHE-Workspace to use. Select one of the kits from the dropdown. Configuration of the workspace will begin which you will be able to see in the Output Window. You'll also notice the kit you selected is now shown in the CMake Tools status bar at the bottom of the window.
198+
199+
* If you are not automatically prompted to select a kit after a few seconds of loading the toolkit, try refreshing your browser. If you're still not prompted, check the CMake Tools status bar at the bottom of the window to see if a kit has already been selected. You'll need to select a kit each time you start a new instance of the Toolkit.
200+
201+
* Click “Build” in the CMake Tools status bar to build the selected target.
202+
203+
* When the build has finished, click “Launch” in CMake Tools status bar to launch the selected target in the terminal window.
204+
205+
Each demonstration application is in a self-contained directory in the examples folder in the IDE. Each demo application directory contains a README.md that explains how to run the demo and what you should expect for results. For instance, the BGV World Country Database Lookup Example Documentation contains the information to run a complete example of a privacy preserving search against an encrypted database. The database is a key value store prepopulated with the english names of countries and their capital cities from the world. Selecting the country will perform a search of the matching capital.
206+
135207

136208

137209
### Debug Mode

0 commit comments

Comments
 (0)