JP6917150B2 - Code protection methods and computer programs - Google Patents

Code protection methods and computer programs Download PDF

Info

Publication number
JP6917150B2
JP6917150B2 JP2017016730A JP2017016730A JP6917150B2 JP 6917150 B2 JP6917150 B2 JP 6917150B2 JP 2017016730 A JP2017016730 A JP 2017016730A JP 2017016730 A JP2017016730 A JP 2017016730A JP 6917150 B2 JP6917150 B2 JP 6917150B2
Authority
JP
Japan
Prior art keywords
file
code
protection module
function
instruction
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
JP2017016730A
Other languages
Japanese (ja)
Other versions
JP2017142791A (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.)
Line Corp
Original Assignee
Line 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 Line Corp filed Critical Line Corp
Publication of JP2017142791A publication Critical patent/JP2017142791A/en
Application granted granted Critical
Publication of JP6917150B2 publication Critical patent/JP6917150B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Description

以下の説明は、コード保護方法およびコンピュータプログラム等に関する。 The following description relates to code protection methods, computer programs, and the like.

中間言語(Intermediate LanguageまたはInterLanguage:IL)とは、ソース言語プログラムをコンパイラによって翻訳して目的言語プログラムを生成するとき、その中間段階として経るようになる言語を意味する。例えば、高級言語プログラムをアセンブリ言語に変えた後、それをアセンブルして機械語プログラムを生成しようとするとき、中間のアセンブリ言語が中間言語となるのである。 An intermediate language (Intermediate Language or InterLanguage: IL) means a language that goes through as an intermediate stage when a source language program is translated by a compiler to generate a target language program. For example, after changing a high-level language program to assembly language, when trying to assemble it to generate a machine language program, the intermediate assembly language becomes the intermediate language.

韓国公開特許第10−2007−0067953号は、モバイルプラットフォームの中間言語変換装置およびその方法に関するものであって、CまたはC++言語で開発されたモバイルプラットフォームソースコードを移動通信端末機のインタプリタで要求する中間言語コードに変換するC/C++コンパイラと、中間言語コードを移動通信端末機のインタプリタで実行されるフォーマットに変換する中間言語アセンブラについて開示している。 Korean Publication No. 10-2007-0067953 relates to an intermediate language converter for mobile platforms and methods thereof, and requires a mobile platform source code developed in C or C ++ language as an interpreter for a mobile communication terminal. A C / C ++ compiler that converts an intermediate language code and an intermediate language assembler that converts an intermediate language code into a format executed by an interpreter of a mobile communication terminal are disclosed.

このような中間言語への変換を経るアプリケーションのコードは、その特性上、逆コンパイル(decompile)に対する耐性が弱い。例えば、ユニティ(Unity)のようなツールを通じてシーシャープ(C−sharp:C#)のようなプログラミング言語で製作されたアプリケーションのコードは、DLL(Dynamic Linking Library)のような中間言語の形態にコンパイルされてクライアントの電子機器に提供され、電子機器のフレームワークで実行されることがある。このとき、このような中間言語の特性にしたがってDLLを逆コンパイルしてコードを修正した後、再びDLLにコンパイルすることが可能であるため、アプリケーションを偽・変造することができるという問題が存在する。 The application code that undergoes such conversion to an intermediate language is weakly resistant to decompilation due to its characteristics. For example, the code of an application written in a programming language like C-sharp (C #) through a tool like Unity is compiled into an intermediate language form like DLL (Dynamic Linking Library). It may be provided to the client's electronic device and executed in the electronic device framework. At this time, since it is possible to decompile the DLL according to such characteristics of the intermediate language, modify the code, and then compile it to the DLL again, there is a problem that the application can be forged or altered. ..

このような偽・変造を防ぐために中間言語形態のファイルを単純に暗号化してクライアントに提供する場合には、クライアントの電子機器は暗号化されたファイルを実行することができなくなり、アプリケーションの実行が不可能となる。かといって、暗号化されたファイルを復号化するための手段(または情報、一例として復号化キー)がクライアントに提供されると、再びアプリケーションの偽・変造問題がそのまま現れてしまうようになる。 If the intermediate language form file is simply encrypted and provided to the client in order to prevent such falsification / alteration, the client's electronic device will not be able to execute the encrypted file, and the application will not be executed. It becomes impossible. However, when the client is provided with the means (or information, for example, the decryption key) for decrypting the encrypted file, the problem of fake / tampering with the application will appear again.

また、分析が難しいバイナリコードで実現された保護モジュールファイルをアプリケーションのパッケージに追加してコードを保護する従来技術も存在する。しかし、このような従来技術は、パッケージから保護モジュールファイルを除去する方式によってコードに対する偽・変造が可能になるという問題がある。 There is also a prior art that protects the code by adding a protection module file realized in binary code that is difficult to analyze to the application package. However, such a conventional technique has a problem that the code can be forged or altered by a method of removing the protection module file from the package.

さらに、ファイルを暗号化する従来技術では、保護モジュールがロードされる前にファイルを少しずつ操作することができるため、この場合には保護モジュールによる探知が不可能となる。言い換えれば、保護モジュールを迂回してファイルを偽・変造することができてしまうという問題がある。 Further, in the conventional technique of encrypting a file, the file can be manipulated little by little before the protection module is loaded, so that the protection module cannot detect the file in this case. In other words, there is a problem that the file can be forged or altered by bypassing the protection module.

保護対象となるアプリケーションのコードと保護モジュールをカップリングして提供することにより、保護モジュールなしではアプリケーションが実行されないようにして保護モジュールの除去を防ぐことができる、コード保護方法およびシステムを提供する。 By coupling the code of the application to be protected with the protection module, it provides a code protection method and system that can prevent the application from running without the protection module and prevent the protection module from being removed.

全体コードに対して保護を適用するのではなく、必ず必要なコードに対してのみ保護モジュールとのカップリングを処理して保護対象コードを選択することができる、コード保護方法およびシステムを提供する。 It provides a code protection method and system that allows protection to be selected by processing the coupling with the protection module only for the code that is absolutely necessary, rather than applying protection to the entire code.

保護モジュールとカップリングされたコードを暗号化し、該当のコードの実行時点にだけ暗号化されたコードを復号化し、復号化されたコードを再び暗号化することにより、アプリケーションの実行時点でも保護モジュールとカップリングされたコードのうちの少なくとも一部が常に暗号化されているようにコードを保護することができる、コード保護方法およびシステムを提供する。 By encrypting the code coupled with the protection module, decrypting the encrypted code only at the time of execution of the corresponding code, and re-encrypting the decrypted code, the protection module can be used even at the time of application execution. Provide code protection methods and systems that can protect the code so that at least part of the coupled code is always encrypted.

保護対象となるアプリケーションのコードを保護モジュールに移動させて保護することにより、アプリケーションのコードを静的に分析できないようにすることができ、保護モジュールに移動されたアプリケーションのコードが最初に実行されるときに復号化され、または周期的に再暗号化されるため、動的な分析に対しても保護を提供することができる、コード保護方法およびシステムを提供する。 By moving the code of the protected application to the protection module to protect it, the code of the application cannot be analyzed statically, and the code of the application moved to the protection module is executed first. It provides code protection methods and systems that can provide protection against dynamic analysis as they are sometimes decrypted or periodically re-encrypted.

ランタイムの瞬間ごとに保護モジュールに格納されたアプリケーションのコードが変わるため、特に動的分析のためにメモリダンプなどを通じた分析方法を無力化させることができる、コード保護方法およびシステムを提供する。 Since the code of the application stored in the protection module changes at each moment of runtime, it provides a code protection method and system that can disable the analysis method such as memory dump, especially for dynamic analysis.

パッケージファイルでライブラリファイルを変換するか除去して利用者がライブラリファイルに直接アクセスできないようにし、暗号化されたライブラリファイルを含む保護モジュールをパッケージファイルに追加し、保護モジュールを通じて暗号化されたライブラリファイルにアクセスするようにすることにより、保護モジュールの除去や迂回によってファイルを偽・変造することを防ぐことができる、コード保護方法およびシステムを提供する。 Convert or remove the library file with the package file to prevent users from accessing the library file directly, add a protection module containing the encrypted library file to the package file, and make it into the library file encrypted through the protection module. By providing access, it provides code protection methods and systems that can prevent falsification or alteration of files by removing or bypassing protection modules.

コンピュータによって実行されるコード保護方法であって、前記コンピュータのプロセッサで、前記コンピュータの格納装置にアプリケーションのためのファイルが含まれたパッケージファイルを格納する段階、前記プロセッサで、前記ファイルのうち実行コードが含まれたファイルで選別される保護対象メソッドまたは関数を変形するか、または前記ファイルのうちライブラリファイルを変換または除去する段階、前記変形された保護対象メソッドまたは関数を復元するための第1保護モジュールファイルまたは前記ライブラリファイルを復元するための第2保護モジュールファイルを前記パッケージファイルに追加して前記パッケージファイルを再生成する段階、および前記再生成されたパッケージファイルをネットワークを介して提供する段階を含む、コード保護方法を提供する。 A code protection method executed by a computer, in which the processor of the computer stores a package file containing a file for an application in the storage device of the computer, and the processor executes the execution code of the file. The step of transforming a protected method or function that is screened in a file that contains, or converting or removing a library file from the file, first protection to restore the transformed protected method or function. The stage of adding the module file or the second protection module file for restoring the library file to the package file to regenerate the package file, and the stage of providing the regenerated package file via the network. Provide code protection methods, including.

一側によると、前記プロセッサで、前記ファイルのうち実行コードが含まれたファイルで選別される保護対象メソッドまたは関数を変形する段階は、前記ファイルのうち実行コードが含まれたファイルで保護対象メソッドまたは関数を選別して前記第1保護モジュールファイルに複製する段階、前記選別された保護対象メソッドまたは関数が含むコードを前記実行コードに変形させる段階、および前記第1保護モジュールファイルに複製された保護対象メソッドまたは関数を見つけ出すための検索コードを前記実行コードに追加する段階を含んでもよい。 According to one side, the step of transforming a protected method or function in the processor that is selected by the file containing the executable code in the file is the protected method in the file containing the executable code. Alternatively, the stage of selecting a function and replicating it to the first protection module file, the stage of transforming the code contained in the selected protected method or function into the execution code, and the protection duplicated in the first protection module file. It may include a step of adding a search code for finding the target method or function to the execution code.

他の側面によると、前記保護対象メソッドまたは関数を選別して前記第1保護モジュールファイルに複製する段階は、前記実行コードの全体メソッドまたは関数のうちから、予め設定された機能のメソッドまたは関数を前記保護対象メソッドまたは関数として選別するか、または前記アプリケーションの開発者によって入力された情報に対応するメソッドまたは関数を前記保護対象メソッドまたは関数として選別してもよい。 According to another aspect, the step of selecting the protected method or function and replicating it to the first protection module file is to select a method or function of a preset function from the whole method or function of the execution code. It may be screened as the protected method or function, or the method or function corresponding to the information entered by the developer of the application may be screened as the protected method or function.

また他の側面によると、前記選別された保護対象メソッドまたは関数が含むコードを前記実行コードに変形させる段階は、前記コードのインストラクションを、認識が不可能なアンノウンインストラクション(unknown instruction)または任意のランダムなアドレスにジャンプ(jump)するインストラクションに変形してもよい。 According to another aspect, the step of transforming the code contained in the selected protected method or function into the executable code transforms the instruction of the code into an unrecognizable instruction or any random instruction. It may be transformed into an instruction that jumps to an address.

また他の側面によると、前記第1保護モジュールファイルに複製された保護対象メソッドまたは関数を見つけ出すための検索コードを前記実行コードに追加する段階は、前記選別された保護対象メソッドまたは関数にゲートウェイを呼び出すための第1コードを追加し、前記実行コードに前記ゲートウェイとして前記第1保護モジュールファイルに複製された保護対象メソッドまたは関数のメモリアドレスを得るための第2コードを追加してもよい。 According to another aspect, the step of adding the search code for finding the protected method or function duplicated in the first protection module file to the execution code is to provide a gateway to the selected protected method or function. The first code for calling may be added, and the second code for obtaining the memory address of the protected method or function duplicated in the first protection module file as the gateway may be added to the execution code.

また他の側面によると、前記メモリアドレスは、前記アプリケーションがインストールされて実行される電子機器でのプログラムカウンタ(Program Counter:PC)と前記第1保護モジュールファイルによって提供される相手アドレス値を因子とし、前記第2コードにしたがって計算されてもよい。 According to another aspect, the memory address is a factor of the program counter (Program Counter: PC) in the electronic device in which the application is installed and executed and the remote address value provided by the first protection module file. , May be calculated according to the second code.

また他の側面によると、前記プロセッサで、前記ファイルのうち実行コードが含まれたファイルで選別される保護対象メソッドまたは関数を変形する段階は、前記第1保護モジュールファイルに複製された保護対象メソッドまたは関数のインストラクションを第1キーまたは第1暗号化アルゴリズムによって暗号化する段階、および前記第1保護モジュールファイルに複製された保護対象メソッドまたは関数に前記暗号化されたインストラクションを復号化するための復号化コードを追加する段階をさらに含んでもよい。 According to another aspect, in the processor, the step of transforming the protected method or function selected by the file containing the execution code among the files is the protected method duplicated in the first protection module file. Alternatively, the step of encrypting the instruction of the function by the first key or the first encryption algorithm, and the decryption for decrypting the encrypted instruction to the protected method or function duplicated in the first protection module file. It may further include the step of adding the conversion code.

また他の側面によると、前記第1保護モジュールファイルは、前記アプリケーションがインストールされた電子機器で前記アプリケーションが実行され、前記第1保護モジュールファイルに複製された保護対象メソッドまたは関数のインストラクションが前記復号化コードによって復号化される場合、予め設定された条件にしたがって前記インストラクションを第2キーまたは第2暗号化アルゴリズムによって再暗号化する機能を含んでもよい。 According to another aspect, the first protection module file is decrypted by the instruction of the protected method or function duplicated in the first protection module file when the application is executed on the electronic device in which the application is installed. When decrypted by the encryption code, it may include a function of re-encrypting the instruction by a second key or a second encryption algorithm according to preset conditions.

また他の側面によると、前記プロセッサで、前記ファイルのうちライブラリファイルを変換または除去する段階は、前記ライブラリファイルを暗号化して暗号化されたライブラリファイルを生成する段階、前記ライブラリファイルを変換するか、または前記パッケージファイルから除去する段階、および前記暗号化されたライブラリファイルを前記第2保護モジュールファイルに追加する段階を含み、前記第2保護モジュールファイルは、前記パッケージファイルを通じて前記アプリケーションがインストールされた電子機器で前記変換または除去されたライブラリファイルに対する制御命令をインターセプト(intercept)し、前記第2保護モジュールファイルに含まれた暗号化されたライブラリファイルを利用して前記インターセプトされた制御命令を処理するモジュールを含んでもよい。 According to another aspect, in the processor, the step of converting or removing the library file among the files is the step of encrypting the library file to generate the encrypted library file, and whether the library file is converted. , Or removing from the package file, and adding the encrypted library file to the second protection module file, wherein the application was installed through the package file. The electronic device intercepts the control command for the converted or removed library file, and processes the intercepted control command using the encrypted library file included in the second protection module file. It may include a module.

また他の側面によると、前記電子機器で前記アプリケーションの実行時、前記電子機器のメモリにロードされた前記第2保護モジュールファイルに対するオープン命令にしたがって迂回リンカ(detour linker)が生成され、前記迂回リンカの制御にしたがって前記電子機器で前記ライブラリファイルに対する制御命令がインターセプトされてもよい。 According to another aspect, when the application is executed in the electronic device, a detour linker is generated according to an open instruction for the second protection module file loaded in the memory of the electronic device, and the detour linker is generated. The control command for the library file may be intercepted by the electronic device according to the control of.

また他の側面によると、前記変換または除去されたライブラリファイルに対する制御命令は、前記ライブラリファイルに対するオープン命令を含み、前記第2保護モジュールファイルでインターセプトされた前記オープン命令にしたがって前記暗号化されたライブラリファイルを復号化した後、前記復号化されたライブラリファイルの内容が格納されたバッファを指示するフェイクハンドル(fake handle)パラメータを生成して返してもよい。 According to another aspect, the control instruction for the converted or removed library file includes an open instruction for the library file, and the encrypted library according to the open instruction intercepted by the second protection module file. After decoding the file, a fake handle parameter indicating a buffer containing the contents of the decrypted library file may be generated and returned.

また他の側面によると、前記変換または除去されたライブラリファイルに対する制御命令は、前記ライブラリファイルに対する読み取り命令、書き込み命令、および検索命令のうちの少なくとも1つの命令をさらに含み、前記第2保護モジュールファイルで前記インターセプトされた前記少なくとも1つの命令にしたがって前記フェイクハンドルパラメータに基づいて前記復号化されたライブラリファイルの内容が格納されたバッファにアクセスして前記少なくとも1つの命令を処理してもよい。 According to another aspect, the control instruction for the converted or removed library file further includes at least one instruction of a read instruction, a write instruction, and a search instruction for the library file, and the second protection module file. At least one instruction may be processed by accessing a buffer containing the contents of the decrypted library file based on the fake handle parameter according to the intercepted at least one instruction.

さらに他の側面によると、前記第2保護モジュールファイルで前記読み取り命令にしたがって前記バッファで前記読み取り命令に対応する内容を複写して返すか、前記書き込み命令にしたがって前記バッファに前記書き込み命令に対応する内容を書き込むか、または前記検索命令にしたがって前記バッファで前記検索命令に対応するファイルポインタの位置を返してもよい。 According to still another aspect, the contents corresponding to the read instruction are copied and returned in the buffer according to the read instruction in the second protection module file, or the contents corresponding to the write instruction are corresponded to the buffer in the buffer according to the write instruction. The content may be written or the position of the file pointer corresponding to the search instruction may be returned in the buffer according to the search instruction.

コンピュータによって実現される電子機器と結合してコード保護方法を実行させるために記録媒体に格納されたコンピュータプログラムであって、前記コード保護方法は、前記電子機器のプロセッサで、前記電子機器の格納装置にアプリケーションのためのファイルが含まれたパッケージファイルを格納する段階(前記パッケージファイルは、変形された保護対象メソッドまたは関数を復元するための第1保護モジュールファイルまたはライブラリファイルを復元するための第2保護モジュールファイルを含み、前記ファイルのうち実行コードが含まれたファイルで選別される保護対象メソッドまたは関数が変形されているか、または前記ファイルのうち前記ライブラリファイルが変換または除去されている)、および前記電子機器のプロセッサで、前記アプリケーションの実行にしたがって前記変形された保護対象メソッドまたは関数を前記第1保護モジュールファイルを通じて復元して前記実行コードを実行するか、または前記アプリケーションの実行時、前記変形または除去されたライブラリファイルを前記第2保護モジュールファイルを通じて復元して前記変形または除去されたライブラリファイルに対する制御命令を処理する段階を含む、コンピュータプログラムを提供する。 A computer program stored in a recording medium in order to execute a code protection method in combination with an electronic device realized by a computer, wherein the code protection method is a processor of the electronic device and a storage device of the electronic device. At the stage of storing the package file containing the files for the application in (the package file is the first protection module file for restoring the deformed protected method or function or the second protection module file for restoring the library file. The protected method or function that contains the protection module file and is screened in the file that contains the executable code is modified, or the library file in the file is converted or removed), and In the processor of the electronic device, the protected method or function modified according to the execution of the application is restored through the first protection module file to execute the execution code, or when the application is executed, the modification is performed. Alternatively, a computer program is provided that includes a step of restoring the removed library file through the second protection module file and processing control instructions for the modified or removed library file.

一側によると、前記第1保護モジュールファイルには、前記実行コードで選別された保護対象メソッドまたは関数が複製され、前記実行コードには、前記第1保護モジュールファイルに複製された保護対象メソッドまたは関数を見つけ出すための検索コードが追加され、前記電子機器のプロセッサで、前記アプリケーションの実行にしたがって前記変形された保護対象メソッドまたは関数を前記第1保護モジュールファイルを通じて復元して前記実行コードを実行する段階は、前記選別された保護対象メソッドまたは関数に対し、前記検索コードを利用して前記第1保護モジュールファイルで前記複製された保護対象メソッドまたは関数を見つけ出して前記実行コードを実行してもよい。 According to one side, the protected method or function selected by the execution code is duplicated in the first protection module file, and the protection target method or function duplicated in the first protection module file is duplicated in the execution code. A search code for finding the function is added, and the processor of the electronic device restores the modified protected method or function through the first protection module file according to the execution of the application and executes the execution code. The step may use the search code to find the duplicated protected method or function in the first protection module file and execute the execution code for the selected protected method or function. ..

他の側面によると、前記第2保護モジュールファイルには前記ライブラリファイルが暗号化されて追加され、前記電子機器のプロセッサで、前記アプリケーションの実行時、前記変形または除去されたライブラリファイルを前記第2保護モジュールファイルを通じて復元して前記変形または除去されたライブラリファイルに対する制御命令を処理する段階は、前記アプリケーションの実行時、前記電子機器のメモリに前記第2保護モジュールファイルが含む保護モジュールをロードする段階、前記ロードされた保護モジュールの制御にしたがって前記変換または除去されたライブラリファイルに対する制御命令をインターセプト(intercept)する段階、および前記ロードされた保護モジュールの制御にしたがって前記第2保護モジュールファイルに追加された暗号化されたライブラリファイルを利用して前記インターセプトされた制御命令を処理する段階を含んでもよい。 According to another aspect, the library file is encrypted and added to the second protection module file, and the modified or removed library file is added to the second protection module file when the application is executed by the processor of the electronic device. The step of restoring through the protection module file and processing the control command for the deformed or removed library file is the step of loading the protection module contained in the second protection module file into the memory of the electronic device when the application is executed. , The step of intercepting control instructions for the converted or removed library file under the control of the loaded protection module, and added to the second protection module file under the control of the loaded protection module. It may include a step of processing the intercepted control instruction by utilizing the encrypted library file.

コンピュータによって実現される電子機器のコード保護方法であって、前記電子機器のプロセッサで、前記電子機器の格納装置にアプリケーションのためのファイルが含まれたパッケージファイルを格納する段階(前記パッケージファイルは、変形された保護対象メソッドまたは関数を復元するための第1保護モジュールファイルまたはライブラリファイルを復元するための第2保護モジュールファイルを含み、前記ファイルのうち実行コードが含まれたファイルで選別される保護対象メソッドまたは関数が変形されているか、または前記ファイルのうち前記ライブラリファイルが変換または除去されている)、および前記電子機器のプロセッサで、前記アプリケーションの実行にしたがって前記変形された保護対象メソッドまたは関数を前記第1保護モジュールファイルを通じて復元して前記実行コードを実行するか、または前記アプリケーションの実行時、前記変形または除去されたライブラリファイルを前記第2保護モジュールファイルを通じて復元して前記変形または除去されたライブラリファイルに対する制御命令を処理する段階を含む、コード保護方法を提供する。 A code protection method for an electronic device realized by a computer, in which the processor of the electronic device stores a package file containing a file for an application in the storage device of the electronic device (the package file is a stage). Protection that includes a first protection module file for restoring a modified protected method or function or a second protection module file for restoring a library file, and is sorted by the file containing the executable code. The target method or function has been modified, or the library file of the file has been converted or removed), and the computer of the electronic device has the modified protected method or function according to the execution of the application. Is restored through the first protection module file to execute the execution code, or when the application is executed, the deformed or removed library file is restored through the second protection module file and the deformation or removal is performed. It provides a code protection method that includes the steps of processing control instructions for a library file.

