Patent ID: 7757097

Claim:
Method of protecting host application code comprising a plurality of code blocks using a self-protecting code system, the method comprising: preprocessing the host application code using a computer programmed with the self-protecting code system and storing the host application code in a memory accessible by the computer; obfuscating the host application code using the computer programmed with the self-protecting code system; installing a guard in the host application code to protect a client block using the computer programmed with the self-protecting code system, the client block being at least one code block; randomly rearranging the code blocks of the host application code without rearranging the code blocks that have already been protected using the computer programmed with the self-protecting code system; linking the rearranged host application code with other resources to produce a binary executable image using the computer programmed with the self-protecting code system; and patching the binary executable image with data values to be used by the guard using the computer programmed with the self-protecting code system and storing the binary executable image after patching the binary executable image; wherein installing a guard comprises: mapping parameters in a guard template to variables and values in the host application code to create guard code, installing the guard code in the host application code; selecting an expression in the host application code to be modified by the guard; inserting a conditional identity function into the selected expression in the host application code, the conditional identity function including checksum variables and corresponding constant values; rewriting the selected expression to conceal the checksum variables; marking the corresponding constant values to be derived from the checksum variables; and saving a sequence of operations for deriving the corresponding constant values from the checksum variables.