Re: Encrypting core data properties
Re: Encrypting core data properties
- Subject: Re: Encrypting core data properties
- From: mmalcolm crawford <email@hidden>
- Date: Sun, 19 Jun 2005 02:26:03 -0700
On Jun 19, 2005, at 2:11 AM, Lee Morgan wrote:
For example if you only care about the data being encrypted when
it's stored to disk then you can override NSMangedObject's
initWithEntity:insertIntoManagedObjectContext: and willSave methods.
There is no need to override
initWithEntity:insertIntoManagedObjectContext -- it's the designated
initialiser... If you override willSave, it's likely you should also
override didSave as well (assuming that you're overriding willSave to
encrypt values prior to writing to the store -- you'll then want to
revert to the unencrypted form before continuing, otherwise you'll
never know whether a given value is encrypted or not...).
If you need it to be secure even while it's in memory you can
probably override setValue:forKey: and valueForKey:
in which case you probably have to override
setPrimitiveValue:forKey: and permitiveValueForKey: also.
**** No, do not do this. ****
The documentation makes it very clear that **** you should not
override these methods. ****
"Core Data relies on NSManagedObject’s implementation of the
following methods, which you should therefore not override:
primitiveValueForKey:, setPrimitiveValue:forKey:..."
setValue:forKey:
[...] Subclasses should not override this method.
setPrimitiveValue:forKey:
[...] Subclasses should not override this method
<http://developer.apple.com/documentation/Cocoa/Reference/
CoreData_ObjC/Classes/NSManagedObject.html>
For suitable techniques to encrypt attributes, see:
<http://lists.apple.com/archives/Cocoa-dev/2005/Jun/msg01425.html>
mmalc
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden