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.
-
If your app has access to the internet, you can use NTP time from a time server. – Julien Nov 21 '13 at 10:53
-
I want suggestions what should I do,I could try using the system date but as i said the client might change it. – Santino 'Sonny' Corleone Nov 21 '13 at 10:53
-
I could have done NTP but this is offline...any other suggestions.I mean like take the time and auto increment or something?though i dont know how to do it. – Santino 'Sonny' Corleone Nov 21 '13 at 10:54
-
You could implement the current time and then count down 30 days or whatever number of days from that. That way only the initial date needs to be known upon install. – Peter_James Nov 21 '13 at 10:54
-
the same way i want but whats the line of code to increment? – Santino 'Sonny' Corleone Nov 21 '13 at 10:54
-
You could find an answer how to licence java application http://stackoverflow.com/questions/2466424/making-commercial-java-software-drm/2466666#2466666 – Developer Marius Žilėnas Nov 21 '13 at 10:55
-
@MariusŽilėnas i read that.thanks – Santino 'Sonny' Corleone Nov 21 '13 at 10:56
-
@user2860598 please help how to count the days – Santino 'Sonny' Corleone Nov 21 '13 at 11:02
-
1@user2860598's suggestion can easily be circumvented: set the computer date to 1/1/2024, install, reset date to today. – Jongware Nov 21 '13 at 11:35
2 Answers
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/

- 3,158
- 3
- 34
- 48

- 5,157
- 7
- 42
- 64
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.

- 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
-
-
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