0

I am trying to license my product(java app) with a simple technique by comparing two dates.I want to know how should I increment the date when I give the app to my client.I need to increment the date everyday,so that when it expires it doesnt work. I dont want to use the system date,cause there are chances the client might change that.So could anyone provide me any suggestions.

Santino 'Sonny' Corleone
  • 1,735
  • 5
  • 25
  • 52

2 Answers2

0

One way i can think of is Use webservice to get current date in your client

earthtools.org provides a free web service to get the time zone from a city here:

http://www.earthtools.org/webservices.htm#timezone

You just pass in the long/lat values like this: (This is for New York)

http://www.earthtools.org/timezone-1.1/40.71417/-74.00639

Use java Rest client to get date in your code

http://www.mkyong.com/webservices/jax-rs/restfull-java-client-with-java-net-url/

Ali Hashemi
  • 3,158
  • 3
  • 34
  • 48
constantlearner
  • 5,157
  • 7
  • 42
  • 64
0

Since the java app is going to be running on your client, you have basically two options (simplistically speaking).

Option1. Use a (possibly) encrypted file on your client's filesystem to store the date you want to store and compare against your expire date.

Option2. Upon registering, register to a server. Now the server knows when you registered, so it should be able to determine when you expire. Each time the application starts, make a call to the server asking if it has expired. This way, you have transferred part of the expiry logic to the server.

Keep in mind that both approaches in their simplistic form can be easily circumvented but that is most of the time the case when you have an app running on clients' computers.

Nikola Yovchev
  • 9,498
  • 4
  • 46
  • 72
  • I am doing option 1.I have enrypted the expiry date.Need to know how to increment the other date – Santino 'Sonny' Corleone Nov 21 '13 at 10:57
  • You can use a hybrid of option 1 and option 2. Upon registering, you can call your server or some other server from which you can get the time. Then each day, you can query that server again and check if it is 30 days more than when you registered it. Keep in mind that it is also very easily circumventable by spoofing the response from the server. – Nikola Yovchev Nov 21 '13 at 10:58
  • I am not using the internet for my app – Santino 'Sonny' Corleone Nov 21 '13 at 10:59
  • Then you have no reliable way of determining when your app is expiring. You are left to rely on the client's clock. – Nikola Yovchev Nov 21 '13 at 11:01