保護対象となるアプリケーションのコードと保護モジュールをカップリングして提供することにより、保護モジュールなしではアプリケーションが実行されないようにし、保護モジュールの除去を防ぐことができる。 By providing a coupling between the code of the application to be protected and the protection module, it is possible to prevent the application from running without the protection module and prevent the protection module from being removed.

全体コードに対して保護を適用するのではなく、必ず必要なコードに対してのみ保護モジュールとのカップリングを処理し、保護対象コードを選択することができる。 Rather than applying protection to the entire code, it is possible to handle the coupling with the protection module only for the code that is absolutely necessary and select the code to be protected.

保護モジュールとカップリングされたコードを暗号化し、該当のコードの実行時点にだけ暗号化されたコードを復号化し、復号化されたコードを再び暗号化することにより、アプリケーションの実行時点でも保護モジュールとカップリングされたコードのうちの少なくとも一部が常に暗号化されているようにコードを保護することができる。 By encrypting the code coupled with the protection module, decrypting the encrypted code only at the time of execution of the corresponding code, and re-encrypting the decrypted code, the protection module can be used even at the time of application execution. You can protect your code so that at least part of the coupled code is always encrypted.

保護対象となるアプリケーションのコードを保護モジュールに移動させて保護することにより、アプリケーションのコードを静的に分析できないようにすることができ、保護モジュールに移動されたアプリケーションのコードが最初の実行時に復号化され、また周期的に再暗号化されるため、動的な分析に対しても保護を提供することができる。 By moving the protected application code to a protection module to protect it, the application code can be prevented from being analyzed statically, and the application code moved to the protection module is decrypted at the first execution. It is encrypted and periodically re-encrypted, which can provide protection against dynamic analysis.

ランタイムの瞬間ごとに保護モジュールに格納されたアプリケーションのコードが変わるため、特に動的分析のためにメモリダンプなどを通じた分析方法を無力化させることができる。 Since the application code stored in the protection module changes at each runtime, it is possible to disable the analysis method such as memory dump, especially for dynamic analysis.

パッケージファイルでライブラリファイルを変換するか除去して利用者がライブラリファイルに直接アクセスできないようにし、暗号化されたライブラリファイルを含む保護モジュールをパッケージファイルに追加し、保護モジュールを通じて暗号化されたライブラリファイルにアクセスするようにすることにより、保護モジュールの除去および迂回によるファイルの偽・変造を防ぐことができる。 Convert or remove the library file with the package file to prevent users from accessing the library file directly, add a protection module containing the encrypted library file to the package file, and make it into the library file encrypted through the protection module. By accessing the file, it is possible to prevent falsification / alteration of the file due to removal of the protection module and bypass.

本発明の一実施形態における、ネットワーク環境の例を示した図である。It is a figure which showed the example of the network environment in one Embodiment of this invention. 本発明の一実施形態における、電子機器およびサーバの内部構成を説明するためのブロック図である。It is a block diagram for demonstrating the internal structure of an electronic device and a server in one Embodiment of this invention. 本発明の一実施形態における、サーバのプロセッサが含むことのできる構成要素の例を示した図である。It is a figure which showed the example of the component which the processor of the server can include in one Embodiment of this invention. 本発明の一実施形態における、サーバが実行することのできる方法の例を示したフローチャートである。It is a flowchart which showed the example of the method which a server can execute in one Embodiment of this invention. 本発明の一実施形態における、保護対象メソッドまたは関数の暗号化および復号化コードの追加のための過程の例を示したフローチャートである。It is a flowchart which showed the example of the process for adding the encryption and decryption code of the protected method or function in one Embodiment of this invention. 本発明の一実施形態における、電子機器のプロセッサが含むことのできる構成要素の例を示した図である。It is a figure which showed the example of the component which can include the processor of the electronic device in one Embodiment of this invention. 本発明の一実施形態における、電子機器が実行することのできる方法の例を示したフローチャートである。It is a flowchart which showed the example of the method which an electronic device can perform in one Embodiment of this invention. 本発明の一実施形態における、サーバがパッケージに保護モジュールファイルを追加して電子機器に送信する過程の例を示した図である。It is a figure which showed the example of the process in which a server adds a protection module file to a package and sends it to an electronic device in one Embodiment of this invention. 本発明の一実施形態における、保護対象メソッドまたは関数を選別する過程の例を示した図である。It is a figure which showed the example of the process of selecting the protected method or function in one Embodiment of this invention. 本発明の一実施形態における、保護対象メソッドまたは関数を保護モジュールファイルに複製する過程の例を示した図である。It is a figure which showed the example of the process of duplicating a protected method or function into a protected module file in one Embodiment of this invention. 本発明の一実施形態における、ゲートウェイを追加してコードのインストラクションを変形する過程の例を示した図である。It is a figure which showed the example of the process of changing the instruction of a code by adding a gateway in one Embodiment of this invention. 本発明の一実施形態における、複製された保護対象メソッドまたは関数のインストラクションを暗号化する過程の例を示した図である。It is a figure which showed the example of the process of encrypting the instruction of the duplicated protected method or function in one Embodiment of this invention. 本発明の一実施形態における、保護動作の全体の流れの例を示した図である。It is a figure which showed the example of the whole flow of protection operation in one Embodiment of this invention. 本発明の一実施形態における、実行時点によるインストラクションの暗号化および復号化を説明するための図である。It is a figure for demonstrating the encryption and decryption of an instruction at the time of execution in one Embodiment of this invention. 本発明の他の実施形態における、サーバのプロセッサが含むことのできる構成要素の例を示したブロック図である。It is a block diagram which showed the example of the component which the processor of the server can include in another embodiment of this invention. 本発明の他の実施形態における、サーバが実行することのできる方法の例を示したフローチャートである。It is a flowchart which showed the example of the method which a server can execute in another embodiment of this invention. 本発明の他の実施形態における、パッケージファイルに保護モジュールを追加する例を示した図である。It is a figure which showed the example which adds the protection module to the package file in another embodiment of this invention. 本発明の他の実施形態における、パッケージファイルに保護モジュールを追加する他の例を示した図である。It is a figure which showed the other example which adds the protection module to the package file in another embodiment of this invention. 本発明の他の実施形態における、電子機器のプロセッサが含むことのできる構成要素の例を示したブロック図である。It is a block diagram which showed the example of the component which can include the processor of the electronic device in another embodiment of this invention. 本発明の他の実施形態における、電子機器が実行することのできる方法の例を示したフローチャートである。It is a flowchart which showed the example of the method which an electronic device can perform in another embodiment of this invention. 本発明の他の実施形態における、制御命令の処理過程の例を示した図である。It is a figure which showed the example of the processing process of the control instruction in another embodiment of this invention.

以下、実施形態について、添付の図面を参照しながら詳しく説明する。 Hereinafter, embodiments will be described in detail with reference to the accompanying drawings.

図1は、本発明の一実施形態における、ネットワーク環境の例を示した図である。図1のネットワーク環境は、複数の電子機器110、120、130、140、複数のサーバ150、160、およびネットワーク170を含む例を示している。このような図1は、発明を説明するための一例に過ぎず、電子機器の数やサーバの数が図1のように限定されることはない。 FIG. 1 is a diagram showing an example of a network environment according to an embodiment of the present invention. The network environment of FIG. 1 shows an example including a plurality of electronic devices 110, 120, 130, 140, a plurality of servers 150, 160, and a network 170. Such FIG. 1 is merely an example for explaining the invention, and the number of electronic devices and the number of servers are not limited as in FIG.

複数の電子機器110、120、130、140は、コンピュータ装置によって実現される固定型端末や移動型端末であってもよい。複数の電子機器110、120、130、140の例としては、スマートフォン(smart phone)、携帯電話、ナビゲーション、コンピュータ、ノート型パンコン、デジタル放送用端末、PDA(Personal Digital Assistants)、PMP(Portable Multimedia Player)、タブレットPCなどがある。一例として、電子機器1(110)は、無線または有線通信方式を利用し、ネットワーク170を介して他の電子機器120、130、140および/またはサーバ150、160と通信してもよい。 The plurality of electronic devices 110, 120, 130, 140 may be fixed terminals or mobile terminals realized by a computer device. Examples of a plurality of electronic devices 110, 120, 130, 140 include a smartphone (smart phone), a mobile phone, a navigation system, a computer, a notebook pancon, a digital broadcasting terminal, a PDA (Personal Digital Assistants), and a PMP (Tablet Multimedia Player). ), Tablet PC, etc. As an example, electronic device 1 (110) may use a wireless or wired communication method to communicate with other electronic devices 120, 130, 140 and / or servers 150, 160 via network 170.

通信方式が制限されることはなく、ネットワーク170が含むことのできる通信網(一例として、移動通信網、有線インターネット、無線インターネット、放送網)を活用する通信方式だけではなく、機器間の近距離無線通信が含まれてもよい。例えば、ネットワーク170は、PAN(personal area network)、LAN(local area network)、CAN(campus area network)、MAN(metropolitan area network)、WAN(wide area network)、BBN(broadband network)、インターネットなどのネットワークのうちの1つ以上の任意のネットワークを含んでもよい。さらに、ネットワーク170は、バスネットワーク、スターネットワーク、リングネットワーク、メッシュネットワーク、スター−バスネットワーク、ツリーまたは階層的(hierarchical)ネットワークなどを含むネットワークトポロジのうちの任意の1つ以上を含んでもよいが、これに制限されることはない。 The communication method is not limited, and not only the communication method utilizing the communication network (for example, mobile communication network, wired Internet, wireless Internet, broadcasting network) that can be included in the network 170, but also the short distance between devices. Wireless communication may be included. For example, the network 170 includes a PAN (personal area network), a LAN (local area network), a CAN (campus area network), a MAN (metropolitan area network), a WAN (wide network), etc. It may include any one or more of the networks. In addition, network 170 may include any one or more of network topologies, including bus networks, star networks, ring networks, mesh networks, star-bus networks, tree or hierarchical networks, and the like. You are not limited to this.

サーバ150、160それぞれは、複数の電子機器110、120、130、140とネットワーク170を介して通信して命令、コード、ファイル、コンテンツ、サービスなどを提供するコンピュータ装置または複数のコンピュータ装置によって実現されてもよい。 Each of the servers 150 and 160 is realized by a computer device or a plurality of computer devices that communicate with a plurality of electronic devices 110, 120, 130, 140 via a network 170 to provide instructions, codes, files, contents, services, and the like. You may.

一例として、サーバ150は、電子機器2(120)から登録されるアプリケーションのパッケージに保護モジュールファイルを追加してもよい。保護モジュールファイルが含まれたアプリケーションのパッケージは、サーバ150から直接電子機器1(110)に提供されてもよいし、別のサーバ160を通じて電子機器1(110)に提供されてもよい。電子機器1(110)は、アプリケーションのパッケージを通じてアプリケーションを電子機器1(110)にインストールおよび実行してもよく、アプリケーションを通じて特定のサービスの提供を受けてもよい。ここで、保護モジュールファイルによってアプリケーションのコードが保護されてもよい。 As an example, the server 150 may add a protection module file to the application package registered from the electronic device 2 (120). The application package containing the protection module file may be provided directly from the server 150 to the electronic device 1 (110), or may be provided to the electronic device 1 (110) through another server 160. The electronic device 1 (110) may install and execute the application on the electronic device 1 (110) through the application package, or may be provided with a specific service through the application. Here, the protection module file may protect the application code.

図2は、本発明の一実施形態における、電子機器およびサーバの内部構成を説明するためのブロック図である。図2では、1つの電子機器に対する例として電子機器1(110)、そして1つのサーバに対する例としてサーバ150の内部構成について説明する。他の電子機器120、130、140やサーバ160も、同一または類似の内部構成を備えてもよい。 FIG. 2 is a block diagram for explaining the internal configurations of the electronic device and the server according to the embodiment of the present invention. In FIG. 2, the internal configuration of the electronic device 1 (110) as an example for one electronic device and the server 150 as an example for one server will be described. Other electronic devices 120, 130, 140 and server 160 may also have the same or similar internal configuration.

