How the Android client verifies the licence

Source: Internet
Author: User

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:

    1. Take a unique device number a.
    2. The client calculates a license number B based on an encryption algorithm F (a).
    3. Ask the user to enter a license number C (Licence), compare it to B, and complete the validation.
With
    1. The device number A can be a serial number (Serial numbers), MAC address, Bluetooth address, android_id, and so on.
    2. 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.
    3. Save the user's input licence to the client--you only need to enter it once.
    4. The verification of Android can be placed in the Onresume method of the first activated activity, or directly in the Applaction OnCreate method.
    5. 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.