JP4837506B2 - Program obfuscation method and program - Google Patents

Program obfuscation method and program Download PDF

Info

Publication number
JP4837506B2
JP4837506B2 JP2006255944A JP2006255944A JP4837506B2 JP 4837506 B2 JP4837506 B2 JP 4837506B2 JP 2006255944 A JP2006255944 A JP 2006255944A JP 2006255944 A JP2006255944 A JP 2006255944A JP 4837506 B2 JP4837506 B2 JP 4837506B2
Authority
JP
Japan
Prior art keywords
program
control variable
blocks
control
encoding
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
JP2006255944A
Other languages
Japanese (ja)
Other versions
JP2008077400A (en
Inventor
和英 福島
晋作 清本
俊昭 田中
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
KDDI Corp
Original Assignee
KDDI Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by KDDI Corp filed Critical KDDI Corp
Priority to JP2006255944A priority Critical patent/JP4837506B2/en
Publication of JP2008077400A publication Critical patent/JP2008077400A/en
Application granted granted Critical
Publication of JP4837506B2 publication Critical patent/JP4837506B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Description

本発明は、プログラムに含まれるアルゴリズムの解析を困難にするためのプログラム難読化方法およびプログラムに関する。   The present invention relates to a program obfuscation method and a program for making it difficult to analyze an algorithm included in the program.

一般に、ソフトウェアには、価値のあるアルゴリズムおよびコンテンツの暗号鍵等、利用者に対して秘密にすべき情報が含まれる場合がある。一方で、ソフトウェアを解析するための技術(RE:Reverse Engineering)も数多く開発されているのが現状である。このため、これらの技術によりソフトウェアが解析されると、不正者に秘密情報が入手されるという脅威が考えられる。   In general, software may include information that should be kept secret from users, such as valuable algorithms and content encryption keys. On the other hand, many technologies (RE: Reverse Engineering) for analyzing software have been developed. For this reason, when software is analyzed by these techniques, there is a threat that secret information is obtained by unauthorized persons.

こうした脅威に対し、ソフトウェアの仕様を保ったまま、ソフトウェアの解析を困難にする難読化という技術がある。例えば、変数の符号化によるソフトウェアの難読化として、ソースコード中の変数を線形変換により符号化する方法が提案されている(例えば、非特許文献1参照。)。この方法では、単一の変数xを線形変換により、変数X(=ax+b)を符号化することで、ソフトウェアの解析を難しくすることを意図するものであり、ここでは、線形変換の際に用いる整数a,bが秘密鍵となる。また、この方法では、ソースコード中の変数の値や演算を隠蔽することを目的としている。   For such threats, there is a technique called obfuscation that makes software analysis difficult while maintaining software specifications. For example, as a software obfuscation by encoding a variable, a method of encoding a variable in a source code by linear transformation has been proposed (see, for example, Non-Patent Document 1). This method is intended to make software analysis difficult by encoding a variable X (= ax + b) by linear transformation of a single variable x, and is used here for linear transformation. The integers a and b are secret keys. In addition, this method aims at hiding the values and operations of variables in the source code.

また、元のプログラムで用いられている変数の個数、ならびに当該変数間の参照・代入関係を秘匿し、かつ、秘密鍵の候補数を多くして耐性の高いプログラムの難読化を実現する技術も開示されている(例えば、特許文献1参照。)。
佐藤他、信学技報、Vol.IT−2002−49,pp.13−18,Mar.2002“データの符号化と演算子の変換によるプログラムの難読化手法” 特開2006−79347号公報
There is also a technology to conceal the number of variables used in the original program and the reference / substitution relationship between the variables, and to increase the number of secret key candidates to obfuscate highly resistant programs. (For example, refer to Patent Document 1).
Sato et al., IEICE Technical Report, Vol. IT-2002-49, pp. 13-18, Mar. 2002 "Program obfuscation by data encoding and operator conversion" JP 2006-79347 A

しかしながら、上記の非特許文献1に開示された技術によれば、ソースコード中の変数の値や演算を秘匿することはできても、難読化前のソースコードで用いられている変数の個数、ならびに変数間における参照・代入の関係を秘匿することは不可能であった。また、秘密鍵の候補数は少なく、秘密鍵の全数探索による攻撃についても脆弱であると考えられる。   However, according to the technique disclosed in Non-Patent Document 1 above, the number of variables used in the source code before obfuscation can be concealed, even though the values and operations of the variables in the source code can be concealed. In addition, it was impossible to conceal the relationship of reference and substitution between variables. In addition, the number of secret key candidates is small, and it is considered vulnerable to attacks by searching for all secret keys.

また、上記の特許文献1に開示された技術においては、プログラムに含まれる整数値を符号化の対象としているため、算術演算をほとんど含まないプログラムや実数型のみの変数のみが使われているプログラムに対しては、効果が小さいという問題がある。   Further, in the technique disclosed in Patent Document 1, since an integer value included in a program is a target for encoding, a program that hardly includes arithmetic operations or a program that uses only real type variables. There is a problem that the effect is small.

そこで、本発明は、上述の課題に鑑みてなされたものであり、整数値に限らず、その適用範囲が広いプログラム難読化方法およびプログラムを提供することを目的とする。   Therefore, the present invention has been made in view of the above-described problems, and an object thereof is to provide a program obfuscation method and program that are not limited to integer values but have a wide application range.

本発明は、上記の課題を解決するために以下の事項を提案している。   The present invention proposes the following items in order to solve the above problems.

(1)本発明は、プログラムに含まれるアルゴリズムの解析を困難にするためのプログラム難読化方法であって、読み込み手段によりプログラムを読み込み、読み込んだプログラムのソースコードに含まれる連続した命令を、切り出し手段によりブロック単位に切り出して、設定手段により該プログラムの実行順序を管理する制御変数を設定する第1のステップと、前記設定手段により設定された前記制御変数を、符号化手段により符号化する第2のステップと、を備えたことを特徴とするプログラム難読化方法を提案している。 (1) The present invention is a program obfuscation method for making it difficult to analyze an algorithm included in a program. The program is read by reading means , and continuous instructions included in the source code of the read program are cut out. A first step of setting a control variable for managing the execution order of the program by a setting unit; and a step of encoding the control variable set by the setting unit by an encoding unit . And a program obfuscation method characterized by comprising two steps.

この発明によれば、プログラムの制御構造を平滑化し、プログラムの実行順序を管理する制御変数を設定して、制御変数を符号化する。したがって、これにより、整数値に限らず、制御変数についても符号化の対象とすることができる。   According to the present invention, the control structure of the program is smoothed, the control variable for managing the execution order of the program is set, and the control variable is encoded. Therefore, not only integer values but also control variables can be encoded.

(2)本発明は、(1)のプログラム難読化方法について、前記第1のステップは、前記読み込み手段によりプログラムを読み込み、読み込んだプログラムのソースコードに含まれる連続した命令を、前記切り出し手段によりブロック単位に切り出すステップと、前記切り出し手段により切り出したブロックの実行順序を制御するための制御変数を、前記設定手段により設定するステップと、前記切り出し手段により切り出したブロックのそれぞれに、制御変数がとるべき値を、割り当て手段により割当てるステップと、switch文またはif文を用いて、前記切り出し手段により切り出したブロックを、並列手段により並列に並べるステップと、前記設定手段により設定された前記制御変数の値を次に実行されるブロックに割当てられた制御変数値に書き換える処理を、付加手段によりそれぞれ切り出したブロックの最後に付加するステップと、を含むことを特徴とするプログラム難読化方法を提案している。 (2) The present invention relates to the program obfuscation method of (1), wherein the first step reads the program by the reading means , and uses the cutout means to execute consecutive instructions included in the source code of the read program. a step of cutting into blocks, a control variable for controlling the execution order of the blocks cut out by the cutout unit, a step of setting by the setting unit, in each of the blocks cut out by the cutout unit takes control variables A step of assigning a power value by the assigning means, a step of arranging the blocks cut out by the cut- out means in parallel using a switch statement or an if statement, and a value of the control variable set by the setting means Assigned to the next block to be executed The process of rewriting the control variable values, proposes a step of adding the last block cut respectively, a program obfuscation method characterized by including the additional means.

この発明によれば、プログラムの制御構造を平滑化し、プログラムの実行順序を管理する制御変数を設定する方法として、ソースコードに含まれる連続した命令を、ブロック単位に切り出し、切り出したブロックの実行順序を制御するための制御変数を設定する。そして、切り出したブロックのそれぞれに、制御変数がとるべき値を割当て、switch文またはif文を用いて、切り出したブロックを並列に並べ、制御変数の値を次に実行されるブロックに割当てられた制御変数値に書き換える処理をそれぞれ切り出したブロックの最後に付加する。   According to the present invention, as a method for setting a control variable for smoothing the control structure of a program and managing the execution order of the program, continuous instructions included in the source code are cut out in block units, and the execution order of the cut out blocks Set control variables to control Then, a value to be taken by the control variable is assigned to each of the cut out blocks, and the cut out blocks are arranged in parallel using a switch statement or an if statement, and the value of the control variable is assigned to the block to be executed next. The process of rewriting to the control variable value is added to the end of each extracted block.

(3)本発明は、(1)または(2)のプログラム難読化方法について、前記第2のステップは、前記符号化手段により符号化を施すn個(但し、nは正整数)の制御変数を、選択手段により任意に選択するステップと、生成手段によりm×nの行列(但し、mは、m≧nの正整数)およびm次元の任意のベクトルを生成するステップと、前記生成手段により生成した行列およびベクトルを変換鍵として、前記選択手段により選択された前記n個の制御変数を線形変換して同時にm個の制御変数を、前記符号化手段により符号化するステップと、を含むことを特徴とするプログラム難読化方法を提案している。 (3) The present invention relates to the program obfuscation method of (1) or (2), wherein the second step includes n control variables (where n is a positive integer) that is encoded by the encoding means. Are arbitrarily selected by the selecting means, an m × n matrix (where m is a positive integer satisfying m ≧ n) and an arbitrary m-dimensional vector are generated by the generating means , and the generating means the resulting matrix and vector as the conversion key, a linear transformation to the m control variables simultaneously the n control variables selected by the selecting means, to include the steps of encoding by said encoding means We propose a program obfuscation method characterized by

この発明によれば、符号化を施すn個(但し、nは正整数)の変数を任意に選択し、m×nの行列(但し、mは、m≧nの正整数)およびm次元の任意のベクトルを生成する。そして、生成した行列およびベクトルを変換鍵としてn個の変数を線形変換して同時にm個の制御変数を符号化する。   According to the present invention, n variables (where n is a positive integer) to be encoded are arbitrarily selected, an m × n matrix (where m is a positive integer satisfying m ≧ n), and an m-dimensional variable. Generate an arbitrary vector. Then, using the generated matrix and vector as a conversion key, n variables are linearly converted and m control variables are encoded simultaneously.

したがって、プログラム中のn個の制御変数を線形変換により同時にm個の制御変数に符号化するため、プログラム中で用いられている制御変数の個数を秘匿すると同時に、制御変数間の参照および代入関係も秘匿することができる。また、変換鍵として行列およびベクトルを用いるため鍵の候補数を多くすることができる。このことにより、耐性の高いソフトウェアの難読化を実現することができる。   Therefore, since n control variables in the program are simultaneously encoded into m control variables by linear transformation, the number of control variables used in the program is concealed, and at the same time, the reference and substitution relationship between the control variables Can also be concealed. In addition, since the matrix and the vector are used as the conversion key, the number of key candidates can be increased. Thereby, obfuscation of highly resistant software can be realized.

(4)本発明は、プログラムに含まれるアルゴリズムの解析を困難にするためのプログラム難読化方法をコンピュータに実行させるためのプログラムであって、プログラムを読み込み、読み込んだプログラムのソースコードに含まれる連続した命令をブロック単位に切り出して、該プログラムの実行順序を管理する制御変数を設定する第1のステップと、前記制御変数を符号化する第2のステップと、をコンピュータに実行させることを特徴とするプログラムを提案している。 (4) The present invention is a program for causing a computer to execute a program obfuscation method for making it difficult to analyze an algorithm included in the program. The program is read, and the continuous code included in the source code of the read program the instruction cut into blocks, and wherein a first step of setting a control variable for managing the execution sequence of the program, a second step of encoding the control variables, that causes a computer to execute the Propose a program to do.

この発明によれば、プログラムの制御構造を平滑化し、プログラムの実行順序を管理する制御変数を設定して、制御変数を符号化する。したがって、これにより、整数値に限らず、制御変数についても符号化の対象とすることができ、こうした処理をプログラムにより自動的に実行することができる。   According to the present invention, the control structure of the program is smoothed, the control variable for managing the execution order of the program is set, and the control variable is encoded. Therefore, not only an integer value but also a control variable can be a target of encoding, and such processing can be automatically executed by a program.

(5)本発明は、(4)のプログラムについて、前記第1のステップは、ソースコードに含まれる連続した命令を、ブロック単位に切り出すステップと、該切り出したブロックの実行順序を制御するための制御変数を宣言するステップと、前記切り出したブロックのそれぞれに、制御変数がとるべき値を割当てるステップと、switch文またはif文を用いて、前記切り出したブロックを並列に並べるステップと、前記制御変数の値を次に実行されるブロックに割当てられた制御変数値に書き換える処理をそれぞれ切り出したブロックの最後に付加するステップと、を含むことを特徴とするプログラムを提案している。 (5) According to the present invention, in the program of (4), the first step is a step of cutting out consecutive instructions included in the source code in units of blocks, and controlling the execution order of the cut out blocks Declaring a control variable, assigning a value to be taken by the control variable to each of the cut-out blocks, arranging the cut-out blocks in parallel using a switch statement or an if statement, and the control variable proposes a program characterized by including a step of adding value then rewritten to run controlled variable value assigned to the block is processed to the the end of each cut-out block.

この発明によれば、プログラムの制御構造を平滑化し、プログラムの実行順序を管理する制御変数を設定する方法として、ソースコードに含まれる連続した命令を、ブロック単位に切り出し、切り出したブロックの実行順序を制御するための制御変数を設定する。そして、切り出したブロックのそれぞれに、制御変数がとるべき値を割当て、switch文またはif文を用いて、切り出したブロックを並列に並べ、制御変数の値を次に実行されるブロックに割当てられた制御変数値に書き換える処理をそれぞれ切り出したブロックの最後に付加する。   According to the present invention, as a method for setting a control variable for smoothing the control structure of a program and managing the execution order of the program, continuous instructions included in the source code are cut out in block units, and the execution order of the cut out blocks Set control variables to control Then, a value to be taken by the control variable is assigned to each of the cut out blocks, and the cut out blocks are arranged in parallel using a switch statement or an if statement, and the value of the control variable is assigned to the block to be executed next. The process of rewriting to the control variable value is added to the end of each extracted block.

(6)本発明は、(4)または(5)のプログラムについて、前記第2のステップは、符号化を施すn個(但し、nは正整数)の制御変数を任意に選択する第ステップと、m×nの行列(但し、mは、m≧nの正整数)およびm次元の任意のベクトルを生成するステップと、前記生成した行列およびベクトルを変換鍵として前記n個の制御変数を線形変換して同時にm個の制御変数を符号化するステップと、を含むことを特徴とするプログラムを提案している。 (6) According to the present invention, in the program of (4) or (5), the second step is a first step of arbitrarily selecting n (n is a positive integer) control variables to be encoded. , M × n matrix (where m is a positive integer satisfying m ≧ n) and an arbitrary vector of m dimensions, and the n control variables are linearly converted using the generated matrix and vector as a conversion key. conversion to propose a program which comprises the steps of encoding the m control variables simultaneously.

この発明によれば、符号化を施すn個(但し、nは正整数)の変数を任意に選択し、m×nの行列(但し、mは、m≧nの正整数)およびm次元の任意のベクトルを生成する。そして、生成した行列およびベクトルを変換鍵としてn個の変数を線形変換して同時にm個の制御変数を符号化する。   According to the present invention, n variables (where n is a positive integer) to be encoded are arbitrarily selected, an m × n matrix (where m is a positive integer satisfying m ≧ n), and an m-dimensional variable. Generate an arbitrary vector. Then, using the generated matrix and vector as a conversion key, n variables are linearly converted and m control variables are encoded simultaneously.

したがって、プログラム中のn個の制御変数を線形変換により同時にm個の制御変数に符号化するため、プログラム中で用いられている制御変数の個数を秘匿すると同時に、制御変数間の参照および代入関係も秘匿することができ、こうした処理をプログラムにより自動的に実行することができる。また、変換鍵として行列およびベクトルを用いるため鍵の候補数を多くすることができる。このことにより、耐性の高いソフトウェアの難読化を実現することができる。   Therefore, since n control variables in the program are simultaneously encoded into m control variables by linear transformation, the number of control variables used in the program is concealed, and at the same time, the reference and substitution relationship between the control variables Can be concealed, and such processing can be automatically executed by a program. In addition, since the matrix and the vector are used as the conversion key, the number of key candidates can be increased. Thereby, obfuscation of highly resistant software can be realized.

本発明によれば、プログラムに制御変数を導入して、その変数を符号化の対象とすることから、直接符号化できる変数を含まないプログラムに対しても、耐性の高いソフトウェアの難読化を実現することができるという効果がある。   According to the present invention, since a control variable is introduced into a program and the variable is a target for encoding, obfuscation of highly resistant software is realized even for a program that does not include a variable that can be directly encoded. There is an effect that can be done.

また、本発明の技術を用いることにより、各種サービスにおけるセキュリティを向上させることができる。具体的には、Java(登録商標)やBrew(登録商標)等のソフトウェアに関する著作権を保護するとともに、不正にプログラムの解析を試みる不正者への情報漏えいを的確に防止できるという効果がある。   Moreover, the security in various services can be improved by using the technique of the present invention. Specifically, there are effects of protecting copyrights related to software such as Java (registered trademark) and Brew (registered trademark) and preventing information leakage to unauthorized persons who attempt to analyze programs illegally.

以下、本発明の実施形態について、図面を用いて、詳細に説明する。
なお、本実施形態における構成要素は適宜、既存の構成要素等との置き換えが可能であり、また、他の既存の構成要素との組合せを含む様々なバリエーションが可能である。したがって、本実施形態の記載をもって、特許請求の範囲に記載された発明の内容を限定するものではない。
Hereinafter, embodiments of the present invention will be described in detail with reference to the drawings.
Note that the constituent elements in the present embodiment can be appropriately replaced with existing constituent elements and the like, and various variations including combinations with other existing constituent elements are possible. Therefore, the description of the present embodiment does not limit the contents of the invention described in the claims.

<処理フロー>
図1、図3から図7を用いて、本発明の実施形態に係るプログラム難読化方法の一般的な処理について説明する。
<Processing flow>
A general process of the program obfuscation method according to the embodiment of the present invention will be described with reference to FIGS. 1 and 3 to 7.

まず、図3に示すように、ソースコード(プログラム)に含まれる連続する命令を、ブロック(図中、B1;、B2;、B3;)として切り出す(ステップS101)。次に、ブロックの実行順番を制御するための制御変数(図4に示す「int c」)を宣言する(ステップS102)。   First, as shown in FIG. 3, continuous instructions included in the source code (program) are cut out as blocks (B1 ;, B2 ;, B3; in the figure) (step S101). Next, a control variable (“int c” shown in FIG. 4) for controlling the execution order of the blocks is declared (step S102).

更に、各ブロック(図3のB1;、B2;、B3;)に、制御変数がとるべき値(図5に示すB1;に対しては「5」、B2;に対しては「9」、B3;に対しては「4」)を割り当てる(ステップS103)。   Further, in each block (B1; B2; B3; in FIG. 3), a value to be taken by the control variable (“5” for B1; shown in FIG. 5; “9” for B2; (3) is assigned to B3; (step S103).

次に、図6に示すように、switch文またはif文を用いて、各ブロックを並列に並べる(ステップS104)。なお、条件分岐命令の判定文では、制御変数の値と、ステップS103において各ブロックに割り当てられた値が等しいかどうかが判定され、制御変数の値と等しい値が割り当てられたブロックの先頭に制御が移る。   Next, as shown in FIG. 6, the blocks are arranged in parallel using a switch statement or an if statement (step S104). In the decision statement of the conditional branch instruction, it is determined whether the value of the control variable is equal to the value assigned to each block in step S103, and control is performed at the head of the block to which the value equal to the value of the control variable is assigned. Move.

更に、図7に示すように、制御変数の値を次に実行されるブロックに割り当てられた値に書き換える処理(図7に示す、ブロックB1;におけるc=9、ブロックB2;におけるc=4)を各ブロックの最後に追加する(ステップS105)。そして、制御変数を符号化する処理を行う(ステップS106)。   Further, as shown in FIG. 7, the process of rewriting the value of the control variable to the value assigned to the block to be executed next (c = 9 in block B1; shown in FIG. 7, c = 4 in block B2;). Is added to the end of each block (step S105). And the process which encodes a control variable is performed (step S106).

<制御変数の符号化処理>
次に、図2を用いて、制御変数の符号化処理について説明する。
<Control variable encoding process>
Next, control variable encoding processing will be described with reference to FIG.

まず、プログラムの中から、難読化の対象として符号化を施すn個(nは整数数)の制御変数を任意に選択する。この操作で選ばれたn個の制御変数をx1,x2・・・,xnとする(ステップS201)。   First, n control variables (n is an integer number) to be encoded are arbitrarily selected as obfuscation targets from the program. The n control variables selected by this operation are set to x1, x2,..., Xn (step S201).

次に、m×n型行列A、m次元ベクトルcを任意に生成し、これらを秘密鍵とする(ステップS202)。但し、mは、m≧nなる正整数である。   Next, an m × n matrix A and an m-dimensional vector c are arbitrarily generated and set as secret keys (step S202). However, m is a positive integer such that m ≧ n.

更に、生成した行列Aおよびベクトルcを用いて以下の変換式(1)を定義する(ステップS203)。 Furthermore, the following conversion equation (1) is defined using the generated matrix A and vector c (step S203).

Figure 0004837506
Figure 0004837506

ここで、X1,X2,・・・,Xmは、難読化後のソフトウェアで用いられる符号化されたm個の制御変数である。   Here, X1, X2,..., Xm are encoded m control variables used in the obfuscated software.

上記した変換式をn個の制御変数x1,x2,・・・,xnに関するm本の連立方程式と見なし、それぞれの制御変数について上記連立方程式を解く。その結果、それぞれの制御変数x1,x2,・・・,xnに関して以下の(2)で示す復号式が成立する(ステップS204)。   The above conversion equations are regarded as m simultaneous equations for n control variables x1, x2,..., Xn, and the simultaneous equations are solved for each control variable. As a result, the decoding equation shown in the following (2) is established for each control variable x1, x2,..., Xn (step S204).

Figure 0004837506
Figure 0004837506

この復号式により、元のプログラム中のそれぞれの制御変数x1,x2,・・・,xnの値を復号化された制御変数X1,X2,・・・Xmを用いて表すことが可能になる。
この手順では、m本の連立方程式から、n個の制御変数x1,x2・・・xnの値を求める。このため、符号化された制御変数X1,X2,・・・Xmの間には、m−n個の自明でない以下の関係式(3)が成り立つことになる。
With this decryption formula, the values of the respective control variables x1, x2,..., Xn in the original program can be expressed using the decrypted control variables X1, X2,.
In this procedure, the values of n control variables x1, x2,... Xn are obtained from m simultaneous equations. Therefore, mn non-obvious relational expressions (3) are established between the encoded control variables X1, X2,... Xm.

Figure 0004837506
Figure 0004837506

この自明でない関係式を用いることにより、上記の復号式における各制御変数X1,X2,・・・,Xmの係数を可変とすることができる。   By using this non-obvious relational expression, the coefficients of the control variables X1, X2,..., Xm in the above decoding formula can be made variable.

次に、プログラム中で用いられている制御変数x1,x2,・・・,xnを以下の規則に従い、符号化された制御変数X1,X2,・・・Xmで置き換える(ステップS205)。具体的には、アルゴリズム中の制御変数xiに対する代入命令xi←uを、以下の演算式(4)で示されるように、制御変数X1,X2,・・・XMに対する代入命令に置き換える。   Next, the control variables x1, x2,..., Xn used in the program are replaced with encoded control variables X1, X2,... Xm according to the following rules (step S205). Specifically, the assignment instruction xi ← u for the control variable xi in the algorithm is replaced with an assignment instruction for the control variables X1, X2,... XM as shown by the following arithmetic expression (4).

Figure 0004837506
Figure 0004837506

この代入命令が実行されると、符号化されたm個全ての制御変数X1,X2,・・・Xmが、同時に変更される。つまり、プログラム中で参照されている制御変数xjを、ステップS204の処理で求めた復号式xj(X1,X2,・・・Xm)を用いて、制御変数X1,X2,・・・Xmの式に置き換える。   When this assignment instruction is executed, all the encoded m control variables X1, X2,... Xm are changed simultaneously. That is, the control variables x1, X2,... Xm are expressed by using the decryption expressions xj (X1, X2,... Xm) obtained in the process of step S204 for the control variables xj referenced in the program. Replace with

後処理として、符号化された制御変数X1,X2,・・・,Xmへの初期値を与える。また、連続する制御変数X1,X2,・・・Xmへの代入命令のマージを行う(ステップS206)。   As post-processing, initial values for the encoded control variables X1, X2,. Further, the assignment instruction to the continuous control variables X1, X2,... Xm is merged (step S206).

具体的には、上記したステップS205の処理により、プログラム中の制御変数x1,x2,・・・,xnは、全てX1,X2,・・・,Xmで置き換えられる。これらの制御変数の初期値は、自明でない関係式f1,f2,・・・fm−nを満たす任意の整数とする。   Specifically, the control variables x1, x2,..., Xn in the program are all replaced with X1, X2,. The initial values of these control variables are arbitrary integers that satisfy non-trivial relational expressions f1, f2,... Fm-n.

また、ステップS205の処理により生成された、符号化された制御変数X1,X2,・・・Xmへの代入命令の中で、連続するものをマージする。   In addition, the consecutive assignment instructions into the encoded control variables X1, X2,... Xm generated by the processing in step S205 are merged.

プログラムの解析が十分に困難であると判定されれば、難読化処理を終了する(ステップS207の「YES」)。一方、さらなる難読化が必要であると判定されれば(ステップS207の「NO」)、ステップS201からステップS206までの処理を繰り返し実行する。   If it is determined that the program analysis is sufficiently difficult, the obfuscation process is terminated (“YES” in step S207). On the other hand, if it is determined that further obfuscation is necessary (“NO” in step S207), the processing from step S201 to step S206 is repeatedly executed.

<具体的なプログラムを例示した処理の流れ>
以下、具体的なプログラムを例示し、本実施形態に係るプログラム難読化方法の処理の流れについて、図8から図14を用いて説明する。なお、図8は、本実施形態に係るプログラム難読化方法により処理を行う元のソースコードを示している。
<Flow of processing exemplifying specific program>
Hereinafter, a specific program is illustrated and the flow of processing of the program obfuscation method according to the present embodiment will be described with reference to FIGS. 8 to 14. FIG. 8 shows the original source code that is processed by the program obfuscation method according to the present embodiment.

まず、図8に示す処理前のソースコードについて、連続する命令を図9に示すように、「/*ブロック1*/」、「/*ブロック2*/」、「/*ブロック3*/」として分割する処理を行う。   First, with respect to the source code before processing shown in FIG. 8, as shown in FIG. 9, consecutive instructions are “/ * block 1 * /”, “/ * block 2 * /”, “/ * block 3 * /”. The process of dividing as follows.

次に、図10に示すように、「int c1、c2;」という制御変数の宣言を追加する処理を行う。更に、図11に示すように、「/*ブロック1*/」には、「/*c1=5;c2=3*/」、「/*ブロック2*/」には、「/*c1=9;c2=2*/」、「/*ブロック3*/」には、「/*c1=4;c2=6*/」という各ブロックにおいて、制御変数が取るべき値を割り付ける。そして、図12に示すように、if文を用いて、各ブロックを並列に並べることにより、制御構造を平坦化したソースコードを作成する。   Next, as shown in FIG. 10, a process of adding a control variable declaration “int c1, c2;” is performed. Further, as shown in FIG. 11, “/ * block 1 * /” includes “/ * c1 = 5; c2 = 3 * /”, and “/ * block 2 * /” includes “/ * c1 = 9; c2 = 2 * / ”and“ / * block 3 * / ”are assigned values to be taken by the control variables in the respective blocks“ / * c1 = 4; c2 = 6 * / ”. Then, as shown in FIG. 12, by using the “if” statement, the blocks are arranged in parallel to create a source code in which the control structure is flattened.

そして、図13に示すように、各ブロックの末尾に、「c1=c2=3;」および「c1+=2;」、「c1=c1+c2+1;」および「c2++;」、「c1==c2;」および「c2==9;」、「c1=c2++;」および「c2――;」という制御変数の値を次に実行されるブロックに割当てられた値に書き換える処理を追加したソースコードを作成する。そして、上記の符号化処理(図2参照)を行うことにより、図14に示す制御変数c1、c2をd1、d2、d3に符号化したソースコードが得られる。   Then, as shown in FIG. 13, at the end of each block, “c1 = c2 = 3;” and “c1 + = 2;”, “c1 = c1 + c2 + 1;” and “c2 +++;”, “c1 == c2;” And source code to which processing for rewriting the values of the control variables “c2 == 9;”, “c1 = c2 +++;” and “c2—;” into values assigned to the next block to be executed is created. . Then, by performing the above encoding process (see FIG. 2), a source code in which the control variables c1 and c2 shown in FIG. 14 are encoded into d1, d2, and d3 is obtained.

以上、説明したように、本実施形態によれば、プログラムの制御構造を平滑化し、プログラムの実行順序を管理する制御変数を設定して、制御変数を符号化する。したがって、これにより、整数値に限らず、制御変数についても符号化の対象とすることができる。   As described above, according to the present embodiment, the control variable of the program is smoothed, the control variable for managing the execution order of the program is set, and the control variable is encoded. Therefore, not only integer values but also control variables can be encoded.

なお、説明した本実施形態は、演算装置もしくはコンピュータにより実現されるものであり、特に、コンピュータにおいては、上述のステップS101からステップS106で実行される処理およびその手順をコンピュータ読み取り可能な記録媒体に記録し、この記録媒体に記録されたプログラムをコンピュータに読み込ませ、実行することによって本発明のプログラム難読化方法を実現することができる。ここでいうコンピュータとは、OSや周辺装置等のハードウェアを含む。   The described embodiment is realized by an arithmetic device or a computer. In particular, in a computer, the processing executed in steps S101 to S106 and the procedure thereof are stored in a computer-readable recording medium. The program obfuscation method of the present invention can be realized by recording, reading the program recorded on the recording medium into a computer, and executing the program. Here, the computer includes hardware such as an OS and peripheral devices.

また、「コンピュータ」は、WWW(World Wide Web)システムを利用している場合であれば、ホームページ提供環境(あるいは表示環境)も含むものとする。また、「コンピュータ読み取り可能な記録媒体」フレキシブルディスク、光磁気ディスク、ROM、CD−ROM等の可搬媒体、コンピュータシステムに内蔵されるハードディスク等の記憶装置のことをいう。更に、インターネット等のネットワークや電話回線等の通信回線を介してプログラムが送信された場合のシステムやクライアントとなるコンピュータシステム内部の揮発性メモリ(RAM)のように、一定時間プログラムを保持しているものも含むものとする。   Further, the “computer” includes a homepage providing environment (or display environment) if a WWW (World Wide Web) system is used. Also, “computer-readable recording medium” refers to a portable medium such as a flexible disk, a magneto-optical disk, a ROM, a CD-ROM, or a storage device such as a hard disk built in a computer system. Furthermore, the program is held for a certain period of time, such as a volatile memory (RAM) in a computer system that becomes a system or a client when the program is transmitted via a network such as the Internet or a communication line such as a telephone line. Including things.

また、上記プログラムは、このプログラムを記憶装置等に格納したコンピュータシステムから、伝送媒体を介して、あるいは、伝送媒体中の伝送波により他のコンピュータシステムに伝送されてもよい。ここで、プログラムを伝送する「伝送媒体」は、インターネット等のネットワーク(通信網)や電話回線等の通信回線(通信線)のように情報を伝送する機能を有する媒体のことをいう。   The program may be transmitted from a computer system storing the program in a storage device or the like to another computer system via a transmission medium or by a transmission wave in the transmission medium. Here, the “transmission medium” for transmitting the program refers to a medium having a function of transmitting information, such as a network (communication network) such as the Internet or a communication line (communication line) such as a telephone line.

また、上記プログラムは、前述した機能の一部を実現するためのものであっても良い。更に、前述した機能をコンピュータシステムにすでに記録されているプログラムとの組合せで実現できるもの、いわゆる差分ファイル(差分プログラム)であっても良い。   The program may be for realizing a part of the functions described above. Furthermore, what can implement | achieve the function mentioned above in combination with the program already recorded on the computer system, and what is called a difference file (difference program) may be sufficient.

以上、この発明の実施形態につき、図面を参照して詳述してきたが、具体的な構成はこの実施形態に限られるものではなく、この発明の要旨を逸脱しない範囲の設計等も含まれる。   The embodiments of the present invention have been described in detail with reference to the drawings. However, the specific configuration is not limited to the embodiments, and includes designs and the like that do not depart from the gist of the present invention.

本実施形態に係る処理フローである。It is a processing flow concerning this embodiment. 本実施形態に係る制御変数の符号化処理を示すフローである。It is a flow which shows the encoding process of the control variable which concerns on this embodiment. ソースコードに含まれる連続する命令をブロックとして切り出す処理の概念図である。It is a conceptual diagram of the process which cuts out the continuous instruction contained in a source code as a block. ソースコードの実行順序を制御するための制御変数を宣言する処理の概念図である。It is a conceptual diagram of the process which declares the control variable for controlling the execution order of a source code. 各ブロックに制御変数として取るべき値を割当てる処理の概念図である。It is a conceptual diagram of the process which assigns the value which should be taken as a control variable to each block. switch文またはif文を用いて、各ブロックを並列に並べる処理の概念図である。It is a conceptual diagram of the process which arranges each block in parallel using a switch sentence or an if sentence. 制御変数の値を次に実行されるブロックに割当てられた値に書き換える処理を各ブロックの最後に追加する処理の概念図である。It is a conceptual diagram of the process which adds the process which rewrites the value of a control variable to the value allocated to the block performed next at the end of each block. 本実施形態に係る処理を行う前のソースコードを示す図である。It is a figure which shows the source code before performing the process which concerns on this embodiment. 連続する命令をブロック1、2、3に分割したソースコードを示す図である。It is a figure which shows the source code which divided | segmented the continuous instruction into blocks 1, 2, and 3. FIG. 制御変数の宣言を追加したソースコードを示す図である。It is a figure which shows the source code which added the declaration of the control variable. 各ブロックに制御変数の取るべき値を割当てたソースコードを示す図である。It is a figure which shows the source code which assigned the value which should take a control variable to each block. 制御構造を平坦化したソースコードを示す図である。It is a figure which shows the source code which planarized the control structure. 制御変数の値を次に実行されるブロックに割当てられた値に書き換える処理を各ブロックの末尾に追加したソースコードを示す図である。It is a figure which shows the source code which added the process which rewrites the value of a control variable to the value allocated to the block performed next at the end of each block. 制御変数を符号化したソースコードを示す図である。It is a figure which shows the source code which encoded the control variable.

Claims (6)

プログラムに含まれるアルゴリズムの解析を困難にするためのプログラム難読化方法であって、
読み込み手段によりプログラムを読み込み、読み込んだプログラムのソースコードに含まれる連続した命令を、切り出し手段によりブロック単位に切り出して、設定手段により該プログラムの実行順序を管理する制御変数を設定する第1のステップと、
前記設定手段により設定された前記制御変数を、符号化手段により符号化する第2のステップと、
を備えたことを特徴とするプログラム難読化方法。
A program obfuscation method for making it difficult to analyze an algorithm included in a program,
A first step of reading a program by the reading means, cutting out consecutive instructions included in the source code of the read program into blocks by the cutting means, and setting a control variable for managing the execution order of the program by the setting means When,
A second step of encoding the control variable set by the setting means by an encoding means ;
A program obfuscation method characterized by comprising:
前記第1のステップは、
前記読み込み手段によりプログラムを読み込み、読み込んだプログラムのソースコードに含まれる連続した命令を、前記切り出し手段によりブロック単位に切り出すステップと、
前記切り出し手段により切り出したブロックの実行順序を制御するための制御変数を、前記設定手段により設定するステップと、
前記切り出し手段により切り出したブロックのそれぞれに、制御変数がとるべき値を、割り当て手段により割当てるステップと、
switch文またはif文を用いて、前記切り出し手段により切り出したブロックを、並列手段により並列に並べるステップと、
前記設定手段により設定された前記制御変数の値を次に実行されるブロックに割当てられた制御変数値に書き換える処理を、付加手段によりそれぞれ切り出したブロックの最後に付加するステップと、
含むことを特徴とする請求項1に記載のプログラム難読化方法。
The first step includes
Reading the program by the reading means, and cutting out consecutive instructions included in the source code of the read program into blocks by the cutting means ;
Setting a control variable for controlling the execution order of the blocks cut out by the cutout means by the setting means ;
Assigning a value to be taken by the control variable to each of the blocks cut out by the cut- out means by the assigning means ;
using the switch statement or the if statement, arranging the blocks cut out by the cut- out means in parallel by the parallel means ;
Adding the process of rewriting the value of the control variable set by the setting means to the control variable value assigned to the block to be executed next, at the end of each block cut out by the adding means ;
The program obfuscation method according to claim 1, comprising :
前記第2のステップは、
前記符号化手段により符号化を施すn個(但し、nは正整数)の制御変数を、選択手段により任意に選択するステップと、
生成手段によりm×nの行列(但し、mは、m≧nの正整数)およびm次元の任意のベクトルを生成するステップと、
前記生成手段により生成した行列およびベクトルを変換鍵として、前記選択手段により選択された前記n個の制御変数を線形変換して同時にm個の制御変数を、前記符号化手段により符号化するステップと、
含むことを特徴とする請求項1または請求項2に記載のプログラム難読化方法。
The second step includes
A step of arbitrarily selecting n control variables (where n is a positive integer) to be encoded by the encoding means ;
Generating an m × n matrix (where m is a positive integer satisfying m ≧ n) and an m-dimensional arbitrary vector by a generating unit;
Linearly transforming the n control variables selected by the selection unit using the matrix and vector generated by the generation unit as conversion keys, and simultaneously encoding m control variables by the encoding unit ; ,
The program obfuscation method according to claim 1 or 2, characterized by comprising :
プログラムに含まれるアルゴリズムの解析を困難にするためのプログラム難読化方法をコンピュータに実行させるためのプログラムであって、
プログラムを読み込み、読み込んだプログラムのソースコードに含まれる連続した命令をブロック単位に切り出して、該プログラムの実行順序を管理する制御変数を設定する第1のステップと、
前記制御変数を符号化する第2のステップと、
コンピュータに実行させることを特徴とするプログラム。
A program for causing a computer to execute a program obfuscation method for making it difficult to analyze an algorithm included in the program,
A first step of reading a program, cutting out consecutive instructions included in the source code of the read program in units of blocks, and setting a control variable for managing the execution order of the program;
A second step of encoding the control variable;
A program that causes a computer to execute .
前記第1のステップは、
ソースコードに含まれる連続した命令を、ブロック単位に切り出すステップと、
該切り出したブロックの実行順序を制御するための制御変数を宣言するステップと、
前記切り出したブロックのそれぞれに、制御変数がとるべき値を割当てるステップと、
switch文またはif文を用いて、前記切り出したブロックを並列に並べるステップと、
前記制御変数の値を次に実行されるブロックに割当てられた制御変数値に書き換える処理をそれぞれ切り出したブロックの最後に付加するステップと、
を含むことを特徴とする請求項4に記載のプログラム。
The first step includes
Cutting out consecutive instructions included in the source code into blocks;
Declaring a control variable for controlling the execution order of the extracted blocks;
Assigning a value to be taken by the control variable to each of the extracted blocks;
arranging the cut-out blocks in parallel using a switch statement or an if statement;
Adding a process of rewriting the value of the control variable to a control variable value assigned to a block to be executed next, at the end of each cut block;
The program according to claim 4, comprising:
前記第2のステップは、
符号化を施すn個(但し、nは正整数)の制御変数を任意に選択する第ステップと、
m×nの行列(但し、mは、m≧nの正整数)およびm次元の任意のベクトルを生成するステップと、
前記生成した行列およびベクトルを変換鍵として前記n個の制御変数を線形変換して同時にm個の制御変数を符号化するステップと、
含むことを特徴とする請求項4または請求項5に記載のプログラム。
The second step includes
A first step of arbitrarily selecting n (n is a positive integer) control variables to be encoded;
generating an m × n matrix (where m is a positive integer of m ≧ n) and an arbitrary vector of m dimensions;
Linearly transforming the n control variables using the generated matrix and vector as a conversion key and simultaneously encoding m control variables;
6. The program according to claim 4 or 5, characterized by comprising:
JP2006255944A 2006-09-21 2006-09-21 Program obfuscation method and program Active JP4837506B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2006255944A JP4837506B2 (en) 2006-09-21 2006-09-21 Program obfuscation method and program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2006255944A JP4837506B2 (en) 2006-09-21 2006-09-21 Program obfuscation method and program

Publications (2)

Publication Number Publication Date
JP2008077400A JP2008077400A (en) 2008-04-03
JP4837506B2 true JP4837506B2 (en) 2011-12-14

Family

ID=39349386

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2006255944A Active JP4837506B2 (en) 2006-09-21 2006-09-21 Program obfuscation method and program

Country Status (1)

Country Link
JP (1) JP4837506B2 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2011150560A (en) * 2010-01-22 2011-08-04 Kddi Corp System and method for protecting software, software conversion method and program

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2002333992A (en) * 2001-05-09 2002-11-22 Denso Corp Execution order inspecting device and its program
JP2003337629A (en) * 2002-05-18 2003-11-28 Mitsuko Miyaji Program obfuscation method and device
JP2004185064A (en) * 2002-11-29 2004-07-02 Matsushita Electric Ind Co Ltd Device and method for making program difficult to read
JP4568489B2 (en) * 2003-09-11 2010-10-27 富士通株式会社 Program protection method, program protection program, and program protection apparatus
JP4667800B2 (en) * 2004-09-09 2011-04-13 Kddi株式会社 Encoding method and program thereof

Also Published As

Publication number Publication date
JP2008077400A (en) 2008-04-03

Similar Documents

Publication Publication Date Title
Behera et al. Different obfuscation techniques for code protection
Madou et al. Software protection through dynamic code mutation
CN102047220B (en) System and method for generating white-box implementations of software applications
RU2676454C2 (en) Computing device comprising table network
JP5167348B2 (en) Software encryption method, software decryption method, software encryption device, and software decryption device
Senthilnathan et al. An enhancing reversible data hiding for secured data using shuffle block key encryption and histogram bit shifting in cloud environment
JP2019523492A (en) Device and method for performing obfuscated arithmetic
CN111512307A (en) Compiling apparatus and method
JP4667800B2 (en) Encoding method and program thereof
US10331896B2 (en) Method of protecting secret data when used in a cryptographic algorithm
JP4917860B2 (en) Program obfuscation method and program
Raja et al. Opposition based joint grey wolf-whale optimization algorithm based attribute based encryption in secure wireless communication
JP4837506B2 (en) Program obfuscation method and program
JP4675642B2 (en) Program obfuscation apparatus, method and program
JP5149061B2 (en) Program obfuscation apparatus, program obfuscation method, and program
JP2007079916A (en) Encoding method and its program
JP5627444B2 (en) Software obfuscation device, software obfuscation method and program
JP3970856B2 (en) Program obfuscation device, program distribution system, computer program
KR101625018B1 (en) Data encryption apparatus and method, computing device and communication device employing the same
JP2007086845A (en) Client server system, method for providing server side program for the system, its server device, and server side program
JP5378055B2 (en) Program obfuscation apparatus, program obfuscation method, and program
JP5149062B2 (en) Program obfuscation apparatus, program obfuscation method, and program
JP2012032900A (en) Unauthorized distribution detection device, method and program of software
KR20230018688A (en) White-box encryption apparatus of lightweight block cipher pipo
Lee et al. The construction of secure mobile agents via evaluating encrypted functions

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20090223

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20110720

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20110726

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20110902

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20110920

A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20110928

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20141007

Year of fee payment: 3

R150 Certificate of patent or registration of utility model

Ref document number: 4837506

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

Free format text: JAPANESE INTERMEDIATE CODE: R150