# US 12,113,899 B2 · On demand code decryption

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 12,113,899 B2
- Document ID: US12113899B2
- Status: Granted
- Kind: B2
- Application number: 17/723,998
- Filed: 2022-04-19
- Published: 2022-11-10
- Granted: 2024-10-08
- Earliest claimed: 2016-06-29
- Assignees: Nagravision Sarl
- Applicants: Nagravision Sàrl
- Inventors: Laurent Dore; Eric Piret; Yasser Belaidi; Brecht Wyseur
- Web page: https://patentgrep.com/patent/US12113899B2

## CPC

- H04L 9/32: including means for verifying the identity or authority of a user of the system {or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials}
- G06F 21/14: against software analysis or reverse engineering, e.g. by obfuscation
- G06F 21/56: Computer malware detection or handling, e.g. anti-virus arrangements
- G06F 21/602: {Providing cryptographic facilities or services}
- G06F 2221/033: Test or assess software
- H04L: TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION (arrangements common to telegraphic and telephonic communication H04M)
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A system and a method for protecting code are provided. Extraction of code to be protected takes place during an object-to-object transformation and that code is replaced with fake binary code. The extracted code to be protected may then be encrypted or otherwise obscured and stored in a separate region of an object file. A prior source-to-source file transformation can be provided to isolate and mark the code to be protected, and to inject additional source code to handle later decryption.

## Claims

### Claim 1

A method of protecting code comprising:
identifying code to be protected in an input object file;
extracting the identified code to be protected from the input object file;
deleting the identified code from the input object file;
replacing the identified code with fake junk code to generate a first output object file, the fake junk code being non-randomized code, the first output object file including markers identifying the fake junk code; and
injecting the identified code into a second output object file,
such that decryption is avoided in a compilation process and wherein the identified code is encrypted or obscured prior to injection into the second output object file.

### Claim 2 (depends on 1)

The method according to claim 1, further comprising consolidating the first output object file and the second output object file into a final object file.

### Claim 3 (depends on 1)

The method according to claim 1, further comprising:
identifying relocation directions within the input object file; and
excluding the relocation directions from replacement by the fake junk code.

### Claim 4 (depends on 1)

The method according to claim 1, wherein the fake junk code is selected to resemble real code.

### Claim 5 (depends on 1)

The method according to claim 1, further comprising encrypting the identified code to be protected.

### Claim 6 (depends on 1)

The method according to claim 1, wherein the identifying identifies the code to be protected in the input object file using the markers.

### Claim 7 (depends on 6)

The method according to claim 6, wherein the markers result from the code to be protected being marked in an input source file.

### Claim 8 (depends on 1)

The method according to claim 1, wherein the replacing replaces the identified code with the fake junk code within the markers in the input object file.

### Claim 9

A system for protecting code, the system comprising:
processing circuitry that carries out an object-to-object file transformation by being configured to:
identify code to be protected in an input object file,
extract the identified code to be protected from the input object file,
delete the identified code from the input object file,
replace the identified code with fake junk code in the input object file to generate a first output object file, the fake junk code being non-randomized code, the first output object file including markers identifying the fake junk code, and
inject the identified code into a second output object file,
such that decryption is avoided in a compilation process and wherein the identified code is encrypted or obscured prior to injection into the second output object file.

### Claim 10 (depends on 9)

The system according to claim 9, wherein the processing circuitry is further configured to consolidate the first output object file and the second output object file in to a final object file.

### Claim 11 (depends on 9)

The system according to claim 9, wherein to perform the object-to-object transformation, the processing circuitry is further configured to:
identify relocation directions within the input object file; and
exclude the relocation directions from replacement by the fake junk code.

### Claim 12 (depends on 9)

The system according to claim 9, wherein the fake junk code is selected to resemble real code.

### Claim 13 (depends on 9)

The system according to claim 9, wherein to perform the object-to-object transformation, the processing circuitry is further configured to encrypt the identified code to be protected.
