In previous tutorials, we saw how to build trusted applications that run securely inside enclaves and combine them with confidential datasets to get the most out of confidential computing advantages. In this chapter, we will push things further to protect the workflow in an end to end mode. That means the next step would be encrypting results.
Assuming your application is deployed (if not please check how to do it here), before triggering an execution you need to generate a public/private AES key-pair and push the public part to the Secret Management Service. The latter, in turn, will provide it, at runtime, to the enclave running your trusted application.
To generate the key-pair, go to
~/iexec-projectsand use the following SDK command:
iexec result generate-encryption-keypair
This generates two files in
.secrets/beneficiary/. Make sure to back up the private key in the file
│ ├── <0x-you-wallet-address>_key
│ └── <0x-you-wallet-address>_key.pub
Now, push the public key to the SMS:
iexec result push-encryption-key --chain bellecour
And check it using:
iexec result check-encryption-key --chain bellecour
Now to see that in action, you'd need to trigger a task and specify yourself as the beneficiary in the command:
iexec app run <0x-your-app-address> \
--chain bellecour \
--tag tee \
Wait for the task to be
COMPLETEDand download the result:
iexec task show <0x-your-task-id> --download --chain bellecour
If you extract the obtained zip and try to read the content of the file
iexec_out/result.zip.aesyou will find it encrypted:
mkdir /tmp/trash && \
unzip <0x-your-task-id>.zip -d /tmp/trash && \
Now you should decrypt the result by running:
iexec result decrypt <0x-your-task-id.zip>
A new zip file appears in the current folder under the name
results.zip. Eventually, unzip it:
unzip results.zip -d my-decrypted-result
And you can see the content of your result file:
$ cat my-decrypted-result/result.txt
Voilà! By finishing this part, you should be able to use confidential computing on iExec like a Ninja. All parts of the workflow are protected: the execution, the dataset, and the result.
You can go to the advanced section and learn more about managing orders on the iExec to effectively monetize your applications and datasets.