3
I need to develop an API that will receive data from a json user via $_GET with PHP, which will check the data and return a true or false value to the Android application.
I am currently using AES encryption to send json via $_GET, where the API will use the key to decrypt and return the required data, but I believe it is not a very secure system, because any user could access the URL of the API directly from the browser (Although it can not use it because it does not have the Key).
I would like to know how I can improve this system in terms of security.
/* Obs */
Currently as my application needs to encrypt the data and send to the API, so that after the reverse occurs, I save an encryption key in a variable within the APK, which is not really something safe because the application can be broken, and with the source code available anyone will have access to the API key.
Implementing a security system depends a lot on the problem and the "fear" you have. What exactly is the danger? What do you need to avoid? The interception. of the data sent? The interception. of the answer? Modification of the answer? Of the data?
– Peter
A dethale: with a bestial xdaAutoTool type, it takes 2 minutes to break an APK and with Jdecomp it takes 2 more minutes to break the JAR and have the source code... This means that if you have the "key" inside your code, the security level and but less than 0.
– Peter
That’s what I’m talking about, Peter. Currently my problem is that the API is completely accessible through the URL by the Browser, such as http:/host/Apiserver/server.php? query=DADOS_CRIPTOGRAFADOS E how the API receives the encrypted data to decrypt with AES, perform the request (User login for example) and then return the encrypted values, anything that is added to the query parameter of the URL will return some value whatever will not mean anything if the key does not match, but if the user has this key will be able to rescue any user data.
– Rafael Alexandre
Point 1, you need to send using POST. Another point, if I understand well, what do you want to do and the identification about PHP? I have the application, I will connect in PHP and PHP will know who I am. That? The main question is whether you want to identify the user (then a person who can enter the password) o se vc quer identificar o applicativo Android (so without taking care of who uses).
– Peter
In case, I want to identify the user who is accessing and logged in the form, this form will do the validation through the API.
– Rafael Alexandre
The key could come together in the GET/POST response, so it wouldn’t be necessary to store it in the app, whether it comes encrypted or not, it’s another story. You can’t guarantee 100% as has been said in other questions, but you can do it in a way that takes more time that the "Cracker" wants to spend in their attempts, it is worth using everything in its reach to make it difficult. You could even fragment the decryption key, to confuse more. Use SSL whenever you can, in all transactions. :)
– Florida