Privasys
Enclave OSAttestation

Mutual RA-TLS

Bidirectional remote attestation over TLS, where both client and server prove they run inside a TEE.

Standard RA-TLS is one-directional: the server proves it runs inside a TEE while the client is a regular TLS peer (browser, CLI tool, API gateway). Mutual RA-TLS extends this so that both sides present an RA-TLS certificate in the handshake, and both sides prove through the evidence exchange that their certificate's key lives inside a TEE.

When to Use Mutual RA-TLS

ScenarioWho needs attesting?Mode
Browser querying an enclave APIServer onlyStandard RA-TLS
CLI tool reading attested dataServer onlyStandard RA-TLS
TEE retrieving a secret from Enclave VaultsBothMutual RA-TLS
TEE calling an attested dependencyBothMutual RA-TLS
Enclave forwarding data to another enclaveBothMutual RA-TLS

The primary use cases are Enclave Vaults and app-to-app calls: when a TEE calls ExportKey (or any operation on a key), the vault needs to verify that the requesting workload matches the key's policy (correct MRENCLAVE, correct configuration OIDs), and a dependent app needs to know the peer is exactly the enclave it is pinned to. The only way to prove this over a network is for the client to present its own attested identity.

How It Works

Mutual RA-TLS reuses the same certificate format, OID scheme and evidence exchange as standard RA-TLS. The differences are that the client also presents an RA-TLS certificate in the handshake, and that the server's attest response asks the client for evidence of its own.

Flow

  1. Standard TLS 1.3 handshake with client authentication. The client presents a client certificate of the same shape as a server leaf: leaf key, chain to the same Privasys intermediate, the OID extensions, no evidence. The server verifies the chain and extensions against its policy at the handshake; the client verifies the server's certificate the same way.
  2. Server evidence. The client sends the evidence request in challenge mode. The server answers with its quote, client_evidence: "required" and a fresh 32-byte client_context.
  3. Client verifies the server exactly as in one-way RA-TLS: quote through the attestation server, measurements against policy, report_data recomputed from the server's certificate and the connection.
  4. Client evidence. The client answers with a second request on the same connection:
{ "v": 2, "mode": "present", "context": "<client_context>", "tee": "...",
  "quote": "...", "gpu_evidence": null, "quote_time": "..." }

with

hctx_c      = TLS-Exporter("EXPORTER-privasys-ratls-attest-v2-client", client_context, 32)
report_data = SHA-512( SHA-256(SPKI_DER_client) || client_context || hctx_c )
  1. Server verifies the client exactly as a client verifies a server response, with the client's SPKI and its own hctx_c. It answers 204 (HTTP) or an empty {"v":2} frame (raw binding) and only then serves application traffic; 403 on failure. A server that requires client evidence and receives application data before a verified present closes the connection.

The mutual leg is always challenge mode; deterministic client evidence is not defined. On the raw binding the client's present frame follows the server's response frame, and the server's acknowledgement frame precedes the protocol.

Binding in Both Directions

DirectionContextExporter labelBound into
Client verifies serverclient's contextEXPORTER-privasys-ratls-attest-v2server quote's report_data
Server verifies clientserver's client_contextEXPORTER-privasys-ratls-attest-v2-clientclient quote's report_data

Both exporter values derive from this connection's exporter_master_secret, so neither quote can be relayed from another session. Each side proved possession of its certificate key in the handshake (CertificateVerify), so no further signature travels in the exchange.

Server-Side Support

Enclave OS Mini

The enclave's rustls TLS server is configured with a permissive client certificate verifier:

  • offer_client_auth() returns true, so the server always sends a CertificateRequest.
  • client_auth_mandatory() returns false, so browsers and standard clients can connect without presenting a certificate.
  • When a client does present a certificate, its chain and extensions are verified at the handshake and the certificate is kept for the connection. The attest handler then requires the client's present step before the application layer (for example the vault module) sees any request.

This design means the same TLS endpoint serves both regular clients and mutual RA-TLS clients. No separate port or configuration is needed.

The RequestContext passed to each module's handle() method includes the DER-encoded client certificate (peer_cert_der, if presented) and the verified client attestation result, so a module can apply an access policy to the caller's measurements and OIDs.

Enclave OS Virtual

In Virtual, mutual RA-TLS is switched on for an app when its owner sets allowed callers (privasys apps allowed-callers), the list of attested apps it recognises.

  1. Caddy asks for a client certificate on connections that offer the privasys-ratls/1 ALPN, and verifies its chain and extensions at the handshake.
  2. The client's present evidence goes to the in-enclave manager, which verifies the quote through the attestation server and matches the caller against the allowed callers: the app id in its certificate, then its measurements and OIDs. The verdict is recorded for that connection and stays current for a few minutes, after which the client attests again.
  3. On every request the manager removes any X-Privasys-Peer-* header the client sent. For a caller with a current verdict it sets X-Privasys-Peer-Verified: true, X-Privasys-Peer-App-Id, X-Privasys-Peer-Image-Digest and X-Privasys-Peer-Measurement. A caller that presented a certificate without a current verdict, or whose app is not an allowed caller, is refused with 403.

