Store a key or password securely locally on android

Pranav

I'm making an android application and currently, I have my server username and password written as constants in my code (which is not very secure). I have researched online but I couldn't really find something that would completely secure the password from the user or at least prevent from hackers. Could anyone help me out on how to securely store a password locally on android? Thanks!

Sven Slootweg

It seems your question is actually "can I restrict server access to my application only?". This is not possible. Once an application or file exists on a client (eg. a user device), there's no sure-fire way to prevent that client from accessing anything in that application or file, with or without your authorization.

If the device can read it, then the device can read it - regardless of whether it's actually your application doing the reading, or something else pretending to be the application.

The most you can do is trying to obfuscate the credentials, but this is unlikely to be useful - those who might have an interest in extracting credentials from your application, will also likely be those who have the skills to bypass such obfuscation.

I can't really give you a more specific suggestion without knowing your usecase. For remote APIs, API keys are typically used - but this would require that the user create an account. For account-less applications, what you want is simply not possible.

I should also note that "preventing hackers" is not a meaningful goal - that can mean many things. You'll want to read up on how threat modelling works, and determine exactly who your 'attackers' are, what their goals are, and what their capabilities are. Only then can you try to find solutions against it.

EDIT: Just wanted to add an extra word of warning: anybody telling you that obfuscation is "effective" for these kind of scenarios, is trying to sell you something. Unfortunately they are generally rather successful in such attempts. The obfuscation model cannot and does not work.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to store password in angularjs securely

From Dev

How Can I Use the Android KeyStore to securely store arbitrary strings?

From Dev

Can I securely store username and password in PHP session variables?

From Dev

Store and encrypt a password locally in C#

From Dev

How to store a password as securely in Chrome Extension?

From Dev

Securely store token/password in Chrome extension

From Dev

How to store a json data securely in phonegap android?

From Dev

Any way to store a password securely in an application

From Dev

How can I store password securely in MySQL and authenticate to external services

From Dev

Storing password securely nodemailer

From Dev

In Eve, how can you store the user's password securely?

From Dev

Store client secret securely

From Dev

Store passwords securely in Windows

From Dev

How to properly store password locally

From Dev

Store AES key in Android

From Dev

how to securely store encryption keys in android?

From Dev

How to securely send/store password in a Spring RESTful login service

From Dev

Securely feeding a program with a password

From Dev

Store and encrypt a password locally in C#

From Dev

How to securely store Google Authenticator secret key?

From Dev

Any way to store a password securely in an application

From Dev

How can I store password securely in MySQL and authenticate to external services

From Dev

How to change the gpg key of the pass password store

From Dev

Best way to securely store google service account private key?

From Dev

How to store samba (cifs) password securely?

From Dev

How can I securely store EC private key in Android?

From Dev

How to store user/password in android?

From Dev

How to store encryption key/password in JSONStore

From Dev

Store and encrypt a password locally

Related Related

  1. 1

    How to store password in angularjs securely

  2. 2

    How Can I Use the Android KeyStore to securely store arbitrary strings?

  3. 3

    Can I securely store username and password in PHP session variables?

  4. 4

    Store and encrypt a password locally in C#

  5. 5

    How to store a password as securely in Chrome Extension?

  6. 6

    Securely store token/password in Chrome extension

  7. 7

    How to store a json data securely in phonegap android?

  8. 8

    Any way to store a password securely in an application

  9. 9

    How can I store password securely in MySQL and authenticate to external services

  10. 10

    Storing password securely nodemailer

  11. 11

    In Eve, how can you store the user's password securely?

  12. 12

    Store client secret securely

  13. 13

    Store passwords securely in Windows

  14. 14

    How to properly store password locally

  15. 15

    Store AES key in Android

  16. 16

    how to securely store encryption keys in android?

  17. 17

    How to securely send/store password in a Spring RESTful login service

  18. 18

    Securely feeding a program with a password

  19. 19

    Store and encrypt a password locally in C#

  20. 20

    How to securely store Google Authenticator secret key?

  21. 21

    Any way to store a password securely in an application

  22. 22

    How can I store password securely in MySQL and authenticate to external services

  23. 23

    How to change the gpg key of the pass password store

  24. 24

    Best way to securely store google service account private key?

  25. 25

    How to store samba (cifs) password securely?

  26. 26

    How can I securely store EC private key in Android?

  27. 27

    How to store user/password in android?

  28. 28

    How to store encryption key/password in JSONStore

  29. 29

    Store and encrypt a password locally

HotTag

Archive