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

Uploaded Source

Built Distribution

cenclave-1.0.0a2-py3-none-any.whl (45.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cenclave-1.0.0a2.tar.gz
  • Upload date:
  • Size: 50.1 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.0a2.tar.gz
Algorithm Hash digest
SHA256 0702fbe4165b284a5a8ee45b289ce1bc9c0228f8a9a3fc9c5e6e17dedaeb8a4c
MD5 2aec4dbdf1b1cd3a29a399fc2d4bd2e2
BLAKE2b-256 d4c5a6737bac6c913a9c68ed3baa452d489f75c6caa2aea82c6fe2a450dd0a3f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cenclave-1.0.0a2-py3-none-any.whl
  • Upload date:
  • Size: 45.6 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.0a2-py3-none-any.whl
Algorithm Hash digest
SHA256 fd35100816185574911c48b2c8984c476416915f540c565eb21c92ad0fcecb2f
MD5 835d7a1b1c9ae2dac7cb1da065e4ebbd
BLAKE2b-256 ac0f890be6b88944cf4845d570dfa8a7e99130d4d9a9ee5899d1784b52450ec7

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