Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Shared Preferences Security

Tags:

android

I am developing an android module, and I have to use a shared preferences to store a jwt token for auto login, and for some other thing.

I store it with a key, like "token" or something like that.

The problem is :

If the developer import my module for his application, and find out the key, he can easily read my jwt token, and It would not to good for me.

Could you provide me some alternative solution?

Edit : My minimum API level must be 14.

like image 851
Robert Banyai Avatar asked Nov 21 '22 00:11

Robert Banyai


1 Answers

This problem is not as easy as it seems to be. For what I know the best solution is to store your key some way by using NDK; C code is harder to decompile and your protection level is higher than using simple Java.
Obfuscating Android Applications using O-LLVM and the NDK

Another solution could be to use a String obfuscator; but, generally speaking, security through obscurity is never a good idea.
Protect string constant against reverse-engineering

like image 179
Massimo Avatar answered Mar 12 '23 01:03

Massimo