# Check for expiry in Shareware applications?

**URL:** <https://www.ruby-forum.com/t/check-for-expiry-in-shareware-applications/87286>\
**Category:** Ruby\
**Created:** [March 26, 2006, 4:42pm UTC](https://www.ruby-forum.com/t/check-for-expiry-in-shareware-applications/87286 "2006-03-26T16:42:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [March 26, 2006, 4:42pm UTC](https://www.ruby-forum.com/t/check-for-expiry-in-shareware-applications/87286/1 "2006-03-26T16:42:20Z")

</div>

Dear all,

sometimes software that is not released as open source comes as  
shareware or  
demo, which has limited time functionality.  
How can this be achieved in Ruby in some way that it cannot be  
trivially  
circumvented (i.e., do not allow for changes in system date to obtain  
another  
30 days) ?

Thank you very much!

Best regards,

Axel

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [March 26, 2006, 4:54pm UTC](https://www.ruby-forum.com/t/check-for-expiry-in-shareware-applications/87286/2 "2006-03-26T16:54:44Z")

</div>

Hey Axel,

Well, haven’t given that much of thought, but how about checking the  
date from the internet?  
The problem being that you have to be connected, but if that fails you  
could still try the following:  
save the dates of execution of the program, if the date of the  
computer moves before that time you know that something is going wrong

- usually the user will only change the date, not the time, so you  
could try to just add another day when the time is not within the last  
day (or something like that)  
or, even more simple - restrict how often the program can be run.  
However, no matter what you do, there is no way to take the right from  
the user to peek into the code and figure out what’s going on. In case  
you save the dates in some external file, i’m quite sure that after  
deletion he will have full charge again 🙂  
another good attempt i’ve seen was from komodo, they have a quite  
decent system of giving licences to use the program for a given  
time-span for one given machine… well, i was not too excited about  
komodo and prefer vim, so i didn’t give it a second look 😑

```auto

```

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [March 26, 2006, 11:05pm UTC](https://www.ruby-forum.com/t/check-for-expiry-in-shareware-applications/87286/3 "2006-03-26T23:05:37Z")

</div>

On 3/26/06, removed\_email\_address@domain.invalid [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Dear all,
> 
> sometimes software that is not released as open source comes as shareware or  
> demo, which has limited time functionality.  
> How can this be achieved in Ruby in some way that it cannot be trivially  
> circumvented (i.e., do not allow for changes in system date to obtain another  
> 30 days) ?

to secure the source code from the users i compiled the ruby code as  
gzipped C-string into an executable. the executable starts the ruby  
interpreter and evaluates the inflated script with rb\_eval (actually  
similar function of the ruby c api which i don’t recall now).

to make it even more secure you could encrypt the gzipped string. also  
you could check a crc of the exe to see wether it has been modified.  
but with a debugger the code might be uncovered at runtime maybe.

the question is, where do you store the license info (date installed /  
numer of times launched) so that the user cannot cirumvent it by  
reinstalling the product / deleting that data.

– henon
