I am working on project that have api (restful)
I use key in resful and use in app
But if anyone can decompile my app and see api key,so can hack my api
Is there way to protect api key or use api key without storing in app?
I am working on project that have api (restful)
I use key in resful and use in app
But if anyone can decompile my app and see api key,so can hack my api
Is there way to protect api key or use api key without storing in app?
Generally Google stores keys into Android Manifest or string.xml (res files). Those two files can be decompiled like any other. I think KeyStore is generally good practice to store private keys, so please take a look at KeyStore class and how to use it.
Also you can find pretty good article on this subject on github
You cannot fully protect a static API key embedded in the app. Reverse engineering tools can easily extract it but you can make life more difficult and it will be a trade off between how valuable the data on your API is, how much time/effort you want to spend protecting it and how motivated the adversary is.
The keystore is useful for protecting dynamic session keys but not static API ones and is not hardware backed on many low end devices so check your customer base.
! Following is related to a commercial product !
Some key and API protection examples can be found here in addition to those linked to previously.