If the OS is evil and you don't do attestation, it can emulate SGX and run your code in a simulated enclave environment where EGETKEY returns keys that the OS knows about.
If the OS is not evil, you can use process isolation to generate and protect the keys.
If the OS is evil and you don't do attestation, it can emulate SGX and run your code in a simulated enclave environment where EGETKEY returns keys that the OS knows about.
If the OS is not evil, you can use process isolation to generate and protect the keys.