EternisAI / tlsn

Rust implementation of the TLSNotary protocol
https://tlsnotary.org
0 stars 0 forks source link

WIP: Working TLS over TEE #1

Open saberistic opened 1 month ago

saberistic commented 1 month ago

Overview

We need to update TLS Notary to run in a Trusted Execution Environment (TEE) mode. This involves introducing a new tls-tee package, updating the configuration and initialization process for both prover and verifier, and modifying the core functionality to support the new mode.

Detailed Requirements

Technical Considerations

Acceptance Criteria

Related Diagram

sequenceDiagram
    participant L as Leader
    participant F as Follower (TEE)
    participant S as Server

    L->>F: RequestTeeSession
    F->>L: InitiateTeeSession (TeeQuote)
    L->>F: VerifyAttestationProof
    F->>L: ProvideAttestationProof
    Note over L,F: Leader verifies attestation

    L->>F: InitiateTlsHandshake
    F->>F: Generate key material
    F->>L: PerformTlsHandshake (Client Hello)
    L->>S: Client Hello
    S->>L: Server Hello, Certificate, Server Key Exchange, Server Hello Done
    L->>F: PerformTlsHandshake (Server messages)
    F->>F: Process server messages, prepare client response
    F->>L: PerformTlsHandshake (Client Key Exchange, Change Cipher Spec, Finished)
    L->>S: Client Key Exchange, Change Cipher Spec, Finished
    S->>L: Change Cipher Spec, Finished
    L->>F: PerformTlsHandshake (Server Finished)
    F->>F: Verify server finished
    F->>L: PerformTlsHandshake (Handshake Complete)

    loop Application Data Exchange
        L->>F: RequestEncryption (plaintext)
        F->>F: Encrypt data
        F->>L: EncryptApplicationData (ciphertext)
        L->>S: Send Encrypted Data
        S->>L: Send Encrypted Response
        L->>F: RequestDecryption (ciphertext)
        F->>F: Decrypt data
        F->>L: DecryptApplicationData (plaintext)
    end

    L->>F: RequestSignature (data)
    F->>F: Sign data
    F->>L: SignData (signature)

    L->>F: CloseConnection
    F->>L: CloseConnection
    L->>S: Close TLS Connection
    L->>F: Finalize
    F->>L: Commit
saberistic commented 1 month ago

I made mostly cosmetic comments, a cleanup could be done (see warnings produced when compiling) need to discuss about the notarization part at the end great job !

Thanks for feedback, fixed most of lints, I guess next is to do notarization