{"id":13641646,"url":"https://github.com/mc2-project/mc2","last_synced_at":"2026-01-15T02:22:34.835Z","repository":{"id":35586165,"uuid":"207685773","full_name":"mc2-project/mc2","owner":"mc2-project","description":"A Platform for Secure Analytics and Machine Learning","archived":false,"fork":false,"pushed_at":"2023-03-29T01:33:34.000Z","size":84117,"stargazers_count":305,"open_issues_count":20,"forks_count":45,"subscribers_count":17,"default_branch":"dev","last_synced_at":"2026-01-12T11:25:17.841Z","etag":null,"topics":["analytics","cloud","machine-learning","privacy","secure-analytics","secure-learning","security"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mc2-project.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2019-09-11T00:09:56.000Z","updated_at":"2025-11-03T07:30:56.000Z","dependencies_parsed_at":"2023-01-16T00:17:49.745Z","dependency_job_id":"b1f594ad-b404-43ce-aa91-15139b7524b3","html_url":"https://github.com/mc2-project/mc2","commit_stats":{"total_commits":66,"total_committers":10,"mean_commits":6.6,"dds":"0.40909090909090906","last_synced_commit":"38a6888a60ea6f9e3a513fadc29c2123334e6cdf"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/mc2-project/mc2","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mc2-project%2Fmc2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mc2-project%2Fmc2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mc2-project%2Fmc2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mc2-project%2Fmc2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mc2-project","download_url":"https://codeload.github.com/mc2-project/mc2/tar.gz/refs/heads/dev","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mc2-project%2Fmc2/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28441275,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-15T00:55:22.719Z","status":"online","status_checked_at":"2026-01-15T02:00:08.019Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["analytics","cloud","machine-learning","privacy","secure-analytics","secure-learning","security"],"created_at":"2024-08-02T01:01:22.618Z","updated_at":"2026-01-15T02:22:34.820Z","avatar_url":"https://github.com/mc2-project.png","language":"C++","funding_links":[],"categories":["Data Analytics","C++"],"sub_categories":["Library OSes and SDKs"],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg width=\"575\" height=\"211\" src=\"client-docs/img/logo.png\"\u003e\n\u003c/p\u003e\n\n\n# A Platform for Secure Analytics and Machine Learning\n\n![build](https://github.com/mc2-project/mc2/actions/workflows/main.yml/badge.svg)\n![docs](https://github.com/mc2-project/mc2/actions/workflows/docs.yml/badge.svg)\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n[\u003cimg src=\"https://img.shields.io/badge/slack-contact%20us-blueviolet?logo=slack\"\u003e](https://join.slack.com/t/mc2-project/shared_invite/zt-rt3kxyy8-GS4KA0A351Ysv~GKwy8NEQ)\n[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.0-4baaaa.svg)](CODE_OF_CONDUCT.md)\n\n\n![MC2 Overview](client-docs/img/mc2_workflow.jpeg)\n\nBorn out of research in the [UC Berkeley RISE Lab](https://rise.cs.berkeley.edu/), [MC\u003csup\u003e2\u003c/sup\u003e](https://mc2-project.github.io/) is a platform for running secure analytics and machine learning on encrypted data.\nWith MC\u003csup\u003e2\u003c/sup\u003e, users can outsource their confidential data workloads to the cloud, while ensuring that the data is never exposed unencrypted to the cloud provider. \nMC\u003csup\u003e2\u003c/sup\u003e also enables secure collaboration -- multiple data owners can use the platform to jointly analyze their collective data, without revealing their individual data to each other.\n\nMC\u003csup\u003e2\u003c/sup\u003e provides the following secure computation services:\n* [Opaque SQL](https://github.com/mc2-project/opaque-sql): Encrypted data analytics on Spark SQL using hardware enclaves\n* [Secure XGBoost](https://github.com/mc2-project/secure-xgboost): Collaborative XGBoost training and inference on encrypted data using hardware enclaves\n\nThe MC\u003csup\u003e2\u003c/sup\u003e project also includes exploratory research prototypes that develop new cryptographic techniques for secure computation. Please visit the individual project pages for more information:\n* [Cerebro](https://github.com/mc2-project/cerebro): A general purpose Python DSL for learning with secure multiparty computation.\n* [Delphi](https://github.com/mc2-project/delphi): Secure inference for deep neural networks.\n* [Muse](https://github.com/mc2-project/muse): Secure inference resilient to malicious clients.\n* [Federated XGBoost](https://github.com/mc2-project/federated-xgboost): Collaborative XGBoost in the federated setting\n\nFor more information on MC\u003csup\u003e2\u003c/sup\u003e, visit our [website](https://mc2-project.github.io/).\n\nThis repository contains the source code for the **MC\u003csup\u003e2\u003c/sup\u003e client**, which enables users to easily interface with MC\u003csup\u003e2\u003c/sup\u003e services deployed remotely in the cloud. **Currently, the client supports remote deployments of Opaque SQL only.** Support for Secure XGBoost is coming soon.\nTo run an end-to-end MC\u003csup\u003e2\u003c/sup\u003e workflow:\n1. Launch Opaque SQL in the cloud (instructions to do so can be found in the respective repositories) \n2. Use the MC\u003csup\u003e2\u003c/sup\u003e client to encrypt data locally, transfer it to the cloud VMs, run scripts specifying the desired computation, and retrieve and view encrypted results.\n\n## Table of Contents\n* [Installation](#installation)\n* [Quickstart](#quickstart)\n* [Documentation](#documentation)\n* [Contact](#contact)\n\n\n## Installation\nTo quickly play with MC\u003csup\u003e2\u003c/sup\u003e Client and Opaque SQL, you can use the provided Dockerfile to build a container (takes ~7 min) with all MC\u003csup\u003e2\u003c/sup\u003e Client and Opaque SQL dependencies. Alternatively, you can pull a pre-built Docker image instead of building one. To do either, you must have [Docker](https://docs.docker.com/get-docker/) installed.\n\nThe container will have the contents of this `mc2` directory at `/mc2/client`, and Opaque SQL will be at `/mc2/opaque-sql`\n\nFor ease of use, we recommend that you create a directory within your host `mc2` directory that will serve as your playground, and then mount your `playground` directory to the Docker container. Mounting will ensure that changes you make in your `playground` directory outside the container will be reflected inside the container, and vice versa. If you're bringing your own data, you can either copy your data over to your playground directory, or separately mount your data directory to the container.\n\n### Installation via building an image\n```sh\n# Clone the `mc2-project/mc2 repo`\ngit clone https://github.com/mc2-project/mc2.git\n\n# Build a Docker image called `mc2_img`\ndocker build -t mc2_img .\n\n# Run the container, mounting your playground to the container, and open a shell into the container\ndocker run -it -v \u003c/absolute/path/to/mc2/playground\u003e:/mc2/client/playground mc2_img /bin/bash\n```\n\n### Installation via pulling an image\nIf you prefer to pull the image instead, you can pull a pre-built image (~3 GB) from [Docker Hub](https://hub.docker.com/r/mc2project/mc2_img).\n\n```\n# Clone the `mc2-project/mc2 repo`\ngit clone https://github.com/mc2-project/mc2.git\n\n# Pull the mc2_img from Docker Hub\ndocker pull mc2project/mc2_img:v0.1.3\n\n# Run the container, mounting your playground to the container, and open a shell into the container\ndocker run -it -v \u003c/absolute/path/to/mc2/playground\u003e:/mc2/client/playground mc2_img /bin/bash\n```\n\n### Installation via build from source\nAlternatively, if you'd like to install MC\u003csup\u003e2\u003c/sup\u003e Client directly on your host, follow [these instructions](https://mc2-project.github.io/client-docs/install.html).\n\n## Quickstart\nThis quickstart will give you a flavor of using MC\u003csup\u003e2\u003c/sup\u003e with Opaque SQL, and can be entirely done locally with Docker if desired. You will use MC\u003csup\u003e2\u003c/sup\u003e Client to encrypt some data, transfer the encrypted data to a remote machine, run an Opaque SQL job on the encrypted data on the remote machine, and retrieve and decrypt the job's encrypted results. To run everything securely, you can choose to spin up Opaque SQL on Azure VMs with SGX-support. Alternatively, to get a flavor of MC\u003csup\u003e2\u003c/sup\u003e without having to use Azure, you can use the deployment of Opaque SQL in the Docker container.\n\nMC\u003csup\u003e2\u003c/sup\u003e Client provides a command line interface that enables you to remotely interact with MC\u003csup\u003e2\u003c/sup\u003e compute services. The CLI relies on a configuration file that you should modify before each step in this quickstart to tell MC\u003csup\u003e2\u003c/sup\u003e Client what exactly you want to do. An example of the configuration file is [here](demo/config.yaml).\n\nThe dataset we'll be using in this quickstart is a medical dataset containing patient records. Here's a couple of sample records for reference.\n\n  ```sh\n  Age,BMI,Glucose,Insulin,HOMA,Leptin,Adiponectin,Resistin,MCP.1,Classification\n  48,23.5,70,2.707,0.467408667,8.8071,9.7024,7.99585,417.114,1\n  83,20.69049454,92,3.115,0.706897333,8.8438,5.429285,4.06405,468.786,1\n  82,23.12467037,91,4.498,1.009651067,17.9393,22.43204,9.27715,554.697,1\n  ```\n\nIf you get stuck at any point while running the quickstart, feel free to ping us on [Slack](https://join.slack.com/t/mc2-project/shared_invite/zt-rt3kxyy8-GS4KA0A351Ysv~GKwy8NEQ).\n\n### Docker Quickstart\nIf you'd like to try everything out locally, you can do so within the Docker container you built in the [installation](#installation) section.\n\n1. In the container, copy the contents of the `quickstart` directory to your mounted `playground` directory to ensure that your changes inside the container get reflected on your host. Then, configure MC\u003csup\u003e2\u003c/sup\u003e Client with your configuration file.\n\n    ```sh\n    # From the /mc2/client directory\n    cp -r quickstart/* playground\n    mc2 configure $(pwd)/playground/config.yaml\n    ```\n\n1. Generate a keypair and a symmetric key that MC\u003csup\u003e2\u003c/sup\u003e Client will use to encrypt your data. Specify your username and output paths in the `user` section of the configuration file. Then, generate the keys.\n\n    ```sh\n    mc2 init\n    ```\n\n1. Start [Opaque SQL](https://mc2-project.github.io/opaque-sql-docs/src/index.html), a MC\u003csup\u003e2\u003c/sup\u003e service for secure SQL analytics.\n    \n    ```sh\n    mc2 start\n    ```\n\n1. Prepare your data for computation by encrypting and uploading it. This step uses the keys you generated in step 2 to encrypt your data. Note that \"uploading\" here means copying because we have a local deployment.\n\n\n    ```sh\n    mc2 upload\n    ```\n\n1. Run the provided Opaque SQL quickstart script, to be executed by MC\u003csup\u003e2\u003c/sup\u003e. The script can be found [here](quickstart/opaque_sql_demo.scala), and performs a filter operation over our data -- the results will contain records of all patients who are younger than 30 years old. Results are encrypted by MC\u003csup\u003e2\u003c/sup\u003e before being saved, and can only be decrypted with the key you used to encrypt your data in the previous step.\n\n    ```sh\n    mc2 run\n    ```\n\n1. Once computation has finished, you can retrieve your encrypted results and decrypt them. Results are saved in the `results/` directory. You can view the results by looking at `results/opaque_sql_result.dec`\n\n    ```sh\n    mc2 download\n    ```\n\n### Azure Quickstart\nYou can also choose to run this quickstart with enclave-enabled VMs on the cloud with Azure Confidential Computing. Unlike the Docker quickstart, in this quickstart you'll first launch enclave-enabled VMs on Azure using MC\u003csup\u003e2\u003c/sup\u003e before uploading data and runing computation. \n\n1. Start off in the container you built in the [installation](#installation) section. In the container, copy the contents of the `quickstart` directory to your mounted \"playground\" directory to ensure that your changes inside the container get reflected on your host. Otherwise, no need to do anything. Then, configure MC\u003csup\u003e2\u003c/sup\u003e Client with your configuration file.\n\n    ```sh\n    # From the /mc2/client directory\n    cp -r quickstart/* playground\n    mc2 configure $(pwd)/playground/config.yaml\n    ```\n\n1. Generate a keypair and a symmetric key that MC\u003csup\u003e2\u003c/sup\u003e Client will use to encrypt your data. Specify your username and output paths in the `user` section of the configuration file. Then, generate the keys.\n\n    ```sh\n    mc2 init\n    ```\n\n1. Next, launch the machines and resources you'll be using for computation. This step does not exist in the Docker quickstart. MC\u003csup\u003e2\u003c/sup\u003e Client provides an interface to launch resources on Azure (and sets up the machines with necessary dependencies). Take a look at the `launch` section of the configuration file -- you'll need to specify the path to your [Azure configuration file](quickstart/azure.yaml), which is a YAML file that details the names and types of various resources you will launch. \n\n    Next, log in to Azure through the command line and set your subscription ID. [Here](https://docs.microsoft.com/en-us/azure/media-services/latest/setup-azure-subscription-how-to?tabs=portal) are instructions on how to find your subscription ID.\n\n    ```sh\n    az login\n    az account set -s \u003cYOUR_SUBSCRIPTION_ID\u003e\n    ```\n    Once you've done that, launch the resources.\n\n    ```sh\n    mc2 launch\n    ```\n\n1. Start [Opaque SQL](https://mc2-project.github.io/opaque-sql-docs/src/index.html), a MC\u003csup\u003e2\u003c/sup\u003e service for secure SQL analytics.\n    \n    ```sh\n    mc2 start\n    ```\n\n1. Prepare your data for computation by encrypting and uploading it. This step uses the keys you generated in step 2 to encrypt your data. Note that \"uploading\" here means copying because we have a local deployment.\n\n    ```sh\n    mc2 upload\n    ```\n\n1. Run the provided Opaque SQL quickstart script, to be executed by MC\u003csup\u003e2\u003c/sup\u003e. The script can be found [here](quickstart/opaque_sql_demo.scala), and performs a filter operation over our data -- the results will contain records of all patients who are younger than 30 years old. Results are encrypted by MC\u003csup\u003e2\u003c/sup\u003e before being saved, and can only be decrypted with the key you used to encrypt your data in the previous step.\n\n    ```sh\n    mc2 run\n    ```\n\n1. Once computation has finished, you can retrieve your encrypted results and decrypt them. Results are saved in the `results/` directory. You can view the results by looking at `results/opaque_sql_result.dec`\n\n    ```sh\n    mc2 download\n    ```\n\n1. Once you've finished using your Azure resources, you can use MC\u003csup\u003e2\u003c/sup\u003e Client to terminate them. You can specify which resources to terminate in the `teardown` section of the configuration.\n    \n    ```sh\n    mc2 teardown\n    ```\n\n## Documentation\nFor more thorough documentation MC\u003csup\u003e2\u003c/sup\u003e Client and Opaque SQL, please visit:\n\n* [MC\u003csup\u003e2\u003c/sup\u003e Client](https://mc2-project.github.io/client-docs/index.html)\n* [Opaque SQL](https://mc2-project.github.io/opaque-sql-docs/src/index.html)\n\n## Contact\nJoin our [Slack](https://join.slack.com/t/mc2-project/shared_invite/zt-rt3kxyy8-GS4KA0A351Ysv~GKwy8NEQ), open a [GitHub issue](https://github.com/mc2-project/mc2/issues), or send a message to mc2-dev@googlegroups.com.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmc2-project%2Fmc2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmc2-project%2Fmc2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmc2-project%2Fmc2/lists"}