Currently in my android app is secured by DexGuard to obfuscate strings and sensitive information like network API keys which is present inside source code.
I have used DexGuarsd so that no one can reverse engineer it.
However I need to stop DexGuard subscription.
So If I use Android Jetpack Security EncryptedSharedPreferencesand EncryptedFile.Builder then will it help me in achieving security like the one provided by DexGaurd.
For example: If I use EncryptedSharedPreferences like below code, then if someone gets access to my source code OR .apk, then will he/she be able to see the sensitive value PASSWORD-XXXXXXXX or not.
Because the above password is present in my source code file.
encryptedSharedPreferences.edit().apply {
putString("MY_KEY","PASSWORD-XXXXXXXX"
}.apply()
My goal is to ensure that even if someone gets my source code then also the above value "PASSWORD-XXXXXXXX" can never be decrypted or seen by anyone.
I need your guidance in achieving it. Please advice the way forward.
Simple keep your password in app level
build.graldlefile like:And use it like:
As
build.gradlefile is not part of an APK source code, so no one can steal it.Why are you saving your password in shared preferences? why can't you use it directly from BuildConfig?. If you really want to save it then encrypt and save it using this class:
Use the above class in your
EncryptedSharedPreferencesclass:Note: To make this work you need to enable minify to hide the
BuildConfigfile.Check this answer here