Misuse of the keychain?

Hi,


Typically I've used the keychain to store small things, like a password, for example.


In a new app, a requirement is for the app data to be stored securely by the app and be able to survive an app delete/reinstall.


I thought about user defaults but it is not secure even though the device itself has system-wide encryption, right?


More importantly, user defaults gets wiped when the app is deleted, as does the Documents folder.


So, now I'm thinking of the keychain...


Basically, the user wants to do some analysis that must be protected and saved via the app. Length is probably anywhere from 500-1500 chars.


My question is: Is saving that much text a misuse of the keychain?


Thank you!

Accepted Reply

Length is probably anywhere from 500-1500 chars.

Is saving that much text a misuse of the keychain?

Storing a few KiB in the keychain is fine. However, there is another serious problem to worry about here. You wrote:

In a new app, a requirement is for the app data to be stored securely by the app and be able to survive an app delete/reinstall.

The keychain does not guarantee that data will survive when the app is deleted. Please read this post for the details.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"


WWDC runs Mon, 4 Jun through to Fri, 8 Jun. During that time all of DTS will be at the conference, helping folks out face-to-face.

Replies

Previous discussion here:


https://forums.developer.apple.com/thread/73314

Length is probably anywhere from 500-1500 chars.

Is saving that much text a misuse of the keychain?

Storing a few KiB in the keychain is fine. However, there is another serious problem to worry about here. You wrote:

In a new app, a requirement is for the app data to be stored securely by the app and be able to survive an app delete/reinstall.

The keychain does not guarantee that data will survive when the app is deleted. Please read this post for the details.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"


WWDC runs Mon, 4 Jun through to Fri, 8 Jun. During that time all of DTS will be at the conference, helping folks out face-to-face.