Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development > iPhone SDK Development - Advanced Discussion

Reply
 
LinkBack Thread Tools Display Modes
Old 06-12-2010, 10:47 AM   #1 (permalink)
A Single-Serving Friend
 
Join Date: Mar 2010
Location: Groningen, NL
Posts: 491
Robert Paulson is on a distinguished road
Question How/Where to store the en-/decryption passphrase?

Hi guys,

I have an idea for an app and was doing some research. Now I am not sure whether it's possible to do what I want to do.

Suppose I want the user to enter some data and that data is stored using a plist or an SQLite database or something. This would be very private data that no-one should be able to access but the user themselves. Therefore, I thought encryption is the way to go.

I googled a bit and found several ways. Among others, this article: Strong Encryption for Cocoa/Cocoa Touch.

What bothers me is this:
Quote:
Originally Posted by iphone dev blog
Okay, now, this is a symmetric block cypher, it is not public-key encryption, so if you store your passphrase as a string in your application (as opposed to making the user enter it or storing it in the keychain) then you're giving somebody the ability to decrypt your encrypted application data, so just be forewarned.
I don't want to use an external server or something. It should all happen on the phone and should not require and internet connection. But is that even possible? I mean, how can I store the passphrase in a way that it cannot be accessed by anyone else?

Is there a way? Or an alternative to achieve the same thing?

Any help is greatly appreciated!

Cheers,
Bob
__________________
We are God’s middle children, according to Tyler Durden, with no special place in history and no special attention.

Consider saying thanks by buying my app. :]
Robert Paulson is offline   Reply With Quote
Old 06-12-2010, 12:16 PM   #2 (permalink)
Super Moderator
 
Join Date: Oct 2009
Location: San Diego, CA
Posts: 1,586
JasonR is on a distinguished road
Default

The keychain is the normal place to store passwords and keys. The Keychain Service Programming Guide in your developer documentation should give you a good overview.
JasonR is offline   Reply With Quote
Old 06-12-2010, 12:52 PM   #3 (permalink)
A Single-Serving Friend
 
Join Date: Mar 2010
Location: Groningen, NL
Posts: 491
Robert Paulson is on a distinguished road
Default

Thanks for the reply, JasonR. I'll make sure to read up on that.


I had another idea, though. Say, the app starts and I let the user enter a passphrase (that the user chooses). I'll then use that passphrase to encrypt their data. When they close the app, the data is encrypted and I simply don't bother to store the correct passphrase. The next time the user opens the app, they have to enter the passphrase and I'll use the entered passphrase to attempt decrypting the data. If it succeeds, the passphrase was correct but if it fails, it was wrong.

Is that an option?

Cheers,
Bob
__________________
We are God’s middle children, according to Tyler Durden, with no special place in history and no special attention.

Consider saying thanks by buying my app. :]
Robert Paulson is offline   Reply With Quote
Old 06-12-2010, 03:38 PM   #4 (permalink)
Super Moderator
 
Join Date: Oct 2009
Location: San Diego, CA
Posts: 1,586
JasonR is on a distinguished road
Default

Bob,

Probably depends on the security needs of your users. Requiring a passphrase every time you run is certainly the best security, but many casual users will find it so annoying that they won't user it.

How well do you know your target market? Are they security conscious enough to take the extra time for a pass phrase?

Also, I've not looked into it deeply, but iOS 4 offers the option to encrypt files, which might be a third option.
JasonR is offline   Reply With Quote
Old 06-13-2010, 07:05 AM   #5 (permalink)
A Single-Serving Friend
 
Join Date: Mar 2010
Location: Groningen, NL
Posts: 491
Robert Paulson is on a distinguished road
Default

JasonR,

the data would be very, very sensible and the users wouldn't want others to be able to access it without the passphrase. Therefore, I think the users won't mind having to enter the passphrase every time they open the app... it might even give them a sense of security.

And thanks for mentioning iOS 4. I'll check that out as well. Thanks a lot!

Cheers,
Bob
__________________
We are God’s middle children, according to Tyler Durden, with no special place in history and no special attention.

Consider saying thanks by buying my app. :]
Robert Paulson is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 372
8 members and 364 guests
.Snipe, AragornSG, baja_yu, davejas69, guusleijsten, hussain1982, Kryckter, Paul Slocum
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,645
Threads: 94,111
Posts: 402,862
Top Poster: BrianSlick (7,990)
Welcome to our newest member, leighec68
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 05:34 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0