0

I have heard about Secure Enclave. In which after key generation, data can be encrypted by SecKeyCreateEncryptedData method.

My Use Case: I want to store some sensitive data persistently. For security purposes, I have encrypted data by above method using Secure Enclave.

Now just want to know is it a legal way to store encrypted data in NSUserDefaults or Keychain. or there is something else that should be done.

Any help would be much appreciated!

Sulthan
  • 128,090
  • 22
  • 218
  • 270
Tanvi Jain
  • 917
  • 2
  • 7
  • 19

1 Answers1

1

Since the data is encrypted you can store it anyway you want. Without the key inside the Secure Enclave the data is worthless.

There are several approaches you can go for: save it to UserDefaults, create a JSON inside documents directory etc.

Let's assume you want to save it to UserDefaults then have a look at this link: How can I use UserDefaults in Swift?

Valuable article about secure enclave and cryptokit: https://www.andyibanez.com/posts/cryptokit-secure-enclave/