Watermarking

Smokescreen home
Revision history
User guide
Installation guide
Obfuscation notes
Directives file
Incremental obfuscation
Buildtool integration
Watermarking
License and download
Purchase
Faqs/Known issues
Email
Smokescreen can write password encrypted watermarks into non-interface classes that are obfuscated. The watermarking feature requires the use of directives when obfuscating or when reading the watermarks from obfuscated classes.
Writing watermarks

When writing watermarks during the obfuscation process, two directives are used. The first is the 'watermark_string' directive, which specifies the actual text that is to be used as a watermark. The second is the 'watermark_password' directive which specifies the password used to encrypt the watermark when it is inserted into the class file. When the obfuscation is performed the specified watermark will be inserted into all obfuscated classes. The watermark text and password will be recorded in the log file. An example of the directives used when writing obfuscating with watermarks is given below.
watermark_password myWatermarkPassword
watermark_string The text for the watermark
Reading watermarks

When reading watermarks, two directives are used. The first is the 'read_watermarks' directive, which tells Smokescreen that watermarks will be read from the classes and no obfuscation will be done. The second is the 'watermark_password' directive which specifies the password used to decrypt the watermark, this must be the same password that was used to write the watermark into the obfuscated classes. When Smokescreen is started in order to read watermarks, all classes that are to be read from must be accessible on the classpath. The 'source_directory' directive is used to specify the obfuscated classes that contain the watermarks, but no destination directory need be specified, since no obfuscation will be performed. Smokescreen will read in the names of the classes using the 'source_directory' specification and then load them into the jvm using the classloader, after which it will read the watermarks. This means that the path specified through the 'source_directory' directive must also be included in the classpath. The watermarks found in each class will be written into the log file, along with the watermark password.

Smokescreen does not read watermarks directly from the classes specified through the 'source_directory' directive, but instead reads them after the classes have been loaded by the classloader. It is therefore important that only one version of the watermarked classes be accessible through the classpath, so that there is no confusion as to which class file a watermark was read from.

If the classes specified through the 'source_directory' directive are not also accessible through the classpath then Smokescreen will report a ClassNotFoundException.

An example of the directives used when reading watermarks is given below.
source_directory my\directory\with\watermarked\classes
watermark_password myWatermarkPassword
read_watermarks
Since the watermarked classes must be accessible through the classpath, the '-jar' option should not be used with the 'java' command to start Smokescreen, since this only allows access to classes inside the jar file. The preferred method is to make the watermarked classes and the Smokescreen jar file accessible through the classpath and then to start execution with the Smokescreen class, as shown below.
java com.leesw.Smokescreen.Smokescreen
In the above example the watermarked classes and the Smokescreen jar file must be made accesible through the classpath by setting the CLASSPATH variable. The '-classpath' or '-cp' option can also be used with the 'java' command to allow access to the watermarked classes and the Smokescreen class, as shown below. The example is for a windows environment which uses a semicolon as a path delimiter.
java -cp myDirectoryWithWatermarkedClasses;Smokescreen362_Reg.jar com.leesw.Smokescreen.Smokescreen