Demand
Limit the use of apps so that apps run only on licensed devices.
Analysis and solution principles
Let the app connect to the server for legitimacy verification every time it runs--a very mature and reliable solution, of course;
However, the limitations of this is that each time you need to connect to the server, some do not need to network or LAN-only internal application is not feasible-the service-side verification is not feasible, can only be verified on the client.
The basic principle of a client-side authentication method:
- Take a unique device number a.
- The client calculates a license number B based on an encryption algorithm F (a).
- Ask the user to enter a license number C (Licence), compare it to B, and complete the validation.
With
- The device number A can be a serial number (Serial numbers), MAC address, Bluetooth address, android_id, and so on.
- The encryption algorithm f (x) transforms from A->b can use a combination of various transformations such as MD5, string-case transformations, string additions, and order changes. However, it is best to meet two conditions:
- The result is unique : This is a must condition and is the guarantee of verifying reliability.
- process Irreversible : this is not necessary, but the best, can increase the difficulty of deciphering.
- Save the user's input licence to the client--you only need to enter it once.
- The verification of Android can be placed in the Onresume method of the first activated activity, or directly in the Applaction OnCreate method.
- If conditions permit, two-step verification of the service side and the client can be used to ensure the correctness of the licence.
http://www.barryzhang.com/archives/377
Sync Posted in http://www.barryzhang.com/archives/188
Advertise my new blog, Welcome to Kazakhstan:barryzhang.com