電子機器1(110)とサーバ150は、メモリ211、221、プロセッサ212、222、通信モジュール213、223、および入力/出力インタフェース214、224を含んでもよい。メモリ211、221は、コンピュータで読み取り可能な記録媒体であって、RAM(random access memory)、ROM(read only memory)、およびディスクドライブのような永久大容量記憶装置(permanent mass storage device)を含んでよい。また、メモリ211、221には、オペレーティングシステムと、少なくとも1つのプログラムコード(一例として、電気機器1(110)にインストールされ実行するブラウザや映像通話のためのアプリケーションなどのためのコード)が格納されてよい。このようなソフトウェア構成要素は、ドライブメカニズム(drive mechanism)を利用してメモリ211、221とは別のコンピュータで読み取り可能な記録媒体からロードされてもよい。このような別のコンピュータで読み取り可能な記録媒体は、フロッピー(登録商標)ドライブ、ディスク、テープ、DVD/CD−ROMドライブ、メモリカードなどのコンピュータで読み取り可能な記録媒体を含んでよい。他の実施形態において、ソフトウェア構成要素は、コンピュータで読み取り可能な記録媒体ではない通信モジュール213、223を利用してメモリ211、221にロードされてもよい。例えば、少なくとも1つのプログラムは、開発者またはアプリケーションのインストールファイルを配布するファイル配布システム(一例として、上述したサーバ160)がネットワーク170を介して提供するファイルによってインストールされるプログラム(一例として、上述したアプリケーション)に基づいてメモリ211、221にロードされてもよい。 Electronic device 1 (110) and server 150 may include memory 211,221, processor 212,222, communication modules 213,223, and input / output interfaces 214,224. The memories 211 and 221 are computer-readable recording media and include a RAM (random access memory), a ROM (read only memory), and a permanent mass storage device such as a disk drive. It's fine. Further, the memory 211 and 221 store an operating system and at least one program code (for example, a code for a browser installed and executed in the electric device 1 (110), an application for a video call, and the like). You can do it. Such software components may be loaded from a computer-readable recording medium other than the memories 211 and 221 using a drive mechanism. Such computer-readable recording media may include computer-readable recording media such as floppy® drives, disks, tapes, DVD / CD-ROM drives, and memory cards. In other embodiments, the software components may be loaded into memory 211, 221 using communication modules 213, 223, which are not computer readable recording media. For example, at least one program is a program installed by a file provided by a file distribution system (as an example, the server 160 described above) that distributes a developer or application installation file via a network 170 (as an example, described above). It may be loaded into memory 211,221 based on the application).

プロセッサ212、222は、基本的な算術、ロジック、および入出力演算を実行することにより、コンピュータプログラムの命令を処理するように構成されてよい。命令は、メモリ211、221または通信モジュール213、223によって、プロセッサ212、222に提供されてよい。例えば、プロセッサ212、222は、メモリ211、221のような記録装置に格納されたプログラムコードにしたがって受信される命令を実行するように構成されてもよい。 Processors 212 and 222 may be configured to process instructions in a computer program by performing basic arithmetic, logic, and input / output operations. Instructions may be provided to processors 212 and 222 by memory 211, 221 or communication modules 213 and 223. For example, processors 212 and 222 may be configured to execute instructions received according to program code stored in a recording device such as memory 211 and 221.

通信モジュール213、223は、ネットワーク170を介して電子機器1(110)とサーバ150とが互いに通信するための機能を提供してもよいし、他の電子機器(一例として、電子機器2(120))または他のサーバ(一例として、サーバ160)と通信するための機能を提供してもよい。一例として、電子機器1(110)のプロセッサ212がメモリ211のような記録装置に格納されたプログラムコードにしたがって生成した要請(一例として、映像通話サービスのための要請)が、通信モジュール213の制御にしたがってネットワーク170を介してサーバ150に伝達されてもよい。これとは逆に、サーバ150のプロセッサ222の制御にしたがって提供される制御信号や命令、コンテンツ、ファイルなどが、通信モジュール223とネットワーク170を経て電子機器1(110)の通信モジュール213を通じて電子機器1(110)に受信されてもよい。例えば、通信モジュール213を通じて受信されたサーバ150の制御信号や命令などは、プロセッサ212やメモリ211に伝達されてもよく、コンテンツやファイルなどは、電子機器1(110)がさらに含むことのできる格納媒体に格納されてもよい。 The communication modules 213 and 223 may provide a function for the electronic device 1 (110) and the server 150 to communicate with each other via the network 170, or may provide another electronic device (for example, the electronic device 2 (120)). )) Or another server (for example, server 160) may be provided with a function for communicating with the server. As an example, a request generated by the processor 212 of the electronic device 1 (110) according to a program code stored in a recording device such as a memory 211 (as an example, a request for a video call service) controls the communication module 213. It may be transmitted to the server 150 via the network 170 according to the above. On the contrary, the control signals, instructions, contents, files, etc. provided under the control of the processor 222 of the server 150 pass through the communication module 223 and the network 170, and then through the communication module 213 of the electronic device 1 (110). It may be received at 1 (110). For example, the control signals and instructions of the server 150 received through the communication module 213 may be transmitted to the processor 212 and the memory 211, and the contents and files may be further stored in the electronic device 1 (110). It may be stored in a medium.

入力/出力インタフェース214、224は、入力/出力装置215とのインタフェースのための手段であってもよい。例えば、入力装置は、キーボードまたはマウスなどの装置を、また出力装置は、アプリケーションの通信セッションを表示するためのディスプレイのような装置を含んでもよい。他の例として、入力/出力インタフェース214は、タッチスクリーンのように入力と出力のための機能が1つに統合された装置とのインタフェースのための手段であってもよい。より具体的な例として、電子機器1(110)のプロセッサ212は、メモリ211にロードされたコンピュータプログラムの命令を処理するにあたり、サーバ150や電子機器2(120)が提供するデータを利用して構成されるサービス画面やコンテンツが入力/出力インタフェース214を通じてディスプレイに表示されてもよい。 The input / output interfaces 214 and 224 may be means for interfacing with the input / output device 215. For example, the input device may include a device such as a keyboard or mouse, and the output device may include a device such as a display for displaying a communication session of an application. As another example, the input / output interface 214 may be a means for an interface with a device such as a touch screen in which functions for input and output are integrated into one. As a more specific example, the processor 212 of the electronic device 1 (110) utilizes the data provided by the server 150 and the electronic device 2 (120) in processing the instructions of the computer program loaded in the memory 211. The configured service screens and contents may be displayed on the display through the input / output interface 214.

また、他の実施形態において、電子機器1(110)およびサーバ150は、図2の構成要素よりもさらに多くの構成要素を含んでもよい。しかし、大部分の従来技術構成要素を明確に図に示す必要はない。例えば、電子機器1(110)は、上述した入力/出力装置215のうちの少なくとも一部を含むように実現されてもよいし、トランシーバ(transceiver)、GPS(Global Positioning System)モジュール、カメラ、各種センサ、データベースなどのような他の構成要素をさらに含んでもよい。より具体的な例として、電子機器1(110)がスマートフォンである場合、一般的にスマートフォンが含んでいる加速度センサやジャイロセンサ、カメラ、各種物理的なボタン、タッチパネルを利用したボタン、入力/出力ポート、振動のための振動器などの多様な構成要素が電子機器1(110)にさらに含まれるように実現されてもよいことが分かる。 Also, in other embodiments, the electronic device 1 (110) and the server 150 may include even more components than the components of FIG. However, it is not necessary to clearly illustrate most of the prior art components. For example, the electronic device 1 (110) may be realized to include at least a part of the above-mentioned input / output device 215, a transceiver, a GPS (Global Positioning System) module, a camera, and various types. Other components such as sensors, databases, etc. may be further included. As a more specific example, when the electronic device 1 (110) is a smartphone, the acceleration sensor, gyro sensor, camera, various physical buttons, buttons using the touch panel, input / output, which are generally included in the smartphone. It can be seen that various components such as ports and vibrators for vibration may be further included in the electronic device 1 (110).

図3は、本発明の一実施形態における、サーバが含むプロセッサを説明するためのブロック図であり、図4は、本発明の一実施形態における、サーバが実行する方法を示したフローチャートである。 FIG. 3 is a block diagram for explaining a processor included in the server according to the embodiment of the present invention, and FIG. 4 is a flowchart showing a method executed by the server according to the embodiment of the present invention.

図3に示すように、サーバ150に含まれたプロセッサ222は、構成要素として、パッケージ管理制御部310、複製制御部320、コード変形制御部330、検索コード追加制御部340、およびパッケージ生成制御部350を含んでもよい。このようなプロセッサ222およびプロセッサ222の構成要素は、図4のコード保護方法が含む段階410〜460を実行するようにサーバ150を制御してもよい。このとき、プロセッサ222およびプロセッサ222の構成要素は、メモリ221が含むオペレーティングシステムのコードと少なくとも1つのプログラムのコードによる命令(instruction)を実行するように実現されてもよい。ここで、プロセッサ222の構成要素は、サーバ150に格納されたプログラムコードが提供する制御命令にしたがってプロセッサ222によって実行される互いに異なる機能(different functions)の表現であってもよい。例えば、プロセッサ222が上述した制御命令にしたがってパッケージを格納および管理するように動作する機能的表現として、パッケージ管理制御部310が使用されてもよい。 As shown in FIG. 3, the processor 222 included in the server 150 has a package management control unit 310, a replication control unit 320, a code deformation control unit 330, a search code additional control unit 340, and a package generation control unit as components. 350 may be included. Such processor 222 and the components of processor 222 may control the server 150 to perform steps 410-460 included in the code protection method of FIG. At this time, the processor 222 and the components of the processor 222 may be realized to execute an instruction by the code of the operating system included in the memory 221 and the code of at least one program. Here, the components of the processor 222 may be representations of different functions executed by the processor 222 according to the control instructions provided by the program code stored in the server 150. For example, the package management control unit 310 may be used as a functional representation in which the processor 222 operates to store and manage packages in accordance with the control instructions described above.

段階410で、プロセッサ222は、コード保護方法のためのプログラムのファイルに格納されたプログラムコードをメモリ221にロードしてもよい。例えば、サーバ150でプログラムが実行されると、プロセッサ222は、オペレーティングシステムの制御にしたがってプログラムのファイルからプログラムコードをメモリ221にロードするようにサーバ150を制御してもよい。 At step 410, processor 222 may load the program code stored in the program file for the code protection method into memory 221. For example, when a program is executed on the server 150, the processor 222 may control the server 150 to load the program code from the program file into the memory 221 under the control of the operating system.

ここで、プロセッサ222が含むパッケージ管理制御部310、複製制御部320、コード変形制御部330、検索コード追加制御部340、およびパッケージ生成制御部350それぞれは、メモリ221にロードされたプログラムコードのうち対応する部分の命令を実行して以後の段階420〜460を実行するためのプロセッサ222の機能的表現であってもよい。 Here, the package management control unit 310, the replication control unit 320, the code deformation control unit 330, the search code addition control unit 340, and the package generation control unit 350 included in the processor 222 are each among the program codes loaded in the memory 221. It may be a functional representation of processor 222 for executing the corresponding instruction and executing subsequent steps 420-460.

段階420で、パッケージ管理制御部310は、格納装置にアプリケーションのためのファイルが含まれたパッケージを格納してもよい。例えば、アプリケーションの開発者は、パッケージを生成してサーバ150に登録してもよい。より具体的な例として、開発者は、電子機器2(120)を利用してネットワーク170を介してサーバ150に接続し、サーバ150が提供するユーザインタフェースを利用してパッケージファイルをサーバ150にアップロードしてもよい。ここで、パッケージ管理制御部310は、サーバ150にアップロードされたパッケージをサーバ150の格納装置に格納および管理してもよい。 At step 420, the package management control unit 310 may store the package containing the files for the application in the storage device. For example, the application developer may generate a package and register it on the server 150. As a more specific example, the developer uses the electronic device 2 (120) to connect to the server 150 via the network 170, and uploads the package file to the server 150 using the user interface provided by the server 150. You may. Here, the package management control unit 310 may store and manage the package uploaded to the server 150 in the storage device of the server 150.

段階430で、複製制御部320は、ファイルのうち実行コードが含まれたファイルで保護対象メソッドまたは関数を選別して保護モジュールファイルに複製してもよい。例えば、複製制御部320は、実行コードの全体メソッドまたは関数のうち、予め設定された機能のメソッドまたは関数を保護対象メソッドまたは関数として選別して保護モジュールファイルに複製してもよい。より具体的な例として、ジャバ(Java(登録商標))言語においてジャバネイティブインタフェース(Java Native Interface:JNI)に該当するメソッドや関数が予め設定されてもよく、複製制御部320は、JNI系列のメソッドや関数を見つけ出して保護モジュールファイルに複製してもよい。他の例として、複製制御部320は、アプリケーションの開発者によって入力された情報に対応するメソッドまたは関数を保護対象メソッドまたは関数として選別して保護モジュールファイルに複製することも可能である。より具体的な例として、サーバ150は、開発者から選別しようとするメソッドや関数の名前の入力を受け、入力された名前のメソッドや関数を選別して保護モジュールファイルに複製してもよい。選択的に、複製制御部320は、予め設定された機能のメソッドまたは関数と開発者によって指示されたメソッドまたは関数の両方を選別することも可能である。 At step 430, the replication control unit 320 may select the protected method or function from the file containing the execution code and replicate it to the protection module file. For example, the replication control unit 320 may select a method or function having a preset function from the entire method or function of the execution code as a protection target method or function and duplicate it in the protection module file. As a more specific example, a method or function corresponding to the Java Native Interface (JNI) in the Java (Java (registered trademark)) language may be preset, and the replication control unit 320 may be a JNI series. You may find the method or function and duplicate it in the protection module file. As another example, the replication control unit 320 can select the method or function corresponding to the information input by the developer of the application as the protection target method or function and replicate it in the protection module file. As a more specific example, the server 150 may receive input of the name of the method or function to be selected from the developer, select the method or function with the input name, and copy it to the protection module file. Optionally, the replication control unit 320 can also select both the method or function of the preset function and the method or function instructed by the developer.

このために、複製制御部320は、実行コードが含まれたファイルと保護モジュールファイルがメモリ221にロードされるようにサーバ150を制御してもよく、メモリ221にロードされた実行コードで選別されたメソッドや関数がメモリ221にロードされた保護モジュールに複製されるようにサーバ150を制御してもよい。このような過程は、実行コードが含まれたファイル(サーバ150の格納装置に格納されたファイル)に対する読み取り命令と保護モジュールファイルに対する書き込み命令などによって処理されてもよい。以下では、メモリ221やサーバ150の格納装置を通じてデータをロードしたり格納されたファイルにデータを書き込み処理したりするなどの過程のような明確な事項についての説明は省略する。 For this purpose, the replication control unit 320 may control the server 150 so that the file containing the execution code and the protection module file are loaded into the memory 221 and are selected by the execution code loaded in the memory 221. The server 150 may be controlled so that the methods and functions are replicated to the protection module loaded in memory 221. Such a process may be processed by a read instruction for a file containing the execution code (a file stored in the storage device of the server 150), a write instruction for the protection module file, and the like. In the following, the description of clear matters such as the process of loading data through the storage device of the memory 221 or the server 150 and writing data to the stored file will be omitted.

段階440で、コード変形制御部330は、選別された保護対象メソッドまたは関数が含むコードを変形させてもよい。例えば、コード変形制御部330は、コードのインストラクションを、認識が不可能なアンノウンインストラクション(unknown instruction)または任意のランダムなアドレスにジャンプ(jump)するインストラクションに変形してもよい。したがって、アプリケーションがインストールおよび実行される電子機器(一例として、電子機器1(110))では、ダンプ(dump)のような機能を通じてコードを得たとしても、認識が不可能なアンノウンインストラクションや任意のランダムなアドレスにジャンプ(jump)するインストラクションにより、本来のコードが分からないようになる。 At step 440, the code transformation control unit 330 may transform the code contained in the selected protected method or function. For example, the code transformation control unit 330 may transform the code instruction into an unknown instruction that cannot be recognized or an instruction that jumps to an arbitrary random address. Therefore, in an electronic device on which an application is installed and executed (for example, electronic device 1 (110)), an unknown instruction or any arbitrary that cannot be recognized even if the code is obtained through a function such as dump. Instructions to jump to a random address obscure the original code.

段階450で、検索コード追加制御部340は、保護モジュールファイルに複製された保護対象メソッドまたは関数を見つけ出すための検索コードを実行コードに追加してもよい。このような検索コードは、実行コードで変形されたコードではなく本来のコードを得るために保護モジュールファイルを検索するためのコードであって、保護モジュールファイルが除去された場合には本来のコードを得ることができなくなるため、保護モジュールを通じた安定的なコードの保護が可能となる。 At step 450, the search code addition control unit 340 may add search code to the execution code to find the protected method or function replicated in the protection module file. Such a search code is not the code transformed by the executable code, but the code for searching the protection module file to obtain the original code, and when the protection module file is removed, the original code is used. Since it cannot be obtained, stable code protection is possible through the protection module.

より具体的な実施形態として、検索コード追加制御部340は、段階450で、選別された保護対象メソッドまたは関数にゲートウェイを呼び出すための第1コードを追加し、実行コードにゲートウェイとして保護モジュールファイルに複製された保護対象メソッドまたは関数のメモリアドレスを得るための第2コードを追加してもよい。ここで、メモリアドレスは、アプリケーションがインストールされて実行される電子機器におけるプログラムカウンタ(Program Counter:PC)と保護モジュールファイルによって提供される相手アドレス値を因子とし、第2コードにしたがって計算されてもよい。保護モジュールファイルに複製された保護対象メソッドまたは関数の検索については、以下でさらに詳しく説明する。 As a more specific embodiment, the search code addition control unit 340 adds the first code for calling the gateway to the selected protected method or function in the step 450, and adds the first code to the execution code as the gateway to the protection module file. You may add a second code to get the memory address of the duplicated protected method or function. Here, the memory address may be calculated according to the second code by using the partner address value provided by the program counter (Program Counter: PC) and the protection module file in the electronic device in which the application is installed and executed as a factor. good. Finding a protected method or function duplicated in a protection module file is described in more detail below.

