views:

136

answers:

6

For my MFC/C++ unmanaged time-limited software needs, I'd like to get a GMT/UTC time-stamp from the internet (instead of relying on the PC clock time that can be easily changed).

I already though about parsing the line "Current UTC"... line from http://www.timeanddate.com/worldclock/ (I think port 80 is more likely to be open than others) but I don't know how reliable this URL is...

Please share with me your pros/cons or different ideas on this.

Thanks.

+5  A: 

Use a SNTP (Simple Network Time Protocol) to get the time from an internet atomic clock.

There's a few libraries available on the web - here's one for MFC on codeproject.

gbjbaanb
Thanks, I'm aware of SNTP, but I thought that port 80 will be less blocked than port 123. That's why I aimed for a port 80 solution. Anyways, I'll give this one a try. Thanks.
BigMoose
+3  A: 

Make your program better instead of wasting time trying to protect it. Any such protection that you can do will be circumvented easily. If you insist, you can run the software on your server, as this is the only way to actually enforce such limits.

Tronic
Thanks, but I cannot run it on the server.
BigMoose
+1  A: 

Looks feasible and this is widely done.

Scrapping of timeanddate.com can break if the site decides to change its HTML. Even a slight change in the HTML can break your scrapper.

I would suggest you use a web service like earthtools. You'll have to pass the necessary arguments(latitude and longitude etc) in the URL and the response is XML which you can easily parse.

codaddict
This is very cool! I wasn't aware of earthtools. since I'm looking for UTC then giving 0,0 for long/lat would be sufficient for me and the parsing of XML is easy.But how reliable is this service? How do I know THIS URL won't break in a while?
BigMoose
(*) It says I need 15 reputation points to raise your vote.. so I would if I could.. Thanks.
BigMoose
+3  A: 

Make a good product and the number of users should increase, as the number of users increases the number of honest users should increase proportionally. So, use a simple date check. It should be enough of a barrier for "regular" users to keep them honest.

It's likely that any other type of protection will just anger the honest users. If I see an app requesting internet access, I start to question its motives.

Ryan Emerle
If I was dealing with honest users only I wouldn't need this solution in the first please, n'est pas? But the fact is that I can pick my users, so some of them may be dishonest.Now, what should I do? - not angry the easy-to-get-mad-honest-users, or protect myself as much as I can?And FYI - this is not a commercial / shareware or even a freeware. This is an internal organization application that exposes some delicate information. My co-workers should be outmost honest and loyal to the company, but... go figure...
BigMoose
A: 

Hmmm. Interesting. You are basicly trying to use the Internet as a dongle.

If you truly need this kind of "protection" over your software, you should perhaps consider getting a true dongle with a real-time clock in it, like HASP. Of course either soltion is going to be trivial to get around for a decent hacker with a disassembler.

Generally I think it is better to open your software up and try to live off of fixes, mods, and support.

T.E.D.
Thanks, but a dongle is an overkill. I'd like some data to be protected, I'd like to protect it as much as I can via software, but it won't be a disaster if I won't make it. I'm trying to do this one in order to expand my programming horizons.
BigMoose
A: 

Well, To conclude: My app contains an offline database that is updated once a day from the intranet.
I'd like to shred this database if it was not updated over a week and that's why I'd like to try and reduce the possibility of someone just changing the PC clock backwards.
I am fully aware of the fact that there are power users that could block my app from getting internet time in 20 different ways, but I'm trying to do the best I can in software (a hardware solution, e.g. a dongle, is an overkill for me).

Since I want to have a port 80 solution, I'll adopt codaddict's solution (earthtools) and will sample the PC clock otherwise.

Thanks for all the replies!

BigMoose