Skip to content

feat: Implement secure key exchange#99

Merged
paolodamico merged 4 commits intomainfrom
takis/key-exchange-part-1
Nov 4, 2025
Merged

feat: Implement secure key exchange#99
paolodamico merged 4 commits intomainfrom
takis/key-exchange-part-1

Conversation

@Takaros999
Copy link
Copy Markdown
Contributor

This PR sets up enclave state for key exchange:

  • Adds an ephemeral key pair for
  • Adds an attestation document with ephemeral PK
  • Adds an attestation verifier instance to the state, this will be used later to verify incoming attestation documents come from enclaves running the same bytecode.

Depends on:

aurel-fr
aurel-fr previously approved these changes Nov 1, 2025
Comment thread enclave-worker/src/types/error.rs
* feat: Implement key exchange (part 2)

* PR comments

* Lint
@Takaros999 Takaros999 changed the title feat: Setup enclave state for key exchange (part 1) feat: Implement secure key exchange Nov 3, 2025
andy-t-wang
andy-t-wang previously approved these changes Nov 3, 2025
Comment thread Cargo.toml Outdated
# Pontifex
pontifex = { version = "1.1.1" }
# TODO: update this when we publish 1.2.0
pontifex = { git ="https://github.com/worldcoin/pontifex", rev = "0ef1dd634fc751c065d326acf6a81f2ea41f5460" }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1.1.2 release coming up, worldcoin/pontifex#27 (review)

///
/// # Returns
/// A verified attestation containing the enclave's public key and the encrypted plaintext in base64 format.
/// A verified attestation containing the enclave's public key and the ciphertext.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"the ciphertext" is a bit confusing. can we clarify what this ciphertext is?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

left this in purpose generic, because it's a separate module, i think it's obvious where it's called that we seal the key

Comment thread secure-enclave/src/state.rs Outdated
pub braze_api_url: Option<String>,
/// HTTP client configured to use the HTTP proxy for Braze
pub http_proxy_client: Option<HttpClient>,
/// Initialization flag
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// Initialization flag
/// Whether the enclave has been initialized by creating a private key or receiving a key from another enclave

Comment thread secure-enclave/src/state.rs Outdated
/// Encryption key pair used for encrypting/decrypting push IDs
pub encryption_keys: Option<KeyPair>,
/// Ephemeral key pair used for exchanging keys
pub ephemeral_key_pair: KeyPair,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this be an Option and the key destroyed after use?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good idea, updated

Comment thread secure-enclave/src/encryption.rs
Comment thread secure-enclave/src/pontifex_server/initialize.rs
paolodamico
paolodamico previously approved these changes Nov 3, 2025
@Takaros999 Takaros999 dismissed stale reviews from paolodamico and andy-t-wang via d00bd16 November 4, 2025 09:31
@paolodamico paolodamico merged commit dfe1683 into main Nov 4, 2025
16 checks passed
@paolodamico paolodamico deleted the takis/key-exchange-part-1 branch November 4, 2025 20:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants