Step 10 - Adding Expiry Date

Files located in the tutorial/step10-expiry-date/files directory:
mousegestures-1.2.jarMouse Gestures library jar
test.jarJar with Mouse Gestures demo frame
config.xmlAllatori configuration file
RunAllatori.batRuns Allatori
MouseGesturesOriginal.batRuns original version of Mouse Gestures
MouseGesturesObfuscated.batRuns obfuscated version of Mouse Gestures
Clean.batDeletes generated files


This step is based on step 2, changes in the configuration file are in bold:

<config>
    <input>
        <jar in="test.jar" out="obf-test.jar"/>
        <jar in="mousegestures-1.2.jar" out="obf-mousegestures-1.2.jar"/>
    </input>

    <keep-names>
        <class template="class *.TestFrame"/>
    </keep-names>

    <property name="log-file" value="log.xml"/>

    <expiry date="2000/01/01" string="EXPIRED!"/> <!-- we set expiry date to January 01, 2000,
                                                       so the obfuscated application will be expired and would not run -->
</config>

The obfuscated application is expired and would not run. Expiry date checks are inserted not only in the main method, therefore cannot be easily removed. This feature can be used in the libraries that do not even have main method.

If you are using Ant and want to set an expiry date to 30 days after the build time, then you need to
1) add the following line to the Ant target that calls Allatori:

    <tstamp>
        <format property="expiry.date" pattern="yyyy-MM-dd" offset="30" unit="day"/>
    </tstamp>

This will create an Ant variable expiry.date with the date you need.
2) Reference the expiry.date variable in the Allatori configuration file:

    <expiry date="${expiry.date}" string="EXPIRED!"/>

Step 9       Step 11       Contents