How do we secure api keys on rooted device?
As you know we cant trust the client what we can do is make things difficult for the hacker. Following are some of the points which I know to secure keys
- Using NDK (store key in your C class and get it in kotlin class on runtime) - Even if device is rooted or decompiled hacker can't access it.
- Using Android Key Chain (stores key in the hardware device and without device integrity, certificate, no one can access it. It is stored in a separate place from your application. Not sure what happens if we decompile the app).
- Secure Shared Preference. (Even if we encrypt the file, it can still be access on rooted device, one might can figure the decrypt algorithm after check the code)
- Secure Shared Preference and Proguard/ Dexguard? (Still not a good idea to store the encrypted key publicly available under app package when device is rooted.)
- If we just encrypt the file? (again it will be under app package folder, can be accessed.)
What can be other options?