Zelix KlassMaster - Documentation
 

The stringEncryptionUnexclude Statement

The ZKM Script stringEncryptionUnexclude statement acts only on the set of excluded fields and classes created by an stringEncryptionExclude statement. The statement removes specified fields and classes from the set of excluded fields and classes so that they become available once more for String Encryption by the ZKM Script obfuscate statement.

The stringEncryptionUnexclude statement is intended to be used in conjunction with a stringEncryptionExclude statement to specify a final set of excluded fields and classes that would have been difficult to achieve using a stringEncryptionExclude statement alone. Typically, in such cases, an initial stringEncryptionExclude statement would set the broad exclusions and then the stringEncryptionUnexclude statement would specify the exceptions to those broad exclusions.

The remainder of this page is organized into the following sections.

Explanation and Examples

The syntax of the stringEncryptionUnexclude statement is the same as that of the stringEncryptionExclude statement. The stringEncryptionUnexclude statement parameters may be loosely categorized into the following groups

Class unexclude parameters

Put informally (with mandatory components in bold), the syntax is:
<classAnnotations> <classModifiers> "<archiveQualifier>"!<packageQualifiers>.<className> <containingClause> <extendsClause> <implementsClause>;

For a class to match a stringEncryptionUnexclude class unexclude parameter and therefore have all of its String literals of the class unexcluded, all of the following must be true:
  • Its annotations must match any specified annotations.
  • The class's modifiers (e.g. public final) must match all parameter modifiers. So if the parameters are public abstract !interface then the class must be public, abstract and NOT an interface to be excluded.
  • If the parameter has an archive qualifier then the class must be contained in an archive which matches that archive qualifier.
  • The class's package qualifiers must match any specified package exclude parameter component. If there is no package exclude parameter component then the class must be in the default package.
  • The class's unqualified name must match the parameter's class name specifier.
  • If the parameter has a containing clause then the class must contain members which match the specified class
  • If the parameter has an extends clause then the class must be a subclass of the specified class
  • If the parameter has an implements clause then the class must directly or indirectly implement all of the specified interfaces
stringEncryptionUnexclude 
          pack2.Class1 and //unexclude all string literals in class pack2.Class1 from encryption
          *.* and //unexclude all string literals in all classes from encryption
          //unexclude all string literals in all classes contained in a JAR file with a name matching "MyJar*.jar"
          "MyJar*.jar"!*.* and 
          //unexclude all string literals in all classes annotated which an annotation matching *.MyAnnotation0 
          @*.MyAnnotation0 *.*; 

Field unexclude parameters

Put informally (with mandatory components in bold), the syntax is:
<classAnnotations> <classModifiers> "<archiveQualifier>"!<packageQualifiers>.<className> <extendsClause> <implementsClause>
    <fieldAnnotations> <fieldModifiers> <fieldType> <fieldName>;

For a field to match a stringEncryptionUnexclude field unexclude parameter and therefore have its intitialization String literal unexcluded, all of the following must be true:
  • The field's containing class must match any class unexclude parameter component (see Class unexclude parameters).
  • The field's annotations must match any specified field level annotations.
  • The field's modifiers (e.g. public volatile) must match all parameter field modifiers. So if the parameters are public static !transient then the field must be public, static and NOT transient to be excluded.
  • The field's type (e.g. int[] or java.lang.String) must match the parameter field type if it exists.
  • The field's name must match the parameter field name specifier.
stringEncryptionUnexclude 
          *.* public static * and //unexclude string literals that initialize 
                                  //public static fields in any class from encryption
          pack2.Class1 * and //unexclude string literals that initialize any fields 
                             //in pack2.Class1 from encryption
          //unexclude string literals that initialize any fields annotated with a class matching *.MyAnnotation0.
          *.* @*.MyAnnotation0 *;  

Syntax

"stringEncryptionUnexclude" unexcludeParameter ("and" unexcludeParameter)* ";"

annotationSpecifier ::= ("@" [packageUnexcludeParameter] nameSpecifier) | annotationSpecifierAndList

annotationSpecifierAndList ::= ["!"] "(" annotationSpecifierOrList ("&&" annotationSpecifierOrList)* ")"

annotationSpecifierOrList ::= annotationSpecifier ("||" annotationSpecifier)*

classUnexcludeParameter ::=
   [annotationSpecifier] [["!"] "public" | "package"]
   [["!"] "abstract"] [["!"] "final"] [["!"] "interface"] [["!"] "synthetic"] [["!"] "enum"] [["!"] "annotation"]
   ["\"" archiveQualifier "\"" "!"] [packageExcludeParameter ["."]] nameSpecifier [containingClause]
   [extendsClause] [implementsClause]

containingClause ::= "containing" "{" "memberAndList" "}"

unexcludeParameter ::= classUnexcludeParameter |
fieldUnexcludeParameter

extendsClause ::= "extends" [annotationSpecifier] wildcardClassName

fieldUnexcludeParameter ::=
   classUnexcludeParameter [annotationSpecifier] [["!"] "public" | "protected"| "package"| "private"]
   [["!"] "static"] [["!"] "final"] [["!"] "transient"] [["!"] "volatile"] [["!"] "synthetic"] [["!"] "enum"]
   [type] nameSpecifier

fullyQualifiedClassName ::= name ("." name)*

implementsClause ::= "implements" [annotationSpecifier] wildcardClassName ("," [annotationSpecifier] wildcardClassName)*

memberAndList ::= ["!"] "(" memberOrList ("&&" memberOrList)* ")"

memberOrList ::= memberSpecifier ("||" memberSpecifier)*

memberSpecifier ::= fieldExcludeParameter | methodExcludeParameter

nameAndList ::= ["!"] "(" nameOrList ("&&" nameOrList)* ")"

name ::= (["0"-"9","a"-"z","A"-"Z","$","_"])+
   i.e. a Java identifer (e.g. a package, class, field or method name) with no wildcards allowed

nameAndList ::= ["!"] "(" nameOrList ("&&" nameOrList)* ")"

nameOrList ::= nameSpecifier ("||" nameSpecifier)*

nameSpecifier ::= wildcardName | nameAndList

packageUnexcludeParameter ::= packageName | packageNameAndList

packageName ::= wildcardName ("." wildcardName)* "."
   NB: the final "." is part of the package name

packageNameAndList ::= ["!"] "(" packageNameOrList ("&&" packageNameOrList)* ")"

packageNameOrList ::= packageUnexcludeParameter ("||" packageUnexcludeParameter)*

type ::=
   ("byte" | "short" | "char" | "int" | "long" | "float" | "double"| "boolean" |
   fullyQualifiedClassName) ("[]")*

wildcardClassName ::= wildcardName ("." wildcardName)*

wildcardName ::= (["*","0"-"9","a"-"z","A"-"Z","$","_"])+
   i.e. a Java identifer (e.g. a package, class, field or method name) with the "*" wildcard allowed
Where archiveQualifier is a relative or absolute archive path name with the "*" wildcard allowed. E.g. "/lib/*.jar" or "myJar0.jar"

ZKM Script stringEncryptionExcludeStatement statement The ZKM Script Language ZKM Script resetStringEncryptionExclusions statement
Zelix KlassMaster - Java Obfuscator