Skip to main content

Command Line Interface for Cosmian Enclave

Project description

Cosmian Enclave Command-Line Interface

Overview

Cosmian Enclave allows to easily run confidential Python web applications based on Intel® SGX and Gramine. Its features include the ability to encrypt the code and the construction of a RATLS channel with your enclave.

Read Cosmian Enclave documentation for more details.

Install

$ pip install cenclave

Usage

$ cenclave -h

Note: if you set the env variable BACKTRACE=full, a Python stacktrace will be printed in case of errors.

Scaffold your app

User: the code provider

$ cenclave scaffold example

Test your app before ceating the enclave

User: the code provider

$ cenclave localtest --project example/

Create the Cosmian Enclave package with the code and the docker image

User: the code provider

$ cenclave package --project example/ \
                   --output workspace/code_provider 

The generated package can now be sent to the sgx operator.

Spawn the Cosmian Enclave docker

User: the SGX operator

$ cenclave spawn --host 127.0.0.1 \
                 --port 9999 \
                 --size 4096 \
                 --package workspace/code_provider/package_cenclave_src_1683276327723953661.tar \
                 --output workspace/sgx_operator/ \
                 app_name

At this moment, evidences have been automatically collected and the web application is up.

Evidences are essential for the code provider to verify the trustworthiness of the running application.

The file workspace/sgx_operator/evidence.json can now be shared with the other participants.

Check the trustworthiness of the application

User: the code provider

The trustworthiness is established based on multiple information:

  • the full code package (tarball)
  • the arguments used to spawn the web app
  • evidences captured from the enclave

Verification of the enclave information:

$ cenclave verify --package workspace/code_provider/package_cenclave_src_1683276327723953661.tar \
                  --evidence output/evidence.json \
                  --output /tmp

If the verification succeeds, you get the RA-TLS certificate (written as a file named ratls.pem) and you can now seal the code key to share it with the SGX operator.

Seal your secrets

User: the code provider

$ cenclave seal --secrets example/secrets_to_seal.json \
                --cert /tmp/ratls.pem \
                --output workspace/code_provider/

Finalize the configuration and run the application

User: the SGX operator

$ cenclave run --sealed-secrets workspace/code_provider/secrets_to_seal.json.sealed \
               app_name

Test the deployed application

User: the SGX operator

$ cenclave test --test workspace/sgx_operator/tests/ \
                --config workspace/sgx_operator/config.toml \
                app_name

Decrypt the result

User: the code provider

Assume the SGX operator gets a result as follows: curl https://localhost:7788/result --cacert /tmp/ratls.pem > result.enc

Then, the code provider can decrypt the result as follows:

$ cenclave decrypt --key key.txt \
                   --output workspace/code_provider/result.plain \
                   result.enc
$ cat workspace/code_provider/result.plain

Manage Cosmian Enclave's containers

User: the SGX operator

You can stop and remove the container as follows:

$ cenclave stop [--remove] <app_name>

You can restart a stopped and not removed containers as follows:

$ cenclave restart <app_name>

You can get the Cosmian Enclave container logs as follows:

$ cenclave logs <app_name>

You can get the Cosmian Enclave docker status as follows:

$ cenclave status <app_name>

You can get the list of running Cosmian Enclave containers:

$ cenclave list

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cenclave-1.0.0a11.tar.gz (51.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cenclave-1.0.0a11-py3-none-any.whl (47.2 kB view details)

Uploaded Python 3

File details

Details for the file cenclave-1.0.0a11.tar.gz.

File metadata

  • Download URL: cenclave-1.0.0a11.tar.gz
  • Upload date:
  • Size: 51.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for cenclave-1.0.0a11.tar.gz
Algorithm Hash digest
SHA256 c8cc4b34682b6ee4b408b0b6a61ad672c079d9f4a843fd19ea954013f6faaa0c
MD5 42f231c2a93f8db9b7a6c9f2496793b5
BLAKE2b-256 be36a8ed0cfc7fd878198189f042591c9f4647017a369c93bb59d0c9fb8ce869

See more details on using hashes here.

File details

Details for the file cenclave-1.0.0a11-py3-none-any.whl.

File metadata

  • Download URL: cenclave-1.0.0a11-py3-none-any.whl
  • Upload date:
  • Size: 47.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for cenclave-1.0.0a11-py3-none-any.whl
Algorithm Hash digest
SHA256 6e03bdc5f89bc1e895af1fadfcc548bfc517146360ae1c7cdc37935326826583
MD5 293f7df56d792c26cc596cf54765bf83
BLAKE2b-256 d2c3ef8ab433e8c29849e17721d24e2758b5ab6110e1b9c9f329e1f3fff8dee6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page