tlsnotary / tlsn

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

Modify notarization format where full TLS keys are not revealed to the verifier. #11

Closed themighty1 closed 2 years ago

themighty1 commented 2 years ago

Currently in TLSNotary, the Client reveals fully all TLS keys to the verifier of the notarization. This approach is not compatible with the Client's privacy since the verifier gets full access to both the plaintext request and the server response.

The notarization format must be carefully modified in a way that preserves the session integrity while at the same time withholding full TLS keys from the verifier.

Here are all the steps which the verifier takes: https://github.com/tlsnotary/PageSigner/blob/bca431a91e9cad1b145bcaac975efe1aa3683bce/core/Main.js#L741

themighty1 commented 2 years ago

Here is one way of doing it. It is not THE only way, there are various ways to achieve it. To simplify, I assumed that there is no private data in the server response.

PHASE 1. The protocol. The protocol has to be modified as follows:

Step 1. For all PUBLIC data in the client's request (CR) to the webserver, the following 2PC circuit is run (for each 16-byte block of data):

inputs:

output which goes both to C and N:

Recall, that ECB is xored to the plaintext block in order to get the ciphertext block.

Step 2. For all PRIVATE data in CR, another 2PC circuit is run (for each 16-byte block of data):

inputs:

output which goes both to C and N:

Step 3. The TLS PRF circuit must be modified to output the hash of the full server_write_key/iv (swk/siv).

What remains unchanged from the current TLSNotary protocol: C sends the whole ciphertext to N in order to compute the MAC in 2PC.

PHASE 2. Signing.

Notary signs the following:

  1. Webserver's ephemeral EC pubkey (that's the key used to obtain PMS via ECDHE)
  2. All ECBs from Step1
  3. All ciphertext from Step 2
  4. Ciphertext used to compute MAC in 2PC.
  5. hash of swk/siv from Step 3.
  6. N's share of swk/siv

Client forms the notarization documents, containing the following:

  1. Notary's sig over 1,2,3,4,5,6
  2. TLS cert chain
  3. RSA signature over ephemeral EC key from the Server Key Exchange TLS message
  4. Public data from the request
  5. C's share of swk/siv
  6. server response with MAC

PHASE 3. Verification.

Verifier (V) verifies that:

Then V xors public data (10) with all ECBs (2) to get public ciphertext. V checks that (public ciphertext | private ciphertext(3)) matches ciphertext (4). V checks that (N's swk/siv(6) + C's swk/siv(11)) hash into (5). V proceeds to authenticate and decrypt the server response (12).

themighty1 commented 2 years ago

Closing, since full TLS keys will never be revealed to the Verifier anyway. Instead zk proofs about the properties of the plaintext will be used.