Step 5 - Introduction to Watermarks

Files located in the tutorial/step05/files directory:
mousegestures-1.2.jarMouse Gestures library jar
test.jarJar with Mouse Gestures demo frame
config.xmlAllatori configuration file
RunAllatori.batRuns Allatori
ExtractWatermark.batRuns Allatori's watermark extracting class
ExtractWatermark.xmlConfiguration file for extracting a watermark
Clean.batDeletes generated files


Here we will show you how to use watermarks.

Let's look what we've changed in the configuration file, changes are in bold:

<config>
    <input single-jar="single.jar">
        <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"/>

    <watermark key="secure-key-to-extract-watermark" value="Customer: John Smith; Date: xx.yy.zzzz"/>
</config>

We have added a watermark element with the following attributes:
key - the key that is used to embed a watermark into the application using steganography techniques;
value - any string that will be embedded into application jars. It can be copyright, customer name, company name or any other information that uniquely identifies the build. A watermark can be used to identify owners of the software or track the origin of a pirated copy.

To extract the watermark we need another configuration file:

<config>
    <input>
        <jar in="single.jar"/>
    </input>

    <watermark key="secure-key-to-extract-watermark"/>
</config>

We specified jar file that contains the watermark and the key for the extraction. The key should match the key used for embedding. If you specify the wrong key, then watermark wouldn't be extracted.

Run ExtractWatermark.bat to see the extracted watermark.

Step 4       Step 6       Contents