invertedfjord
invertedfjord

Reputation: 362

Is encoding a custom object using nscoder and saving to nsuserdefaults encrypted?

I know saving directly to nsuserdefaults is not encrypted from other answered questions. However, I wasn't sure if using nscoder and decoder made it encrypted. In my case, I have custom class object which I encode and then save using NSuserdefaults.

Upvotes: 0

Views: 244

Answers (1)

Duncan C
Duncan C

Reputation: 131491

No, it's not encrypted. The keychain is encrypted, but NSCoder does not do any encryption, nor is NSUserDefaults encrypted.

You could apply encryption to the Data that comes out of NSCoder before writing it to UserDefaults, and then decrypt it after reading.

Note that you're not supposed to save large blocks of data to UserDefaults. It's supposed to be used for simple user settings.

Upvotes: 1

Related Questions