段階460で、パッケージ生成制御部350は、保護対象メソッドまたは関数が複製された保護モジュールファイルとアプリケーションのためのファイルを含むパッケージを生成してもよい。このとき、アプリケーションの実行コードが含まれたファイルで保護対象メソッドまたは関数が含むコードは変形されているため、保護モジュールファイルなしではアプリケーションを正確に実行することができなくなる。したがって、保護モジュールの除去を防ぐことができる。また、アプリケーションの実行コードでは、保護対象メソッドまたは関数が含むコードのインストラクションが変形されているため、本来のコードを復元することができなくなってコードを保護し、コードに対する偽・変造を防ぐことができるようになる。 At step 460, the package generation control unit 350 may generate a package containing a protection module file in which the protected method or function is duplicated and a file for the application. At this time, since the code included in the protected method or function is transformed in the file containing the execution code of the application, the application cannot be executed accurately without the protection module file. Therefore, the removal of the protection module can be prevented. In addition, in the execution code of the application, the instruction of the code included in the protected method or function is deformed, so the original code cannot be restored, the code can be protected, and falsification / alteration of the code can be prevented. become able to.

図5は、本発明の一実施形態における、保護対象メソッドまたは関数の暗号化および復号化コードの追加のための過程の例を示したフローチャートである。図5の段階510および520は、選択的に、図4のコード保護方法に含まれて実行されてもよい。図5では、図5の段階510および520が段階430と段階440の間に含まれて実行される実施形態について説明しているが、図5の段階510および520は、段階430以後、そして段階460以前であれば実行順に制約はない。図5の段階510および520を実行するために、プロセッサ222は、暗号化制御部(図示せず)および復号化コード追加制御部(図示せず)をさらに含んでもよい。 FIG. 5 is a flowchart showing an example of a process for adding an encryption and decryption code of a protected method or function in one embodiment of the present invention. Steps 510 and 520 of FIG. 5 may optionally be included and performed in the code protection method of FIG. FIG. 5 describes an embodiment in which steps 510 and 520 of FIG. 5 are included between steps 430 and 440 and performed, but steps 510 and 520 of FIG. 5 are after step 430 and then in steps. If it is 460 or earlier, there is no restriction on the execution order. To perform steps 510 and 520 of FIG. 5, processor 222 may further include an encryption control unit (not shown) and a decryption code additional control unit (not shown).

段階510で、プロセッサ222または暗号化制御部は、保護モジュールファイルに複製された保護対象メソッドまたは関数のインストラクションを第1キーまたは第1暗号化アルゴリズムによって暗号化してもよい。カップリングによって保護モジュールファイルに複製された保護対象メソッドまたは関数は、ハイレベル言語(一例として、ジャバやC++)で作成されているため、保護対象メソッドまたは関数が保護モジュールファイルから流出する可能性が存在する。したがって、保護対象メソッドまたは関数を暗号化することにより、このような流出を防ぐことができる。 At step 510, the processor 222 or the cryptographic control unit may encrypt the instructions for the protected method or function replicated in the protection module file with the first key or the first cryptographic algorithm. Protected methods or functions duplicated in a protected module file by coupling are written in a high-level language (for example, Java or C ++), so protected methods or functions may be leaked from the protected module file. exist. Therefore, such leakage can be prevented by encrypting the protected method or function.

段階520で、プロセッサ222または復号化コード追加制御部は、保護モジュールファイルに複製された保護対象メソッドまたは関数に暗号化されたインストラクションを復号化するための復号化コードを追加してもよい。ここで、復号化コードは、複製された保護対象メソッドまたは関数とは異なり、バイナリコードで作成され、分析を難しくすることができる。 At step 520, the processor 222 or the decryption code addition control unit may add the decryption code to decrypt the encrypted instruction to the protected method or function replicated in the protection module file. Here, the decryption code, unlike the duplicated protected method or function, is written in binary code and can be difficult to analyze.

暗号化されたインストラクションを復号化する過程については、以下でさらに詳しく説明する。 The process of decrypting an encrypted instruction is described in more detail below.

以下、図6および図7を参照しながら、パッケージを受信した電子機器1(110)の観点からコード保護方法について説明する。 Hereinafter, the code protection method will be described with reference to FIGS. 6 and 7 from the viewpoint of the electronic device 1 (110) that has received the package.

図6は、本発明の一実施形態における、電子機器のプロセッサが含むことのできる構成要素の例を示した図であり、図7は、本発明の一実施形態における、電子機器が実行することのできる方法の例を示したフローチャートである。 FIG. 6 is a diagram showing an example of components that can be included in the processor of the electronic device according to the embodiment of the present invention, and FIG. 7 is a diagram showing the execution by the electronic device according to the embodiment of the present invention. It is a flowchart which showed the example of the possible method.

図6に示すように、電子機器1(110)に含まれたプロセッサ212は、構成要素として、パッケージ管理制御部610および実行コード処理部620を含んでもよく、実施形態によっては、選択的に、再暗号化制御部630をさらに含んでもよい。このようなプロセッサ212およびプロセッサ212の構成要素は、図7のコード保護方法が含む段階710〜740を実行するように電子機器1(110)を制御してもよい。ここで、プロセッサ212およびプロセッサ212の構成要素は、メモリ211が含むオペレーティングシステムのコードと少なくとも1つのプログラムのコード(一例として、サーバ150が提供する保護モジュールファイルを含むパッケージのコード)による命令(instruction)を実行するように実現されてもよい。また、プロセッサ212の構成要素は、電子機器1(110)に格納されたプログラムコードが提供する制御命令にしたがってプロセッサ212によって実行される互いに異なる機能(different functions)の表現であってもよい。例えば、プロセッサ212が上述した制御命令にしたがってパッケージを格納および管理するように電子機器1(110)を制御するために動作する機能的表現として、パッケージ管理制御部610が使用されてもよい。 As shown in FIG. 6, the processor 212 included in the electronic device 1 (110) may include a package management control unit 610 and an execution code processing unit 620 as components, and may selectively include an execution code processing unit 620 depending on the embodiment. The re-encryption control unit 630 may be further included. Such a processor 212 and components of the processor 212 may control electronic device 1 (110) to perform steps 710 to 740 included in the code protection method of FIG. Here, the processor 212 and the components of the processor 212 are instructions (instruction) by the code of the operating system included in the memory 211 and the code of at least one program (for example, the code of the package including the protection module file provided by the server 150). ) May be implemented. Further, the components of the processor 212 may be representations of different functions (different funtions) executed by the processor 212 according to the control instructions provided by the program code stored in the electronic device 1 (110). For example, the package management control unit 610 may be used as a functional representation that operates to control the electronic device 1 (110) so that the processor 212 stores and manages the package in accordance with the control instructions described above.

段階710で、パッケージ管理制御部610は、格納装置にアプリケーションのためのファイルが含まれたパッケージを格納してもよい。例えば、パッケージ管理制御部610は、電子機器1(110)のオペレーティングシステムの制御にしたがって電子機器1(110)の格納装置にパッケージを格納するように電子機器1(110)を制御してもよい。 At step 710, the package management control unit 610 may store the package containing the files for the application in the storage device. For example, the package management control unit 610 may control the electronic device 1 (110) so as to store the package in the storage device of the electronic device 1 (110) according to the control of the operating system of the electronic device 1 (110). ..

ここで、パッケージとは、図3〜図5を参照しながら説明した保護モジュールファイルが含まれたパッケージであって、サーバ150を通じて直接ダウンロードするか、または他のサーバ(一例として、サーバ160)を通じてダウンロードしたパッケージであってもよい。したがって、保護モジュールファイルには、アプリケーションの実行コードで選別された保護対象メソッドまたは関数が複製されていてもよく、実行コードには、前記選別された保護対象メソッドまたは関数に含まれたコードが変形されて含まれていてもよい。また、実行コードには、保護モジュールファイルに複製された保護対象メソッドまたは関数を見つけ出すための検索コードが追加された状態であってもよい。 Here, the package is a package containing the protection module file described with reference to FIGS. 3 to 5, and can be downloaded directly through the server 150 or through another server (for example, the server 160). It may be a downloaded package. Therefore, the protected method or function selected by the execution code of the application may be duplicated in the protection module file, and the code contained in the selected protected method or function is transformed into the execution code. May be included. In addition, the execution code may have a search code added to find the protected method or function duplicated in the protection module file.

段階720で、プロセッサ212は、コード保護方法のためのアプリケーションのファイルに格納されたプログラムコードをメモリ211にロードしてもよい。例えば、電子機器1(110)でアプリケーションが実行されると、プロセッサ212は、オペレーティングシステムの制御にしたがってアプリケーションのパッケージで実行コードを含むプログラムコードをメモリ221にロードするようにサーバ150を制御してもよい。 At step 720, processor 212 may load the program code stored in the application file for the code protection method into memory 211. For example, when an application is executed on the electronic device 1 (110), the processor 212 controls the server 150 to load the program code including the execution code into the memory 221 in the application package according to the control of the operating system. May be good.

段階730で、実行コード処理部620は、アプリケーションの実行にしたがって実行コードを実行し、選別された保護対象メソッドまたは関数に対して検索コードを利用し、保護モジュールファイルで複製された保護対象メソッドまたは関数を見つけ出して実行してもよい。 At stage 730, the executable code processor 620 executes the executable code according to the execution of the application, uses the search code for the selected protected method or function, and duplicates the protected method or function in the protection module file. You may find the function and execute it.

上述したように、選別された保護対象メソッドまたは関数は、アンノウンインストラクションや任意のランダムなアドレスにジャンプ(jump)するインストラクションを含むようにコードが変形されたため、実行コードを実行するだけでは実行コードを正確に実行することができない。本来のコードは保護モジュールファイルに複製されており、保護モジュールファイルのプログラムコードはメモリ211にロードされているため、実行コード処理部620は、検索コードを利用してメモリ211にロードされた複製された保護対象メソッドまたは関数を見つけ出して実行することにより、本来の実行コードを正確に実行することができるようになる。 As mentioned above, the screened protected method or function has been modified to include unknown instructions or instructions that jump to any random address, so just executing the executable code will result in the executable code. It cannot be executed accurately. Since the original code is duplicated in the protection module file and the program code of the protection module file is loaded in the memory 211, the execution code processing unit 620 is duplicated loaded in the memory 211 using the search code. By finding and executing the protected method or function, the original execution code can be executed accurately.

具体的な実施形態として、検索コードは、選別された保護対象メソッドまたは関数に追加されてゲートウェイを呼び出すための第1コード、および実行コードにゲートウェイとして追加される第2コードを含んでもよい。この場合、段階730で、実行コード処理部620は、第1コードにしたがってゲートウェイとして第2コードを呼び出し、第2コードを通じて保護モジュールファイルに複製された保護対象メソッドまたは関数のメモリアドレスを取得することで、複製された保護対象メソッドまたは関数を見つけ出して実行してもよい。上述したように、メモリアドレスは、アプリケーションの実行によるプログラムカウンタ(Program Counter:PC)と保護モジュールファイルによって提供される相手アドレス値を因子とし、第2コードによって計算されてもよい。 As a specific embodiment, the search code may include a first code added to the screened protected method or function to call the gateway, and a second code added to the execution code as the gateway. In this case, at step 730, the execution code processing unit 620 calls the second code as a gateway according to the first code, and acquires the memory address of the protected method or function duplicated in the protection module file through the second code. You may find and execute the duplicated protected method or function with. As described above, the memory address may be calculated by the second code with the partner address value provided by the program counter (Program Counter: PC) and the protection module file provided by the execution of the application as factors.

また、上述したように、保護モジュールファイルに複製された保護対象メソッドまたは関数(のインストラクション)は、第1キーまたは第1暗号化アルゴリズムによって暗号化されていてもよい。この場合、実行コード処理部620は、複製された保護対象メソッドまたは関数に追加された復号化コードを利用して暗号化されたインストラクションを復号化してもよい。 Further, as described above, the protected method or function (instruction) duplicated in the protection module file may be encrypted by the first key or the first encryption algorithm. In this case, the execution code processing unit 620 may decrypt the encrypted instruction by using the decryption code added to the duplicated protected method or function.

段階740で、再暗号化制御部630は、アプリケーションが実行され、保護モジュールファイルに複製された保護対象メソッドまたは関数のインストラクションが復号化コードによって復号化され、予め設定された条件が満たされる場合、インストラクションを第2キーまたは第2暗号化アルゴリズムによって再暗号化してもよい。それぞれの保護対象メソッドまたは関数に対する実行時点がそれぞれ異なるため、少なくとも一部の保護対象メソッドまたは関数は常に暗号化された状態で存在するようになる。また、実行時点ごとに暗号化された保護対象メソッド(または関数)と、復号化された保護対象メソッド(または関数)または再暗号化された保護対象メソッド(または関数)が継続して異なるため、保護モジュールファイルに複製された保護対象メソッドまたは関数は互いに異なる値を有するようになり、コードをより一層安全に保護することができるようになる。 At step 740, the re-encryption control unit 630 tells the re-encryption control unit 630 when the application is executed and the instructions for the protected method or function replicated in the protection module file are decrypted by the decryption code and the preset conditions are met. Instructions may be re-encrypted with a second key or a second encryption algorithm. Since each protected method or function has a different execution time point, at least some protected methods or functions will always exist in an encrypted state. Also, because the encrypted protected method (or function) and the decrypted protected method (or function) or re-encrypted protected method (or function) continue to be different at each execution time point. The protected methods or functions duplicated in the protection module file will have different values, allowing the code to be protected even more safely.

このように、本発明の実施形態によると、保護対象となるアプリケーションのコードと保護モジュールをカップリングして提供することにより、保護モジュールなしではアプリケーションが実行されないようにし、保護モジュールの除去を防ぐことができる。また、全体コードに対して保護を適用するのではなく、必ず必要なコードに対してのみ保護モジュールとのカップリングを処理することにより、保護対象コードを選択することができる。さらに、保護モジュールとカップリングされたコードを暗号化し、該当のコードの実行時点にだけ暗号化されたコードを復号化し、復号化されたコードを再び暗号化することにより、アプリケーションの実行時点でも保護モジュールとカップリングされたコードのうちの少なくとも一部が常に暗号化されているようにコードを保護することができる。これだけでなく、保護対象となるアプリケーションのコードを保護モジュールに移動させて保護することにより、アプリケーションのコードを静的に分析できないようにすることができ、保護モジュールに移動したアプリケーションのコードが最初の実行時に復号化され、または周期的に再暗号化されるため、動的な分析に対しても保護を提供することができる。例えば、ランタイムの瞬間ごとに保護モジュールに格納されたアプリケーションのコードが変わるため、特に動的分析のためにメモリダンプなどを通じた分析方法を無力化させることができる。 As described above, according to the embodiment of the present invention, by providing the code of the application to be protected and the protection module by coupling, the application cannot be executed without the protection module and the removal of the protection module is prevented. Can be done. In addition, the code to be protected can be selected by processing the coupling with the protection module only for the code that is absolutely necessary, instead of applying the protection to the entire code. Furthermore, by encrypting the code coupled with the protection module, decrypting the encrypted code only at the time of execution of the corresponding code, and re-encrypting the decrypted code, it is protected even at the time of application execution. You can protect your code so that at least part of the code coupled to the module is always encrypted. Not only this, but by moving the code of the protected application to the protection module and protecting it, it is possible to prevent the application code from being analyzed statically, and the code of the application moved to the protection module is the first. Decrypted at run time or periodically re-encrypted, it can also provide protection against dynamic analysis. For example, since the application code stored in the protection module changes every moment of runtime, it is possible to disable the analysis method through a memory dump or the like, especially for dynamic analysis.

以下では、コード保護方法のさらに具体的な実施形態について説明する。 Hereinafter, a more specific embodiment of the code protection method will be described.

図8は、本発明の一実施形態における、サーバがパッケージに保護モジュールファイルを追加して電子機器に送信する過程の例を示した図である。 FIG. 8 is a diagram showing an example of a process in which a server adds a protection module file to a package and transmits it to an electronic device according to an embodiment of the present invention.

図8は、開発者端末810、コード保護システム820、ファイル配布システム830、ユーザ端末840、およびサービスシステム850をそれぞれ示している。開発者端末810は、アプリケーションの開発者が利用する電子機器であってもよく、ユーザ端末840は、アプリケーションのユーザが利用する電子機器であってもよい。コード保護システム820は、上述したサーバ150に対応してもよく、ファイル配布システム830とサービスシステム850もそれぞれ個別サーバであってもよい。他の実施形態において、コード保護システム820とファイル配布システム830は、同じ主体によって運営されるシステムであるか、または1つのシステムであってもよい。また、サービスシステム850は、開発者によって運営されるサーバシステムであってもよいし、開発者とは異なる第三者によって開発者が提供するサーバ側プログラムを基盤として動作するサーバシステムであってもよい。例えば、サービスシステム850は、ゲームアプリケーションを通じてオンラインゲームサービスを提供するゲームサーバであってもよい。この場合、ユーザ端末840は、ゲームアプリケーションを通じてゲームサーバに接続してゲームサービスの提供を受けることができるようになる。 FIG. 8 shows a developer terminal 810, a code protection system 820, a file distribution system 830, a user terminal 840, and a service system 850, respectively. The developer terminal 810 may be an electronic device used by the developer of the application, and the user terminal 840 may be an electronic device used by the user of the application. The code protection system 820 may correspond to the server 150 described above, and the file distribution system 830 and the service system 850 may also be individual servers. In other embodiments, the code protection system 820 and the file distribution system 830 may be systems operated by the same entity or may be one system. Further, the service system 850 may be a server system operated by the developer, or may be a server system that operates based on a server-side program provided by the developer by a third party different from the developer. good. For example, the service system 850 may be a game server that provides an online game service through a game application. In this case, the user terminal 840 can connect to the game server through the game application and receive the game service.

1.パッケージ登録過程は、開発者端末810が、開発者によって開発されたアプリケーションのパッケージをコード保護システム820に登録する過程であってもよい。例えば、開発者端末810とコード保護システム820の間のネットワーク(一例として、図1のネットワーク170)を介したデータ通信によってパッケージが開発者端末810からコード保護システム820にアップロードされてもよい。以下では、このようなネットワークを介したデータ通信についての説明は省略する。 1. 1. The package registration process may be a process in which the developer terminal 810 registers the package of the application developed by the developer in the code protection system 820. For example, the package may be uploaded from the developer terminal 810 to the code protection system 820 by data communication via the network between the developer terminal 810 and the code protection system 820 (for example, the network 170 in FIG. 1). Hereinafter, the description of data communication via such a network will be omitted.

