Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

Currently, I develop an Android App needing online authentication for login (and registration). The main focus is on security. I’m amaing for:

  • keeping the users’ passwords safe and
  • preventing MITM attacks.
Secondary aims are performance and user experience. Besides, I’d prefer not to use third-party solutions.

I studied a lot about different approaches[1][2][3]. My problem is now how to combine these ideas into one secure mechanism. To put it differently, have I overlooked something?

Long story short, I came up with the following:

Flowchart. Basically, if an authToken is present, it is sent to the server and checked there. If successful, the login process is completed. Else or if no token was present, the user has to enter his credentials. His/Her password is hashed, sent to the server which generates a token and doing so completes the process and enables the user to login automatically the next time.

The illustration you see shows the login process performed by the app’s background Service before it downloads notifications for this user. The idea is to send the hashed user password only once and then to work with a server-side generated authentication token which is kept in an encrypted KeyStore on the phone and renewed on every login process.

Further information: The app–server communication is done over HTTPS. The hash is a randomly salted bcrypt created on the phone. The database table consists only of id, username, hash, salt, authtoken.

What do you think about these considerations?
I am looking forward to your critism and feedback.

Qdeep

Some ideas were “stolen” in the The definitive guide to form based website authentication here on SO. Others found by searching for android secure authentication.

share|improve this question

migrated from stackoverflow.com Aug 12 '14 at 13:15

This question came from our site for professional and enthusiast programmers.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.