A request with no client certificate is not refused: the same hostname serves browsers, whose connections the gateway terminates and opens again inward without one. It reaches the container as an anonymous request with no peer headers. A container that requires attested callers therefore checks X-Privasys-Peer-Verified and the peer's app id, and never trusts the caller's word. See Connecting to an app for the headers and for how a container calls another app.

The connection tag X-Privasys-Attestation (none, deterministic or challenge) records how the connection itself was attested; the peer headers are what identify a calling app.

Your own attestation server

By default the manager verifies callers' quotes with the Privasys attestation server. An owner who wants that decision to rest on their own verifier names it in the allowed callers:

privasys apps allowed-callers my-app --data @callers.json --attestation-server https://as.example.com/verify

The callers' quotes for that app are then sent to your server, and every other app on the host keeps its own choice. Your server answers the same API as the Privasys attestation server (a POST with the quote, answered with the verdict and the platform identity), so you can run that server yourself. The manager calls it the way a careful client calls any outside service:

  • an https URL on a public host name, reached on a public address, with no redirect followed;
  • no credential is sent, so your server sees only the quote;
  • a verdict is expected within ten seconds, and an answer up to 1 MiB.

If the server is unreachable, busy or answers anything other than a valid verdict, the caller is refused, so the outcome always comes from the verifier you chose. The runtime keeps the server's verdicts for your app alone and starts afresh when you name another server.

Your callers' quotes, including the identity of the machine they run on, go to the server you name. Callers that already trust you with their requests usually accept that; name a server they can trust too.

A host whose runtime predates this option is not sent your server: the deploy or the signed policy is refused until the host is rolled, so your callers are never verified by a server you did not choose. To change your callers on such a host in the meantime, for example to remove one, sign the policy without attestation_server. The option applies to container apps. To keep the whole decision in your hands, including which server is named, sign the policy with your wallet (privasys apps policy approve --allowed-callers @callers.json): the runtime then applies the version you signed.

Client-Side Support

The client certificate is a standing 24-hour leaf minted by the client's own runtime, with the key kept across re-mints; nothing is generated during the handshake. A container on Enclave OS Virtual cannot mint its own identity or produce a quote: its runtime issues the certificate and key, stamped with the app's id and code hash, and produces each connection's evidence; the container fetches both through the runtime's in-enclave API (the Go client's NewEgressIdentity). When the server's response says client_evidence: "required", the SDK (Rust connect_mutual, the Go Client with a client certificate) obtains a fresh quote from its runtime bound to client_context and the connection's exporter, and sends the present message before any application data.

Because the binding uses the RFC 8446 exporter, upstream Go crypto/tls and rustls are sufficient on both ends. Earlier versions needed forks of both libraries to carry a challenge nonce inside the CertificateRequest message; version 2 needs none, and those forks are archived.

Enclave Vaults Integration

Enclave Vaults uses mutual RA-TLS when a TEE calls ExportKey, under the key's policy. The flow is:

  1. The requesting TEE connects to the vault, presenting its own RA-TLS certificate in the handshake.
  2. The client verifies the vault's identity (standard RA-TLS); the vault's attest response requires client evidence.
  3. The client presents its quote, bound to the vault's client_context and the connection.
  4. The vault reads the OID extensions from the client certificate and the measurements from the client's quote.
  5. The vault checks the client's measurements (MRENCLAVE / MRTD) and configuration OIDs against the key's policy.
  6. If the policy matches, the vault returns its share of the key. Otherwise the request is rejected.

This ensures that secrets are only released to workloads that match the policy defined by the secret owner, verified end-to-end through hardware attestation, with no trusted intermediary.

Security Properties

PropertyGuarantee
Bidirectional attestationBoth sides prove they run inside a TEE with specific code and configuration
Key bindingEach party's TLS key is bound to its own TEE quote via report_data
Session binding in both directionsEach quote commits to this connection's TLS exporter under a direction-specific label, preventing relay
No trusted intermediaryVerification happens directly between the two TEEs over the TLS channel
Standard TLSThe handshake is unmodified; no forked TLS library is needed on either side
Graceful degradationThe server accepts both mutual RA-TLS clients and standard TLS clients on the same port
Policy enforcementThe server can enforce fine-grained access policies based on the client's attestation evidence
Edit on GitHub