I wanted to design and build a secure remote computation application. I wanted to leverage Intel SGX capabilities and I have thought of 2 approaches but due to lack of development experience, I could not be able to decide which approach I should implement.
Scenario: Typical client(assumed secure + Non SGX) machine and Server(could be malicious + SGX enabled) system
Approach 1: Each client(having some data) generates a symmetric key(AES) at client side and encrypt the data locally and sends to the server. The clients secret key is provisioned to the server via remote attestation and then use this secret key to decrypt the data inside the SGX enclave.
Approach 2: The server generates public-private key pair inside enclave and the public key is sent to each client. Each client then encrypts using public key and then send data to the server which is later decrypted using the previously generated private key.
Please Note: SGX enclave can be disassembled but could not be debugged. So is it safe to do approach 2?