I'd create a key (like an md-5 hash) based on the current local time.
In the app, id set the date on what the md5 hash is based, and keep the software check the current date against the date set in the application (if altered, the md5 key has to change as well), and keep it working for as long as your contract is. eg, set a timeout date (second md5 hash).
This way, you can force your customer to renew it's license, and then you have to set two new dates in the application and create a new license file with the md5 keys in it.
But just like with any key, software etc. it's far from perfect.
#pseudo:
my $sDate="01-01-2005";
my $eDate="01-01-2006";
checkKey( $sDate, $eDate );
# obfuscate this sub.
sub checkKey() {
my ($sDate,$eDate) = @_;
require Digest::MD5 qw(md5_hex);
# md5 keys of your license file:
my $k1 = "deda6aea2f525d96806cb8fa18998d94";
my $k2 = "00026573e6a61456bb57336800bf663e";
my $k3 = "9533f158f330713d6e7e2cbdeaf245ea";
if(
md5_hex($sDate) eq $k1 &&
md5_hex($eDate) eq $k2 &&
md5_hex($sDate . $eDate) eq $k3 &&
$eDate < $currentdate
) {
return 1; #allowed to run
} else {
return 0; #renew your license!
}
}
"We all agree on the necessity of compromise. We just can't agree on when it's necessary to compromise." - Larry Wall.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|