Hi,
I want to use the iOs Secure Enclave to create a "Primary Device" Mechanism. It would work like this.
- Device Creates Enclave Key Pair and Sends the Public Key to the Server (Preferably Node JS)
- The Server encrypts a random message with the Public Key and sends it to the Device. I can be sure the Device is the only one able to decipher that string, because the private key is safe in the Secure Enclave
- Now the client would decrypt the message and send the result to the server which can compare it to the original message.
When de- and encrypting Data in the ios ecosystem the process is straightforward. I Encrypt Data using SecKeyCreateEncryptedData and Decrypt using SecKeyCreateDecryptedData passing Public Key and CipherText Objects.
Now my question is: how can I export the public Key to have my Node JS Backend encrypt Messages which will be decryptable again with the SecureEnclave.