2.保護ファイル追加過程は、コード保護システム820が、登録されたアプリケーションのパッケージに保護モジュールファイルを追加する過程であってもよい。この過程において、図4および図5を参照しながら説明したコード保護方法がコード保護システム820によって実行されてもよい。 2. The protection file addition process may be a process in which the code protection system 820 adds a protection module file to the package of the registered application. In this process, the code protection method described with reference to FIGS. 4 and 5 may be implemented by the code protection system 820.

3.パッケージ登録過程は、コード保護システム820が、保護モジュールファイルが追加されたパッケージをファイル配布システム830に登録する過程であってもよい。他の実施形態において、コード保護システム820は、保護モジュールファイルが追加されたパッケージを開発者端末810に提供し、開発者端末810が直接ファイル配布システム830に保護モジュールファイルが追加されたパッケージを登録することも可能である。 3. 3. The package registration process may be a process in which the code protection system 820 registers the package to which the protection module file is added in the file distribution system 830. In another embodiment, the code protection system 820 provides the developer terminal 810 with a package to which the protection module file is added, and the developer terminal 810 directly registers the package to which the protection module file is added to the file distribution system 830. It is also possible to do.

4.パッケージ配布過程は、ファイル配布システム830が、ユーザ端末840の要請にしたがって保護モジュールファイルが追加されたパッケージをユーザ端末840に配布する過程であってもよい。ユーザ端末840では、保護モジュールファイルが追加されたパッケージを通じてアプリケーションがインストールされてもよい。 4. The package distribution process may be a process in which the file distribution system 830 distributes the package to which the protection module file is added to the user terminal 840 at the request of the user terminal 840. On the user terminal 840, the application may be installed through a package to which the protection module file is added.

5.サービス通信過程は、ユーザ端末840が、実行するアプリケーションを基盤としてサービスシステム850と通信してサービスの提供を受ける過程であってもよい。 5. The service communication process may be a process in which the user terminal 840 communicates with the service system 850 based on the application to be executed and receives the service.

図9は、本発明の一実施形態における、保護対象メソッドまたは関数を選別する過程の例を示した図である。図9は、ゲームアプリケーションパッケージ910を示している。ゲームアプリケーションパッケージ910は、ファイル1(911)およびファイル2(912)のような複数のファイルを含んでもよい。 FIG. 9 is a diagram showing an example of a process of selecting a method or function to be protected in one embodiment of the present invention. FIG. 9 shows the game application package 910. The game application package 910 may include a plurality of files such as file 1 (911) and file 2 (912).

ここで、図8で説明したコード保護システム820は、保護対象メソッドまたは関数を、予め設定されたルールにしたがって、または開発者によって入力された情報にしたがって選別してパッキングリスト(packing list)920を生成してもよい。例えば、メソッド2が保護対象メソッドとして選別された場合、パッキングリスト920には、選別されたメソッドの識別子である「メソッド2」とランダムな固有値であるインデックス「9」にマッチングされた保護対象リストが生成されてもよい。また、メソッド4が保護対象メソッドとして追加選別された場合、パッキングリスト920には、選別されたメソッドの識別子である「メソッド4」とランダムな固有値であるインデックス「2」にマッチングされた保護対象リストが生成されてもよい。 Here, the code protection system 820 described with reference to FIG. 8 sorts the protected methods or functions according to preset rules or according to the information input by the developer to select the packing list 920. It may be generated. For example, when method 2 is selected as a protected method, the packing list 920 contains a protected list matched with the identifier "method 2" of the selected method and the index "9" which is a random eigenvalue. It may be generated. Further, when the method 4 is additionally selected as the protected method, the packing list 920 shows the protected list matched with the identifier "method 4" of the selected method and the index "2" which is a random eigenvalue. May be generated.

コード保護システム820は、生成されたパッキングリスト920を基盤として選別された保護対象メソッド(または関数)を識別することができるようになる。 The code protection system 820 will be able to identify protected methods (or functions) selected based on the generated packing list 920.

図10は、本発明の一実施形態における、保護対象メソッドまたは関数を保護モジュールファイルに複製する過程の例を示した図である。図10は、ゲームアプリケーションパッケージ1010のファイル1(1011)で関数「jni onload」の1番目のインストラクション「instruction 1」がコード保護システム820によって保護モジュールファイル1020に複製される例を説明している。ここで、コード保護システム820は、図9で説明したパッキングリスト920を基盤として選別された保護対象メソッドまたは関数を見つけ出してもよい。 FIG. 10 is a diagram showing an example of a process of replicating a protected method or function to a protected module file in one embodiment of the present invention. FIG. 10 illustrates an example in which the first instruction "instruction 1" of the function "jni onload" is replicated to the protection module file 1020 by the code protection system 820 in the file 1 (1011) of the game application package 1010. Here, the code protection system 820 may find a protected method or function selected based on the packing list 920 described with reference to FIG.

一般的に、1つのインストラクションは、同じように保護モジュールファイル1020に複製されてもよいが、現在のプログラムカウンタ値がオペコード(opcode)値に影響を与えるインストラクションは、2つ以上のインストラクションに変換されて複製されることも可能である。例えば、現在のプログラムカウンタで4Mbyte以上離れるように分岐されるインストラクションは、このような分岐を反映するために2つ以上のインストラクションに変換されて複製されてもよい。 In general, one instruction may be duplicated in the protection module file 1020 as well, but an instruction whose current program counter value affects the opcode value is converted to two or more instructions. It is also possible to duplicate. For example, an instruction that is branched at a current program counter so as to be separated by 4 Mbytes or more may be converted into two or more instructions and duplicated in order to reflect such a branch.

また、アンドロイド(登録商標)オペレーティングシステムで4byteと定義されたインストラクションのアーム(arm)モードと2byteと定義されたインストラクションのサム(thumb)モードのように、モード別インストラクションが保護モジュールファイル1020でそれぞれ異なる領域(「FunctionArm」および「FunctionThumb」)に複製されることも可能である。インストラクションの変換は、コード保護システム820が呼び出すインストラクション変換器(instruction translator)によって処理されてもよい。ここで、コード保護システム820は、アームモードのためのインストラクション変換器とサムモードのためのインストラクション変換器をそれぞれ呼び出してもよい。他の実施形態では、サム2(thumb2)モードのためのインストラクション変換器がさらに利用されることも可能である。 In addition, the instruction for each mode is different in the protection module file 1020, such as the arm mode of the instruction defined as 4byte and the thumb mode of the instruction defined as 2byte in the android (registered trademark) operating system. It is also possible to replicate to regions (“Faction Arm” and “Function Thumb”). The instruction conversion may be processed by an instruction translator called by the code protection system 820. Here, the code protection system 820 may call the instruction converter for the arm mode and the instruction converter for the thumb mode, respectively. In other embodiments, instruction transducers for thumb2 mode may be further utilized.

また、インストラクションの変換は、コード最適化のために複数のインストラクションを1つに統合する過程を含んでもよい。例えば、実行コードのコンパイル過程において不必要に含まれたインストラクションが除去されてもよい。 The instruction conversion may also include the process of integrating multiple instructions into one for code optimization. For example, instructions that are unnecessarily included in the process of compiling the executable code may be removed.

ここで、保護モジュールファイルのコードは、メモリで可変的にロードされるため、インストラクションは、可変的なメモリアドレスを考慮して変換されてもよい。このような可変的なメモリアドレスは、上述した保護モジュールファイルによって提供される相手アドレス値を基盤としてもよい。 Here, since the code of the protection module file is variably loaded in the memory, the instruction may be translated in consideration of the variable memory address. Such a variable memory address may be based on the peer address value provided by the protection module file described above.

図11は、本発明の一実施形態における、ゲートウェイを追加してコードのインストラクションを変形する過程の例を示した図である。 FIG. 11 is a diagram showing an example of a process of adding a gateway and transforming a code instruction in one embodiment of the present invention.

上述したように、保護モジュールファイルのコードがメモリにロードされるアドレスは可変的である。コード保護システム820は、保護対象メソッド(または関数)にゲートウェイ1110を呼び出すための第1コード「b.gateway Index1」を追加してもよく、ゲームアプリケーションパッケージ1010(または実行コード)にはゲートウェイ1110のための第2コードのセクションを追加してもよい。ここで、4バイトアドレスは、アプリケーションがユーザ端末840で実行される場合に保護モジュールファイル1020によって提供される相手アドレス値であってもよい。このようなゲートウェイ1110を通じてメモリにアップロードされた保護モジュールファイル1020のコードで複製された保護対象メソッド(または関数)のインストラクションを見つけ出して実行することができるようになる。 As mentioned above, the address at which the protection module file code is loaded into memory is variable. The code protection system 820 may add the first code "b.gateway Index1" for calling the gateway 1110 to the protected method (or function), and the game application package 1010 (or the execution code) of the gateway 1110 may be added. You may add a section of second code for this. Here, the 4-byte address may be a remote address value provided by the protection module file 1020 when the application is executed on the user terminal 840. It becomes possible to find and execute the instruction of the protected method (or function) duplicated by the code of the protection module file 1020 uploaded to the memory through such a gateway 1110.

既存のインストラクションは、アンノウンインストラクションや任意のランダムなアドレスにジャンプ(jump)するインストラクションに変形されてもよい。「Index1」のようなインデックスは、パッキングリスト920によって管理されてもよい。 Existing instructions may be transformed into unknown instructions or instructions that jump to any random address. Indexes such as "Index1" may be managed by packing list 920.

図12は、本発明の一実施形態における、複製された保護対象メソッドまたは関数のインストラクションを暗号化する過程の例を示した図である。図12は、図11で説明した保護モジュールファイル1020が複製されたインストラクションを暗号化した保護モジュールファイル1210に変更される例を示している。第1点線ボックス1211は、複製されたインストラクションが暗号化されたことを示しており、第2点線ボックス1212は、暗号化されたインストラクションを復号化するための復号化コードが追加された例を示している。 FIG. 12 is a diagram showing an example of a process of encrypting a duplicated protected method or function instruction in one embodiment of the present invention. FIG. 12 shows an example in which the protection module file 1020 described with reference to FIG. 11 is changed to the encrypted protection module file 1210 for the duplicated instruction. The first dotted line box 1211 shows that the duplicated instruction is encrypted, and the second dotted line box 1212 shows an example in which a decryption code for decrypting the encrypted instruction is added. ing.

復号化コード「UnCryptor Code」は、最初の実行時に暗号化されたインストラクションを復号化し、インストラクションが復号化された後には、単純に復号化されたインストラクションにジャンプするように実現されてもよい。 The decryption code "UnCryptor Code" may be implemented to decrypt the encrypted instruction at the first execution, and after the instruction is decrypted, simply jump to the decrypted instruction.

図13は、本発明の一実施形態における、保護動作の全体の流れの例を示した図である。ユーザ端末840でアプリケーションが実行される場合、ユーザ端末840は、ゲームアプリケーションパッケージ1010でメモリにロードされた実行コードを順に実行しながらサービスの提供を受けてもよい。ファイル1(1011)の保護対象関数「jni onload」が実行されなければならない場合、ユーザ端末840は、インストラクション「b.gateway Index1」にしたがってゲートウェイ1110を呼び出してもよく、ゲートウェイ1110の「Index1」に含まれたインストラクションにしたがって保護モジュールファイル1210に複製された保護対象メソッドまたは関数を見つけ出すことができるようになる。 FIG. 13 is a diagram showing an example of the overall flow of the protection operation in one embodiment of the present invention. When the application is executed on the user terminal 840, the user terminal 840 may receive the service while sequentially executing the execution code loaded in the memory in the game application package 1010. When the protected function "jni onload" of the file 1 (1011) must be executed, the user terminal 840 may call the gateway 1110 according to the instruction "b.gateway Index1", and the gateway 1110 "Index1" may be called. It will be possible to find the protected method or function duplicated in the protection module file 1210 according to the included instructions.

ゲートウェイ1110の「4byte address」は、保護モジュールファイル1210で保護モジュールのためのコードがメモリにロードされた後、メモリにおける相手アドレス値としてゲートウェイ1110に提供されてもよい。ユーザ端末840は、ゲートウェイ1110を通じて保護モジュールファイル1210(実際には、メモリにロードされた保護モジュールコード)で保護対象関数「jni onload」が複製された領域を見つけ出してもよい。ユーザ端末840は、コード「UnCryptor Code」によって暗号化されたインストラクションを復号化してもよい。保護モジュールファイル1310(実際には、メモリにロードされた保護モジュールコード)は、暗号化されたインストラクションが復号化された様子を示している。ここで、コード「UnCryptor Code」は、「instruction 1」にジャンプするためのコード(他の例として、本来の場所にジャンプするためのコード)に変更された。したがって、ユーザ端末840は、保護対象関数「jni onload」のためのインストラクションを得ることができるようになる。 The "4 byte addless" of the gateway 1110 may be provided to the gateway 1110 as a remote address value in the memory after the code for the protection module is loaded into the memory in the protection module file 1210. The user terminal 840 may find an area in which the protection target function "jni onload" is duplicated in the protection module file 1210 (actually, the protection module code loaded in the memory) through the gateway 1110. The user terminal 840 may decrypt the instruction encrypted by the code "UnCryptor Code". The protection module file 1310 (actually, the protection module code loaded into memory) shows how the encrypted instructions have been decrypted. Here, the code "UnCryptor Code" has been changed to a code for jumping to "instruction 1" (as another example, a code for jumping to the original place). Therefore, the user terminal 840 can obtain the instruction for the protection target function "jni onload".

以後、予め設定された条件にしたがって復号化されたインストラクションは、他のキー(第2キー)や他の暗号化アルゴリズム(第2暗号化アルゴリズム)によって再暗号化されてもよい。 After that, the instruction decrypted according to the preset conditions may be re-encrypted by another key (second key) or another encryption algorithm (second encryption algorithm).

図14は、本発明の一実施形態における、実行時点によるインストラクションの暗号化および復号化を説明するための図である。 FIG. 14 is a diagram for explaining encryption and decryption of instructions at the time of execution in one embodiment of the present invention.

実行時点1での第1ボックス1410は、保護モジュールファイルに複製されたコードの暗号化状態を示している。ここで、ボックス1410に示すように、最初に複製されたコードはすべて暗号化された状態で存在してもよい。 The first box 1410 at execution time 1 indicates the encrypted state of the code replicated in the protection module file. Here, as shown in box 1410, all the first replicated code may exist in an encrypted state.

実行時点2での第2ボックス1420は、一部コードが復号化され、復号化されたコード「Code」が一部存在することを示している。 The second box 1420 at the execution time point 2 indicates that a part of the code is decoded and a part of the decoded code "Code" exists.

実行時点3での第3ボックス1430は、復号化されたコードのうちの一部が再暗号化され、再暗号化されたコード「ReCrypted Code」が一部存在することを示している。 The third box 1430 at the time of execution 3 indicates that a part of the decrypted code is re-encrypted and a part of the re-encrypted code "Recrypted Code" exists.

このように、アプリケーションの実行時、各インストラクションの実行時点に復号化が行われ、暗号化されたインストラクションに対する再暗号化が行われるため、保護モジュールファイルは実行時点によって互いに異なるコード値を含むようになる。したがって、保護モジュールファイルを分析しても、本来のコードを得ることが難しくなるため、コードに対する偽・変造を防ぐことができる。インストラクションの再暗号化のための条件は、アプリケーションがバックグラウンドモードで動作するように転換される場合や、インストラクションが復号化されて実行された直後など、多様な条件によって予め設定されてもよい。 In this way, when the application is executed, decryption is performed at the execution time of each instruction and re-encryption is performed for the encrypted instruction, so that the protection module file contains different code values depending on the execution time. Become. Therefore, even if the protection module file is analyzed, it is difficult to obtain the original code, and forgery / alteration of the code can be prevented. The conditions for re-encrypting the instruction may be preset according to various conditions, such as when the application is converted to operate in the background mode or immediately after the instruction is decrypted and executed.

図15は、本発明の他の実施形態における、サーバのプロセッサが含むことのできる構成要素の例を示したブロック図であり、図16は、本発明の他の実施形態における、サーバが実行することのできる方法の例を示したフローチャートである。 FIG. 15 is a block diagram showing an example of components that the server processor can include in another embodiment of the invention, and FIG. 16 is a block diagram performed by the server in another embodiment of the invention. It is a flowchart which showed the example of the possible method.

サーバ150は、本発明の他の実施形態に係るコード保護システムを実現してもよく、図15に示すように、サーバ150に含まれたプロセッサ222は、構成要素として、パッケージファイル管理部1510、暗号化制御部1520、ファイル制御部1530、保護モジュール追加部1540、およびパッケージファイル提供部1550を含んでもよい。このようなプロセッサ222およびプロセッサ222の構成要素は、図16のコード保護方法が含む段階1610〜1660を実行するようにサーバ150を制御してもよい。このとき、プロセッサ222およびプロセッサ222の構成要素は、メモリ221が含むオペレーティングシステムのコードと少なくとも1つのプログラムのコードによる命令(instruction)を実行するように実現されてもよい。ここで、プロセッサ222の構成要素は、サーバ150に格納されたプログラムコードが提供する制御命令にしたがってプロセッサ222によって実行されるプロセッサ222の互いに異なる機能(different functions)の表現であってもよい。例えば、プロセッサ222が上述した制御命令にしたがってアプリケーションのためのパッケージファイルを格納するようにサーバ150を制御するプロセッサ222の機能的表現として、パッケージファイル管理部1510が使用されてもよい。 The server 150 may realize a code protection system according to another embodiment of the present invention, and as shown in FIG. 15, the processor 222 included in the server 150 is a component of the package file management unit 1510. The encryption control unit 1520, the file control unit 1530, the protection module addition unit 1540, and the package file provision unit 1550 may be included. Such processor 222 and the components of processor 222 may control the server 150 to perform steps 161 to 1660 included in the code protection method of FIG. At this time, the processor 222 and the components of the processor 222 may be realized to execute an instruction by the code of the operating system included in the memory 221 and the code of at least one program. Here, the component of the processor 222 may be a representation of different functions of the processor 222 executed by the processor 222 according to a control instruction provided by a program code stored in the server 150. For example, the package file management unit 1510 may be used as a functional representation of the processor 222 that controls the server 150 so that the processor 222 stores the package files for the application according to the control instructions described above.

