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.0a4.tar.gz (50.0 kB view details)

Uploaded Source

Built Distribution

cenclave-1.0.0a4-py3-none-any.whl (45.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cenclave-1.0.0a4.tar.gz
  • Upload date:
  • Size: 50.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for cenclave-1.0.0a4.tar.gz
Algorithm Hash digest
SHA256 af86e2192c5666595229847e08df28ffa5a5659023b47751eee5dda82b7c7cd1
MD5 20897ac84cf0ede50d07dbd4c3549bc7
BLAKE2b-256 77e9914b73399bb976cd09b9624b0c302907ad814110a32784d3ad8bcb50593c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cenclave-1.0.0a4-py3-none-any.whl
  • Upload date:
  • Size: 45.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for cenclave-1.0.0a4-py3-none-any.whl
Algorithm Hash digest
SHA256 0fb628a1d83b2e79f48cc50402bbf4b8b16a67adc4134e9f6308f2d357b89714
MD5 7433a61b77ab915cb0b2b952064375a3
BLAKE2b-256 15f4062c5dcf29718dbbb0ff9d353dcbc8bd26781b8cb7596371a8b82f099bc0

See more details on using hashes here.

Supported by

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