JP5407585B2 - Program code encryption apparatus and program - Google Patents
Program code encryption apparatus and program Download PDFInfo
- Publication number
- JP5407585B2 JP5407585B2 JP2009150279A JP2009150279A JP5407585B2 JP 5407585 B2 JP5407585 B2 JP 5407585B2 JP 2009150279 A JP2009150279 A JP 2009150279A JP 2009150279 A JP2009150279 A JP 2009150279A JP 5407585 B2 JP5407585 B2 JP 5407585B2
- Authority
- JP
- Japan
- Prior art keywords
- encryption
- unit
- decryption
- program code
- block
- 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.)
- Expired - Fee Related
Links
- 238000000034 method Methods 0.000 claims description 73
- 230000008569 process Effects 0.000 description 15
- 238000004364 calculation method Methods 0.000 description 3
- 230000006870 function Effects 0.000 description 3
- 230000006378 damage Effects 0.000 description 2
- 239000000725 suspension Substances 0.000 description 2
- 230000009471 action Effects 0.000 description 1
- 238000004891 communication Methods 0.000 description 1
- 238000001514 detection method Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 230000007246 mechanism Effects 0.000 description 1
- 230000001902 propagating effect Effects 0.000 description 1
- 230000004044 response Effects 0.000 description 1
Images
Description
本発明は、プログラムコード暗号化装置及びプログラムに関する。 The present invention relates to a program code encryption apparatus and a program.
プログラムコード内に含まれる秘密を秘匿するため、または、プログラムコードを改竄されないようにするために、ハードディスクやROM(リード・オンリー・メモリ)などに保存されるプログラムコードの一部分を暗号化しておくことが行われている。この方式では、プログラムコードを起動してからその暗号化された部分を実行するまでの間にその部分を復号し、復号した部分を実行する方法がとられる。 To conceal the secrets contained in the program code or prevent the program code from being tampered with, a part of the program code stored in a hard disk or ROM (read-only memory) is encrypted. Has been done. In this system, a method is adopted in which the portion is decrypted between the time when the program code is activated and the encrypted portion is executed, and the decrypted portion is executed.
本発明は、暗号化済みのプログラムコードの一部分を破壊して実行するという攻撃により暗号化対象のプログラムコードが復元されることを防止することを目的とする。 An object of the present invention is to prevent a program code to be encrypted from being restored by an attack that destroys and executes a part of an encrypted program code.
請求項1に係る発明は、暗号化対象のプログラムコードの各単位を、暗号化結果の中のある単位に復号誤りが生じるとその単位以降のすべての単位に復号誤りが生じる第1の暗号方式を用いて、第1の方向に暗号化する第1の暗号化手段と、前記第1の暗号化手段による前記プログラムコードの暗号化結果の各単位を、暗号化結果の中のある単位に復号誤りが生じるとその単位以降のすべての単位に復号誤りが生じる第2の暗号方式を用いて、前記第1の方向とは逆向きの第2の方向に暗号化する第2の暗号化手段と、を備え、前記第2の暗号化手段は、前記第1の暗号化手段の暗号化に用いられた暗号化パラメータを前記第1の暗号化手段による前記プログラムコードの暗号化結果と共に暗号化する、ことを特徴とするプログラムコード暗号化装置である。 According to the first aspect of the present invention, there is provided a first encryption method in which each unit of a program code to be encrypted causes a decryption error to occur in all units after that unit when a decryption error occurs in a certain unit in the encryption result. The first encryption means for encrypting in the first direction and each unit of the encryption result of the program code by the first encryption means into a unit in the encryption result Second encryption means for encrypting in a second direction opposite to the first direction, using a second encryption method in which a decryption error occurs in all units after the unit when an error occurs; The second encryption means encrypts the encryption parameter used for encryption of the first encryption means together with the encryption result of the program code by the first encryption means. , dark program code, characterized in that It is an apparatus.
請求項2に係る発明は、前記第1の暗号方式と前記第2の暗号方式とは同一の暗号方式であることを特徴とする請求項1に記載のプログラムコード暗号化装置である。 The invention according to claim 2, wherein the first encryption method and the second encryption method is a program code encryption device according to claim 1, characterized in that the same encryption method.
請求項3に係る発明は、コンピュータを、暗号化対象のプログラムコードの各単位を、暗号化結果の中のある単位に復号誤りが生じるとその単位以降のすべての単位に復号誤りが生じる第1の暗号方式を用いて、第1の方向に暗号化する第1の暗号化手段、前記第1の暗号化手段による前記プログラムコードの暗号化結果の各単位を、暗号化結果の中のある単位に復号誤りが生じるとその単位以降のすべての単位に復号誤りが生じる第2の暗号方式を用いて、前記第1の方向とは逆向きの第2の方向に暗号化する第2の暗号化手段、として機能させるためのプログラムであって、前記第2の暗号化手段は、前記第1の暗号化手段の暗号化に用いられた暗号化パラメータを前記第1の暗号化手段による前記プログラムコードの暗号化結果と共に暗号化する、ことを特徴とするプログラムである。 According to a third aspect of the present invention, when a decryption error occurs in each unit of the program code to be encrypted in a certain unit in the encryption result, the decryption error occurs in all the units after that unit. The first encryption means for encrypting in the first direction by using the encryption method, and each unit of the encryption result of the program code by the first encryption means is a unit in the encryption result Second encryption that encrypts in a second direction opposite to the first direction, using a second encryption method in which a decryption error occurs in all units after that unit when a decryption error occurs means, I program der to function as, the second encryption means, said program according to claim 1, wherein the encryption parameter used to encrypt the encryption means of the first encryption means Along with the code encryption result To-coding, a program, characterized in that.
参考例の構成は、暗号化結果の中のある単位に復号誤りが生じるとその単位以降のすべての単位に復号誤りが生じる第1の暗号方式を用いて第1の方向に暗号化を施され、その暗号化の結果に対して暗号化結果の中のある単位に復号誤りが生じるとその単位以降のすべての単位に復号誤りが生じる第2の暗号方式を用いて前記第1の方向とは逆向きの第2の方向に暗号化を施された暗号化済みプログラムコードと、前記暗号化済みプログラムコードを、前記第2の暗号方式を用いて前記第2の方向に復号するための処理を前記コンピュータに実行させるための第1の復号プログラムコードと、前記第1の復号プログラムコードを前記コンピュータに実行させることにより得られた前記暗号化済みプログラムコードの復号化結果を、前記第1の暗号方式を用いて前記第1の方向に復号するための処理を前記コンピュータに実行させるための第2の復号プログラムコードと、を備え、前記第2の復号プログラムコードを前記コンピュータに実行させることにより得られた前記暗号化済みプログラムコードの復号化結果が、前記コンピュータにより実行されることを特徴とするプログラムである。 In the configuration of the reference example, when a decryption error occurs in a certain unit in the encryption result, encryption is performed in the first direction using the first encryption method in which the decryption error occurs in all the units after that unit. The first direction is determined by using the second encryption method in which when a decryption error occurs in a certain unit in the encryption result with respect to the encryption result, a decryption error occurs in all the units after the unit. A process for decrypting the encrypted program code encrypted in the second direction in the reverse direction and the encrypted program code in the second direction using the second encryption method; A first decryption program code to be executed by the computer, and a decryption result of the encrypted program code obtained by causing the computer to execute the first decryption program code, And a second decoding program code for causing the computer to execute a process for decoding in the first direction using a signal method, and causing the computer to execute the second decoding program code The decrypted result of the encrypted program code obtained is executed by the computer.
参考例の構成は、暗号文中のある単位に復号誤りが生じるとその単位以降のすべての単位に復号誤りが生じる暗号方式を用いて、平文をあらかじめ定められた単位ずつ順に暗号化する暗号化手段と、暗号化対象のプログラムコードの各単位が順方向及び逆方向にそれぞれ少なくとも1回以上暗号化されるよう、前記暗号化手段に前記プログラムコードの暗号化を行わせる制御を行う暗号化制御手段と、を備えるプログラムコード暗号化装置である。 The configuration of the reference example is an encryption means for encrypting plaintext in order by a predetermined unit using an encryption method in which when a decryption error occurs in a unit in the ciphertext, a decryption error occurs in all the units after that unit. And encryption control means for controlling the encryption means to encrypt the program code so that each unit of the program code to be encrypted is encrypted at least once in the forward direction and in the reverse direction. And a program code encryption device.
参考例の構成は、コンピュータを、暗号文中のある単位に復号誤りが生じるとその単位以降のすべての単位に復号誤りが生じる暗号方式を用いて、平文をあらかじめ定められた単位ずつ順に暗号化する暗号化手段、暗号化対象のプログラムコードの各単位が順方向及び逆方向にそれぞれ少なくとも1回以上暗号化されるよう、前記暗号化手段に前記プログラムコードの暗号化を行わせる制御を行う暗号化制御手段、として機能させるためのプログラムである。 The configuration of the reference example encrypts the plaintext in order by a predetermined unit using an encryption method in which when a decryption error occurs in a unit in the ciphertext, a decryption error occurs in all the units after that unit. Encryption means, encryption for controlling the encryption means to encrypt the program code so that each unit of the program code to be encrypted is encrypted at least once in the forward direction and in the reverse direction. It is a program for functioning as control means.
請求項1又は3に係る発明によれば、暗号化済みのプログラムコードの一部分を破壊して実行するという攻撃により暗号化対象のプログラムコードが復元されることを防止できる暗号化装置を提供することができる。 The invention according to claim 1 or 3 provides an encryption device capable of preventing the program code to be encrypted from being restored by an attack that destroys and executes a part of the encrypted program code. Can do.
また、暗号化パラメータを暗号化するという特別のステップを設けることなく、第1の暗号化手段の暗号化に用いられる暗号化パラメータを平文のままとするよりも秘匿性を高めることができる。 Further , without providing a special step of encrypting the encryption parameter, it is possible to improve the confidentiality as compared with the case where the encryption parameter used for encryption of the first encryption unit is kept in plain text.
請求項2に係る発明によれば、第1の暗号化手段と第2の暗号化手段とで別々の暗号方式を用いる場合よりも、装置の実装サイズ(例えば回路数又はプログラムコード数)を小さくすることができる。 According to the second aspect of the present invention, the device mounting size (for example, the number of circuits or the number of program codes) is smaller than when the first encryption unit and the second encryption unit use different encryption methods. can do.
参考例の構成によれば、暗号化済みのプログラムコードの一部分を破壊して実行するという攻撃により暗号化対象のプログラムコードが復元されることが防止される。 According to the configuration of the reference example, it is possible to prevent the program code to be encrypted from being restored by an attack in which a part of the encrypted program code is destroyed and executed.
参考例の構成によれば、暗号化済みのプログラムコードの一部分を破壊して実行するという攻撃により暗号化対象のプログラムコードが復元されることを防止することができる。 According to the configuration of the reference example, it is possible to prevent the program code to be encrypted from being restored by an attack that destroys and executes a part of the encrypted program code.
一般に、暗号化のアルゴリズムは、様々な大きさのデータを対象とするため、その設計および実装のしやすさから、ブロック暗号や、ストリーム暗号が用いられることが多い。しかしコードを暗号化して保護していても、暗号化して保護されたプログラムコードの一部を破壊しておき実行すると、ブロック暗号では破壊したブロックだけについて、ストリーム暗号では破壊したビットだけについては復号が失敗するが、その他の部分については復号が成功してしまう。 In general, since encryption algorithms target data of various sizes, block ciphers and stream ciphers are often used because of their ease of design and implementation. However, even if the code is encrypted and protected, if part of the encrypted and protected program code is destroyed and executed, only the broken block is decrypted with the block cipher and only the broken bit is decrypted with the stream cipher. Will fail, but the other parts will be successfully decoded.
例えば、ブロック暗号方式のCBC(Cipher Block Chaining)モードでは、暗号化されたコード10の一部を意図的に破壊した場合(図1の(a))、破壊されたブロック12とその次に復号されるブロックは正しく復号できないが、復号の進む方向に関して破壊されたブロックの前のブロック群14や、後ろのブロック群16は正しい平文が復号されてしまう(図1の(b))。これは、CBCモードでは、周知のように、復号対象の暗号文ブロックが、当該ブロックとその次のブロックにしか影響を与えないためである。
For example, in the block cipher CBC (Cipher Block Chaining) mode, when a part of the encrypted
このように部分的に復号が失敗した復号結果のコードを実行した場合、正しく復号されたブロック群14が正しく実行された後、破壊された部分12の所でプログラムが暴走し、一時停止する。この一時停止したときにメモリを見ると、復号されたコードが、破壊された部分12を除いて、読むことが可能である(図1の(c))。このような処理を、破壊する場所を変化させて複数回行うと、正しい平文のコードをすべて取得することも可能である。
Thus, when the code of the decoding result in which decoding has partially failed is executed, after the correctly decoded
なお、以上の流れにおけるプログラムの暴走と一時停止は、オペレーティングシステムの機能によるものである。したがって、上述の性質を用いた攻撃は、デバッガ検出技術を用いてデバッガ上でのプログラム実行を阻止する構成をとったとしても、阻止し得ない。 The program runaway and suspension in the above flow are due to the function of the operating system. Therefore, an attack using the above-described property cannot be prevented even if a configuration for preventing program execution on the debugger using the debugger detection technique is adopted.
このような攻撃に対し、本実施形態では、暗号化結果の中のある単位に復号誤りが生じるとその単位以降のすべての単位に復号誤りが生じる暗号方式(暗号アルゴリズム)により、平文のプログラムコードを順逆両方向に暗号化することで対処する。ここでいう「単位」とは、ブロック暗号方式を用いる場合はブロックであり、ストリーム暗号方式を用いる場合はビット又はバイトである。 In response to such an attack, in this embodiment, when a decryption error occurs in a certain unit in the encryption result, a plaintext program code is generated by an encryption method (encryption algorithm) in which a decryption error occurs in all the units after that unit. Is addressed by encrypting in both forward and reverse directions. The “unit” here is a block when the block encryption method is used, and is a bit or a byte when the stream encryption method is used.
実施形態の暗号化装置の一例を図2に示す。この例では、暗号化装置は逆方向暗号化部20及び順方向暗号化部22を含む。逆方向暗号化部20は、暗号化対象のプログラムを、そのプログラム内でのコードの並びとは逆順に、すなわちそのプログラムの末尾から先頭に向かって、暗号化する(以下、この暗号化の方向を逆方向と呼ぶ)。一方、順方向暗号化部22は、暗号化対象のプログラムを、そのプログラム内でのコードの並びと同じ順(以下、順方向と呼ぶ)に暗号化する。ここで、逆方向暗号化部20及び順方向暗号化部22は、いずれも、暗号化結果の中のある単位に復号誤りが生じるとその単位以降のすべての単位に復号誤りが生じるような暗号方式を用いて暗号化する。
An example of the encryption apparatus according to the embodiment is shown in FIG. In this example, the encryption device includes a
この暗号化装置による暗号化処理の流れを、図3を参照して説明する。この実施形態では、一例として、まず(a)暗号化対象である平文のプログラムコード(以下、平文コードと略す)30を、(b)逆方向暗号化部20により、当該コード30を逆方向に暗号化する。次に、(c)この逆方向の暗号化処理の結果得られた逆方向に暗号化済みのコード32を、(d)順方向暗号化部22により順方向に暗号化する。このような処理により、(e)順逆両方向に暗号化済みのコード34が得られる。
The flow of encryption processing by this encryption apparatus will be described with reference to FIG. In this embodiment, as an example, first, (a) a plaintext program code (hereinafter abbreviated as plaintext code) 30 to be encrypted is converted into (b) a
なお、逆方向暗号化部20が用いる暗号方式と、順方向暗号化部22が用いる暗号化方式は、暗号化結果の中のある単位に復号誤りが生じるとその単位以降のすべての単位に復号誤りが生じるという性質を持つものであれば、同じ方式であっても異なる方式であってもよい。また、逆方向暗号化部20と順方向暗号化部22とが同じ暗号化方式を用いる場合、暗号化に用いる鍵(或いは鍵の種(シード))又は初期ベクトルなどといったパラメータとしては、両者が同じものを用いてもよいし、異なるものを用いてもよい。
Note that the encryption method used by the
上述のような暗号化装置により作成された両方向に暗号化済みのコード34をコンピュータ上で実行しようとする場合、暗号化時とは逆のプロセスで復号すればよい。すなわち、まず暗号化済みのコード34を、順方向暗号化部22の暗号方式で(より厳密には、順方向暗号化部22の暗号処理手順に対応した復号処理手順で)順方向に復号したのち、その復号結果を逆方向暗号化部20の暗号方式で逆方向に復号すればよい。
When the
このように両方向に暗号化済みのコード34の一部を破壊すると、プログラムコード全体が正しく復号できなくなることを、図4を参照して説明する。
With reference to FIG. 4, it will be described that the entire program code cannot be correctly decrypted if a part of the
(a)両方向に暗号化済みのコード34の一部を破壊して順方向暗号化部22の暗号方式で順方向に復号すると、コード34の先頭から破壊された箇所までの部分36は正しく復号されるが、(b)順方向に関して破壊された箇所以後の部分38は、正しく復号されず、破壊された状態となる。なぜなら、順方向の暗号化に用いられた暗号方式は、復号誤りが生じた単位以降のすべての単位に復号誤りが生じる方式だからである。そして、このような順方向の復号結果を逆方向暗号化部20の暗号方式で逆方向に復号すると、順方向の復号化で正しく復号化された部分36は、逆方向の復号でその部分より前に位置する破壊された部分39の影響により、破壊される(すなわち誤った復号結果となる)。このように、プログラムコード全体39の復号結果が破壊されたものとなる。
(A) When part of the
以上の例では、まず逆方向に暗号化し、次に順方向に暗号化したが、これはあくまで一例に過ぎない。この代わりに、まず順方向に暗号化し、次に逆方向に暗号化してもよい。この場合、復号側では、まず逆方向に復号し、次に順方向に復号するようにすればよい。 In the above example, encryption is performed first in the reverse direction and then in the forward direction, but this is only an example. Alternatively, it may be encrypted first in the forward direction and then in the reverse direction. In this case, on the decoding side, the decoding may be performed first in the reverse direction and then in the forward direction.
さて、以上の例において、暗号化結果の中のある単位に復号誤りが生じるとその単位以降のすべての単位に復号誤りが生じる暗号方式としては、例えばブロック暗号方式のPCBC(Propagating CBC)モードを用いればよい。PCBCモードでは、図5に示すように、暗号化対象の平文の先頭ブロックPB1と初期ベクトルIVとの排他的論理和(XOR)を計算し、その計算結果に対して鍵Kによる暗号化演算Eを施す。これにより先頭の平文ブロックPB1の暗号化結果である暗号文ブロックCB1が得られる。次に、その暗号文ブロックCB1と元の平文ブロックPB1との排他的論理和と、次の平文ブロックPB2との排他的論理和を求め、その結果に対して鍵Kによる暗号化演算Eを施すことで、2番目の平文ブロックPB2に対する暗号化結果CB2を得る。以降、ブロックPB2の場合と同様、あるブロックの平文と暗号化結果とを次のブロックの平文に反映させた上で暗号化演算を行うという処理を繰り返す。 In the above example, when a decryption error occurs in a unit in the encryption result, a decryption error occurs in all the units after that unit. For example, a block cipher PCBC (Propagating CBC) mode is used. Use it. In the PCBC mode, as shown in FIG. 5, the exclusive OR (XOR) of the plaintext first block PB1 to be encrypted and the initial vector IV is calculated, and an encryption operation E using the key K is performed on the calculation result. Apply. As a result, a ciphertext block CB1 which is an encryption result of the head plaintext block PB1 is obtained. Next, an exclusive OR of the ciphertext block CB1 and the original plaintext block PB1 and an exclusive OR of the next plaintext block PB2 are obtained, and an encryption operation E using the key K is performed on the result. Thus, the encryption result CB2 for the second plaintext block PB2 is obtained. Thereafter, as in the case of the block PB2, the process of performing the encryption operation after reflecting the plaintext of one block and the encryption result in the plaintext of the next block is repeated.
PCBCモードの復号処理は、上記暗号化の逆の処理である。すなわち、図6に示すように、暗号文の先頭ブロックCB1に対し、鍵Kを用いて、暗号化演算Eの逆演算である復号演算Dを施し、その復号演算の結果と初期ベクトルIVとの排他的論理和をとることで、平文ブロックPB1を得る。次に、暗号文ブロックCB1と復号結果の平文ブロックPB1との排他的論理和を、2番目の暗号文ブロックCB2の復号結果と排他的論理和演算することで、2番目の平文ブロックPB2を復元する。以降、同様の処理を行うことで、各ブロックの復号結果を順に得ていく。 The decryption process in the PCBC mode is the reverse process of the above encryption. That is, as shown in FIG. 6, a decryption operation D that is an inverse operation of the encryption operation E is performed on the first block CB1 of the ciphertext using the key K, and the result of the decryption operation and the initial vector IV The plaintext block PB1 is obtained by taking the exclusive OR. Next, the exclusive plain OR of the ciphertext block CB1 and the plaintext block PB1 of the decryption result is exclusive ORed with the decryption result of the second ciphertext block CB2, thereby restoring the second plaintext block PB2. To do. Thereafter, the same processing is performed to sequentially obtain the decoding results of each block.
以上の説明から分かるように、PCBCモードを用いた場合、暗号文のあるブロックが破壊された場合、そのブロックの復号結果の平文が誤ったものとなり、その誤りが後続の各ブロックの復号結果へと次々に伝搬することになる。したがって、PCBCモードでは、暗号文ブロックのあるブロックに誤りがあると、そのブロック以降の復号結果は原理上すべて誤りとなる。 As can be seen from the above description, when the PCBC mode is used, when a block having a ciphertext is destroyed, the plaintext of the decryption result of that block becomes incorrect, and the error is transferred to the decryption result of each subsequent block. It will propagate one after another. Therefore, in the PCBC mode, if there is an error in a block having a ciphertext block, all the decryption results after that block are erroneous in principle.
なお、PCBCモードは、暗号化結果の中のある単位に復号誤りが生じるとその単位以降のすべての単位に復号誤りが生じる暗号方式のあくまで一例に過ぎない。PCBCモードでは、ある暗号文ブロックの復号結果の平文ブロックを次のブロックの復号演算Dの結果に作用させたが、この代わりに、復号において復号結果の平文ブロックを次のブロックの暗号文ブロックに作用(例えば両者の排他的論理和をとるなど)させるような暗号方式を用いてもよい。この暗号方式では、暗号化の際には、対象の平文ブロックと前ブロックの暗号化結果との演算結果(例えば排他的論理和)に暗号演算を施し、その演算結果と前ブロックの平文との演算(例えば排他的論理和演算)を施すことで、暗号文ブロックを求める。 The PCBC mode is merely an example of an encryption method in which when a decryption error occurs in a certain unit in the encryption result, the decryption error occurs in all the units after that unit. In the PCBC mode, the plaintext block of the decryption result of a ciphertext block is applied to the result of the decryption operation D of the next block. Instead, the plaintext block of the decryption result is converted to the ciphertext block of the next block in decryption. You may use the encryption system which makes an effect | action (for example, taking the exclusive OR of both). In this encryption method, at the time of encryption, cryptographic operation is performed on the operation result (for example, exclusive OR) of the target plaintext block and the encryption result of the previous block, and the operation result and the plaintext of the previous block are A ciphertext block is obtained by performing an operation (for example, an exclusive OR operation).
また、この実施形態の暗号方式としては、あるブロックに用いる暗号鍵が、直前のブロックの平文ブロックの影響を受ける暗号方式を用いてもよい。この方式では、あるブロックを復号する際に用いる鍵は、前のブロックの復号結果の平文の影響を受ける。したがって、前のブロックの暗号文が破壊されていれば、その復号結果の平文も誤った値となり、その誤った平文の影響を受ける今のブロックの鍵も誤った値となる。したがって、今のブロックの復号結果は誤りとなる。このように、暗号文のいずれかのブロックが破壊されていると、それ以降のブロックの復号結果及び鍵の両方が共に誤ったものとなるので、以降のブロックの暗号文が破壊されていなくても、それらブロックの復号結果は誤りとなる。 Further, as the encryption method of this embodiment, an encryption method in which the encryption key used for a certain block is affected by the plaintext block of the immediately preceding block may be used. In this method, the key used when decrypting a certain block is affected by the plaintext of the decryption result of the previous block. Therefore, if the ciphertext of the previous block is destroyed, the plaintext of the decryption result also has an incorrect value, and the key of the current block affected by the incorrect plaintext also has an incorrect value. Therefore, the decoding result of the current block becomes an error. In this way, if any block of ciphertext is destroyed, both the decryption result and the key of the subsequent block will be wrong, so the ciphertext of the subsequent block is not destroyed. However, the decoding result of those blocks becomes an error.
実施形態の暗号化装置に用いる暗号化方式として以上に例示したのは、ブロックの暗号化及び復号が前のブロックの平文の影響を受けるようにする、いわば平文を連鎖させる暗号化方式であった。しかし、本実施形態に使用される暗号化方式は、このような平文連鎖の方式に限るものではない。この他にも、例えばあるブロックの暗号化及び復号に用いられる鍵が、前のブロック用の鍵と当該前のブロックの暗号文又は平文との演算結果として求められる暗号方式を用いてもよい。この方式でも、あるブロックの暗号文に誤りがあれば、次のブロックの復号のための鍵が誤った値となり、その誤りが以降の各ブロックのための鍵に伝搬していくため、以降の各ブロックの復号結果は原理上誤りとなる。 What has been exemplified above as an encryption method used in the encryption device of the embodiment is an encryption method in which plaintext is chained so that block encryption and decryption are affected by the plaintext of the previous block. . However, the encryption method used in this embodiment is not limited to such a plaintext chain method. In addition to this, for example, an encryption method may be used in which a key used for encryption and decryption of a certain block is obtained as a calculation result of a key for the previous block and the ciphertext or plaintext of the previous block. Even in this method, if there is an error in the ciphertext of a certain block, the key for decoding the next block becomes an incorrect value, and the error propagates to the key for each subsequent block. The decoding result of each block is erroneous in principle.
次に、図7を参照して、暗号化対象のプログラムコードを含んだ、プログラムファイル100の一例を説明する。このプログラムファイル100は、実行するとまずその中に含まれる暗号化されたプログラムを復号し、その復号結果のプログラムを実行する。
Next, an example of the
このプログラムファイル100は、例えばオブジェクトファイル形式のファイルであり、オブジェクトヘッダ110、コードセクション120及びデータセクション130を含んでいる。
The
オブジェクトヘッダ110は、当該プログラムファイル100のヘッダ情報を記述したセクションである。また、コードセクション120は、コンピュータが実行するプログラムコードが含まれるセクションである。このセクションは、書き込み、読み出し及び実行が可能なセクションである。暗号化対象のプログラムコード126もコードセクション120に含まれる。データセクション130はプログラムコードの実行において用いられるデータが含まれるセクションである。
The
この例において、コードセクション120は、復号範囲取得コード121、順方向復号鍵生成コード122、順方向復号コード123、逆方向復号鍵生成コード124、逆方向復号コード125、及び暗号化対象のプログラムコード126を含んでいる。復号範囲取得コード121は、コードセクション120のうち復号すべき範囲を特定する情報を取得する。順方向復号鍵生成コード122は、順方向の復号に用いる鍵を生成する。順方向復号コード123は、暗号化されたプログラムコードを、上述の暗号化装置における順方向の暗号化に用いられた暗号方式で、順方向に復号する。逆方向復号鍵生成コード124は、逆方向の復号に用いる鍵を生成する。逆方向復号コード125は、順方向復号コード123による復号結果を、上述の暗号化装置における逆方向の暗号化に用いられた暗号方式で、逆方向に復号する。
In this example, the
また、データセクション130には、コードセクション120内で暗号化対象のプログラムコード126が含まれる範囲を示す暗号化範囲情報と、暗号化演算に用いられるパラメータ(例えば初期ベクトルIV及び鍵の種(シード))、及び暗号化対象のプログラムコード126のデータサイズをブロックのサイズの整数倍にするために追加したパディング情報が含まれる。これらの値は、暗号化対象のプログラムコード126をこの実施形態の暗号化装置で暗号化する際に求めればよい。
Further, the
プログラム作成者は、図7に例示した構造を持つプログラムファイル100を作成し、このうちの暗号化対象のプログラムコード126の部分を、この実施形態の暗号化装置を用いて、順逆両方向に暗号化する。そして、このように暗号化されたプログラムコード126を含んだプログラムファイル100が、ユーザに提供される。
The program creator creates the
ユーザのコンピュータ上でこのプログラムファイル100が呼び出されると、コンピュータは、コードセクション120に含まれる各コード121〜126をその並び順に従って先頭から順番に実行する。すなわち、コンピュータは、まず復号範囲取得コード121を実行して、データセクション130の暗号化範囲情報に基づきコードセクション120中で復号すべき範囲を特定する。次に順方向復号鍵生成コード122を実行して、データセクション130の鍵の種を用いて順方向の復号鍵を生成する。次にコンピュータは、順方向復号コード123を実行することで、その復号鍵を用いて、暗号化されたプログラムコード126を先頭から順に順方向に復号する。この復号の結果は、コードセクション120内の当該暗号化されたプログラムコード126に上書きされる。次にコンピュータは、逆方向復号鍵生成コード124を実行して、データセクション130の鍵の種を用いて逆方向の復号鍵を生成し、更に逆方向復号コード125を実行することで、その復号鍵を用いて、順方向の復号結果を末尾から先頭へと逆方向に復号する。この復号の結果、すなわち平文のプログラムコードは、コードセクション120内の当該暗号化されたプログラムコード126の領域に上書きされる。
When the
このようにして逆方向の復号コード125の実行が完了すると、コンピュータは、次の暗号化対象のプログラムコード126の領域にある平文のプログラムコードを実行する。これにより、暗号化対象のプログラムコード126に記述された処理が実行されることとなる。
When the execution of the reverse-
なお、プログラムファイル100には、復号結果の平文のプログラムコードの実行完了後、その平文のプログラムコードをメモリから削除する処理を指示するコードが含まれていてもよい。
Note that the
図7を用いて説明した例では、逆方向及び順方向の暗号化で同じパラメータ(例えば鍵の種、初期ベクトル)を用いたが、これらパラメータを方向ごとに異なる値としてもよい。また、この場合、順方向及び逆方向の暗号化のうち先に実行する方向の暗号化に用いたパラメータを、後で実行する方向の暗号化処理により暗号化してもよい。この場合、図8に例示するように、逆方向の暗号化のためのパラメータ40を、コードセクション120内に、暗号化対象のプログラムコード126(すなわち平文コード30)の例えば次に配置する。そして、暗号化装置は、逆方向の暗号化を行う際、そのパラメータ40を参照して暗号化を実行する。そして、データセクション130には、順方向暗号化のパラメータ45を置く。暗号化装置は、逆方向に暗号化済みのコード32を順方向に暗号化する際、そのコード32の後ろに続く逆方向暗号化のパラメータ40の範囲も暗号化する。このようにして生成される両方向に暗号化済みのコード36には、逆方向暗号化のパラメータ40が含まれている。このように、本実施形態では、暗号化する範囲が方向ごとに異なっていてもよい。
In the example described with reference to FIG. 7, the same parameters (for example, key seed and initial vector) are used for backward and forward encryption, but these parameters may be different values for each direction. In this case, the parameter used for the encryption in the direction to be executed first out of the encryption in the forward direction and the reverse direction may be encrypted by the encryption process in the direction to be executed later. In this case, as illustrated in FIG. 8, the
以上に例示した暗号化装置は、図1に示したように逆方向暗号化部20と順方向暗号化部22とを備えていたが、逆方向と順方向とで同一の暗号方式を用いる場合は、両者の暗号化演算部分を共通化させてもよい。この場合の暗号化装置の構成の例を、図9に示す。この例では、暗号化装置は、暗号化部24と暗号化制御部26とを含む。暗号化部24は、暗号化制御部26から入力される暗号化対象のデータを、暗号化結果の中のある単位に復号誤りが生じるとその単位以降のすべての単位に復号誤りが生じるような暗号方式により暗号化する。暗号化制御部26は、暗号化対象の平文のプログラムコードの各ブロックを、まず順方向及び逆方向のうちの一方の方向(第1の方向と呼ぶ)に沿って順に暗号化部24に供給し、暗号化を行わせる。次に、暗号化制御部26は、第1の方向の暗号化結果の各ブロックを、第1の方向とは逆向きの第2の方向に沿って順に暗号化部24に供給し、暗号化させる。このような構成でも、図1の例と同様の両方向についての暗号化結果が生成される。
The encryption device exemplified above includes the
以上では、順逆各方向にそれぞれ1回ずつ暗号化を行ったが、1回ずつに限られるわけではない。図4を用いて説明したような復号結果の破壊が実現されるためには、暗号化対象のブロックがそれぞれ順逆各方向に1回以上暗号化されていればよい。 In the above, the encryption is performed once in each of the forward and reverse directions, but it is not limited to once. In order to realize the destruction of the decryption result as described with reference to FIG. 4, it is only necessary that the encryption target block is encrypted at least once in each forward and reverse direction.
また、以上では、ブロック暗号方式を例にとって説明したが、ストリーム暗号方式に同様の方式を適用してもよい。ブロック暗号方式では、暗号化の単位がブロックであったが、ストリーム暗号方式では暗号化の単位がビット又はバイトになる。 In the above description, the block cipher method is taken as an example, but a similar method may be applied to the stream cipher method. In the block encryption method, the encryption unit is a block, but in the stream encryption method, the encryption unit is bits or bytes.
以上に例示した暗号化装置は、一つの例では、汎用のコンピュータに上述の処理を表すプログラムを実行させることにより実現される。ここで、コンピュータは、例えば、ハードウエアとして、CPU等のマイクロプロセッサ、ランダムアクセスメモリ(RAM)およびリード・オンリー・メモリ(ROM)等のメモリ(一次記憶)、HDD(ハードディスクドライブ)コントローラを経由して接続されたHDD、各種I/O(入出力)インタフェース等が、バスを介して接続された回路構成を有する。バスには、ローカルエリアネットワーク等のネットワークに接続するためのネットワークインタフェースが接続されていてもよい。また、そのバスに対し、例えばI/Oインタフェース経由で、CDやDVDなどの可搬型ディスク記録媒体に対する読み取り及び/又は書き込みのためのディスクドライブ、フラッシュメモリなどの各種規格の可搬型の不揮発性記録媒体に対する読み取り及び/又は書き込みのためのメモリリーダライタなどが接続されてもよい。上に例示した各機能モジュールの処理内容が記述されたプログラムがCDやDVD等の記録媒体を経由して、又はネットワーク等の通信手段経由で、ハードディスクドライブ等の固定記憶装置に保存され、コンピュータにインストールされる。インストールされたプログラムがRAMに読み出されCPU等のマイクロプロセッサにより実行されることにより、上に例示した装置の機能が実現される。 In one example, the encryption apparatus exemplified above is realized by causing a general-purpose computer to execute a program representing the above-described processing. Here, for example, the computer passes through a microprocessor such as a CPU, a memory (primary storage) such as a random access memory (RAM) and a read only memory (ROM), and an HDD (hard disk drive) controller as hardware. The connected HDDs, various I / O (input / output) interfaces, and the like have a circuit configuration connected via a bus. A network interface for connecting to a network such as a local area network may be connected to the bus. Also, portable non-volatile recording of various standards such as a disk drive and a flash memory for reading and / or writing to a portable disk recording medium such as a CD or a DVD via the I / O interface, for example. A memory reader / writer or the like for reading from and / or writing to a medium may be connected. A program in which the processing contents of each functional module exemplified above are described is stored in a fixed storage device such as a hard disk drive via a recording medium such as a CD or DVD, or via a communication means such as a network, and stored in a computer. Installed. The installed program is read into the RAM and executed by a microprocessor such as a CPU, thereby realizing the functions of the apparatus exemplified above.
20 逆方向暗号化部、22 順方向暗号化部、30 平文コード、32 逆方向に暗号化済みのコード、34 両方向に暗号化済みのコード。 20 Reverse encryption part, 22 Forward encryption part, 30 Plain text code, 32 Code encrypted in reverse direction, 34 Code encrypted in both directions.
Claims (3)
前記第1の暗号化手段による前記プログラムコードの暗号化結果の各単位を、暗号化結果の中のある単位に復号誤りが生じるとその単位以降のすべての単位に復号誤りが生じる第2の暗号方式を用いて、前記第1の方向とは逆向きの第2の方向に暗号化する第2の暗号化手段と、
を備え、
前記第2の暗号化手段は、前記第1の暗号化手段の暗号化に用いられた暗号化パラメータを前記第1の暗号化手段による前記プログラムコードの暗号化結果と共に暗号化する、ことを特徴とするプログラムコード暗号化装置。 Using the first encryption method in which each unit of the program code to be encrypted has a decryption error in all units after the unit when a decryption error occurs in a certain unit in the encryption result, the first direction A first encryption means for encrypting,
A second cipher in which each unit of the encryption result of the program code by the first encryption means causes a decryption error in all units after the unit when a decryption error occurs in a certain unit in the encryption result Second encryption means for encrypting in a second direction opposite to the first direction using a method;
Equipped with a,
The second encryption means encrypts an encryption parameter used for encryption of the first encryption means together with an encryption result of the program code by the first encryption means. A program code encryption device.
暗号化対象のプログラムコードの各単位を、暗号化結果の中のある単位に復号誤りが生じるとその単位以降のすべての単位に復号誤りが生じる第1の暗号方式を用いて、第1の方向に暗号化する第1の暗号化手段、
前記第1の暗号化手段による前記プログラムコードの暗号化結果の各単位を、暗号化結果の中のある単位に復号誤りが生じるとその単位以降のすべての単位に復号誤りが生じる第2の暗号方式を用いて、前記第1の方向とは逆向きの第2の方向に暗号化する第2の暗号化手段、
として機能させるためのプログラムであって、
前記第2の暗号化手段は、前記第1の暗号化手段の暗号化に用いられた暗号化パラメータを前記第1の暗号化手段による前記プログラムコードの暗号化結果と共に暗号化する、ことを特徴とするプログラム。 Computer
Using the first encryption method in which each unit of the program code to be encrypted has a decryption error in all units after the unit when a decryption error occurs in a certain unit in the encryption result, the first direction A first encryption means for encrypting,
A second cipher in which each unit of the encryption result of the program code by the first encryption means causes a decryption error in all units after the unit when a decryption error occurs in a certain unit in the encryption result Second encryption means for encrypting in a second direction opposite to the first direction, using a scheme;
A program for functioning as,
The second encryption means encrypts an encryption parameter used for encryption of the first encryption means together with an encryption result of the program code by the first encryption means. Program .
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2009150279A JP5407585B2 (en) | 2009-06-24 | 2009-06-24 | Program code encryption apparatus and program |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2009150279A JP5407585B2 (en) | 2009-06-24 | 2009-06-24 | Program code encryption apparatus and program |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| JP2011007962A JP2011007962A (en) | 2011-01-13 |
| JP5407585B2 true JP5407585B2 (en) | 2014-02-05 |
Family
ID=43564717
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP2009150279A Expired - Fee Related JP5407585B2 (en) | 2009-06-24 | 2009-06-24 | Program code encryption apparatus and program |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JP5407585B2 (en) |
Family Cites Families (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JPH10303883A (en) * | 1997-04-24 | 1998-11-13 | Fuji Xerox Co Ltd | Enciphering method |
| JP4606808B2 (en) * | 2004-08-11 | 2011-01-05 | 京セラミタ株式会社 | Data erasing apparatus, image forming apparatus, data erasing method, and data erasing program |
| JP4470982B2 (en) * | 2007-09-19 | 2010-06-02 | 富士ゼロックス株式会社 | Information processing apparatus and information processing program |
-
2009
- 2009-06-24 JP JP2009150279A patent/JP5407585B2/en not_active Expired - Fee Related
Also Published As
| Publication number | Publication date |
|---|---|
| JP2011007962A (en) | 2011-01-13 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US7472285B2 (en) | Apparatus and method for memory encryption with reduced decryption latency | |
| TWI469609B (en) | Key recovery mechanism for cryptographic systems | |
| KR101302799B1 (en) | Performing aes encryption or decryption in multiple modes with a single instruction | |
| CN109845182B (en) | Cryptographic messages and authentication instructions | |
| US20090316899A1 (en) | Encryption/decryption device and security storage device | |
| CN101311942A (en) | Software encryption and decryption method and encryption and decryption device | |
| GB2443244A (en) | Authenticated Encryption Method and Apparatus | |
| WO2007118829A1 (en) | Encryption apparatus and method for providing an encrypted file system | |
| JP2008085986A (en) | Data conversion device, electronic device, and data conversion method | |
| JP2018515815A (en) | Data encryption apparatus and method, and data decryption apparatus and method | |
| CN112416243B (en) | Memory device and method for executing security commands | |
| KR101117588B1 (en) | Record carrier comprising encryption indication information | |
| US10223249B2 (en) | Test methodology for detection of unwanted cryptographic key destruction | |
| JP4758904B2 (en) | Confidential information processing method | |
| JP5407585B2 (en) | Program code encryption apparatus and program | |
| JP2011123229A (en) | Program code encryption device and program | |
| KR100782614B1 (en) | Detection of a change of the data of a dataset | |
| JP2009169489A (en) | Encryption method, decryption method, encryption device, and decryption device | |
| JP2011053749A (en) | Debugging method, debugging device and translator program | |
| JP2007336446A (en) | Data encryption device | |
| JP2010268149A (en) | Decoding device, decoding method, and program | |
| CN119728084B (en) | Online data encryption and decryption method, device, equipment and storage medium based on eFlash-XIP mode | |
| US20250038951A1 (en) | Encryption device, decryption device, cryptographic system, encryption method, and decryption method | |
| JP4853026B2 (en) | Information processing apparatus and program | |
| JP7063628B2 (en) | Cryptographic devices, encryption methods and programs |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20120518 |
|
| A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20130709 |
|
| A521 | Request for written amendment filed |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20130906 |
|
| 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: 20131008 |
|
| A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20131021 |
|
| R150 | Certificate of patent or registration of utility model |
Ref document number: 5407585 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R150 |
|
| 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 |
|
| LAPS | Cancellation because of no payment of annual fees |