段階1610で、プロセッサ222は、サーバ150の制御と関連するプログラムのファイルに格納されたプログラムコードをメモリ221にロードしてもよい。例えば、プロセッサ222は、オペレーティングシステムの制御にしたがって前記プログラムのファイルからプログラムコードをメモリ221にロードするようにサーバ150を制御してもよい。例えば、前記プログラムのファイルは、プロセッサ222が以後で説明される段階1620〜1660を実行するように制御するためのコードのうちの少なくとも一部を含んでもよい。 At step 1610, processor 222 may load program code stored in a file of programs associated with control of server 150 into memory 221. For example, the processor 222 may control the server 150 to load the program code from the file of the program into the memory 221 under the control of the operating system. For example, the program file may contain at least a portion of the code that controls the processor 222 to perform steps 1620 to 1660 described below.

段階1620で、パッケージファイル管理部1510は、アプリケーションのためのパッケージファイルを格納するようにサーバ150を制御してもよい。例えば、パッケージファイルは、入力/出力インタフェース224を通じてサーバ150に入力されるか、または通信モジュール223を通じてサーバ150に受信されてもよく、サーバ150は、パッケージファイル管理部1510の制御にしたがって入力された、または受信されたパッケージファイルを、ストレージのような永久格納装置に格納して管理してもよい。例えば、パッケージファイルは、開発者によって開発されたコードをコンパイルした後、すべてのファイルを集めて生成したアプリケーションのパッケージであってもよい。 At step 1620, the package file management unit 1510 may control the server 150 to store the package files for the application. For example, the package file may be input to the server 150 through the input / output interface 224 or received by the server 150 through the communication module 223, which is input under the control of the package file management unit 1510. , Or the received package file may be stored and managed in a permanent storage device such as storage. For example, the package file may be a package of an application generated by collecting all the files after compiling the code developed by the developer.

段階1630で、暗号化制御部1520は、パッケージファイルが含むライブラリファイルを暗号化して暗号化されたライブラリファイルを生成してもよい。ライブラリファイルを暗号化する方法としては、周知の暗号化方式のうちの1つが利用されてもよい。 At step 1630, the encryption control unit 1520 may encrypt the library file included in the package file to generate the encrypted library file. As a method of encrypting the library file, one of well-known encryption methods may be used.

段階1640で、ファイル制御部1530は、パッケージファイルが含むライブラリファイルを変換するか、またはパッケージファイルから除去してもよい。例えば、ファイル制御部1530は、ライブラリファイルが含むコードや命令(instruction)をアンノウン(unknown)コードや命令に変換するか、ファイル自体をパッケージファイルから除去することにより、利用者がライブラリファイルの内容にアクセスできないようにすることができる。 At step 1640, the file control unit 1530 may convert the library file contained in the package file or remove it from the package file. For example, the file control unit 1530 converts the code or instruction contained in the library file into an unknown code or instruction, or removes the file itself from the package file so that the user can change the contents of the library file. It can be made inaccessible.

段階1650で、保護モジュール追加部1540は、暗号化されたライブラリファイルを含む保護モジュールをパッケージファイルに追加してパッケージファイルを再生成してもよい。単純にライブラリファイルを変換するか除去する場合には、パッケージファイルを通じてアプリケーションが正確に実行されることが不可能となるため、サーバ150は、保護モジュール追加部1540の制御にしたがって暗号化されたライブラリファイルを保護モジュールに含ませてパッケージファイルに追加することにより、ライブラリファイルへのアクセスを防ぐと同時に、保護モジュールを通じてしかライブラリファイルにアクセスすることができないようにすることができる。 At step 1650, the protection module adder 1540 may add a protection module containing an encrypted library file to the package file to regenerate the package file. If the library file is simply converted or removed, the application cannot be executed correctly through the package file, so the server 150 is an encrypted library under the control of the protection module addition unit 1540. By including the file in the protection module and adding it to the package file, you can prevent access to the library file and at the same time ensure that the library file can only be accessed through the protection module.

段階1660で、パッケージファイル提供部1550は、再生成されたパッケージファイルをネットワーク170を介して提供するようにサーバ150を制御してもよい。再生成されたパッケージファイルは、ネットワーク170を介して利用者の端末(一例として、電子機器1(110))に直接送信されてもよいし、別のサーバ(一例として、サーバ160)を通じて利用者の端末に伝達されてもよい。他の例として、再生成されたパッケージファイルは、ネットワーク170を介して開発者の端末に送信された後、開発者の端末から別のサーバにアップロードされて利用者の端末に伝達されることも可能である。 At step 1660, the package file provider 1550 may control the server 150 to serve the regenerated package file over the network 170. The regenerated package file may be sent directly to the user's terminal (for example, electronic device 1 (110)) via the network 170, or may be sent to the user through another server (for example, server 160). It may be transmitted to the terminal of. As another example, the regenerated package file may be sent to the developer's terminal via network 170, then uploaded from the developer's terminal to another server and transmitted to the user's terminal. It is possible.

ここで、保護モジュール(保護モジュールファイルに含まれた保護モジュール)は、パッケージファイルを通じてアプリケーションがインストールされた電子機器(一例として、電子機器1(110))で変換または除去されたライブラリファイルに対する制御命令をインターセプト(intercept)またはフッキング(hooking)し、保護モジュールに含まれた暗号化されたライブラリファイルを利用してインターセプトされた制御命令を処理するように実現されてもよい。電子機器で動作する保護モジュールについては、以下でさらに詳しく説明する。 Here, the protection module (protection module included in the protection module file) is a control instruction for the library file converted or removed by the electronic device (for example, electronic device 1 (110)) in which the application is installed through the package file. May be implemented to intercept or hook and use the encrypted library file contained in the protection module to process the intercepted control instructions. The protection modules that work with electronic devices are described in more detail below.

図17は、本発明の他の実施形態における、パッケージファイルに保護モジュールを追加する例を示した図である。サーバ150に入力または受信されるパッケージファイル1710は、少なくとも1つのライブラリファイル1711を含んでもよい。例えば、アンドロイドオペレーティングシステムにおいて、ライブラリファイル1711は、「libGame.so」のように「.so」の拡張子を有してもよく、少なくともヘッダ1712とコード1713を含むように実現されてもよい。従来技術では、このようなパッケージファイル1710に、パッケージファイル1710の保護のために保護モジュールファイルを追加したが、上述したように、保護モジュールファイルを削除するか、または保護モジュールがメモリにロードされる以前にライブラリファイル1711にアクセスすることにより、ライブラリファイル1711を偽・変造することができた。 FIG. 17 is a diagram showing an example of adding a protection module to a package file in another embodiment of the present invention. The package file 1710 input or received to the server 150 may include at least one library file 1711. For example, in an android operating system, library file 1711 may have a ".so" extension, such as "libGame.so", or may be implemented to include at least header 1712 and code 1713. In the prior art, a protection module file was added to such a package file 1710 to protect the package file 1710, but as described above, the protection module file is deleted or the protection module is loaded into memory. By previously accessing the library file 1711, the library file 1711 could be forged or altered.

このような偽・変造を防ぐために、本実施形態では、パッケージファイル1710に暗号化されたライブラリファイル1724を含む保護モジュール1721を追加し、パッケージファイル1710からライブラリファイル1711を除去してパッケージファイル1720を生成してもよい。これにより、パッケージファイル1720の利用者は、保護モジュール1721を除去することができず、ライブラリファイル1711の内容に簡単にアクセスすることができないようになる。保護モジュール1721は、パッケージファイル1720に対する保護機能や暗号化されたライブラリファイル1724の復号化機能などのためのヘッダ1722とコード1723をさらに含んでもよい。 In order to prevent such falsification / alteration, in the present embodiment, the protection module 1721 including the encrypted library file 1724 is added to the package file 1710, and the library file 1711 is removed from the package file 1710 to obtain the package file 1720. It may be generated. As a result, the user of the package file 1720 cannot remove the protection module 1721 and cannot easily access the contents of the library file 1711. The protection module 1721 may further include a header 1722 and a code 1723 for protection against the package file 1720, decryption of the encrypted library file 1724, and the like.

図18は、本発明の他の実施形態における、パッケージファイルに保護モジュールを追加する他の例を示した図である。図18の実施形態では、図17の実施形態と同じように、パッケージファイル1710に暗号化されたライブラリファイル1823を含む保護モジュール1820を追加してもよい。この反面、図18の実施形態では、図17の実施形態とは異なり、ライブラリファイル1711を削除せず、コード1713を利用者の端末が解釈することができないアンノウンコードまたは命令1811に変換してパッケージファイル1710を生成してもよい。この場合にも、パッケージファイル1810の利用者は、ライブラリファイル1711の内容に容易にアクセスすることができなくなり、保護モジュール1820を除去する場合、アプリケーションが正常に実行しなくなるため、保護モジュール1820の削除を防ぐことができる。保護モジュール1820は、パッケージファイル1810に対する保護機能や暗号化されたライブラリファイル1823の復号化機能などのためのヘッダ1821とコード1822をさらに含んでもよい。 FIG. 18 is a diagram showing another example of adding a protection module to a package file in another embodiment of the present invention. In the embodiment of FIG. 18, a protection module 1820 containing an encrypted library file 1823 may be added to the package file 1710, as in the embodiment of FIG. On the other hand, in the embodiment of FIG. 18, unlike the embodiment of FIG. 17, the library file 1711 is not deleted, and the code 1713 is converted into an unknown code or instruction 1811 that cannot be interpreted by the user's terminal and packaged. File 1710 may be generated. Also in this case, the user of the package file 1810 cannot easily access the contents of the library file 1711, and when the protection module 1820 is removed, the application does not execute normally. Therefore, the protection module 1820 is deleted. Can be prevented. The protection module 1820 may further include a header 1821 and code 1822 for protection against the package file 1810, decryption of the encrypted library file 1823, and the like.

以下では、サーバ150で再生成されて提供されるパッケージファイルを受信した電子機器1(110)の観点から本発明の実施形態について説明する。 Hereinafter, embodiments of the present invention will be described from the perspective of electronic device 1 (110) that has received the package file regenerated and provided by the server 150.

図19は、本発明の他の実施形態における、電子機器のプロセッサが含むことのできる構成要素の例を示したブロック図であり、図20は、本発明の一実施形態における、電子機器が実行することのできる方法の例を示したフローチャートである。 FIG. 19 is a block diagram showing an example of components that can be included in the processor of the electronic device in another embodiment of the present invention, and FIG. 20 is a block diagram shown by the electronic device in one embodiment of the present invention. It is a flowchart which showed the example of the method which can be done.

電子機器1(110)は、本発明の他の実施形態に係るコード保護システムを実現してもよく、図19に示すように、電子機器1(110)に含まれたプロセッサ212は、構成要素として、アプリケーションインストール制御部1910、制御命令インターセプト部1920、および制御命令処理部1930を含んでもよい。このようなプロセッサ212およびプロセッサ212の構成要素は、図20のコード保護方法が含む段階2010〜2040を実行するように電子機器1(110)を制御してもよい。このとき、プロセッサ212およびプロセッサ212の構成要素は、メモリ211が含むオペレーティングシステムのコードと少なくとも1つのプログラムのコードによる命令(instruction)を実行するように実現されてもよい。ここで、プロセッサ212の構成要素は、電子機器1(110)に格納されたプログラムコードが提供する制御命令にしたがってプロセッサ212によって実行されるプロセッサ212の互いに異なる機能(different functions)の表現であってもよい。例えば、プロセッサ212が上述した制御命令にしたがってアプリケーションをインストールするように電子機器1(110)を制御するプロセッサ212の機能的表現として、アプリケーションインストール制御部1910が使用されてもよい。 The electronic device 1 (110) may realize the code protection system according to another embodiment of the present invention, and as shown in FIG. 19, the processor 212 included in the electronic device 1 (110) is a component. May include an application installation control unit 1910, a control instruction intercept unit 1920, and a control instruction processing unit 1930. Such a processor 212 and components of the processor 212 may control electronic device 1 (110) to perform steps 2010 to 2040 included in the code protection method of FIG. At this time, the processor 212 and the components of the processor 212 may be realized to execute an instruction by the code of the operating system included in the memory 211 and the code of at least one program. Here, the components of the processor 212 are representations of different functions of the processor 212 executed by the processor 212 according to the control instructions provided by the program code stored in the electronic device 1 (110). May be good. For example, the application installation control unit 1910 may be used as a functional representation of the processor 212 that controls the electronic device 1 (110) so that the processor 212 installs the application according to the control instructions described above.

段階2010で、プロセッサ212は、電子機器1(110)の制御と関連するプログラムのファイルに格納されたプログラムコードをメモリ211にロードしてもよい。例えば、プロセッサ212は、オペレーティングシステムの制御にしたがって前記プログラムのファイルからプログラムコードをメモリ211にロードするように電子機器1(110)を制御してもよい。例えば、前記プログラムのファイルは、プロセッサ212が以下で説明される段階2020〜2040を実行するように制御するためのコードのうちの少なくとも一部を含んでもよい。 In step 2010, the processor 212 may load the program code stored in the file of the program associated with the control of the electronic device 1 (110) into the memory 211. For example, the processor 212 may control the electronic device 1 (110) to load the program code from the file of the program into the memory 211 according to the control of the operating system. For example, the program file may contain at least a portion of the code that controls the processor 212 to perform steps 2020-2040 described below.

段階2020で、アプリケーションインストール制御部1910は、パッケージファイルを受信し、パッケージファイルを通じてアプリケーションをインストール(install)するように電子機器1(110)を制御してもよい。ここで、パッケージファイルは、上述したように、サーバ150でパッケージファイルが含むライブラリファイルが変換または削除され、ライブラリファイルを暗号化して含む保護モジュールが追加されたファイルであってもよい。 At step 2020, the application installation control unit 1910 may control the electronic device 1 (110) to receive the package file and install the application through the package file. Here, as described above, the package file may be a file in which the library file included in the package file is converted or deleted by the server 150, and a protection module including the encrypted library file is added.

段階2030で、制御命令インターセプト部1920は、アプリケーションの実行時、電子機器1(110)のメモリ211にロードされた保護モジュールの制御にしたがって変換または削除されたライブラリファイルに対する制御命令をインターセプト(intercept)してもよい。例えば、制御命令インターセプト部1920は、電子機器1(110)のメモリ211にロードされた保護モジュールに対するオープン命令にしたがって迂回リンカ(detour linker)を生成し、生成された迂回リンカの制御にしたがって変換または削除されたライブラリに対する制御命令をインターセプトしてもよい。言い換えれば、迂回リンカは、変換または削除されたライブラリに対する制御命令をモニタリングし、モニタリングされた制御命令をインターセプトするように電子機器1(110)を制御するモジュールであって、制御命令インターセプト部(1920)の他の機能的表現であってもよい。 In step 2030, the control instruction intercept unit 1920 intercepts the control instruction for the library file converted or deleted under the control of the protection module loaded in the memory 211 of the electronic device 1 (110) when the application is executed. You may. For example, the control instruction intercept unit 1920 generates a detour linker according to an open instruction for the protection module loaded in the memory 211 of the electronic device 1 (110), and converts or converts according to the control of the generated detour linker. Control instructions for the deleted library may be intercepted. In other words, the detour linker is a module that monitors the control instructions for the converted or deleted library and controls the electronic device 1 (110) to intercept the monitored control instructions, and is a control instruction intercept unit (1920). ) May be another functional expression.

段階2040で、制御命令処理部1930は、保護モジュールの制御にしたがって保護モジュールに含まれた暗号化されたライブラリファイルを利用してインターセプトされた制御命令を処理してもよい。例えば、変換または除去されたライブラリファイルに対する制御命令は、ライブラリファイルに対するオープン命令を含んでもよい。この場合、制御命令処理部1930は、段階2040で、保護モジュールの制御にしたがってインターセプトされたオープン命令に対する応答によって暗号化されたライブラリファイルを復号化した後、復号化されたライブラリファイルの内容が格納されたバッファを指示するフェイクハンドル(fake handle)パラメータを生成して返してもよい。一例として、フェイクハンドルパラメータは、定数(integer)変数の最大値を有してもよく、保護モジュールは、フェイクハンドルパラメータとして定数変数の最大値が返される場合には、復号化されたライブラリファイルの内容が格納されたバッファにアクセスしてライブラリファイルに対する制御命令を処理するように制御してもよい。 At step 2040, the control instruction processing unit 1930 may process the intercepted control instructions using the encrypted library file included in the protection module under the control of the protection module. For example, a control instruction for a converted or removed library file may include an open instruction for the library file. In this case, the control instruction processing unit 1930 decrypts the library file encrypted by the response to the open instruction intercepted under the control of the protection module in step 2040, and then stores the contents of the decrypted library file. A fake hand parameter indicating a buffered buffer may be generated and returned. As an example, the fake handle parameter may have the maximum value of the constant variable, and the protection module of the decrypted library file if the maximum value of the constant variable is returned as the fake handle parameter. You may control to access the buffer containing the contents and process control instructions for the library file.

