SuperAPI AI Directory

RA-TLS

RA-TLS is a remote attestation and secure communication mechanism provided by Gramine that integrates Intel SGX remote attestation into TLS connections. It embeds an SGX quote by extending the X.509 certificate, enabling remote users to verify that the application is running in a trusted execution environment (TEE) and to establish a secure channel for transmitting data. RA-TLS is provided as libraries, including ra_tls_attest.so for generating certificates and ra_tls_verify_dcap.so for verification, and is suitable for scenarios requiring confidential computing and remote attestation.

Open website

About this tool

RA-TLS is a component in the Gramine framework used to implement remote attestation and secure communication. Gramine is typically used to create and run trusted execution environments (TEEs), and attestation is an important aspect of TEEs, allowing remote users to verify that an application is running on genuine hardware, in an up-to-date TEE, and with an initial state that matches expectations. Attestation is divided into local attestation and remote attestation, and Gramine currently implements only the SGX attestation flow. Remote attestation itself only provides trust guarantees; users also need to establish a secure channel for trusted communication and may need secret provisioning to transparently provide sensitive data such as keys. Gramine exposes local and remote attestation through the /dev/attestation pseudo-filesystem, secure channels are built using the RA-TLS library, and secret provisioning is based on the RA-TLS library.

The RA-TLS interface hides the complexity of the underlying /dev/attestation flow, provides a simple abstraction of a TLS connection between the TEE and the remote user, and enhances the remote attestation flow. Using RA-TLS, applications can securely send and receive arbitrary data with remote users. RA-TLS is currently bound to Intel SGX but can be adapted to other TEEs. RA-TLS integrates Intel SGX remote attestation into TLS connection establishment, conceptually extending the standard X.509 certificate with SGX-related information (the SGX quote), enabling the remote user (verifier) to verify that it is indeed communicating with an SGX enclave (prover).

RA-TLS certificates are self-signed because the actual chain of trust is stored in the Intel SGX certificates embedded in the SGX quote. The certificate embeds the SGX quote in a standard X.509 extension field (the TCG DICE "tagged evidence" OID), which contains the SGX report and the complete Intel SGX certificate chain. The certificate also contains evidence claims, the most important of which is the "pubkey-hash" claim, containing the hash of an ephemeral public key (in DER format) generated by the enclave application. The REPORTDATA field of the SGX report contains the secure hash of the complete claims buffer, thereby binding the RA-TLS certificate to the enclave application that generated it. RA-TLS certificates generated by Gramine contain both the new standard OID and the old non-standard OID for backward compatibility; in the future, only the new standard OID will be retained.

RA-TLS is provided as two libraries: ra_tls_attest.so and the DCAP/ECDSA-based ra_tls_verify_dcap.so. The interface is defined in the tools/sgx/ra-tls/ra_tls.h header file, and usage examples can be found in CI-Examples/ra-tls-mbedtls. ra_tls_attest.so creates a self-signed RA-TLS certificate, must be loaded into the SGX enclave, and relies on the /dev/attestation pseudo-filesystem to obtain the SGX quote and embed it in the certificate. This library is not thread-safe, requires sgx.remote_attestation = "dcap" to be set in the manifest, and allows the certificate timestamps to be set using the environment variables RA_TLS_CERT_TIMESTAMP_NOT_BEFORE and RA_TLS_CERT_TIMESTAMP_NOT_AFTER. ra_tls_verify_dcap.so contains a verification callback that should be registered when the TLS library verifies the certificate; it forwards the RA-TLS certificate and SGX quote to the DCAP verification library (libsgx_dcap_quoteverify.so) and checks the result. This library is not thread-safe and requires all DCAP infrastructure to be installed and running correctly on the host.

When using RA-TLS, applications can construct arbitrary attestation flows through the low-level /dev/attestation interface. A typical approach is to write the secure hash of the unique public key generated by the TEE instance to /dev/attestation/user_report_data, so that after receiving the SGX quote, the remote user can bind the TEE instance to the public key. The remote user should verify the quote using quote_dump or the Intel DCAP libraries and tools. RA-TLS is suitable for confidential computing scenarios that require remote attestation and secure communication, such as deploying microservices in the cloud. Limitations include that currently only Intel SGX is supported, the libraries are not thread-safe, they depend on the DCAP infrastructure, and the old non-standard OIDs will be deprecated in the future.