JP2007079916A - Encoding method and its program - Google Patents

Encoding method and its program Download PDF

Info

Publication number
JP2007079916A
JP2007079916A JP2005266608A JP2005266608A JP2007079916A JP 2007079916 A JP2007079916 A JP 2007079916A JP 2005266608 A JP2005266608 A JP 2005266608A JP 2005266608 A JP2005266608 A JP 2005266608A JP 2007079916 A JP2007079916 A JP 2007079916A
Authority
JP
Japan
Prior art keywords
variables
encoding
encoded
program
pieces
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.)
Pending
Application number
JP2005266608A
Other languages
Japanese (ja)
Inventor
Kazuhide Fukushima
和英 福島
Shinsaku Kiyomoto
晋作 清本
Toshiaki Tanaka
俊昭 田中
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 JP2005266608A priority Critical patent/JP2007079916A/en
Publication of JP2007079916A publication Critical patent/JP2007079916A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Storage Device Security (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To provide an encoding method for preventing the deterioration in the calculating efficiency of a whole program and the deterioration in a computable range, and for concealing information included in the program secret. <P>SOLUTION: From a program, n(n is a positive integer which is 2 or more) pieces of variables to be encoded are selected, and m(m is a positive integer and m≥n) pieces of encoding formulas including n pieces of independent encoding functions are defined by using encoding functions constituted of an exclusive logical sum of the selected n pieces of variables and arbitrary constants. The encoding formula constituted of the n pieces of independent encoding functions are calculated about the n pieces of variables to calculate n pieces of encoded variables corresponding to the n pieces of variables, and the n pieces of variables before encoding are expressed by using the n pieces of encoded variables, and the encoded variables are given initial values, and the merge of the continuous substitution instructions is executed. <P>COPYRIGHT: (C)2007,JPO&INPIT

Description

本発明は、プログラム中の複数の変数を排他的論理和を用いて同時に符号化する符号化方法およびそのプログラムに関する。   The present invention relates to an encoding method for encoding a plurality of variables in a program simultaneously using exclusive OR, and the program.

一般に、ソフトウェアには、価値のあるアルゴリズムおよびコンテンツの暗号鍵など、利用者に対して秘密にすべき情報が含まれる場合がある。一方では、ソフトウェアを解析するための技術(RE:Reverse Engineering)が数多く開発されている。このため、これらの技術によりソフトウェアが解析されると、不正者が秘密情報を入手するという脅威が考えられる。この脅威に対し、ソフトウェアの仕様を保ったまま、ソフトウェアの解析を困難にする難読化という技術がある。   In general, software may contain information that should be kept secret from users, such as valuable algorithms and content encryption keys. On the other hand, many techniques (RE: Reverse Engineering) for analyzing software have been developed. For this reason, when software is analyzed by these techniques, there is a threat that an unauthorized person obtains confidential information. For this threat, there is a technique called obfuscation that makes it difficult to analyze software while keeping the software specifications.

このような技術としては、例えば、変数の符号化によるソフトウェアの難読化として、ソースコード中の変数を線形変換により符号化する方法が提案されている(例えば、非特許文献1参照)。この方法では、単一の変数xを線形変換により、変数X(=ax+b)に符号化することで、ソフトウェアの解析を難しくすることを意図するものである。ここでは、線形変換の際に用いる整数a,bが秘密鍵となり、ソースコード中の変数の値や演算を隠蔽することを目的としている。
佐藤他、信学技報、Vol.IT‐2002−49,pp.13−18,Mar.2002“データの符号化と演算子の変換によるプログラムの難読化手法”
As such a technique, 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 (for example, see Non-Patent Document 1). This method is intended to make software analysis difficult by encoding a single variable x into a variable X (= ax + b) by linear transformation. Here, the integers a and b used in the linear conversion become secret keys, and the purpose is to conceal the values of variables and operations in the source code.
Sato et al., IEICE Technical Report, Vol. IT-2002-49, pp. 13-18, Mar. 2002 "Program obfuscation by data encoding and operator conversion"

しかし、上記の非特許文献1に開示された技術によれば、ソースコード中の変数の値や演算を秘匿することはできても、難読化前のソースコードで用いられている変数の個数、ならびに変数間における参照・代入の関係を秘匿することは不可能であった。また、秘密鍵の候補数は少なく、秘密鍵の全数探索による攻撃についても脆弱であると考えられる。さらに、上記の方法は、単一の変数を一次変数により符号化する方式であり、符号化された1つ変数に対して、対応する符号化前の変数が1つ存在する。このため、攻撃者が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. Further, the above method is a method of encoding a single variable with a primary variable, and there is one corresponding variable before encoding for one encoded variable. For this reason, if an attacker can obtain a decoding equation for one variable, there is a problem that the encoding for the variable can be solved.

上記の問題点に対して、プログラムに含まれる複数の変数を同時に符号化する難読化手法も考えられる。この方式の場合、1つの復号式には、符号化された変数が複数存在するため、単一の復号式からは、符号化前の変数と符号化された変数の関係を得ることはできない。このため、攻撃者が1つの変数の復号式を入手したとしても、その変数に対する符号化を解くことはできないという利点がある。   In order to solve the above problem, an obfuscation method that simultaneously encodes a plurality of variables included in a program can be considered. In this method, since there are a plurality of encoded variables in one decoding formula, it is not possible to obtain the relationship between the variables before encoding and the encoded variables from a single decoding formula. For this reason, even if the attacker obtains a decoding equation for one variable, there is an advantage that the encoding for the variable cannot be solved.

しかし、上記の方式では、変数の符号化・復号の演算が複雑であり、難読化を適用することにより、プログラム全体の計算効率が大きく低下し、さらに、符号化による桁上がりが生じるために、計算可能範囲が小さくなる可能性があった。   However, in the above method, the variable encoding / decoding operations are complicated, and by applying obfuscation, the calculation efficiency of the entire program is greatly reduced, and further, carry by encoding occurs. There was a possibility that the calculation range would be small.

本発明は上記事情に鑑みてなされたものであり、プログラム全体の計算効率の低下と計算可能範囲の減少を防止しつつ、プログラムに含まれる秘密情報を秘匿化する符号化方法およびそのプログラムを提供することを目的とする。   The present invention has been made in view of the above circumstances, and provides an encoding method for concealing confidential information included in a program and a program thereof while preventing a decrease in calculation efficiency and a decrease in a computable range of the entire program The purpose is to do.

上記した課題を解決するために本発明は、以下の事項を提案している。
請求項1に係る発明は、プログラム内の複数の変数を符号化する符号化方法であって、前記プログラムから符号化の対象となる変数をn個(nは正の整数)選択する第1のステップと、該選択したn個の変数と任意の定数との排他的論理和からなる符号化関数により、n個の独立した符号化関数を含むm個(mは正の整数であり、m≧n)の符号化式を定義する第2のステップと、該n個の独立な符号化関数からなる符号化式を前記選択したn個の変数について演算し、前記選択したn個の変数に対応した符号化されたm個の変数を求める第3のステップと、前記符号化されたm個の変数を用いて、前記選択したn個の変数を表す第4のステップと、該符号化された変数に初期値を与え、連続する代入命令のマージを実行する第5のステップとを、有することを特徴とする。
In order to solve the above-described problems, the present invention proposes the following matters.
The invention according to claim 1 is an encoding method for encoding a plurality of variables in a program, wherein a first variable for selecting n variables (n is a positive integer) to be encoded is selected from the program. By an encoding function consisting of a step and an exclusive OR of the selected n variables and an arbitrary constant, m including n independent encoding functions (m is a positive integer, m ≧ a second step of defining the encoding expression of n) and an encoding expression composed of the n independent encoding functions for the selected n variables and corresponding to the selected n variables A third step of determining the encoded m variables, a fourth step of representing the selected n variables using the encoded m variables, and the encoded Fifth step of giving initial values to variables and merging successive assignment instructions And characterized in that it has.

請求項2に係る発明は、請求項1に記載の符号化方法について、前記第4のステップが、前記選択したn個の変数に対する代入命令を符号化されたm個の変数に対する代入命令に置き換えるステップと、前記選択したn個の変数のそれぞれを前記第3のステップで求めた符号化されたm個の変数に置き換えるステップと、をさらに有することを特徴とする。   The invention according to claim 2 is the encoding method according to claim 1, wherein the fourth step replaces the assignment instruction for the selected n variables with an assignment instruction for the encoded m variables. And a step of replacing each of the selected n variables with the encoded m variables obtained in the third step.

請求項3に係る発明は、請求項1に記載の符号化方法について、前記第5のステップが、前記符号化された変数にm−n個の自明でない関係式を満たす任意の値を初期値として与えることを特徴とする。  According to a third aspect of the present invention, in the encoding method according to the first aspect, the fifth step sets an initial value as an arbitrary value satisfying mn non-trivial relational expressions in the encoded variable. It is characterized by giving as.

請求項4に係る発明は、プログラム内の複数の変数を符号化する符号化装置に用いられるプログラムであって、前記プログラムを記憶装置に格納し、該格納したプログラムから符号化の対象となる変数をn個(nは正の整数)選択する第1のステップと、該選択したn個の変数と任意の定数との排他的論理和からなる符号化関数により、n個の独立した符号化関数を含むm個(mは正の整数であり、m≧n)の符号化式を定義する第2のステップと、演算装置により該n個の独立な符号化関数からなる符号化式を前記選択したn個の変数について演算し、前記選択したn個の変数に対応した符号化されたm個の変数を求める第3のステップと、前記符号化されたm個の変数を用いて、前記選択したn個の変数を表す第4のステップと、該符号化された変数に初期値を与え、連続する代入命令のマージを実行する第5のステップとを、有することを特徴とする。   The invention according to claim 4 is a program used in an encoding apparatus that encodes a plurality of variables in a program, the program being stored in a storage device, and a variable to be encoded from the stored program N independent encoding functions by a first step of selecting n (n is a positive integer) and an encoding function comprising an exclusive OR of the selected n variables and an arbitrary constant A second step of defining m (m is a positive integer, m ≧ n) encoding formulas including the above, and the encoding formula comprising the n independent encoding functions is selected by the arithmetic unit A third step of calculating the selected n variables and obtaining m encoded variables corresponding to the selected n variables, and using the encoded m variables, the selection A fourth step representing the n variables and the sign Are variables giving initial values to the, and a fifth step of executing a merging assignment consecutive instructions, characterized in that it has.

請求項5に係る発明は、請求項4に記載のプログラムについて、前記第4のステップが、前記選択したn個の変数に対する代入命令を符号化されたm個の変数に対する代入命令に置き換えるステップと、前記選択したn個の変数のそれぞれを前記第3のステップで求めた符号化されたm個の変数に置き換えるステップと、をさらに有することを特徴とする。   The invention according to claim 5 is the program according to claim 4, wherein the fourth step is a step of replacing an assignment instruction for the selected n variables with an assignment instruction for the encoded m variables. And replacing each of the selected n variables with the encoded m variables obtained in the third step.

請求項6に係る発明は、請求項4に記載のプログラムについて、前記第5のステップが、前記符号化された変数にm−n個の自明でない関係式を満たす任意の値を初期値として与えることを特徴とする。   The invention according to claim 6 provides the program according to claim 4, wherein the fifth step gives the encoded variable an arbitrary value satisfying mn non-trivial relational expressions as an initial value. It is characterized by that.

本発明によれば、元のソフトウェア中のn個の変数を、排他的論理和演算により同時にm個の変数に符号化するため、元のソフトウェア中で用いられている変数の個数、変数の初期値、変数が保持する値等を隠蔽することが可能であるという効果がある。また、変数の符号化に伴い、行われる演算も変更されるためプログラムに含まれるアルゴリズムも同時に隠蔽できるという効果がある。   According to the present invention, since n variables in the original software are simultaneously encoded into m variables by exclusive OR operation, the number of variables used in the original software, the initial values of the variables, There is an effect that it is possible to hide values, values held by variables, and the like. In addition, since the operation to be performed is changed as the variables are encoded, the algorithm included in the program can be concealed at the same time.

さらに、本発明によれば、複数の変数を同時に符号化するため、1つの変数の復号式が仮に、入手されたとしても、その変数を復号することはできないという効果がある。また、変数の符号化および復号ともに排他的論理和演算のみで行うことから、実行効率の低下が小さく、排他的論理和の演算が桁上がりを生じない演算であるため、変数の符号化により計算可能な範囲が制限されることがないという効果がある。   Furthermore, according to the present invention, since a plurality of variables are encoded at the same time, even if a decoding expression for one variable is obtained, the variable cannot be decoded. In addition, since encoding and decoding of variables is performed only by exclusive OR operation, the decrease in execution efficiency is small and exclusive OR operation is an operation that does not cause a carry. There is an effect that the possible range is not limited.

以下、図面を用いて本発明の実施形態について説明する。
図1は、本発明の実施形態に係わる符号化方法の概略手順を示すフローチャートである。
本発明の符号化方法は、プログラムから符号化の対象となるn個の変数を選択し、この変数に対して、m個の符号化式を定義し、この符号化式に含まれるn個の独立な式を解いて、n個の復号式を導出する。そして、導出された復号式を用いて、変数命令の符号化を行った後、後処理を行うことを特徴とするものであり、これを実現するために、図1に示されるように、各ステップを順次実行する。以下にステップ毎の詳細手順の説明を行う。
Hereinafter, embodiments of the present invention will be described with reference to the drawings.
FIG. 1 is a flowchart showing a schematic procedure of an encoding method according to an embodiment of the present invention.
In the encoding method of the present invention, n variables to be encoded are selected from a program, m encoding expressions are defined for the variables, and n variables included in the encoding expression are defined. Solve the independent equations to derive n decoding equations. Then, after the variable instruction is encoded using the derived decoding formula, post-processing is performed, and in order to realize this, as shown in FIG. Steps are executed sequentially. The detailed procedure for each step will be described below.

(S1:符号化対象の選択)
まず、プログラムの中から、難読化の対象として符号化を施すn個(nは正の整数)の変数を任意に選択する。この操作で選ばれたn個の変数x_1,x_2…,x_n,とする。
(S2:符号化式の定義)
m個(ただし、mは正の整数であり、なおかつm≧nであるものとする)の復号式E_1、E_2、・・・、E_mを以下の数1のように定義する。ここで、X_1、X_2、・・・、X_mは、符号化された変数である。
(S1: Selection of encoding target)
First, n variables (n is a positive integer) to be encoded are arbitrarily selected as obfuscation targets from the program. Let n variables x_1, x_2..., X_n selected by this operation.
(S2: Definition of encoding formula)
M decoding equations E_1, E_2,..., E_m (where m is a positive integer and m ≧ n) are defined as the following Equation 1. Here, X_1, X_2,..., X_m are encoded variables.

Figure 2007079916
Figure 2007079916

また、符号化関数E_1、E_2、・・・、E_mは、符号化前の変数x_1、x_2、・・・、x_nおよび任意の定数との排他的論理和をとったものである。つまり、復号式E_1は、C_1を定数とすると、数2のようになる。   In addition, the encoding functions E_1, E_2,..., E_m are exclusive ORs of the variables x_1, x_2,. In other words, the decoding equation E_1 is expressed by Equation 2 where C_1 is a constant.

Figure 2007079916
Figure 2007079916

また、m個の符号化関数E_1、E_2、・・・、E_mは任意に定義することが可能であるが、m個の関数のうちn個の関数は独立である必要がある。   In addition, m encoding functions E_1, E_2,..., E_m can be arbitrarily defined, but n functions among m functions need to be independent.

ここで、n個の関数f_1、f_2、・・・、f_nが独立であるとは、関数f_1、f_2、・・・、f_nが従属でないということであり、n個の関数f_1、f_2、・・・、f_nが従属であるということは、f_(i_1)xor f_(i_2)xor ・・・f_(i_k)=Cとなるような正の整数列1≦i_1<i_2<・・・<i_k≦n(1≦k≦n)、および定数Cが存在すると定義する。   Here, the n functions f_1, f_2, ..., f_n are independent means that the functions f_1, f_2, ..., f_n are not subordinate, and the n functions f_1, f_2,. .., that f_n is subordinate means that f_ (i_1) xor f_ (i_2) xor... F_ (i_k) = C is a positive integer sequence 1 ≦ i_1 <i_2 <... <i_k ≦ n (1 ≦ k ≦ n) and the constant C is defined to exist.

上記のような符号化式を用いることにより,プログラムに含まれる変数x_1、x_2、・・・、x_nに対する代入命令を符号化された変数X_1、X_2、・・・、X_mに対する代入命令に置き換えることができる。   By using the above encoding formula, the substitution instruction for the variables x_1, x_2,..., X_n included in the program is replaced with the substitution instruction for the encoded variables X_1, X_2,. Can do.

(S3:復号式の導出)
上記S2で定義した符号化式に含まれるn個の独立な式を、連立方程式と見なし、変数x_1、x_2、・・・、x_nについて解き、以下、数3に示すようなn個の復号式を得る。復号式を用いることにより,プログラムに含まれる変数x_1、x_2、・・・、x_nに対する参照を、符号化された変数X_1、X_2、・・・、X_mに対する参照に置き換えることができる。
(S3: Derivation of decoding formula)
The n independent equations included in the coding equation defined in S2 are regarded as simultaneous equations, solved for variables x_1, x_2,..., X_n, and n decoding equations as shown in Equation 3 below. Get. By using the decoding formula, references to variables x_1, x_2,..., X_n included in the program can be replaced with references to encoded variables X_1, X_2,.

Figure 2007079916
Figure 2007079916

ただし、復号関数D_1、D_2、・・・、D_nは、X_1、X_2、・・・、X_mおよび任意の定数のうちのいくつかの排他的論理和をとったものであり、S2で定義された符号化関数E_1、E_2、・・・、E_mに依存する。この得られたn個の復号式を残りのm−n個の方程式に代入することにより、m−n個の自明でない関係式が得られる。なお、ここで、自明でない関係式とは、符号化された変数X_1、X_2、・・・、X_mが満たすべき関係式である。この関係式を用いると、1つの変数の復号式を2^{m−n}通りに表現することができ、どの変数が復号されているかを特定することを難しくすることができる。   However, the decoding functions D_1, D_2,..., D_n are exclusive ORs of X_1, X_2,..., X_m and any constants, and are defined in S2. Depends on the encoding functions E_1, E_2, ..., E_m. By substituting the obtained n decoding expressions into the remaining mn equations, mn non-obvious relational expressions are obtained. Here, the non-trivial relational expression is a relational expression that the encoded variables X_1, X_2,..., X_m should satisfy. If this relational expression is used, a decoding expression of one variable can be expressed in 2 ^ {mn} ways, and it can be difficult to specify which variable is decoded.

(S4:変数命令の符号化)
プログラムで用いられている符号化前の変数x_1、x_2、・・・、x_n を以下の手順に従って、全て符号化された変数X_1、X_2、・・・、X_m に置き換える。
(S4: Encoding variable instruction)
The uncoded variables x_1, x_2,..., X_n used in the program are replaced with all encoded variables X_1, X_2,.

(a)代入命令の符号化
符号化前の変数x_i に対する代入命令x_i←v を以下、数4に示される符号化された変数X_1、X_2、・・・、X_m に対する代入命令に置き換える。
(A) Encoding of assignment instruction The substitution instruction x_i ← v for the variable x_i before coding is replaced with the substitution instruction for the encoded variables X_1, X_2,.

Figure 2007079916
Figure 2007079916

(b)参照されている変数の符号化
プログラム中で参照されている符号化前の変数x_iをS3で求めた復号式D_i(X_1、X_2、・・・、X_m)で置き換える。
(B) Encoding of referenced variable The uncoded variable x_i referenced in the program is replaced with the decoding equation D_i (X_1, X_2,..., X_m) obtained in S3.

(S5:後処理)
後処理として、符号化された変数に初期値を与える。また、連続する代入命令のマージを行う。
(S5: Post-processing)
As post-processing, an initial value is given to the encoded variable. In addition, continuous assignment instructions are merged.

(a)符号化された変数への初期値代入命令の追加
符号化された変数X_1、X_2、・・・、X_mには、m−n個の自明でない関係式を満たす任意の値を初期値として代入する。
(A) Addition of initial value substitution instruction to encoded variable The encoded variables X_1, X_2,..., X_m have initial values of arbitrary values satisfying mn non-trivial relational expressions. Is assigned as

(b)連続する代入命令のマージ
S4で生成された代入命令の中で、連続しているものをマージする。具体的には、数5のような連続する2命令は、数6のような1つの命令にマージされる。
(B) Merging consecutive assignment instructions Merged assignment instructions generated in S4 are merged. Specifically, two consecutive instructions such as Expression 5 are merged into one instruction such as Expression 6.

Figure 2007079916
Figure 2007079916

Figure 2007079916
Figure 2007079916

以上のS1からS5の処理を繰り返すことによって、プログラムを順次難しくしていくことができる(S6)。   By repeating the processes from S1 to S5, the program can be made difficult sequentially (S6).

上記の処理を図2から図6を用いて、より具体的に説明する。
ここでは、図2に示される1からnまでの和を求めるプログラムの擬似コードを難読化する場合の処理手順を例にとって説明する。
まず、図2に示すプログラムに含まれる2つの変数x、yを符号化の対象として選択する。次に、数7に示す3つの符号化式を定義する。
The above processing will be described more specifically with reference to FIGS.
Here, an example of a processing procedure in the case of obfuscating the pseudo code of the program for calculating the sum from 1 to n shown in FIG. 2 will be described.
First, two variables x and y included in the program shown in FIG. 2 are selected as encoding targets. Next, three encoding expressions shown in Equation 7 are defined.

Figure 2007079916
Figure 2007079916

ここで、X、YおよびZは難読化後のプログラム中で用いられる符号化された変数であり、関数E_1、E_2およびE_3が符号化関数となる。また、符号化関数E_1とE_2とは独立である。   Here, X, Y, and Z are encoded variables used in the obfuscated program, and the functions E_1, E_2, and E_3 are the encoding functions. Also, the encoding functions E_1 and E_2 are independent.

次に、独立な符号化関数を含む2個の連立方程式を、変数x、yについて解く。ここでは、符号化関数E_1とE_2が独立であるので、数7の式(1)と式(2)を連立する。この結果、以下、数8で示す2つの復号式が得られる。なお、数8において、D_1およびD_2は復号関数である。   Next, two simultaneous equations including independent encoding functions are solved for the variables x and y. Here, since the encoding functions E_1 and E_2 are independent, Equations (1) and (2) in Equation 7 are simultaneously provided. As a result, the following two decoding formulas are obtained. In Equation 8, D_1 and D_2 are decoding functions.

Figure 2007079916
Figure 2007079916

また、得られた数8に示す復号式を、復号式の導出に用いられなかった数7の符号化式(3)に代入することにより、以下、数9に示す自明でない関係式が得られる。   Further, by substituting the obtained decoding formula shown in Formula 8 into the coding formula (3) of Formula 7 that was not used to derive the decoding formula, the following non-trivial relational formula shown in Formula 9 is obtained. .

Figure 2007079916
Figure 2007079916

数9に示す自明でない関係式を利用することにより、変数x、yの符号式を以下、数10に示す2通りに表現することができる。   By using the non-trivial relational expression shown in Expression 9, the sign expressions of the variables x and y can be expressed in two ways as shown in Expression 10 below.

Figure 2007079916
Figure 2007079916

次に、プログラムで用いられている元の変数xおよびyを以下の手順で、全て符号化された変数X、YおよびZに置き換える。   Next, the original variables x and y used in the program are replaced with the encoded variables X, Y and Z in the following procedure.

(a)代入命令の符号化
変数xに対する代入命令x←uを以下、数11に示される符号化された代入命令に置き換える。また、変数yに対する代入命令をy←vを以下、数12に示される符号化された代入命令に置き換える。この結果、得られるプログラムの擬似コードを図3に示す。
(A) Encoding of assignment instruction The substitution instruction x ← u for the variable x is replaced with the encoded substitution instruction shown in Expression 11 below. Also, the substitution instruction for the variable y is replaced with the encoded substitution instruction shown in Expression 12 below from y ← v. As a result, pseudo code of the obtained program is shown in FIG.

Figure 2007079916
Figure 2007079916

Figure 2007079916
Figure 2007079916

(b) 参照されている変数の符号化
プログラム中で参照されている変数xおよびyをそれぞれ復号式D_1(X、Y、Z)およびD_2(X、Y、Z)で置き換える。なお、数10に示すように、復号式の表現方法には2通りある。ここでは、任意の表現を選択して置き換える。この結果、得られるプログラムの擬似コードを図4に示す。
(B) Encoding Referenced Variables Variables x and y referenced in the program are replaced with decoding formulas D_1 (X, Y, Z) and D_2 (X, Y, Z), respectively. As shown in Equation 10, there are two methods for expressing the decoding formula. Here, an arbitrary expression is selected and replaced. As a result, pseudo code of the obtained program is shown in FIG.

次に、変数X、YおよびZに自明でない数9を満たす以下の初期値を与える。
X=110250890, Y=−2357829, Z=−2357829
この結果、得られるプログラムの擬似コードを図5に示す。そして、最後に、連続する代入命令のマージを行う。この最終的に得られるプログラムの擬似コードを図6に示す。このようにして、実際の処理においては、プログラムの難読化が実行される。
Next, the following initial values satisfying the non-trivial number 9 are given to the variables X, Y, and Z.
X = 110250890, Y = −2357829, Z = −2357829
As a result, pseudo code of the obtained program is shown in FIG. Finally, continuous assignment instructions are merged. FIG. 6 shows the pseudo code of the finally obtained program. In this way, obfuscation of the program is executed in the actual processing.

ここまで、具体的な事例を用いて説明したが、符号化前のプログラムである図2と符号化後のプログラムである図6とを比較すると、プログラムの本質的な中身を変えることなく、難読化を行い、プログラム内の秘密情報を秘匿化できていることがわかる。   Up to this point, explanations have been made using specific examples. However, comparing FIG. 2 which is a program before encoding and FIG. 6 which is a program after encoding, it is difficult to read without changing the essential contents of the program. It can be seen that the confidential information in the program is concealed.

以上、説明したように、本実施形態においては、元のソフトウェア中で用いられている変数の個数、変数の初期値、変数が保持する値等を隠蔽することが可能である。また、符号化、復号処理がともに排他的論理和演算のみで実行されるため、桁上がりの発生がない。したがって、実行効率の低下が小さく、計算可能な範囲が制限されることもない。   As described above, in the present embodiment, it is possible to hide the number of variables used in the original software, the initial value of the variable, the value held by the variable, and the like. Also, since encoding and decoding processes are executed only by exclusive OR operation, no carry occurs. Therefore, the decrease in execution efficiency is small, and the range that can be calculated is not limited.

なお、本発明によれば、CやJava(登録商標)など高級言語のソースコードから、携帯端末等で利用されているものを含む各種プロセッサの機械語まで、幅広いソフトウェアに適用可能である。   The present invention can be applied to a wide range of software from source codes in high-level languages such as C and Java (registered trademark) to machine languages of various processors including those used in portable terminals and the like.

また、上記した本発明の実施形態は、演算装置、もしくはコンピュータにより実現されるものであり、特に、後者によれば、S1〜S5のそれぞれで実行される手順を含むプログラムをコンピュータ読み取り可能な記録媒体に記録し、この記録媒体に記録されたプログラムをコンピュータに読み込ませ、実行することによって本発明の符号化方法を実現するものである。ここでいうコンピュータとは、OSや周辺機器等のハードウェアを含む。   Further, the above-described embodiment of the present invention is realized by an arithmetic device or a computer. In particular, according to the latter, a computer-readable recording including a program executed in each of S1 to S5. The encoding method of the present invention is realized by recording on a medium and causing a computer to read and execute a program recorded on the recording medium. The computer here includes an OS and hardware such as peripheral devices.

また、「コンピュータ」は、WWWシステムを利用している場合であれば、ホームページ提供環境(あるいは表示環境)も含むものであってもよい。また、「コンピュータ読み取り可能な記録媒体」とは、フレキシブルディスク、光磁気ディスク、ROM、CD−ROM等の可搬媒体、コンピュータシステムに内蔵されるハードディスク等の記憶装置のことをいう。更に、インターネット等のネットワークや電話回線等の通信回線を介してプログラムが送信された場合のシステムやクライアントとなるコンピュータシステム内部の揮発性メモリ(RAM)のように、一定時間プログラムを保持しているものも含むものとする。   In addition, the “computer” may include a homepage providing environment (or display environment) as long as the WWW system is used. The “computer-readable recording medium” refers to a storage device such as a flexible medium, a magneto-optical disk, a portable medium such as a ROM and a CD-ROM, and a hard disk incorporated 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 figure which shows the execution procedure of the encoding method concerning embodiment of this invention. 符号化処理前のプログラムの擬似コードを示す図である。It is a figure which shows the pseudo code of the program before an encoding process. 代入命令の符号化を図2のプログラムに実行した場合の擬似コードを示す図である。FIG. 3 is a diagram illustrating pseudo code when encoding of an assignment instruction is executed in the program of FIG. 2. 参照されている変数の符号化をさらに実行した場合の擬似コードを示す図である。It is a figure which shows the pseudo code at the time of performing further encoding of the variable referred to. 変数に初期値を与えた場合の擬似コードを示す図である。It is a figure which shows the pseudo code at the time of giving an initial value to a variable. すべての符号化処理を実行して最終的に得られる擬似コードを示した図である。It is the figure which showed the pseudo code finally obtained by performing all the encoding processes.

Claims (6)

プログラム内の複数の変数を符号化する符号化方法であって、
前記プログラムから符号化の対象となる変数をn個(nは正の整数)選択する第1のステップと、
該選択したn個の変数と任意の定数との排他的論理和からなる符号化関数により、n個の独立した符号化関数を含むm個(mは正の整数であり、m≧n)の符号化式を定義する第2のステップと、
該n個の独立な符号化関数からなる符号化式を前記選択したn個の変数について演算し、前記選択したn個の変数に対応した符号化されたm個の変数を求める第3のステップと、
前記符号化されたm個の変数を用いて、前記選択したn個の変数を表す第4のステップと、
該符号化された変数に初期値を与え、連続する代入命令のマージを実行する第5のステップとを、
有することを特徴とする符号化方法。
An encoding method for encoding a plurality of variables in a program,
A first step of selecting n variables (n is a positive integer) to be encoded from the program;
By the encoding function consisting of exclusive OR of the selected n variables and an arbitrary constant, m (m is a positive integer and m ≧ n) including n independent encoding functions. A second step of defining an encoding formula;
A third step of calculating an encoding expression comprising the n independent encoding functions for the selected n variables and obtaining m encoded variables corresponding to the selected n variables; When,
A fourth step representing the selected n variables using the encoded m variables;
A fifth step of giving an initial value to the encoded variable and merging successive assignment instructions;
An encoding method comprising:
前記第4のステップが、前記選択したn個の変数に対する代入命令を符号化されたm個の変数に対する代入命令に置き換えるステップと、
前記選択したn個の変数のそれぞれを前記第3のステップで求めた符号化されたm個の変数に置き換えるステップと、
をさらに有することを特徴とする請求項1に記載の符号化方法。
The fourth step replaces the assignment instruction for the selected n variables with an assignment instruction for the encoded m variables;
Replacing each of the selected n variables with the encoded m variables determined in the third step;
The encoding method according to claim 1, further comprising:
前記第5のステップが、前記符号化された変数にm−n個の自明でない関係式を満たす任意の値を初期値として与えることを特徴とする請求項1に記載の符号化方法。   2. The encoding method according to claim 1, wherein the fifth step gives an arbitrary value satisfying mn non-trivial relational expressions as the initial value to the encoded variable. プログラム内の複数の変数を符号化する符号化装置に用いられるプログラムであって、
前記プログラムを記憶装置に格納し、該格納したプログラムから符号化の対象となる変数をn個(nは正の整数)選択する第1のステップと、
該選択したn個の変数と任意の定数との排他的論理和からなる符号化関数により、n個の独立した符号化関数を含むm個(mは正の整数であり、m≧n)の符号化式を定義する第2のステップと、
演算装置により該n個の独立な符号化関数からなる符号化式を前記選択したn個の変数について演算し、前記選択したn個の変数に対応した符号化されたn個の変数を求める第3のステップと、
前記符号化されたn個の変数を用いて、前記選択したn個の変数を表す第4のステップと、
該符号化された変数に初期値を与え、連続する代入命令のマージを実行する第5のステップとを、
をコンピュータに実行させるためのプログラム。
A program used in an encoding device for encoding a plurality of variables in a program,
A first step of storing the program in a storage device and selecting n variables (n is a positive integer) to be encoded from the stored program;
By the encoding function consisting of exclusive OR of the selected n variables and an arbitrary constant, m (m is a positive integer and m ≧ n) including n independent encoding functions. A second step of defining an encoding formula;
An arithmetic operation unit calculates an encoding expression composed of the n independent encoding functions for the selected n variables, and obtains encoded n variables corresponding to the selected n variables. 3 steps,
A fourth step representing the selected n variables using the encoded n variables;
A fifth step of giving an initial value to the encoded variable and merging successive assignment instructions;
A program that causes a computer to execute.
前記第4のステップが、前記選択したn個の変数に対する代入命令を符号化されたm個の変数に対する代入命令に置き換えるステップと、
前記選択したn個の変数のそれぞれを前記第3のステップで求めた符号化されたn個の変数に置き換えるステップと、
をさらに有することを特徴とする請求項4に記載のプログラム。
The fourth step replaces the assignment instruction for the selected n variables with an assignment instruction for the encoded m variables;
Replacing each of the selected n variables with the encoded n variables determined in the third step;
The program according to claim 4, further comprising:
前記第5のステップが、前記符号化された変数にm−n個の自明でない関係式を満たす任意の値を初期値として与えることを特徴とする請求項4に記載のプログラム。
5. The program according to claim 4, wherein the fifth step gives an arbitrary value satisfying mn non-trivial relational expressions as the initial value to the encoded variable.
JP2005266608A 2005-09-14 2005-09-14 Encoding method and its program Pending JP2007079916A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2005266608A JP2007079916A (en) 2005-09-14 2005-09-14 Encoding method and its program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2005266608A JP2007079916A (en) 2005-09-14 2005-09-14 Encoding method and its program

Publications (1)

Publication Number Publication Date
JP2007079916A true JP2007079916A (en) 2007-03-29

Family

ID=37940161

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2005266608A Pending JP2007079916A (en) 2005-09-14 2005-09-14 Encoding method and its program

Country Status (1)

Country Link
JP (1) JP2007079916A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2010262334A (en) * 2009-04-30 2010-11-18 Kddi Corp Device, and method for obfuscating program, and program
JP2014109641A (en) * 2012-11-30 2014-06-12 Kddi Corp Program conversion device and program

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
CSNJ200610050183, 福島 和英,清本 晋作,田中 俊昭, "排他的論理和を利用した変数の符号化による難読化方式", 電子情報通信学会2005年基礎・協会ソサイエティ大会講演論文集, 20050907, p.183, JP *
JPN6010063719, 福島 和英,清本 晋作,田中 俊昭, "排他的論理和を利用した変数の符号化による難読化方式", 電子情報通信学会2005年基礎・協会ソサイエティ大会講演論文集, 20050907, p.183, JP *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2010262334A (en) * 2009-04-30 2010-11-18 Kddi Corp Device, and method for obfuscating program, and program
JP2014109641A (en) * 2012-11-30 2014-06-12 Kddi Corp Program conversion device and program

Similar Documents

Publication Publication Date Title
Muhammad et al. CISSKA-LSB: color image steganography using stego key-directed adaptive LSB substitution method
CN105453481B (en) Calculating equipment including table network
Li et al. A image encryption algorithm based on coexisting multi-attractors in a spherical chaotic system
JP4667800B2 (en) Encoding method and program thereof
Elamir et al. Hybrid image encryption scheme for secure E-health systems
Gao et al. High-performance reversible data hiding in encrypted images with adaptive Huffman code
Elkamchouchi et al. New encryption algorithm for secure image transmission through open network
JP2007156861A (en) Apparatus and method for protecting confidential information, and program
Basak et al. Steganography in color animated image sequence for secret data sharing using secure hash algorithm
JP6499323B2 (en) Calculation with encrypted value
JP2007079916A (en) Encoding method and its program
JP4917860B2 (en) Program obfuscation method and program
JP4675642B2 (en) Program obfuscation apparatus, method and program
KR101440680B1 (en) Homomorphic Encryption and Decryption Method using Chinese Remainder Theorem and apparatus using the same
Gencoglu Embedded image coding using laplace transform for Turkish letters
JP2005049925A (en) Device, program, and method for making program difficult to be read
JP2009086746A (en) Information processor and information processing program
JP5149061B2 (en) Program obfuscation apparatus, program obfuscation method, and program
JP4837506B2 (en) Program obfuscation method and program
JP5627444B2 (en) Software obfuscation device, software obfuscation method and program
JP2007086845A (en) Client server system, method for providing server side program for the system, its server device, and server side program
JP3970856B2 (en) Program obfuscation device, program distribution system, computer program
JP2011209801A (en) Apparatus and method for obfuscating software, and program
JP2017055269A (en) Information processing apparatus and information processing system
JP2008286964A (en) Encryption apparatus, decryption apparatus, encryption method, decryption method and program for stream encryption

Legal Events

Date Code Title Description
RD02 Notification of acceptance of power of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7422

Effective date: 20071015

RD04 Notification of resignation of power of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7424

Effective date: 20071015

A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20080303

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A821

Effective date: 20080304

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20101028

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20101109

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20101221

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A821

Effective date: 20101222

A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20110125