How persistence works in Conclave applications
Conclave 1.2 is here! It brings with it a load of important features, an important one being the Enclave Persistent Filesystem and the Persistent Map.
Conclave is a confidential computing platform used to develop solutions that pool and process confidential data from multiple parties. This computation can be used to provide a high level of insight and analysis. Conclave builds on a trusted execution environment called an enclave. An enclave is a trusted region in memory to which the CPU blocks access. No other entity – such as the operating system or the computer provider – has access to the data within this trusted region. The enclave process runs separately within the host but access is restricted to the host or the client.
Enclaves have limited access to the outside world in order to keep them isolated from the rest of the server hardware. Inside an enclave, you don’t get access to components like filesystems, networks, and others normally found within an operating system. However, there could be cases where your application will require some way to retain state data – to allow storing of important data that is not lost during enclave restarts. In other words, you need a way to persist information from your enclave. A simple way to achieve this is to provide persistence using a filesystem.
Conclave 1.1 implemented an in-memory Java filesystem so developers could download Java libraries that would work inside the enclave. Version 1.1 stored the entire filesystem within the enclave memory. Such a filesystem provides a good assurance of data privacy as all files are stored in encrypted enclave memory. Developers can use standard Java file input/output to work with these files. However, as it is an in-memory filesystem, the contents will be lost if the enclave is restarted or stopped.
Conclave 1.2 combats this limitation with the support of a persistent filesystem. This filesystem is encrypted by the enclave and is stored by the host in non-volatile storage, such as the disk of the host. From a developer standpoint, this is no different from using in-memory file storage, with the only difference being that the data gets persisted through the encrypted storage on the host. You can use the persisted filesystem to read and write files that need to be available after a restart of your enclaves. This is represented as a single encrypted file on the host; your enclave will load/save/read/write all files and directories into that file. The encryption is done using a key only known to the enclave, thus ensuring strong data confidentiality. When the enclave restarts and the filesystem file is present, Conclave will try to load and prepare the filesystem file so that it can be used by the enclave.
Enabling a persistent filesystem in your Conclave application
To enable a persistent filesystem in your Conclave application:
- Enable the persistentFileSystemSize in the enclave runtime environment in build.gradle. This is the setting to specify the maximum size of the persisted filesystem. The default size for it is 0m – indicating that the persisted filesystem is disabled. The size can be specified in bytes, but can also be specified in kilobytes, megabytes, or gigabytes by inputting k, m, or g respectively after the value. It is important to note that this value cannot change once the enclave has started for the first time. So it is important to choose an appropriate value that is big enough for your long-term needs.