I want all keys in my iOS application to rely on the Secure Enclave for security as the iOS keychain becomes insecure on jailbroken devices. Currently, the Secure Enclave currently only supports generation/storage of EC and RSA keys. I'm considering the following design for indirectly using the Secure Enclave to store symmetric encryption keys, but want to validate its security:
- On application initialization, generate an asymmetric EC key K in the Secure Enclave.
- Use it to sign the device UUID (or some other constant), yielding signature S.
- Derive encryption key E = KDF(S)
- Use encryption key E to encrypt items in the local database. (E itself is not stored anywhere.)
- On any subsequent application start, re-derive S and E and use E to decrypt the local database.
Edit: as @zaph pointed out, the Secure Enclave protects the entire Keychain. The distinction lies in that some keys can be generated in the Secure Enclave (curve p256 EC keys and RSA keys) and some can't. Those that can, enjoy a higher level of security as their private keys cannot be exported from the Secure Enclave. It is those keys that I'm interested in exploiting to indirectly protect other keys/data.