granoff / Lockbox

Objective-C utility class for storing data securely in the key chain.
MIT License
847 stars 87 forks source link

Support saving and loading objects conforming to NSSecureCoding #21

Closed jordanekay closed 8 years ago

granoff commented 10 years ago

Based on my reading of the NSSecureCoding docs, I am not sure you have correctly conformed Lockbox to this protocol.

What is it you are aiming to achieve with this pull request? (I may be totally missing something, so I am asking with all due respect to you and your contribution, of course!)

jordanekay commented 10 years ago

Basically I want to be able to save/restore objects to/from the keychain, but only those which conform to NSSecureCoding.

jordanekay commented 10 years ago

Any update on whether this is a good idea, or how I should improve it?

granoff commented 10 years ago

What I am not thrilled about is adding the NSData+Base64 category to Lockbox.

What would be more interesting is to add the method signatures you suggest and then implement them in a way that simply takes the data they represent without further encoding them and storing/retrieving that in/from the keychain.

As it stands now, Lockbox boils everything down to an NSString and stores that. But you should be able to store NSData as is in the keychain. So you'd have to re-factor what I've done a bit to achieve that.

calebd commented 10 years ago

The keychain accepts binary data. You don't need to boil everything down to strings. That would make almost all of the inner workings of this class better. For example, storing a dictionary simply requires running it through an NSArchiver instead of doing the funky string conversion that is done now.

rivera-ernesto commented 10 years ago

That would be good. The manual string-separator can't be very robust.

granoff commented 8 years ago

I have just pushed an update to Lockbox that deprecates all the setXxx and related getters, and added methods for archiving and unarchiving objects of any kind that conform to NSSecureCoding.