{"id":24306776,"url":"https://github.com/pluto/caratls","last_synced_at":"2025-03-06T18:26:28.505Z","repository":{"id":272550952,"uuid":"899822365","full_name":"pluto/caratls","owner":"pluto","description":null,"archived":false,"fork":false,"pushed_at":"2025-02-07T22:26:36.000Z","size":43,"stargazers_count":8,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-07T22:30:32.733Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","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/pluto.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-07T05:26:28.000Z","updated_at":"2025-02-07T21:42:19.000Z","dependencies_parsed_at":"2025-01-23T07:20:07.917Z","dependency_job_id":null,"html_url":"https://github.com/pluto/caratls","commit_stats":null,"previous_names":["pluto/caratls"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pluto%2Fcaratls","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pluto%2Fcaratls/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pluto%2Fcaratls/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pluto%2Fcaratls/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pluto","download_url":"https://codeload.github.com/pluto/caratls/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242261829,"owners_count":20098838,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2025-01-17T03:48:36.003Z","updated_at":"2025-03-06T18:26:28.496Z","avatar_url":"https://github.com/pluto.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# caratls\n\n## WORK IN PROGRESS\n\n**tldr**: caratls (Certificate Authority trusted Remote Attestation TLS) lets a browser connect directly to a TEE using a Root CA-signed certificate (e.g., from Let's Encrypt), then encapsulates a second TLS session inside the outer session. This inner TLS session is bootstrapped with TEE-generated self-signed certificates and supports channel binding, ensuring strong trust with the TEE even if the outer certificate is compromised.\n\n```\nOuter TLS session trusted by Root CA (ie Let's Encrypt)\n..encapsulates TLS session with TEE bootstrapped self-signed certificate\n...verifies TEE attestation token inline\n...use TlsStream\u003cTlsStream\u003cTcpStream\u003e\u003e for regular client/server comms\n```\n\n\n## Motivation\n\n- **Direct Browser Compatibility**: Browsers only trust CA-signed certificates by default. Hence, we first establish a standard HTTPS/WSS connection using a Let's Encrypt certificate.\n- **TEE Bootstrapping**: Once the outer TLS session is set up, we initiate an inner TLS session with self-signed, TEE-generated keys. This inner session includes remote attestation to verify the TEE identity.\n- **Secure \"Inner\" TLS**: If the outer certificate is compromised or reused across multiple TEEs, the inner session still provides end-to-end security anchored in the TEE.\n- **Scalability**: Managing a single CA-signed cert per domain (e.g., `api.example.com`) avoids [Let's Encrypt rate-limit issues](https://letsencrypt.org/docs/rate-limits/) and complicated certificate distribution across many TEEs.\n\n\n## Concept\n\n1. **Outer TLS**  \n   - Negotiated using a Let's Encrypt cert (or any other Root CA-signed certificate).  \n   - Allows standard HTTPS/WSS connections from browsers.\n\n2. **Inner TLS**  \n   - Encapsulated inside the outer TLS stream (`TlsStream\u003cTlsStream\u003cTcpStream\u003e\u003e`).  \n   - Uses self-signed, TEE-bootstrapped certificates.  \n   - Performs channel binding (EKM or key attestation) to prove the session is securely terminated in the TEE.\n\n3. **TEE Attestation**  \n   - Verified inline during the inner TLS handshake.  \n   - Confirms the TEE’s authenticity and ties it to the self-signed cert.\n\n\n## Approaches\n\n- **EKM-Based**:  \n  The TEE attestation includes an Extracted Key Material (EKM) nonce derived from the inner TLS handshake, thereby binding the attestation to that specific session.\n\n- **Key Attestation**:  \n  The TEE directly attests the ephemeral key used in the inner TLS session, typically by signing the public key or embedding it in the TEE's quote/report.\n\nBoth approaches ensure a strong channel binding between the TEE and the client.\nCurrently this crate only implements an EKM-based approach for Google Confidential Space.\n\n\n## Usage\n\n```rust\n// Server/ TEE side\nlet token_generator = DummyTokenGenerator::new()\nlet tee_tls_acceptor = TeeTlsAcceptor::new(token_generator, ...);\nlet tee_tls_stream = tee_tls_acceptor.accept(tls_stream).await?;\n\n// Client side\nlet token_verifier = DummyTokenVerifier::new()\nlet tee_tls_connector = TeeTlsConnector::new(token_verifier, ...);\nlet tee_tls_stream = tee_tls_connector.connect(tls_stream).await?;\n```\n\nThe `tls_stream` in both cases is already an outer TLS connection (e.g., from Let's Encrypt) which then encapsulates the secure TEE-bootstrapped inner TLS connection.\n\n\n## Development\n\ncaratls is organized into multiple crates:\n\n* `server \u0026 client`: Split for better dependency control (e.g., WASM/iOS target support on the client side).\n* `ekm` and `key`: Different crates implement either EKM-based or Key-Attestation based channel binding.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpluto%2Fcaratls","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpluto%2Fcaratls","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpluto%2Fcaratls/lists"}