以後、ライブラリファイルの内容が格納されたバッファには、フェイクハンドルパラメータを利用してアクセスすることができるようになる。例えば、変換または除去されたライブラリファイルに対する制御命令は、ライブラリファイルに対する読み取り命令、書き込み命令、および検索命令のうちの少なくとも1つの命令をさらに含んでもよい。この場合、制御命令処理部1930は、段階2040で、保護モジュールの制御にしたがってインターセプトされた少なくとも1つの命令に対する応答により、フェイクハンドルパラメータを基盤として復号化されたライブラリファイルの内容が格納されたバッファにアクセスして少なくとも1つの命令を処理してもよい。より具体的な例として、制御命令処理部1930は、段階2040で、保護モジュールの制御にしたがって読み取り命令に対する応答によってバッファで読み取り命令に対応する内容を複写して返すか、書き込み命令にしたがってバッファに書き取り命令に対応する内容を書き込むか、または検索命令にしたがってバッファで検索命令に対応するファイルポインタの位置を返してもよい。したがって、電子機器1(110)は、本来のライブラリファイルなしでも、バッファを通じてライブラリファイルに対する制御命令を処理することができるようになる。 After that, the buffer containing the contents of the library file can be accessed using the fake handle parameter. For example, the control instruction for the converted or removed library file may further include at least one instruction of a read instruction, a write instruction, and a search instruction for the library file. In this case, the control instruction processing unit 1930 stores the contents of the library file decoded based on the fake handle parameter by the response to at least one instruction intercepted under the control of the protection module in step 2040. May be accessed to process at least one instruction. As a more specific example, in step 2040, the control instruction processing unit 1930 copies and returns the contents corresponding to the read instruction in the buffer according to the response to the read instruction according to the control of the protection module, or returns the contents corresponding to the read instruction to the buffer according to the write instruction. The content corresponding to the write instruction may be written, or the position of the file pointer corresponding to the search instruction may be returned in the buffer according to the search instruction. Therefore, the electronic device 1 (110) can process the control instruction for the library file through the buffer without the original library file.

図21は、本発明の他の実施形態における、制御命令の処理過程の例を示した図である。図21は、保護モジュールに対するオープン命令関数である「dlopen(保護モジュール)」2110を示している。保護モジュールに対するオープン命令にしたがい、制御命令インターセプト部1920は、迂回リンカ2111を生成してもよく、保護モジュールに対するオープン2112および/または読み取り2113を処理してもよい。 FIG. 21 is a diagram showing an example of a control command processing process in another embodiment of the present invention. FIG. 21 shows "dropen (protection module)" 2110 which is an open instruction function for the protection module. According to the open instruction for the protection module, the control instruction intercept unit 1920 may generate the bypass linker 2111 and may process the open 2112 and / or the read 2113 for the protection module.

一方、図21は、ライブラリファイルに対するオープン命令関数である「dlopen(ライブラリファイル)」2120を示している。ここで、ライブラリファイルに対するオープン2121と読み取り2122は、迂回リンカ2111によってモニタリングされ、インターセプトされてもよい。保護モジュールがオープンされる前にライブラリファイルに対するオープン2121や読み取り2122が要求される場合、ライブラリファイルは除去されたか変換されているため、制御命令が正常に処理されなくなり、これによって保護モジュールを迂回することができなくなる。 On the other hand, FIG. 21 shows "dropen (library file)" 2120, which is an open instruction function for a library file. Here, the open 2121 and read 2122 for the library file may be monitored and intercepted by the bypass linker 2111. If an open 2121 or read 2122 is required for a library file before the protection module is opened, the library file has been removed or converted and control instructions will not be processed properly, thereby bypassing the protection module. You will not be able to.

メモリにロードされた保護モジュール2130が含むオープンインタセプタ2131モジュールは、インターセプトされたオープン2121にしたがって暗号化されたライブラリファイルを復号化し、復号化されたライブラリファイル2132をバッファに管理してもよく、フェイクハンドル(fake handle)パラメータを生成してもよい。フェイクハンドルパラメータは、復号化されたライブラリファイルの内容が格納されたバッファを指示し、保護モジュール2130が制御命令にしたがってライブラリファイルにアクセスできるようにしてもよい。 The open interceptor 2131 module contained in the memory-loaded protection module 2130 may decrypt the library file encrypted according to the intercepted open 2121 and manage the decrypted library file 2132 in a buffer, fake. A handle parameter may be generated. The fake handle parameter may indicate a buffer containing the contents of the decrypted library file, allowing the protection module 2130 to access the library file according to control instructions.

読み取りインタセプタ2134モジュールは、インターセプトされた読み取り2122にしたがい、フェイクハンドルパラメータを基盤としてバッファで読み取り2122に対応するライブラリファイルの内容を複写2135して返してもよい。 The read interceptor 2134 module may copy and return the contents of the library file corresponding to the read 2122 in a buffer based on the fake handle parameter according to the intercepted read 2122.

暗号化されたライブラリファイルの復号化やライブラリファイルの内容に対するアクセスがすべてメモリ(一例として、電子機器1(110)のメモリ211)上で保護モジュール2130によって行われるため、保護モジュール2130の削除あるいは迂回を防ぐことができる。 Since the protection module 2130 performs all decryption of the encrypted library file and access to the contents of the library file on the memory (for example, the memory 211 of the electronic device 1 (110)), the protection module 2130 is deleted or bypassed. Can be prevented.

このように、本発明の実施形態によると、パッケージファイルでライブラリファイルを変換するか除去することで、利用者がライブラリファイルに直接アクセスすることができないようにし、暗号化されたライブラリファイルを含む保護モジュールをパッケージファイルに追加し、保護モジュールを通じて暗号化されたライブラリファイルにアクセスするようにすることにより、保護モジュールの除去あるいは迂回によるファイルの偽・変造を防ぐことができる。 Thus, according to an embodiment of the invention, a protection module that includes an encrypted library file by converting or removing the library file with a package file to prevent users from directly accessing the library file. Is added to the package file so that the encrypted library file is accessed through the protection module, so that the file can be prevented from being forged or altered by removing or bypassing the protection module.

上述したシステムまたは装置は、ハードウェア構成要素、ソフトウェア構成要素、またはハードウェア構成要素とソフトウェア構成要素との組み合わせによって実現されてもよい。例えば、実施形態で説明された装置および構成要素は、例えば、プロセッサ、コントローラ、ALU(arithmetic logic unit)、デジタル信号プロセッサ(digital signal processor)、マイクロコンピュータ、FPGA(field programmable gate array)、PLU(programmable logic unit)、マイクロプロセッサ、または命令を実行して応答することができる様々な装置のように、1つ以上の汎用コンピュータまたは特殊目的コンピュータを利用して実現されてもよい。処理装置は、オペレーティングシステム(OS)および前記OS上で実行される1つ以上のソフトウェアアプリケーションを実行してよい。また、処理装置は、ソフトウェアの実行に応答し、データにアクセスし、データを格納、操作、処理、および生成してもよい。理解の便宜のために、1つの処理装置が使用されるとして説明される場合もあるが、当業者は、処理装置が複数個の処理要素(processing element)および/または複数種類の処理要素を含んでもよいことが理解できるであろう。例えば、処理装置は、複数個のプロセッサまたは1つのプロセッサおよび1つのコントローラを含んでもよい。また、並列プロセッサ(parallel processor)のような、他の処理構成(processing configuration)も可能である。 The system or device described above may be implemented by hardware components, software components, or a combination of hardware components and software components. For example, the devices and components described in the embodiments include, for example, a processor, a controller, an ALU (arithmetic logic unit), a digital signal processor, a microprocessor, an FPGA (field programgate array), and a PLU (program). It may be implemented using one or more general purpose computers or special purpose computers, such as a logic unit), a microprocessor, or various devices capable of executing and responding to instructions. The processing device may execute an operating system (OS) and one or more software applications running on said OS. The processing device may also respond to the execution of the software, access the data, store, manipulate, process, and generate the data. For convenience of understanding, one processing device may be described as being used, but those skilled in the art will appreciate that the processing device includes multiple processing elements and / or multiple types of processing elements. But you can see that it's okay. For example, the processing device may include multiple processors or one processor and one controller. In addition, other processing configurations such as a parallel processor are also possible.

ソフトウェアは、コンピュータプログラム、コード、命令、またはこれらのうちの1つ以上の組み合わせを含んでもよく、思うままに動作するように処理装置を構成したり、独立的または集合的に(collectively)処理装置に命令したりしてよい。ソフトウェアおよび/またはデータは、処理装置に基づいて解釈されたり、処理装置に命令またはデータを提供するために、いかなる種類の機械、コンポーネント、物理装置、仮想装置(virtual equipment)、コンピュータ格納媒体または装置、または送信される信号波(signal wave)に永久的または一時的に具現化(embody)されてもよい。ソフトウェアは、ネットワークによって接続されたコンピュータシステム上に分散され、分散された方法によって格納されても実行されてもよい。ソフトウェアおよびデータは、1つ以上のコンピュータで読み取り可能な記録媒体に格納されてもよい。 The software may include computer programs, codes, instructions, or a combination of one or more of these, configuring the processing equipment to operate at will, or collecting processing equipment independently or collectively. You may order to. The software and / or data is interpreted on the basis of a processing device or is a machine, component, physical device, virtual equipment, computer storage medium or device of any kind to provide instructions or data to the processing device. , Or may be permanently or temporarily embodied in the transmitted signal wave. The software is distributed on networked computer systems and may be stored or executed in a distributed manner. The software and data may be stored on a recording medium readable by one or more computers.

実施形態に係る方法は、多様なコンピュータ手段によって実行可能なプログラム命令の形態で実現されてコンピュータで読み取り可能な媒体に記録されてもよい。前記コンピュータで読み取り可能な媒体は、プログラム命令、データファイル、データ構造などを単独でまたは組み合わせて含んでもよい。前記媒体に記録されるプログラム命令は、実施形態のために特別に設計されて構成されたものであってもよいし、コンピュータソフトウェア当業者に公知な使用可能なものであってもよい。コンピュータで読み取り可能な記録媒体の例としては、ハードディスク、フロッピディスク、および磁気テープのような磁気媒体、CD−ROM、DVDのような光媒体、フロプティカルディスク(floptical disk)のような光磁気媒体、およびROM、RAM、フラッシュメモリなどのようなプログラム命令を格納して実行するように特別に構成されたハードウェア装置が含まれる。プログラム命令の例は、コンパイラによって生成されるもののような機械語コードだけではなく、インタプリタなどを使用してコンピュータによって実行される高級言語コードを含む。上述したハードウェア装置は、実施形態の動作を実行するために1つ以上のソフトウェアモジュールとして動作するように構成されてもよく、その逆も同じである。 The method according to the embodiment may be realized in the form of program instructions that can be executed by various computer means and recorded on a computer-readable medium. The computer-readable medium may include program instructions, data files, data structures, etc. alone or in combination. The program instructions recorded on the medium may be those specially designed and configured for the embodiment, or may be usable known to those skilled in the art of computer software. Examples of computer-readable recording media include hard disks, floppy disks, and magnetic media such as magnetic tape, optical media such as CD-ROMs and DVDs, and optical magnetism such as floptic discs. Includes media and hardware devices specially configured to store and execute program instructions such as ROM, RAM, flash memory, and the like. Examples of program instructions include not only machine language code, such as those generated by a compiler, but also high-level language code, which is executed by a computer using an interpreter or the like. The hardware devices described above may be configured to operate as one or more software modules to perform the operations of the embodiments, and vice versa.

以上のように、実施形態を限定された実施形態と図面に基づいて説明したが、当業者であれば、上述した記載から多様な修正および変形が可能である。例えば、説明された技術が、説明された方法とは異なる順序で実行されたり、および/あるいは、説明されたシステム、構造、装置、回路などの構成要素が、説明された方法とは異なる形態で結合されたりまたは組み合わされたり、他の構成要素または均等物によって対置されたり置換されたとしても、適切な結果を達成することができる。 As described above, the embodiments have been described based on the limited embodiments and drawings, but those skilled in the art can make various modifications and modifications from the above description. For example, the techniques described may be performed in a different order than the methods described, and / or components such as the systems, structures, devices, circuits described may be in a different form than the methods described. Appropriate results can be achieved even if they are combined or combined, or confronted or replaced by other components or equivalents.

したがって、異なる実施形態であっても、特許請求の範囲と均等なものであれば、添付される特許請求の範囲に属する。 Therefore, even if the embodiments are different, they belong to the attached claims as long as they are equal to the claims.

110、120、130、140: 電子機器
150、160: サーバ
170: ネットワーク
110, 120, 130, 140: Electronic equipment 150, 160: Server 170: Network

Claims (20)

