When app development, how to protect the interface of the app?
With HTTPS is I think of the method, but do not know how to achieve, so consider using token, although not absolutely effective, but can prevent the general user to attack, master not to attack, can only alarm it.
Token= "$ (parameter md5| string modified by a certain rule | timestamp | User ID) $" =fasdfasdfasdfasdfadfadfasd
Server-side build a token
Server-side token is also very important, the most important thing is that there is a timestamp, when the client will be Serkoken submitted to the time, can be used to limit the duration of sertoken, if not within the time limit, or with the last IP, or different from the last device information, Then it is considered that the URL is illegal.
The premise of token reliability is:
1) The app side is not decompile, the attacker does not know the method of your construction clienttoken;
2) server-side Sertoken generation is complex, the algorithm is not guessed, the verification is strict enough to limit the attacker can not forge the server-side token, the special short-term failure principle, limiting the general attackers have no time to guess the token
The client builds a token:
String Sertoken=getservertoken (String IP, string username,string deviceinfo,string tag);-- dedc080af089bccd7fbdf708e3c06898//Get a server-side token
String Clientparmmd5=md5 ("name=test&value=123"); --a95bc463f71a08ba40e64e52d23b9284//Pair parameter MD5
String clientip= "103.16.127.226"; Client IP
String deviceinfo= "Xxxxxxxxxx";
String Username= "Curappusername"; Current App User
String startstr= "as11as (";
String endstr= ") end;
String clientstr=startstr+clientparmmd5+ "|" +sertoken+ "|" +clientip+ "|" +DEVICEINFO+USERNAME+ENDSTR; Client string to encrypt
String Clienttoken=getclienttoken (CLIENTSTR);
Initiating a request
String Url=xxxx.com?name=test&value=123&token=clienttoken
Server-side resolution validation token
Decrypt the token submitted by the client.
Decomposition to: "As11as (a95bc463f71a08ba40e64e52d23b9284|dedc080af089bccd7fbdf708e3c06898|103.16.127.226|xxxxxx|username+ Endstr "
Decrypt Server Token
String sertoken= "dedc080af089bccd7fbdf708e3c06898";
string [] Sertokenarr=decrysertoken (Sertoken)
Here is a policy to verify the server-side token, to verify that the server-side token provided is still valid, and if invalid, stop the subsequent judgment operation directly.
Sertoken validation passes, and then determines whether the parameters in the URL have been tampered with,
String Nowparmd5=md5 (request.querystring["name"]+request.querystring["Value"]);
String oleparmd5=clientparmmd5;
If the judgment is tampered with, then it returns a prompt message,
Note Collect the client's information, and if there is a malicious attack, then the evidence will be retained.
If your app is recompiled, and the attacker knows how to build your token, it can only be attacked and the alarm resolved.
Server installation certificate using HTTPS or SSL, combined with Auth authentication can solve the problem that the app was called by others.
Is this scheme effective?
How to prevent the app interface from being called by others