views:

80

answers:

3

I am planning to store a password in my Native app (Android and iPhone). Should I store them after encrypting it ? or can I store it without any encryption? Are they really secure?

A: 

I would store it encrypted. If someone would read your password he/she could simply use it. If it is stored encrypted, that person would need to decrypt it before usage.

Im0rtality
Hi Im0rtality, Thanks for the response.I really don't know, how can a person read my password, that is stored in my device. Can you elaborate on it?
Krishnan
Just like phooze and tomash said, with rooted device you can read sensitive files (for example file where you store your password).And if that file can be read anyone could get get access to password protected part of application.
Im0rtality
A: 

Stored passwords are not safe at all. Determined user can root it's device and access any database and preferences. If you encypt password, your application can be decompiled to get decode function or step-executed until decrypted password is stored somewhere in process memory.

It doesn't mean you shouldn't encrypt passwords - use any symmetric encryption and initialise key in some non-trivial way (i.e. arythmetic expression). This will prevent script-kiddies and casual programmers from reading passwords. Just remember if some really want them, he will get them anyway.

tomash
+2  A: 

Any jailbroken iPhone will give any user access to the application's Documents folder. So, yes, it's insecure.

Additionally, if you put the password inside the code, you're still weak, as someone can decompile the program and find the key. What I'd recommend is a proxy.

For example, we have an application that connects to Facebook's API on the phone. However, we don't want to store our Facebook API private key on the phone, because then any user who reverse engineers our code could hack our Facebook application!

So, instead, we store the Facebook private key on a (secure) proxy server. When the device needs to interact with Facebook, it contacts the proxy, asks the proxy to log-in, and then the proxy gives a session key to the device to use directly with Facebook.

Certainly, it's still hackable - but you won't lose your private key in the process, and instead, the only thing your user could do is do the same things you do in your proxy server API.

Could you give us a little more information about what you're trying to do?

phooze
I wanted to store the user Name and password of a registered service in to the App I am planning to develop. Can you elaborate on proxy?
Krishnan
Added some detail about proxies - depends what kind of service you are trying to connect to, but the basic concept is there!
phooze
Hi Phooze,So you got any idea what twitter and facebook Applications use to store the password
Krishnan