Zelix KlassMaster - Documentation

Obfuscating J2METM MIDlets using Zelix KlassMaster

Zelix KlassMasterTM can obfuscate J2ME MIDlets before or after preverification. However, it is usually easiest and most effective to obfuscate after preverification. There are two reasons for this
  1. If the preverification is done automatically by an IDE then the IDE usually requires a special obfuscation plugin that it can call between its compile and preverification steps. Unfortunately, obfuscation plugins can limit the obfuscation options available to you.
  2. If the preverification is done by a utility then that utility may not open classes from a JAR file. This can complicate your build process.

Obfuscating after preverification

If you obfuscate after preverification then Zelix KlassMaster will automatically update the preverification data structures in the bytecode. This means that you can easily add the obfuscation step to the end of your J2ME build prepocess without the need of a special IDE plugin.

Note that you must include your JAD file in your ZKM Script open statement along with your JAR file so that Zelix KlassMaster can update it.

Obfuscating before preverification

If you obfuscate before preverification then you may need a special plugin. There is a Zelix KlassMaster plugin for the Sun Wireless Toolkit 2.0 but it does slightly limit the obfuscation options that you can specify. For example the Toolkit doesn't allow Zelix KlassMaster to update the JAD so MIDlet fully qualified names cannot be changed.

Suggested options

  • trim your classes after setting your trim exclusions using the ZKM Script trimExclude statement trimExclude *.* extends javax.microedition.midlet.MIDlet;
  • obfuscate your classes after setting your name exclusions using the ZKM Script exclude statement exclude *.* extends javax.microedition.midlet.MIDlet;
  • to reduce bytecode size you can use the following obfuscate statement parameters
    • collapsePackagesWithDefault=""
    • lineNumbers=delete
    • encryptStringLiterals=none
  • to improve bytecode protection without greatly increasing its size you can use the obfuscate statement's obfuscateFlow=light parameter.
 
Documentation Table of Contents