Files located in the tutorial/step10-expiry-date/files directory:
mousegestures-1.2.jar | Mouse Gestures library jar |
test.jar | Jar with Mouse Gestures demo frame |
config.xml | Allatori configuration file |
RunAllatori.bat | Runs Allatori |
MouseGesturesOriginal.bat | Runs original version of Mouse Gestures |
MouseGesturesObfuscated.bat | Runs obfuscated version of Mouse Gestures |
Clean.bat | Deletes generated files |
<config> <jars> <jar in="test.jar" out="obf-test.jar"/> <jar in="mousegestures-1.2.jar" out="obf-mousegestures-1.2.jar"/> </jars> <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!"/>