• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Secure NSString?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Secure NSString?


  • Subject: Re: Secure NSString?
  • From: Marcel Weiher <email@hidden>
  • Date: Sun, 13 Jun 2004 22:12:44 +0100

On 13 Jun 2004, at 19:12, Matthew Christensen wrote:

I'm currently working on an application in which I want several text fields to use secure strings. That is, I want to make sure that when the strings are released, all of their data is zeroed out, so a core dump or other glance into memory does not reveal the stored data.

Hmm...but can't you just get a glance while the program is running? With the proper privileges, this shouldn't be a problem. Anyway...

My initial idea was to use categories on NSString and make sure that the data is zeroed on dealloc. The problem there is that the internal NSString data is not accessible, so i can't actually access or zero the data -- or at least I can't figure out how to do this.

It will be a little bit of reverse-engineering, but sounds doable. Use class-dump to get the headers of private classes, then inject your methods where needed. However, this won't be revision-safe, as you're mucking with internals. But just because you shouldn't doesn't mean you can't :-))

Another approach was to make a subclass of NSString that does this, and set the controls to use an instance of this secure string class. However, the problem here is that the UI controls accept strings by value, not by reference. So once I call setStringValue on the control, a new NSString is created somewhere else, so my deallocation is useless.

Hmm...must control...comment about value-semantics...

It's certainly a head scratcher from my point of view. Does anyone have any suggested approaches?

Another approach would be to inject your own malloc() that does what you need on free. I think there are hooks for this, possibly even on several levels.

Cheers,

Marcel
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >Secure NSString? (From: Matthew Christensen <email@hidden>)

  • Prev by Date: Re: How can I get a checksum or reliable info at all on a file?
  • Next by Date: Re: You know you're over-caching IMPs when..
  • Previous by thread: Secure NSString?
  • Next by thread: Cocoa and resource forks
  • Index(es):
    • Date
    • Thread