Reputation: 2981
I'm a total noobie when it comes to encryption and I think I'm seeing my problem all wrong, let me explain:
I want an Android application to contact a server to get items to display in an app. Then if the user interacts with this item , I want to send a feedback to the server telling which item has been clicked on to save it in a database .
The first thing is that I don't want anyone to "intercept" this "feedback" over the network while sending them to the server. So I decided to use https connection. But let's say the script I'm calling for feedback is https://mydomain.com/myscript.php (with a POST request). I don't want someone to reverse engineer my Android code and see that I'm calling this script to send a feedback ,because then he could use it to the same purpose.
So then I thought "Hey, let's just grab a key from the server to send it back when i have to send a feedback to the server". But again, to get this key, I need to call a php script, and if someone could call this script, get the key, he could then send the feedbacks as he wants.
It seems to me like there is no end to this. And I know there is one :D I think I am looking at this the complete wrong way. Do you have some guidelines to follow to do so?
Thanks !
Upvotes: 3
Views: 1902
Reputation: 9299
You cannot extend trust to client software. There is a good quote in "Building Secure Software: How to Avoid Security Problems the Right Way" by Viega and McGraw.
People commonly hide secrets in client code, assuming those secrets will be safe. The problem with putting secrets in client code is that talented end users will be able to abuse the client and steal all its secrets. Instead of making assumptions that need to hold true, you should be reluctant to extend trust. Servers should be designed not to trust clients, and vice versa, since both clients and servers get hacked. A reluctance to trust can help with compartmentalization.
You can't trust client software. But you can sometimes trust individual users. And you can remove spam. Things to consider:
Large companies use a combination of 4, 3 and 1. The Google Play store used to try and detect all spam reviews and delete them. But now they use #4 as well. You can't post reviews on the Google Play store without being logged in anymore!
Edit: this may also be useful http://android-developers.blogspot.ca/2013/01/verifying-back-end-calls-from-android.html?m=1
Upvotes: 4