问题
I don't want to publish my app on Android Market, but i would create a license key from my website based on the MAC address of the user device. It should include also expiration date. Once the user enters the code in the android device it should be recognised. I've read that it can be done by using custom public encryption. In this scenario i should implement:
- A function in my application that takes the MAC address of the device and shows a string to the user.
- A function on my website that owns the private key and cipher the string at point 1. and adds expiration date
- A function in my application that decipher the string at point 2. using the puplic key and validates the license key.
I've read many discussions on stackoverflow and other sites but nothing applicable... or it is not clear how to apply in my scenario :(
Can you provide me e way to solve this problem? is there something that is android native that i'm missing (i hope) ?
Many thanks! Marco
回答1:
I see nothing really difficult to implement your intents:
- Your licensing server must have its own private and public key pairs.
- Then you have to create private key in your application during 1st run/install. It can be done just randomly
- Then you have to interchange between your application and server with public keys
- During buying/licensing procedure your application should encrypt MAC address or other (gmail id, IMEI code whatever) send to server - server stores key
- In order to check validity of license application sends to server cipher of MAC - server checks it against stored in database
If you don't know how to implement private/public keys stuff - read manuals, there're a lot of implementations of Diffie-Hellman's procedure - it's easy and nothing special there
回答2:
I was looking to implement licensing on apps that are not distributed through Play and came across this:
https://code.google.com/p/droidactivator/
Maybe it will help you too?
来源:https://stackoverflow.com/questions/7722841/how-to-use-public-encryption-to-manage-licensing-on-android-applications