Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the most secure way to authorize an user in Android?

In my app, user logs in with a web service, and web service returns an Authorization Key. After that point, every request user makes is done with this key.

My question is how to securely store this key? I have been storing it in SharedPreferences, but that does not sound very secure to me.

like image 316
The Cook Avatar asked Jan 25 '17 07:01

The Cook


People also ask

Is Android keystore secure?

Security features. The Android Keystore system protects key material from unauthorized use in two ways. First, it reduces the risk of unauthorized use of key material from outside the Android device by preventing the extraction of the key material from application processes and from the Android device as a whole.

How Android manage the security in their platform?

The Android application sandbox, which isolates your app data and code execution from other apps. An application framework with robust implementations of common security functionality such as cryptography, permissions, and secure interprocess communication (IPC).

What is the Android security model?

Android platform uses the Linux user-based permissions model to isolate application resources. This process in called application sandbox. The aim of sandboxing is to prevent malicious external programs from interacting with the protected app.


1 Answers

You are right using shared preferences is not the approach to follow. You should utilise Android Keystore System for any such purpose, it is preferred approach.

The Android Keystore system lets you store cryptographic keys in a container to make it more difficult to extract from the device. Once keys are in the keystore, they can be used for cryptographic operations with the key material remaining non-exportable.

And KeyStoreUsage.java is the example for same.

like image 188
Jeet Avatar answered Oct 22 '22 00:10

Jeet