How to use public encryption to manage licensing in Android apps?

I do not want to publish my application on the Android Market, but I would create a license key from my site based on the MAC address of the user device. It should also include the expiration date. As soon as the user enters the code in the Android device, it must be recognized. I read that this can be done using custom public encryption. In this case, I have to implement:

  • A function in my application that takes a MAC address and shows a string to the user.
  • A function on my website that owns the private key and encrypts the string at point 1. and adds an expiration date
  • A function in my application that decrypts a string at point 2. using a puppet key and checks the license key.

I read a lot of discussions about stackoverflow and other sites, but nothing is applicable ... or it is not clear how to apply in my scenario: (

Can you provide me a way to solve this problem? is there something that is native to android i can't (hopefully)?

Thank you very much! Marco

+2
source share
2 answers

I do not see anything really difficult to realize your intentions:

  • Your licensing server must have its own private and public key pairs.
  • Then you need to create the private key in the application during the first launch / installation. This can be done simply by accident.
  • Then you need to exchange between your application and server using public keys
  • During the purchase / licensing process, your application must encrypt the MAC address or another (gmail identifier, IMEI code, any) sent to the server-server. Saves key
  • To verify the correctness of sending a licensed application to the server cipher of the MAC server, it checks to see if it is stored in the database

If you do not know how to implement private / public keys - read the manuals, there are many implementations of the Diffie-Hellman procedure - this is easy and there is nothing special there

0
source

I tried to implement licensing of applications that are not distributed through Play, and came across this:

https://code.google.com/p/droidactivator/

Maybe this will help too?

0
source

Source: https://habr.com/ru/post/1487991/


All Articles