Hary
Hary

Reputation: 5818

Securely Storing Sensitive Data from App on Remote Server

I have an Android App where a user enters some sensitive information in the form of text. I need to store this data on a remote server, to be retrieved by that user from a different device. I want to secure this data against everyone other than that user, especially a rogue database admin - the user should be the only one capable of recovering the information.

My approach is, SALT will be generate in Android app and every sensitive data will be hashed with this SALT and will be stored for later decryption to get the actual raw data.

Is this the correct approach? or Any better approach for this?

If yes,

  1. What if the user change the device?
  2. How to use the same SALT in the new device as SALT cannot be saved in database?

Update: Sensitive data needs to be stored in Firebase Database.

Upvotes: 1

Views: 450

Answers (1)

AnOccasionalCashew
AnOccasionalCashew

Reputation: 661

Disclaimer

I'm not a security professional. I'm not an expert. I'm just some random developer on the internet who's done some reading in the past and took a stab at answering your question. Head over to the information security stackexchange if you want more reliable information.


A user enters sensitive information into your program. You want them to be able to recover it later, so you must save it somewhere. How to handle this?

Where to save it?

  • On the device if it doesn't need to be accessible from elsewhere.
  • On a server if the user might need to access it from a different device (or recover it).

How to secure it?

  • Encrypt it.

What to encrypt it with?

  • A standard, secure algorithm (such as AES), and a key derived from a user provided password.

But users tend to come up with poor passwords. If we're sending this to a server, and the database might be compromised, how to protect against brute force attacks?

  • Employ a key stretching algorithm, such as PBKDF2.

How secure is this, really?

  • Well if the user picks a poor password, and then your database is compromised, brute force will be relatively easy.
  • If the password ever leaves their device (like if you, say, reused the same password for the app to log in to your servers or something) then you're treading in dangerous waters.

Upvotes: 1

Related Questions