コンピュータによって実行されるコード保護方法であって、
前記コンピュータのプロセッサで、前記コンピュータの格納装置にアプリケーションのためのファイルが含まれたパッケージファイルを格納する段階、
前記プロセッサで、前記ファイルのうち実行コードが含まれたファイルで選別される保護対象メソッドまたは関数を変形するか、または前記ファイルのうちライブラリファイルを変換または除去する段階、
前記変形された保護対象メソッドまたは関数を復元するための第1保護モジュールファイルまたは前記ライブラリファイルを復元するための第2保護モジュールファイルを前記パッケージファイルに追加して前記パッケージファイルを再生成する段階、および
前記再生成されたパッケージファイルをネットワークを介して提供する段階を含み、前記第2保護モジュールファイルは、前記パッケージファイルを通じて前記アプリケーションがインストールされた電子機器で前記変換または除去されたライブラリファイルに対する制御命令をインターセプトし、前記第2保護モジュールファイルに含まれた暗号化されたライブラリファイルを利用して前記インターセプトされた制御命令を処理するモジュールを含む、コード保護方法。
A code protection method executed by a computer
The stage of storing a package file containing a file for an application in the storage device of the computer in the processor of the computer.
The stage in which the processor transforms a protected method or function that is screened in the file that contains the executable code, or transforms or removes a library file in the file.
The step of adding the first protection module file for restoring the modified protected method or function or the second protection module file for restoring the library file to the package file and regenerating the package file. and said viewing including the step of providing via the network the regenerated package file for the second protective module file, the converted or removed library file in the electronic device in which the application is installed via the package file A code protection method comprising a module that intercepts a control instruction and processes the intercepted control instruction using an encrypted library file included in the second protection module file.
前記プロセッサで、前記ファイルのうち実行コードが含まれたファイルで選別される保護対象メソッドまたは関数を変形する段階は、
前記ファイルのうち実行コードが含まれたファイルから保護対象メソッドまたは関数を選別して前記第1保護モジュールファイルに複製する段階、
前記選別された保護対象メソッドまたは関数が含むコードを前記実行コードで変形させる段階、および
前記第1保護モジュールファイルに複製された保護対象メソッドまたは関数を見つけ出すための検索コードを前記実行コードに追加する段階
を含む、請求項1に記載のコード保護方法。
In the processor, the step of transforming the protected method or function that is selected in the file containing the executable code among the files is
The stage of selecting a protected method or function from the file containing the execution code and replicating it to the first protection module file.
The step of transforming the code contained in the selected protected method or function with the execution code, and the search code for finding the protected method or function duplicated in the first protection module file are added to the execution code. The code protection method according to claim 1, which comprises a step.
前記保護対象メソッドまたは関数を選別して前記第1保護モジュールファイルに複製する段階は、
前記実行コードの全体メソッドまたは関数のうち予め設定された機能のメソッドまたは関数を前記保護対象メソッドまたは関数として選別するか、または前記アプリケーションの開発者によって入力された情報に対応するメソッドまたは関数を前記保護対象メソッドまたは関数として選別する、請求項2に記載のコード保護方法。
The step of selecting the protected method or function and replicating it to the first protection module file is
The method or function of the preset function among the whole methods or functions of the execution code is selected as the protected method or function, or the method or function corresponding to the information input by the developer of the application is selected. The code protection method according to claim 2, which is selected as a method or function to be protected.
前記選別された保護対象メソッドまたは関数が含むコードを前記実行コードで変形させる段階は、
前記コードのインストラクションを、認識が不可能なアンノウンインストラクション(unknown instruction)または任意のランダムなアドレスにジャンプ(jump)するインストラクションに変形する、請求項2又は3に記載のコード保護方法。
The step of transforming the code contained in the selected protected method or function with the execution code is
The code protection method according to claim 2 or 3 , wherein the instruction of the code is transformed into an unknown instruction that cannot be recognized or an instruction that jumps to an arbitrary random address.
前記第1保護モジュールファイルに複製された保護対象メソッドまたは関数を見つけ出すための検索コードを前記実行コードに追加する段階は、
前記選別された保護対象メソッドまたは関数にゲートウェイを呼び出すための第1コードを追加し、前記実行コードに前記ゲートウェイとして前記第1保護モジュールファイルに複製された保護対象メソッドまたは関数のメモリアドレスを得るための第2コードを追加する、請求項2−4のうちの何れか1項に記載のコード保護方法。
The step of adding the search code for finding the protected method or function duplicated in the first protection module file to the execution code is
To add the first code to call the gateway to the selected protected method or function, and to obtain the memory address of the protected method or function duplicated in the first protection module file as the gateway in the execution code. The code protection method according to any one of claims 2 to 4, wherein the second code of the above is added.
前記メモリアドレスは、前記アプリケーションがインストールされて実行される電子機器でのプログラムカウンタ(Program Counter:PC)と前記第1保護モジュールファイルによって提供される相手アドレス値を因子とし、前記第2コードにしたがって計算される、請求項5に記載のコード保護方法。 The memory address is based on the program counter (Program Counter: PC) in the electronic device in which the application is installed and executed and the remote address value provided by the first protection module file as a factor, and according to the second code. The code protection method according to claim 5, which is calculated. 前記プロセッサで、前記ファイルのうち実行コードが含まれたファイルで選別される保護対象メソッドまたは関数を変形する段階は、
前記第1保護モジュールファイルに複製された保護対象メソッドまたは関数のインストラクションを第1キーまたは第1暗号化アルゴリズムによって暗号化する段階、および
前記第1保護モジュールファイルに複製された保護対象メソッドまたは関数に前記暗号化されたインストラクションを復号化するための復号化コードを追加する段階
をさらに含む、請求項2−6のうちの何れか1項に記載のコード保護方法。
In the processor, the step of transforming the protected method or function that is selected in the file containing the executable code among the files is
The step of encrypting the instructions of the protected method or function duplicated in the first protection module file by the first key or the first encryption algorithm, and the protected method or function duplicated in the first protection module file. The code protection method according to any one of claims 2 to 6, further comprising a step of adding a decryption code for decrypting the encrypted instruction.
前記第1保護モジュールファイルは、前記アプリケーションがインストールされた電子機器で前記アプリケーションが実行され、前記第1保護モジュールファイルに複製された保護対象メソッドまたは関数のインストラクションが前記復号化コードによって復号化される場合、所定の条件にしたがって前記インストラクションを第2キーまたは第2暗号化アルゴリズムによって再暗号化する機能を含む、請求項7に記載のコード保護方法。 In the first protection module file, the application is executed on the electronic device in which the application is installed, and the instruction of the protected method or function duplicated in the first protection module file is decrypted by the decryption code. The code protection method according to claim 7, wherein the instruction is re-encrypted by a second key or a second encryption algorithm according to a predetermined condition. 前記プロセッサで、前記ファイルのうちライブラリファイルを変換または除去する段階は、
前記ライブラリファイルを暗号化して暗号化されたライブラリファイルを生成することにより前記ライブラリファイルを変換するか、または前記パッケージファイルから除去する段階、および
前記暗号化されたライブラリファイルを前記第2保護モジュールファイルに追加する段階
を含む、請求項2−8のうちの何れか1項に記載のコード保護方法。
The stage of converting or removing a library file among the files on the processor is
To convert the library file by generating a library file that is encrypted by encrypting the library file, or step is removed from the package file, and the encrypted the library files second protection module file code protection method according the step of adding to any one of including, claim 2 -8.
前記電子機器で前記アプリケーションの実行時、前記電子機器のメモリにロードされた前記第2保護モジュールファイルに対するオープン命令にしたがって迂回リンカ(detour linker)が生成され、前記迂回リンカの制御にしたがって前記電子機器で前記ライブラリファイルに対する制御命令がインターセプトされる、請求項9に記載のコード保護方法。 When the application is executed by the electronic device, a detour linker is generated according to an open instruction for the second protection module file loaded in the memory of the electronic device, and the electronic device is controlled by the detour linker. The code protection method according to claim 9, wherein the control instruction for the library file is intercepted in the above. 前記変換または除去されたライブラリファイルに対する制御命令は、前記ライブラリファイルに対するオープン命令を含み、
前記第2保護モジュールファイルでインターセプトされた前記オープン命令にしたがって前記暗号化されたライブラリファイルを復号化した後、前記復号化されたライブラリファイルの内容が格納されたバッファを指示するフェイクハンドル(fake handle)パラメータを生成して返す、請求項9又は10に記載のコード保護方法。
The control instruction for the converted or removed library file includes an open instruction for the library file.
After decrypting the encrypted library file according to the open instruction intercepted by the second protection module file, a fake handle (fake handle) indicating a buffer in which the contents of the decrypted library file are stored. ) The code protection method according to claim 9 or 10 , wherein a parameter is generated and returned.
前記変換または除去されたライブラリファイルに対する制御命令は、前記ライブラリファイルに対する読み取り命令、書き込み命令、および検索命令のうちの少なくとも1つの命令をさらに含み、
前記第2保護モジュールファイルで前記インターセプトされた前記少なくとも1つの命令にしたがって前記フェイクハンドルパラメータに基づいて前記復号化されたライブラリファイルの内容が格納されたバッファにアクセスして前記少なくとも1つの命令を処理する、請求項11に記載のコード保護方法。
The control instruction for the converted or removed library file further includes at least one instruction of a read instruction, a write instruction, and a search instruction for the library file.
The second protection module file processes the at least one instruction by accessing the buffer containing the contents of the decrypted library file based on the fake handle parameter according to the intercepted at least one instruction. The code protection method according to claim 11.
前記第2保護モジュールファイルで前記読み取り命令にしたがって前記バッファで前記読み取り命令に対応する内容を複写して返すか、前記書き込み命令にしたがって前記バッファに前記書き込み命令に対応する内容を書き込むか、または前記検索命令にしたがって前記バッファで前記検索命令に対応するファイルポインタの位置を返す、請求項12に記載のコード保護方法。 In the second protection module file, the content corresponding to the read instruction is copied and returned in the buffer according to the read instruction, the content corresponding to the write instruction is written to the buffer according to the write instruction, or the content corresponding to the write instruction is written in the buffer. The code protection method according to claim 12, wherein the position of the file pointer corresponding to the search command is returned in the buffer according to the search command. コンピュータを有する電子機器にコード保護方法を実行させるために記録媒体に格納されたコンピュータプログラムであって、
前記コード保護方法は、
前記電子機器のプロセッサが、前記電子機器の格納装置に、アプリケーションのためのファイルが含まれたパッケージファイルを格納させる段階であって、前記パッケージファイルは、変形された保護対象メソッドまたは関数を復元するための第1保護モジュールファイルまたはライブラリファイルを復元するための第2保護モジュールファイルを含み、前記ファイルのうち実行コードが含まれたファイルで選別される保護対象メソッドまたは関数が変形されているか、または前記ファイルのうち前記ライブラリファイルが変換または除去されている、段階、および
前記電子機器のプロセッサが、前記アプリケーションの実行にしたがって前記変形された保護対象メソッドまたは関数を前記第1保護モジュールファイルを通じて復元して前記実行コードを実行するか、または前記アプリケーションの実行時、前記変または除去されたライブラリファイルを前記第2保護モジュールファイルを通じて復元して前記変または除去されたライブラリファイルに対する制御命令を処理する段階
を含み、前記第2保護モジュールファイルは、前記パッケージファイルを通じて前記アプリケーションがインストールされた電子機器で前記変換または除去されたライブラリファイルに対する制御命令をインターセプトし、前記第2保護モジュールファイルに含まれた暗号化されたライブラリファイルを利用して前記インターセプトされた制御命令を処理するモジュールを含む、コンピュータプログラム。
A computer program stored on a recording medium to cause an electronic device having a computer to execute a code protection method.
The code protection method is
The electronic device processor is in the stage of causing the electronic device storage device to store a package file containing a file for an application, and the package file restores a modified protected method or function. The protected method or function that contains the first protection module file for restoring or the second protection module file for restoring the library file and is screened by the file containing the executable code is modified or modified. The stage in which the library file is converted or removed from the file, and the processor of the electronic device restores the modified protected method or function through the first protection module file according to the execution of the application. when said either executes the execution code, or the application execution Te, the control command for the conversion or the removed library file and restore through the second protective module file the conversion or removal library file processing the step of viewing including, the second protection module files, intercepts a control command for the conversion or removal library file in the electronic device in which the application is installed via the package file included in the second protective module file A computer program that includes a module that processes the intercepted control instructions using an encrypted library file.
前記第1保護モジュールファイルには、前記実行コードで選別された保護対象メソッドまたは関数が複製され、
前記実行コードには、前記第1保護モジュールファイルに複製された保護対象メソッドまたは関数を見つけ出すための検索コードが追加され、
前記電子機器のプロセッサで、前記アプリケーションの実行にしたがって前記変形された保護対象メソッドまたは関数を前記第1保護モジュールファイルを通じて復元して前記実行コードを実行する段階は、
前記選別された保護対象メソッドまたは関数に対し、前記検索コードを利用して前記第1保護モジュールファイルから前記複製された保護対象メソッドまたは関数を見つけ出して前記実行コードを実行する、請求項14に記載のコンピュータプログラム。
The protected method or function selected by the execution code is duplicated in the first protection module file.
A search code for finding the protected method or function duplicated in the first protection module file is added to the execution code.
In the processor of the electronic device, the step of restoring the modified protected method or function through the first protection module file and executing the execution code according to the execution of the application is
14. The 14th aspect of claim 14, wherein the duplicated protected method or function is found from the first protection module file by using the search code for the selected protected method or function, and the execution code is executed. Computer program.
前記選別された保護対象メソッドまたは関数に含まれたコードのインストラクションが、認識が不可能なアンノウンインストラクション(unknown instruction)または任意のランダムなアドレスにジャンプ(jump)するインストラクションに変形される、請求項14又は15に記載のコンピュータプログラム。 Claim 14 that the instruction of the code contained in the selected protected method or function is transformed into an unrecognizable unknown instruction or an instruction that jumps to an arbitrary random address. Or the computer program according to 15. 前記第2保護モジュールファイルには、前記ライブラリファイルが暗号化されて追加され、
前記電子機器のプロセッサで、前記アプリケーションの実行時、前記変または除去されたライブラリファイルを前記第2保護モジュールファイルを通じて復元して前記変または除去されたライブラリファイルに対する制御命令を処理する段階は、
前記アプリケーションの実行時、前記電子機器のメモリに前記第2保護モジュールファイルが含む保護モジュールをロードする段階、
前記ロードされた保護モジュールの制御にしたがって前記変換または除去されたライブラリファイルに対する制御命令をインターセプト(intercept)する段階、および
前記ロードされた保護モジュールの制御にしたがって前記第2保護モジュールファイルに追加された暗号化されたライブラリファイルを利用して前記インターセプトされた制御命令を処理する段階
を含む、請求項14−16のうちの何れか1項に記載のコンピュータプログラム。
The library file is encrypted and added to the second protection module file.
In the processor of the electronic device, upon execution of the application, processing the control command for the conversion or the converted removed library file and restore through the second protective module file or remove library files ,
At the time of executing the application, the step of loading the protection module included in the second protection module file into the memory of the electronic device,
A step of intercepting control instructions for the converted or removed library file under the control of the loaded protection module, and added to the second protection module file under the control of the loaded protection module. The computer program according to any one of claims 14 to 16, comprising processing the intercepted control instruction using an encrypted library file.
コンピュータによって実現される電子機器のコード保護方法であって、
前記電子機器のプロセッサで、前記電子機器の格納装置にアプリケーションのためのファイルが含まれたパッケージファイルを格納する段階(前記パッケージファイルは、変形された保護対象メソッドまたは関数を復元するための第1保護モジュールファイルまたはライブラリファイルを復元するための第2保護モジュールファイルを含み、前記ファイルのうち実行コードが含まれたファイルで選別される保護対象メソッドまたは関数が変形されているか、または前記ファイルのうち前記ライブラリファイルが変換または除去されている)、および
前記電子機器のプロセッサで、前記アプリケーションの実行にしたがって前記変形された保護対象メソッドまたは関数を前記第1保護モジュールファイルを通じて復元して前記実行コードを実行するか、または前記アプリケーションの実行時、前記変または除去されたライブラリファイルを前記第2保護モジュールファイルを通じて復元して前記変または除去されたライブラリファイルに対する制御命令を処理する段階
を含み、前記第2保護モジュールファイルは、前記パッケージファイルを通じて前記アプリケーションがインストールされた電子機器で前記変換または除去されたライブラリファイルに対する制御命令をインターセプトし、前記第2保護モジュールファイルに含まれた暗号化されたライブラリファイルを利用して前記インターセプトされた制御命令を処理するモジュールを含む、コード保護方法。
It is a code protection method for electronic devices realized by a computer.
The stage of storing a package file containing a file for an application in the storage device of the electronic device in the processor of the electronic device (the package file is a first stage for restoring a modified protected method or function. The protected method or function that contains the second protection module file for restoring the protection module file or library file and is screened by the file that contains the executable code is modified or among the files. The library file has been converted or removed), and in the processor of the electronic device, the modified protected method or function is restored through the first protection module file according to the execution of the application to obtain the execution code. when either run, or the application execution, look including the step of treating a control command for the conversion or the converted removed library file and restore through the second protective module file or remove library file The second protection module file intercepts the control instruction for the converted or removed library file in the electronic device in which the application is installed through the package file, and is encrypted contained in the second protection module file. A code protection method that includes a module that processes the intercepted control instructions using a library file.
前記第1保護モジュールファイルには、前記実行コードから選別された保護対象メソッドまたは関数が複製され、
前記実行コードには、前記第1保護モジュールファイルに複製された保護対象メソッドまたは関数を見つけ出すための検索コードが追加され、
前記電子機器のプロセッサで、前記アプリケーションの実行にしたがって前記変形された保護対象メソッドまたは関数を前記第1保護モジュールファイルを通じて復元して前記実行コードを実行する段階は、
前記選別された保護対象メソッドまたは関数に対し、前記検索コードを利用して前記第1保護モジュールファイルから前記複製された保護対象メソッドまたは関数を見つけ出して前記実行コードを実行する、請求項18に記載のコード保護方法。
The protected method or function selected from the execution code is duplicated in the first protection module file.
A search code for finding the protected method or function duplicated in the first protection module file is added to the execution code.
In the processor of the electronic device, the step of restoring the modified protected method or function through the first protection module file and executing the execution code according to the execution of the application is
The 18th aspect of claim 18, wherein the duplicated protected method or function is found from the first protection module file by using the search code for the selected protected method or function, and the execution code is executed. Code protection method.
前記第2保護モジュールファイルには、前記ライブラリファイルが暗号化されて追加され、
前記電子機器のプロセッサで、前記アプリケーションの実行時、前記変または除去されたライブラリファイルを前記第2保護モジュールファイルを通じて復元して前記変または除去されたライブラリファイルに対する制御命令を処理する段階は、
前記アプリケーションの実行時、前記電子機器のメモリに前記第2保護モジュールファイルが含む保護モジュールをロードする段階、
前記ロードされた保護モジュールの制御にしたがって前記変換または除去されたライブラリファイルに対する制御命令をインターセプト(intercept)する段階、および
前記ロードされた保護モジュールの制御にしたがって前記第2保護モジュールファイルに追加された暗号化されたライブラリファイルを利用して前記インターセプトされた制御命令を処理する段階
を含む、請求項18又は19に記載のコード保護方法。
The library file is encrypted and added to the second protection module file.
In the processor of the electronic device, upon execution of the application, processing the control command for the conversion or the converted removed library file and restore through the second protective module file or remove library files ,
When the application is executed, the step of loading the protection module included in the second protection module file into the memory of the electronic device,
A step of intercepting control instructions for the converted or removed library file under the control of the loaded protection module, and added to the second protection module file under the control of the loaded protection module. The code protection method according to claim 18 or 19 , comprising processing the intercepted control instruction using an encrypted library file.
JP2017016730A 2016-02-11 2017-02-01 Code protection methods and computer programs Active JP6917150B2 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
KR10-2016-0015910 2016-02-11
KR1020160015910A KR101823226B1 (en) 2016-02-11 2016-02-11 Method and system for code protection

Publications (2)

Publication Number Publication Date
JP2017142791A JP2017142791A (en) 2017-08-17
JP6917150B2 true JP6917150B2 (en) 2021-08-11

Family

ID=59628580

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2017016730A Active JP6917150B2 (en) 2016-02-11 2017-02-01 Code protection methods and computer programs

Country Status (2)

Country Link
JP (1) JP6917150B2 (en)
KR (1) KR101823226B1 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR102018960B1 (en) * 2017-12-19 2019-09-05 유재욱 Software code obfuscation using doubly packed structures
CN108133147B (en) * 2017-12-20 2023-12-22 中兴通讯股份有限公司 Method and device for protecting executable code and readable storage medium
KR102326100B1 (en) * 2020-01-06 2021-11-17 한국전자통신연구원 System and method for creating secure Android apps and installing/running apps on the Android platform

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1593015B1 (en) * 2003-02-03 2018-05-30 Nokia Technologies Oy Architecture for encrypted application installation
WO2013101034A1 (en) * 2011-12-29 2013-07-04 Intel Corporation Software modification for partial secure memory processing
JP6343869B2 (en) * 2013-02-20 2018-06-20 凸版印刷株式会社 Portable terminal device and decryption processing program
KR101471589B1 (en) * 2013-08-22 2014-12-10 (주)잉카엔트웍스 Method for Providing Security for Common Intermediate Language Program

Also Published As

Publication number Publication date
JP2017142791A (en) 2017-08-17
KR101823226B1 (en) 2018-01-29
KR20170094737A (en) 2017-08-21

Similar Documents

Publication Publication Date Title
US10255443B2 (en) Method, apparatus, system and non-transitory computer readable medium for code protection
CN105103127B (en) For the method obscured and computing device based on compiler
US11093601B2 (en) Dynamic switching between pointer authentication regimes
US9230113B2 (en) Encrypting and decrypting a virtual disc
US6868495B1 (en) One-time pad Encryption key Distribution
US20180260199A1 (en) Method and apparatus for intermediate representation of applications
Quoc et al. Securetf: A secure tensorflow framework
JP6936016B2 (en) Extension method and system for package files
JP2018530041A (en) System and method for application code obfuscation
EP0932955A1 (en) Self-decrypting digital information system and method
US20090187769A1 (en) System and method for an autonomous software protection device
JP6917150B2 (en) Code protection methods and computer programs
JP6935617B2 (en) Methods and systems for improving the loading speed of intermediate language files
KR101771348B1 (en) Method and system for packing package file
CN116249980A (en) Software access through heterogeneous encryption
JP7015120B2 (en) How and system to provide application packages, how and system to run applications
JP6698775B2 (en) Security providing apparatus and method for protecting code of shared object, and security executing apparatus and method
WO2001008345A1 (en) A computer system and process for accessing an encrypted and self-decrypting digital information product
CN109492353B (en) Application reinforcement method, device, electronic equipment and storage medium
JP7348701B2 (en) Methods and systems for loading executable images into memory
KR20210154017A (en) Method and system for protecting file using class dispersion and sequential memory loading
Novokmet Monolith to serverless microservice application evolution
Nam et al. Interface Module for Emulator-Based Web Application Execution Engine
CN115640571A (en) Method for a library operating system LibOS of a trusted execution environment TEE
Shmueli et al. Helping Protect Software Distribution with PSWD

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20200123

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20201125

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20201215

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20210204

RD03 Notification of appointment of power of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7423

Effective date: 20210414

A711 Notification of change in applicant

Free format text: JAPANESE INTERMEDIATE CODE: A712

Effective date: 20210412

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: 20210706

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20210719

R150 Certificate of patent or registration of utility model

Ref document number: 6917150

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

S111 Request for change of ownership or part of ownership

Free format text: JAPANESE INTERMEDIATE CODE: R313111

S533 Written request for registration of change of name

Free format text: JAPANESE INTERMEDIATE CODE: R313533

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350