Abstract:
Obfuscation transforms original code into an obfuscated code that is less intelligible, but behaves like the original. In one embodiment, a data sequence describing an obfuscator is processed by a reader who outputs an obfuscator. The data sequence may be stored or transmitted and the obfuscator may be used for code obfuscation. In one embodiment, additional readers are used to create objects associated with the obfuscated code. In one embodiment, a generator produces encrypted files and obfuscated code that can decrypt and encrypt the files.

Description:
BACKGROUND 
       [0001]    Obfuscation transforms original code into an obfuscated code for mitigating reverse engineering, modification, and other attacks on the code. The obfuscated code is less intelligible, but behaves like the original. Various obfuscation techniques have been proposed. A disadvantage of existing obfuscators is that they are not serializable. Serialization involves the formatting of data so that it can be transmitted or stored. Another disadvantage of existing obfuscators is that they do not provide objects associated with the obfuscated code, and therefore do not take full advantage of the benefits of obfuscation. 
       SUMMARY 
       [0002]    Embodiments are provided for code obfuscation. In one embodiment, data is written into a sequence, which may be stored or transmitted over a network, and a reader extracts elements from the sequence to initialize a code obfuscator. The obfuscator may be used for code obfuscation. In one embodiment, an object reader is used to read an object from the sequence, and the object may be associated with the obfuscator. In one embodiment, input is given to a generator that outputs a sequence. An encryption initialized with a key is read from the sequence. An obfuscator initialized to produce code for decrypting cipher texts created with the encryption using the key is also read from the sequence. Data included in the input is encrypted using the encryption and stored in an encrypted file. 
     
    
     
       DRAWINGS 
         [0003]    The following figures illustrate the embodiments by way of example. They do not limit their scope. 
           [0004]      FIG. 1  shows a flow diagram of a method of initializing an obfuscator from serialized data, in accordance with one embodiment. 
           [0005]      FIG. 2  shows a flow diagram of a method of initializing an obfuscator and associated objects from serialized data, in accordance with one embodiment. 
           [0006]      FIG. 3  shows a flow diagram of a method of producing random obfuscated code with corresponding random encryption, in accordance with one embodiment. 
       
    
    
     DETAILED DESCRIPTION 
       [0007]    This section includes detailed examples, particular embodiments, and specific terminology. These are not meant to limit the scope. They are intended to provide clear and through understanding, cover alternatives, modifications, and equivalents. 
         [0008]    Obfuscation is a transformation from code in one domain to another code in the same or another domain. The transformed code is intended to be less intelligible than the original code, while preserving the original code behavior. The obfuscation may or may not require the original code in order to produce transformed code. In cryptography, encryption provides data confidentiality and signatures provide data integrity. Signcryption provides both. An object implemented using software or hardware can represent any logic, including obfuscation, encryption, signatures, and signcryption. Any object can be serialized. 
         [0009]    Serialization involves the formatting of data so that it can be transmitted or stored. The logic writing the data is called a writer and the logic reading the data is called a reader. The serialized data is called a sequence. A sequence may have a physical representation, such as a memory, a file, a network connection, and so on. The writer or the reader can be internal or external to the logic of the serialized object. The writer and the reader may be in physically different locations. The data may be prepended with a type. The type may be used to select or verify a reader. More than one reader may exist for a given type, and readers, even if referring to the same type, can output objects of any kind. Writers and readers can be recursive. For example, if object A contains object B, then the output of a writer for A may include the output of a writer for B, and a reader for A may use a reader for B. An object can represent anything, such as an integer, an obfuscator, an encryption scheme, and so on. 
         [0010]      FIG. 1  shows a flow diagram of a method of initializing an obfuscator from serialized data, in accordance with one embodiment. Input data  100  is provided to a writer  102  of a given type. The writer outputs a sequence  104  containing the type followed by the data. For example, the type may be AES, representing the encryption algorithm AES (Advanced Encryption Standard), and the data may be an array of bytes representing a key. An obfuscator reader  106  for the type reads the data and outputs an obfuscator  108  initialized with the data. For example, an obfuscator reader for AES may read an array of bytes representing a key, and output an obfuscator that has been initialized to produce obfuscated code for decrypting cipher texts created with AES encryption using the key. Any obfuscator reader  106  for the type can be used. For example, the reader may output an obfuscator that has been initialized to produce obfuscated code for encrypting plaintexts with AES encryption using the key. 
         [0011]    The input data may include elements of different types and may be further processed by the writer. For example, if the data includes an encryption algorithm and a byte array representing a key for the encryption algorithm, then the writer may use the encryption algorithm to determine the length of the key, and the length may be written into the sequence along with the key. 
         [0012]    The writer and the obfuscator reader may be operated on physically different devices, by different entities, and at different times. 
         [0013]      FIG. 2  shows a flow diagram of a method of initializing an obfuscator and associated objects from serialized data, in accordance with one embodiment. A sequence  104  representing data of a given type is provided as input to an obfuscator reader  106  and an object reader  200 . The object reader can return an object of any kind. The obfuscator reader reads the data from the sequence, initializes an obfuscator  108 , and outputs the obfuscator. The object reader reads the data from the sequence, initializes an object  202 , and outputs the object. 
         [0014]    To illustrate, suppose that the sequence contains a type and data, the type being AES and the data being an array of bytes representing a key, and suppose that the obfuscator reader outputs an obfuscator that has been initialized to produce obfuscated code for decrypting cipher texts created with AES encryption using the key. Then, the object reader may output an object initialized to encrypt plaintexts with AES encryption using the key. 
         [0015]    The sequence may contain elements not used by the object reader or the obfuscator reader or both. Also, the readers can be invoked in any order. If a reader modifies the sequence and such changes are not desirable, then a copy of the original sequence can be used to restore the sequence. Also, a plurality of object readers may be used, and a plurality of objects may be outputted 
         [0016]      FIG. 3  shows a flow diagram of a method of producing random obfuscated code with corresponding random encryption, in accordance with one embodiment. Input  300  is provided to a generator  302  who generates a sequence  104  that is read by an encryption reader  304 . The encryption reader outputs an encryption  306 . An encrypted file  308  is produced using the encryption and data contained in the input. An obfuscator reader  106  also reads the sequence and outputs an obfuscator  108  initialized to produce obfuscated code  310  for decrypting cipher texts created with the encryption. The obfuscator outputs the obfuscated code. 
         [0017]    The encryption reader can be replaced with any reader for any object suitable for the application of the method, such as a signature or a signcryption, or any other algorithm. The generator may use random values and may be invoked repeatedly. Obfuscated code may require compilation, which may be performed locally or at a different device. Executable obfuscated code and encrypted files may be executed or stored. Alternatively, they can be requested and transmitted over a network. 
         [0018]    The specific embodiments and specific terminology used above should not be construed as limiting the scope of the embodiments. These details have been presented for purposes of illustration and are not intended to be exhaustive. Many modifications and uses are possible. The scope of the embodiments is defined by the Claims appended hereto and their equivalents.