JP2004185348A - Program correction method and its implementation IC card - Google Patents
Program correction method and its implementation IC card Download PDFInfo
- Publication number
- JP2004185348A JP2004185348A JP2002351928A JP2002351928A JP2004185348A JP 2004185348 A JP2004185348 A JP 2004185348A JP 2002351928 A JP2002351928 A JP 2002351928A JP 2002351928 A JP2002351928 A JP 2002351928A JP 2004185348 A JP2004185348 A JP 2004185348A
- Authority
- JP
- Japan
- Prior art keywords
- program
- card
- information
- program code
- data
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Landscapes
- Stored Programmes (AREA)
Abstract
【課題】ICカードのプログラムを修正する場合は、利用者もしくは第三者がプログラムコードを参照されたり、また不当なプログラムコードに書き換えられることがないよう、膨大な枚数で発行されるICカードを全て回収し、ICカードに格納されているICカードプログラムを全て修正しなければならなかった。
【解決手段】プログラム修正情報を復号化する手段と修正情報の履歴情報を管理する手段をICカードに持つことで、ICカードの回収作業や管理をせずにICカードプログラムを修正することが出来る。またプログラムコードを検証する手段と、ICカードの実行を制御して、ICカードを使用できなくする手段をICカードに設けることで、プログラムコードの不当な改ざんを検出し、ICカードの不正利用を防止することができる。
【選択図】 図1To modify a program of an IC card, a large number of IC cards are issued to prevent a user or a third party from referring to the program code or rewriting the program code with an illegal program code. All had to be collected and all the IC card programs stored in the IC card had to be corrected.
An IC card program can be modified without having to collect and manage the IC card by providing the IC card with a means for decoding program modification information and a means for managing history information of modification information. . In addition, by providing a means for verifying the program code and a means for controlling the execution of the IC card and making the IC card unusable, the unauthorized alteration of the program code is detected, and the unauthorized use of the IC card is prevented. Can be prevented.
[Selection diagram] Fig. 1
Description
【0001】
【発明の属する技術分野】
本発明はICカードなどの過般可能な記憶媒体に格納されたプログラムの修正技術に関する。
【0002】
【従来の技術】
ICカードはメモリカードなどのデータを書き込むだけの媒体ではなく、CPUを備えておりメモリに格納してあるプログラムコードを実行することが出来る。ICカード内で実行するプログラム(ICカードプログラム)はICカードに備わっているメモリ、特にROMなどの書き込み不可能な不揮発メモリに格納することが一般的である。また特開平07−210642号に開示されているようなEEPROMなどの書き込み可能な不揮発メモリに、必要なプログラムコードを格納する方法もある。
【0003】
【特許文献1】
特開平07−210642号
【0004】
【発明が解決しようとする課題】
ICカードプログラムに誤りがあった場合は、プログラムコードを変更する必要があるために、何万、何十万枚という単位で発行されたICカードを回収する必要があった。複数のアプリケーションプログラムを搭載できるICカードの場合、動的にアプリケーションプログラムをローディングしたり、削除したりすることが可能なものがあるため、アプリケーションプログラムを削除した後、修正したアプリケーションプログラムを再度ローディングすることが可能である。しかし、ROMに格納されているICカードプログラムは、一度ROMにプログラムコードを格納してしまうと、後でプログラムコードを変更することが出来ないため、ICカードを再発行しなければならなかった。
【0005】
また従来技術で説明したように、必要なプログラムコードをEEPROMなどの書込み可能な不揮発メモリに格納することが考えられるが、上記従来技術でも秘匿性を持ったICカードプログラムを修正する場合は、プログラムコードをカード利用者を含む第三者に対して修正したプログラムコードを参照できないようにしなければならず、ICカードを回収しなければならなかった。
【0006】
本発明の第一の目的は、利用者からICカードを回収せずに、修正が必要なICカードプログラムを自動的に修正することにある。またICカードプログラムの誤りが何度も発見されると、その都度修正内容が更新されることが考えられるので、せっかく修正した内容を古い修正内容で上書きされないようにする手段も必要となる。
【0007】
本発明の第二の目的は、万が一にもICカードプログラムが不当なプログラムコードに書き換えられた場合、不当なプログラムコードを実行しないようにすることである。
【0008】
【課題を解決するための手段】
前記第一の目的を達成するために、プログラム修正情報を復号化する機能と、修正したプログラムコードを格納する機能と、ICカードプログラムを修正した履歴を管理する情報と、必要なプログラム修正情報を履歴情報より判断する機能をICカード内に設けるようにした。
【0009】
前記第二の目的を達成するために、修正したプログラムコードの正当性を検証する機能と、万が一不当なプログラムコードに書き換えられた場合にICカードを停止させる機能を設けるようにした。
【0010】
【発明の実施の形態】
一般的にICカードはICチップを搭載しており、ICカード用のICチップは通常CPUと3種類のメモリで構成されている。このメモリは通常、ROM(Read Only Memory)などの書き換え不可能な不揮発メモリと、EEPROM(Electrically Erasable and Programmable Read Only Memory)などの書き換え可能な不揮発メモリと、RAM(Random Access Memory)などの書き換え可能な揮発メモリで構成されていることは公知のものである。また、ICカードは通常ICカードリーダ/ライタと呼ばれる装置を介して携帯端末、パーソナルコンピュータ(PC)等の外部装置とコマンドおよびコマンド応答という方法で情報のやり取りをすることも公知のものである。また、コマンドによってカードに渡されるデータをコマンドデータといい、カードがコマンド処理結果として渡すコマンドの応答としては、応答データと応答コードがあることも公知のものである。
【0011】
以下、本発明の実施形態の例を図面を用いて詳細に説明する。
【0012】
図1は本発明の構成図である。ICカード(0100)は、ROM(0104)とEEPROM(0102)を備えており、ICカード(0100)と外部装置(0120)は、それぞれデータ送受信部(0118)とICカードインタフェース部(132)とで情報のやりとりを行う。またICカード(0100)は、暗号化されたデータを復号化するための暗号制御部(0116)と、暗号化されたプログラム修正情報(0112)を復号化したデータをプログラム修正情報格納領域(0122)に格納するためのプログラム修正情報格納制御部(0114)と、受信したコマンドデータに対応したプログラムコード群(0128)へ分岐するためのジャンプテーブル(0130)とを備えており、プログラムコード群(0128)を実行する場合、プログラム実行部(134)がジャンプテーブル(0130)を参照して適切なプログラムコードへ分岐する。また図2に示すように、復号化されたプログラム修正情報(0126)は、履歴情報(136)と、修正用のプログラムコード(140)と、修正用のジャンプテーブル(138)とを含むデータで構成されている。また修正用のプログラムコード(140)を格納するためのプログラム修正情報格納領域(0122)は、履歴情報(0106)と、ジャンプテーブル(0130)と共にEEPROM(0102)に格納される。
【0013】
以下、請求項1における実施例1を図面を用いて説明する。
【0014】
図2は、プログラム修正情報(0126)の具体例である。プログラム修正情報(0126)の構成は、前述の通りである。またプログラム修正情報(0126)は暗号化されており、利用者および第三者への情報の漏洩を防止する。更に認証のための認証データ(0124)を追加し、該データの認証を行うようにしておくとよい。
【0015】
図3は、実施例1における制御フローである。外部装置(0120)のICカードインタフェース部(132)からICカード(0100)にあるデータ送受信部(0118)へ暗号化されたプログラム修正情報(0112)が送信される。暗号化されたプログラム修正情報(0112)の受信する契機について特に制限はないが、外部装置(0120)とICカード(0100)との通信が確立した時点、すなわちICカード(0100)に電力が供給された後、ICカード(0100)から最初の応答を外部装置(0120)が受信した直後が望ましい。通信が確立した後、ICカード(0100)がコマンドデータを受信すると、プログラム実行部(134)によってプログラム修正情報格納制御部(0114)が呼び出され、暗号化されたプログラム修正情報(0112)が、暗号制御部(0116)によって復号化される。プログラム修正情報格納制御部(0114)では、修正用の履歴情報(136)と、ICカード(0100)に格納されている履歴情報(0106)とを比較し、修正用の履歴情報(136)の方が新しい場合は、修正用のプログラムコード(140)をプログラム修正情報格納領域(0122)に格納する。また履歴情報(0106)およびジャンプテーブル(0130)も修正用の履歴情報(136)と修正用のジャンプテーブル(138)にそれぞれ更新する。このとき外部装置(0120)に対して、修正用のプログラムコード(140)を格納したことを示す応答コードを応答するようにする。また修正用の履歴情報(136)の方が古い、または同じである場合は、修正用のプログラムコード(140)はプログラム修正情報格納領域(0122)には格納せず、履歴情報(0106)およびジャンプテーブル(0130)も更新しないようにする。このときも、外部装置(0120)に対しては、修正用のプログラムコード(140)を格納しないことを示す応答コードを応答するようにする。
【0016】
図4は、実施例1におけるプログラム実行部(134)を示すフローチャートである。まず、暗号化されたプログラム修正情報(0112)を受信するためのコマンドデータであるかどうかを判定する(0600)。暗号化されたプログラム修正情報(0112)を受信した場合は、プログラム修正情報格納制御部(0114)へ分岐する(0602)。他のコマンドデータの場合は、コマンドデータを元に、ジャンプテーブル(0130)から実行すべきプログラムコードのアドレスを求め(0300)、求めたアドレスへ分岐する(0302)。
【0017】
図5は実施例1におけるプログラム修正情報格納制御部(0114)のフローチャートである。まず暗号制御部(0116)で暗号化されたプログラム修正情報(0112)を復号化する(0700)。データの復号化が完了したら、認証データ(0124)による認証を行う(0702)。認証データ(0124)が正しければ、修正用の履歴情報(136)とICカード(0100)内に格納されている履歴情報(0106)を比較する(0704)。修正用の履歴情報(136)が、既に格納されている履歴情報(0106)より新しければ、プログラム修正情報格納領域(0122)に修正用のプログラムコード(140)を格納し(0706)、ジャンプコード(0130)および履歴情報(0106)を更新する(0708、0710)。それぞれのデータを更新した後は、復号化されたプログラム修正情報(0126)をプログラム修正情報格納領域(0122)に格納したことを示す応答コードを送信する(0712)。もし修正用の履歴情報(136)が、既に格納されている履歴情報(0106)より古いか、または同じであれば、復号化されたプログラム修正情報(0126)は格納せずに、復号化されたプログラム修正情報(0126)が不要であることを示す応答コードを送信する(0714)。また認証データ(0124)が一致しない場合は、認証データ(0124)が不正であることを示す応答コードを返すようにする(0716)。
【0018】
なお本実施例の場合、プログラム修正情報格納制御部(0114)については、本発明によるプログラム修正方法の対象としていない。これは万が一にも、プログラム修正情報格納制御部(0114)が悪意のあるプログラムコードに書き換えられることを防止するためである。
【0019】
以下、実施例1の他の実施例である実施例2を図面を用いて詳細に説明する。
【0020】
図6は、実施例2におけるプログラム修正情報格納制御部(0114)のフローチャートである。図5との違いは、認証データ(0124)が不一致となった回数をカウントする認証不一致カウンタと、その上限値とを設けた点である。すなわち上限値を設けておくことで、アタッカーからの攻撃の繰り返しに対する防衛を実現している。
【0021】
まず、認証不一致カウンタとその上限値を比較する(804)。認証不一致カウンタが上限値に達した場合は、暗号化されたプログラム修正情報(0112)は復号化せずに、認証不一致カウンタが上限値に達したことを示す応答コードを返す(0806)。上限値に達していない場合は、図5と同様、データを復号化し(0700)、認証データ(0124)を確認する(0702)。認証データ(0124)が正しい場合、後の処理は図5で説明した通りである。認証データ(0124)が正しくない場合は、認証不一致カウンタを更新し(0802)、認証データ(0124)が不一致であることを示す応答コードを返す(0716)。
【0022】
以下、さらに他の実施例である実施例3を詳細に説明する。
【0023】
図7は、本発明の構成図である。図1との違いは、プログラム修正情報格納領域(0122)に格納された修正後のプログラムコード(0108)を検証するためのプログラム検証部(0900)と、カードの実行を制御するカード実行制御部(0902)がICカード(0100)に、また外部装置(0120)から受信するコマンドデータとして暗号化された検証情報(0904)が追加された点である。なお、ICカード(0100)はオフラインで使用されることもあるが、ICカード(0100)の利用者は最終的にはオンラインによる決算を必要とするので、検証情報(0904)をICカード(0100)に送信する外部装置(0120)は、ICカード(0100)の発行元が提供しているホストコンピュータ、もしくは該ホストコンピュータとオンラインで接続されるなど、検証情報(0904)の提供元が信頼できる状態であることが前提となる。
【0024】
図8は、実施例3における検証情報(0904)の一例である。検証情報(0904)は、修正用の履歴情報(136)と、認証データ(0124)と、検証データ(1000)とで構成されている。検証データ(1000)は、修正用のジャンプテーブル(138)と修正用のプログラムコード(140)より、任意のアルゴリズムで一意的に求められるデータである。検証データ(1000)の例としては、ハッシュコードなどが挙げられる。
【0025】
図9は、実施例3におけるプログラム実行部(134)を示すフローチャートである。図4との違いは、コマンドの振り分けに先立って、カードの実行が可能かどうかを判定する(1200)。この判定は、カードを実行できないようにすることを意味するインジケータを設けておき、インジケータが任意の値に設定されているか否かで判定する。実行できない場合はカードの実行を停止する処理(1206)と、検証情報(0904)を受信するためのコマンドデータであるかどうかを判断し(1202)、プログラム検証部(0900)に分岐する処理(1204)が追加された点である。プログラム検証部(0900)についても、悪意のあるプログラムコードに書き換えられることを防止する必要があるため、本発明におけるプログラム修正方法の対象としないようにする。
【0026】
図10は、実施例3におけるプログラム検証部(0900)のフローチャートである。プログラム検証部(0900)では、暗号制御部(0116)へ制御を依頼し、検証情報(0904)を復号化する(1100)。復号化が完了した後、認証データ(0124)が正しいかどうかを判定する(1102)。認証データ(0124)が不一致であった場合は、不一致であることを示す応答コードを返す(1116)。更に実施例2のように、認証不一致カウンタの更新処理および判定処理を設ければ、アタッカーに対する防衛手段となる。認証データ(0124)が正しい場合は、既に格納されている履歴情報(0106)と、検証用の履歴情報(906)とを比較する(1104)。検証用の履歴情報(906)と格納されている履歴情報(0106)が一致した場合は、ICカード(0100)内に格納されているジャンプテーブル(0130)とプログラム修正情報格納領域(0122)に格納されている修正後のプログラムコード(0108)を入力として、検証データ(1000)を求めるためのアルゴリズムで検証用のデータを求め(1106)、求めた値と検証データ(1000)とを比較する(1108)。検証データ(1000)と、前記処理(1106)で求めた検証用のデータが一致すれば、修正後のプログラムコード(0108)は正しいことが証明されるため、検証結果が正しいことを示す応答コードを送信する(1110)。検証データ(1000)と前記処理(1106)で求めた検証用のデータが不一致であった場合は、カード実行制御部(0902)に分岐する(1112)。カード実行制御部(0902)は、図9で説明したカードを実行できないようにすることを意味するインジケータを設定し、カードを停止させる。カードの停止方法はICカード(0100)の仕様に依存するため、省略する。
【0027】
なお、カード実行制御部(0902)では検証情報(0904)が不一致であった場合、直ちにICカードを停止させる方法もあるが、検証情報(0904)が不一致であったことを示す応答コードを返すようにしておけば、応答コードを受信した外部装置(0120)で不正なプログラムコードが格納されていることを認識できるため、外部装置(0120)からカードの管理元へ不正なプログラムコードが格納されていることを通知出来る。
【0028】
以下、さらに他の実施例である実施例4を詳細に説明する。
【0029】
図11は、実施例4のプログラム検証部(0900)を示すフローチャートである。図10との違いは、履歴情報(136)とICカード(0100)内の履歴情報(0106)が不一致であった場合の取り扱いである。実施例3の場合であれば、検証用の履歴情報(906)が一致する検証情報(0904)を受信するまで、外部装置(0120)から検証情報(0904)を何回でも送信しなければならないが、本実施例によればICカード(0100)内の履歴情報(0106)を暗号化し(1500)、履歴情報応答データ(1600)として返すようにしているので、暗号化された履歴情報(0106)を外部装置(0120)へ返すことで(1502)、外部装置(0120)では適切な検証情報(0904)を認識することが出来るようになり、何度も検証情報(0904)を送受信する必要がなくなる。また本実施例では、ICカード(0100)が不当なプログラムコードに改ざんされる事を想定し、ICカード(0100)の停止用データを設けている。ICカード(0100)の停止用データとしては、あらかじめ修正用の履歴情報(136)として使用しないユニークな値を割り当てておく。そしてICカード(0100)の停止用データかどうかを判定し(1504)、停止用データであれば、カード実行制御部(0902)に制御を渡してICカード(0100)を停止させる。停止用データでなければ、図10と同様に検証データを求めてプログラムを検証する。
【0030】
図12は、実施例4における履歴情報応答データ(1600)の一例である。履歴情報応答データ(1600)は、履歴情報(0106)と認証データ(0124)を含み、認証データ(0124)で正当なICカード(0100)で作成されたものであることを識別することが出来る。
【0031】
以上より、修正後のプログラムコードなど秘匿性の高い情報はカード内でしか参照できないようになるため、ICカードを回収しなくても、プログラムコードが安全に修正できるようになるという効果がある。
【0032】
また、ICカード自身で必要な修正情報であるかどうかを判断できるため、ICカードプログラムが古いプログラムコードに戻るなどの操作上の失敗を防止する効果がある。
【0033】
また、個々のICカードの修正の履歴を管理する必要がなくなるため、ICカードの履歴情報の管理に必要なスペースや情報の管理に要する費用を削減する効果がある。
【0034】
また、プログラムコードの正当性を検証することで、不当なプログラムコードの書き換えによるカードの改ざんを検出し、更にはカードの不正利用を防止する効果がある。
【0035】
【発明の効果】
本発明によれば、修正後のプログラムコードなど秘匿性の高い情報はカード内でしか参照できないようになるため、ICカードを回収しなくても、プログラムコードが安全に修正できるようになる。
【図面の簡単な説明】
【図1】本発明の構成図である。
【図2】プログラム修正情報の具体例である。
【図3】実施例1の制御フローである。
【図4】実施例1におけるプログラム実行部を示すフローチャートである。
【図5】実施例1におけるプログラム修正情報格納制御部を示すフローチャートである。
【図6】実施例2におけるプログラム修正情報格納制御部を示すフローチャートである。
【図7】請求項2における本発明の構成図
【図8】検証情報の具体例
【図9】実施例3におけるプログラム実行部を示すフローチャート
【図10】実施例3におけるプログラム検証部のフローチャート
【図11】実施例4におけるプログラム検証部のフローチャート
【図12】履歴情報応答データの具体例
【符号の説明】
0100‥ICカード
0102‥EEPROM
0104‥ROM
0106‥履歴情報
0108‥修正後のプログラムコード
0112‥暗号化されたプログラム修正情報
0114‥プログラム修正情報格納制御部
0116‥暗号制御部
0118‥データ送受信部
0120‥外部装置
0122‥プログラム修正情報格納領域
0124‥認証データ
0126‥復号化されたプログラム修正情報
0128‥プログラムコード群
0130‥ジャンプテーブル
132‥ICカードインタフェース部
134‥プログラム実行部
136‥修正用の履歴情報
138‥修正用のジャンプテーブル
140‥修正用のプログラムコード
0900‥プログラム検証部
0902‥カード実行制御部
0904‥検証情報
906‥検証用の履歴情報
1000‥検証データ
1600‥履歴情報応答データ[0001]
TECHNICAL FIELD OF THE INVENTION
The present invention relates to a technique for modifying a program stored in a general-purpose storage medium such as an IC card.
[0002]
[Prior art]
The IC card is not a medium for writing data, such as a memory card, but includes a CPU and can execute a program code stored in the memory. Generally, a program executed in the IC card (IC card program) is generally stored in a memory provided in the IC card, in particular, a non-writable nonvolatile memory such as a ROM. There is also a method of storing necessary program codes in a writable nonvolatile memory such as an EEPROM as disclosed in Japanese Patent Application Laid-Open No. 07-210642.
[0003]
[Patent Document 1]
JP-A-07-210642
[Problems to be solved by the invention]
If there is an error in the IC card program, it is necessary to change the program code, and it is necessary to collect tens or hundreds of thousands of issued IC cards. In the case of an IC card in which a plurality of application programs can be mounted, some of them can dynamically load and delete the application programs. Therefore, after deleting the application programs, reload the corrected application programs. It is possible. However, once the program code is stored in the ROM, the IC card program stored in the ROM cannot be changed later, so the IC card must be reissued.
[0005]
Further, as described in the related art, it is conceivable that the necessary program code is stored in a writable nonvolatile memory such as an EEPROM. It was necessary to prevent the third party including the card user from referring to the corrected program code, and the IC card had to be collected.
[0006]
A first object of the present invention is to automatically correct an IC card program that needs to be corrected without collecting the IC card from a user. Further, when an error in the IC card program is found many times, it is conceivable that the correction content is updated each time. Therefore, means for preventing the corrected content from being overwritten with the old correction content is also required.
[0007]
A second object of the present invention is to prevent an illegal program code from being executed if an IC card program is rewritten by an illegal program code.
[0008]
[Means for Solving the Problems]
In order to achieve the first object, a function for decoding program modification information, a function for storing a modified program code, information for managing a history of modification of an IC card program, and necessary program modification information are provided. A function of judging from history information is provided in the IC card.
[0009]
In order to achieve the second object, a function for verifying the validity of the corrected program code and a function for stopping the IC card in the event that the program code is rewritten by an illegal program code are provided.
[0010]
BEST MODE FOR CARRYING OUT THE INVENTION
In general, an IC card has an IC chip mounted thereon, and the IC chip for the IC card usually includes a CPU and three types of memories. This memory is typically a non-rewritable non-volatile memory such as a ROM (Read Only Memory), a rewritable non-volatile memory such as an EEPROM (Electrically Erasable and Programmable Read Only Memory), and a rewritable memory such as a RAM (Random Access Memory). It is well known that it is composed of a volatile memory. It is also known that an IC card exchanges information with an external device such as a portable terminal or a personal computer (PC) by means of a command and a command response via a device usually called an IC card reader / writer. It is also known that the data passed to the card by the command is called command data, and that the command passed by the card as a command processing result includes response data and a response code.
[0011]
Hereinafter, embodiments of the present invention will be described in detail with reference to the drawings.
[0012]
FIG. 1 is a configuration diagram of the present invention. The IC card (0100) includes a ROM (0104) and an EEPROM (0102). The IC card (0100) and the external device (0120) include a data transmitting / receiving unit (0118) and an IC card interface unit (132), respectively. To exchange information. The IC card (0100) includes an encryption control unit (0116) for decrypting the encrypted data, and a decrypted data of the encrypted program modification information (0112) in a program modification information storage area (0122). ), And a jump table (0130) for branching to a program code group (0128) corresponding to the received command data, and a program code group (0130). To execute (0128), the program execution unit (134) branches to an appropriate program code with reference to the jump table (0130). As shown in FIG. 2, the decrypted program correction information (0126) is data including history information (136), a correction program code (140), and a correction jump table (138). It is configured. The program correction information storage area (0122) for storing the correction program code (140) is stored in the EEPROM (0102) together with the history information (0106) and the jump table (0130).
[0013]
Hereinafter, a first embodiment of the present invention will be described with reference to the drawings.
[0014]
FIG. 2 is a specific example of the program modification information (0126). The configuration of the program modification information (0126) is as described above. Further, the program modification information (0126) is encrypted to prevent information leakage to the user and the third party. Further, it is preferable that authentication data (0124) for authentication is added and the data is authenticated.
[0015]
FIG. 3 is a control flow in the first embodiment. The encrypted program modification information (0112) is transmitted from the IC card interface unit (132) of the external device (0120) to the data transmission / reception unit (0118) of the IC card (0100). There are no particular restrictions on the timing of receiving the encrypted program modification information (0112), but power is supplied to the IC card (0100) when communication between the external device (0120) and the IC card (0100) is established. After that, it is desirable that the external device (0120) receives the first response from the IC card (0100). After the communication is established, when the IC card (0100) receives the command data, the program execution unit (134) calls the program correction information storage control unit (0114), and encrypts the program correction information (0112). It is decrypted by the encryption control unit (0116). The program modification information storage controller (0114) compares the modification history information (136) with the history information (0106) stored in the IC card (0100), and compares the modification history information (136) with the modification history information (136). If it is newer, the program code for correction (140) is stored in the program correction information storage area (0122). Also, the history information (0106) and the jump table (0130) are updated to the history information for correction (136) and the jump table for correction (138), respectively. At this time, a response code indicating that the correction program code (140) is stored is sent to the external device (0120). If the history information for correction (136) is older or the same, the program code for correction (140) is not stored in the program correction information storage area (0122), and the history information (0106) and The jump table (0130) is also not updated. At this time, a response code indicating that the program code for correction (140) is not stored is returned to the external device (0120).
[0016]
FIG. 4 is a flowchart illustrating the program execution unit (134) according to the first embodiment. First, it is determined whether or not the received command data is command data for receiving the encrypted program modification information (0112) (0600). When the encrypted program modification information (0112) is received, the process branches to the program modification information storage control unit (0114) (0602). In the case of other command data, the address of the program code to be executed is obtained from the jump table (0130) based on the command data (0300), and the process branches to the obtained address (0302).
[0017]
FIG. 5 is a flowchart of the program modification information storage control unit (0114) in the first embodiment. First, the program modification information (0112) encrypted by the encryption control unit (0116) is decrypted (0700). When the decryption of the data is completed, authentication based on the authentication data (0124) is performed (0702). If the authentication data (0124) is correct, the history information for correction (136) is compared with the history information (0106) stored in the IC card (0100) (0704). If the correction history information (136) is newer than the already stored history information (0106), the correction program code (140) is stored in the program correction information storage area (0122) (0706), and jump is performed. The code (0130) and the history information (0106) are updated (0708, 0710). After updating each data, a response code indicating that the decrypted program modification information (0126) is stored in the program modification information storage area (0122) is transmitted (0712). If the history information for correction (136) is older than or the same as the history information (0106) already stored, the decrypted program correction information (0126) is not stored, but is decrypted. A response code indicating that the program correction information (0126) is unnecessary is transmitted (0714). If the authentication data (0124) does not match, a response code indicating that the authentication data (0124) is invalid is returned (0716).
[0018]
In the case of the present embodiment, the program correction information storage control unit (0114) is not a target of the program correction method according to the present invention. This is to prevent the program correction information storage control unit (0114) from being rewritten by malicious program code.
[0019]
Hereinafter, Embodiment 2 which is another embodiment of Embodiment 1 will be described in detail with reference to the drawings.
[0020]
FIG. 6 is a flowchart of the program modification information storage control unit (0114) in the second embodiment. The difference from FIG. 5 is that an authentication mismatch counter that counts the number of times the authentication data (0124) has mismatched and an upper limit thereof are provided. In other words, by setting the upper limit, defense against repeated attacks from attackers is realized.
[0021]
First, the authentication mismatch counter is compared with its upper limit (804). If the authentication mismatch counter reaches the upper limit, the encrypted program modification information (0112) is not decrypted, and a response code indicating that the authentication mismatch counter has reached the upper limit is returned (0806). If the upper limit has not been reached, the data is decrypted (0700) and the authentication data (0124) is confirmed (0702) as in FIG. If the authentication data (0124) is correct, the subsequent processing is as described with reference to FIG. If the authentication data (0124) is not correct, the authentication mismatch counter is updated (0802), and a response code indicating that the authentication data (0124) does not match is returned (0716).
[0022]
Hereinafter, a third embodiment which is still another embodiment will be described in detail.
[0023]
FIG. 7 is a configuration diagram of the present invention. The difference from FIG. 1 is that a program verification unit (0900) for verifying the corrected program code (0108) stored in the program correction information storage area (0122) and a card execution control unit for controlling the execution of the card (0902) is that encrypted verification information (0904) is added to the IC card (0100) and as command data received from the external device (0120). Note that the IC card (0100) may be used offline, but the user of the IC card (0100) ultimately needs to settle online, so the verification information (0904) is transmitted to the IC card (0100). The external device (0120) that transmits the verification information (0904) can be trusted by the host computer provided by the issuer of the IC card (0100) or connected to the host computer online. It is assumed that this is the state.
[0024]
FIG. 8 is an example of the verification information (0904) in the third embodiment. The verification information (0904) is composed of correction history information (136), authentication data (0124), and verification data (1000). The verification data (1000) is data uniquely obtained by an arbitrary algorithm from the correction jump table (138) and the correction program code (140). Examples of the verification data (1000) include a hash code.
[0025]
FIG. 9 is a flowchart illustrating the program execution unit (134) according to the third embodiment. The difference from FIG. 4 is that it is determined whether the card can be executed before the command is distributed (1200). This determination is made by providing an indicator that means that the card cannot be executed, and determining whether the indicator is set to an arbitrary value. If it cannot be executed, processing for stopping the execution of the card (1206) and processing for determining whether or not the command data is for receiving the verification information (0904) (1202), and branching to the program verification unit (0900) ( 1204) is added. Since it is necessary to prevent the program verification unit (0900) from being rewritten by malicious program code, the program verification unit (0900) is not subjected to the program correction method of the present invention.
[0026]
FIG. 10 is a flowchart of the program verification unit (0900) according to the third embodiment. The program verification unit (0900) requests control to the encryption control unit (0116) and decrypts the verification information (0904) (1100). After the decryption is completed, it is determined whether or not the authentication data (0124) is correct (1102). If the authentication data (0124) does not match, a response code indicating the mismatch is returned (1116). Further, as in the second embodiment, if update processing and determination processing of the authentication mismatch counter are provided, it becomes a defense means against an attacker. If the authentication data (0124) is correct, the history information (0106) already stored is compared with the verification history information (906) (1104). When the history information for verification (906) and the stored history information (0106) match, the jump table (0130) stored in the IC card (0100) and the program correction information storage area (0122) are stored. Using the stored corrected program code (0108) as an input, data for verification is obtained by an algorithm for obtaining verification data (1000) (1106), and the obtained value is compared with the verification data (1000). (1108). If the verification data (1000) matches the verification data obtained in the process (1106), the corrected program code (0108) is proved to be correct, and a response code indicating that the verification result is correct Is transmitted (1110). If the verification data (1000) does not match the verification data obtained in the process (1106), the flow branches to the card execution control unit (0902) (1112). The card execution control unit (0902) sets an indicator indicating that the card described with reference to FIG. 9 cannot be executed, and stops the card. The method of stopping the card depends on the specifications of the IC card (0100), and is therefore omitted.
[0027]
Note that the card execution control unit (0902) may immediately stop the IC card when the verification information (0904) does not match, but returns a response code indicating that the verification information (0904) does not match. By doing so, the external device (0120) that has received the response code can recognize that an incorrect program code is stored, and therefore, the external device (0120) stores the incorrect program code in the card management source. Can be notified.
[0028]
Hereinafter, a fourth embodiment which is still another embodiment will be described in detail.
[0029]
FIG. 11 is a flowchart illustrating the program verification unit (0900) according to the fourth embodiment. The difference from FIG. 10 is the handling when the history information (136) and the history information (0106) in the IC card (0100) do not match. In the case of the third embodiment, the verification information (0904) must be transmitted from the external device (0120) any number of times until the verification information (0904) that matches the verification history information (906) is received. However, according to the present embodiment, the history information (0106) in the IC card (0100) is encrypted (1500) and returned as history information response data (1600). ) Is returned to the external device (0120) (1502), so that the external device (0120) can recognize appropriate verification information (0904), and it is necessary to transmit and receive the verification information (0904) many times. Disappears. Further, in the present embodiment, data for stopping the IC card (0100) is provided on the assumption that the IC card (0100) is falsified with an invalid program code. As stop data of the IC card (0100), a unique value not used as correction history information (136) is assigned in advance. Then, it is determined whether the data is stop data for the IC card (0100) (1504). If the data is stop data, the control is passed to the card execution control unit (0902) to stop the IC card (0100). If the data is not stop data, the program is verified by obtaining verification data as in FIG.
[0030]
FIG. 12 is an example of the history information response data (1600) in the fourth embodiment. The history information response data (1600) includes the history information (0106) and the authentication data (0124), and the authentication data (0124) can identify that the data was created with a valid IC card (0100). .
[0031]
As described above, since highly confidential information such as the corrected program code can be referred to only in the card, there is an effect that the program code can be corrected safely without collecting the IC card.
[0032]
In addition, since the IC card itself can determine whether it is necessary correction information, there is an effect of preventing operational failure such as returning the IC card program to an old program code.
[0033]
In addition, since it is not necessary to manage the history of correction of each IC card, there is an effect of reducing the space required for managing history information of the IC card and the cost required for managing the information.
[0034]
Further, by verifying the validity of the program code, it is possible to detect tampering of the card due to unauthorized rewriting of the program code, and further to prevent illegal use of the card.
[0035]
【The invention's effect】
According to the present invention, since highly confidential information such as the corrected program code can be referred to only in the card, the program code can be corrected safely without collecting the IC card.
[Brief description of the drawings]
FIG. 1 is a configuration diagram of the present invention.
FIG. 2 is a specific example of program modification information.
FIG. 3 is a control flow according to the first embodiment.
FIG. 4 is a flowchart illustrating a program execution unit according to the first embodiment.
FIG. 5 is a flowchart illustrating a program modification information storage control unit according to the first embodiment.
FIG. 6 is a flowchart illustrating a program modification information storage control unit according to the second embodiment.
7 is a block diagram of the present invention in claim 2. FIG. 8 is a specific example of verification information. FIG. 9 is a flowchart showing a program execution unit in the third embodiment. FIG. 10 is a flowchart of a program verification unit in the third embodiment. FIG. 11 is a flowchart of a program verification unit according to the fourth embodiment. FIG. 12 is a specific example of history information response data.
0100
0104 @ ROM
0106 {history information 0108} modified program code 0112 {encrypted program modification information 0114} program modification information storage control unit 0116 {encryption control unit 0118} data transmission / reception unit 0120 {external device 0122} program modification
Claims (5)
前記外部装置から提供されるプログラムコードと履歴情報とを含むデータより構成される暗号化されたプログラム修正情報を受信し、前記履歴情報に基づいてプログラムコードを記憶するか否かを決定することを特徴とするプログラム修正方法。A non-rewritable nonvolatile memory, a rewritable nonvolatile memory, a CPU for accessing the non-rewritable nonvolatile memory and the rewritable nonvolatile memory, and a command data provided from an external device. A program execution unit that branches to a program code, an encryption control unit that encrypts and decrypts encrypted data, a data transmission and reception unit that exchanges data with the external device, and a program that is received from the external device. In a method for correcting a program in an IC card comprising a program correction information storage area for storing a program code included in the correction information, and a program correction information storage control unit for storing the program correction information,
Receiving encrypted program modification information composed of data including a program code and history information provided from the external device, and determining whether to store the program code based on the history information. Characteristic program modification method.
前記外部装置から提供されるプログラムコードと履歴情報とを含むデータより構成される暗号化されたプログラム修正情報を受信する手段と、前記履歴情報に基づいてプログラムコードを記憶するか否かを決定する手段とを備えたことを特徴とするICカード。A non-rewritable nonvolatile memory, a rewritable nonvolatile memory, a CPU for accessing the non-rewritable nonvolatile memory and the rewritable nonvolatile memory, and a command data provided from an external device. A program execution unit that branches to a program code, an encryption control unit that encrypts and decrypts encrypted data, a data transmission and reception unit that exchanges data with the external device, and a program that is received from the external device. An IC card comprising: a program correction information storage area for storing a program code included in the correction information; and a program correction information storage control unit for storing the program correction information.
Means for receiving encrypted program modification information composed of data including program code and history information provided from the external device, and determining whether to store the program code based on the history information And an IC card.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2002351928A JP2004185348A (en) | 2002-12-04 | 2002-12-04 | Program correction method and its implementation IC card |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2002351928A JP2004185348A (en) | 2002-12-04 | 2002-12-04 | Program correction method and its implementation IC card |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| JP2004185348A true JP2004185348A (en) | 2004-07-02 |
Family
ID=32753682
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP2002351928A Pending JP2004185348A (en) | 2002-12-04 | 2002-12-04 | Program correction method and its implementation IC card |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JP2004185348A (en) |
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP2007094823A (en) * | 2005-09-29 | 2007-04-12 | Dainippon Printing Co Ltd | IC card and IC card program capable of managing execution of update program |
| JP2007206902A (en) * | 2006-01-31 | 2007-08-16 | Dainippon Printing Co Ltd | IC card program correction system, program, and IC card |
-
2002
- 2002-12-04 JP JP2002351928A patent/JP2004185348A/en active Pending
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP2007094823A (en) * | 2005-09-29 | 2007-04-12 | Dainippon Printing Co Ltd | IC card and IC card program capable of managing execution of update program |
| JP2007206902A (en) * | 2006-01-31 | 2007-08-16 | Dainippon Printing Co Ltd | IC card program correction system, program, and IC card |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| TWI524275B (en) | Storage device and method of operating a storage device | |
| TWI391864B (en) | Critical security parameter generation and exchange system and method for smart-card memory modules | |
| US8898477B2 (en) | System and method for secure firmware update of a secure token having a flash memory controller and a smart card | |
| US7469837B2 (en) | Storage device | |
| US20040059916A1 (en) | Memory card | |
| US20040073846A1 (en) | Memory device, terminal apparatus, and data repair system | |
| US20100058073A1 (en) | Storage system, controller, and data protection method thereof | |
| CN105706099B (en) | software update device | |
| US8060925B2 (en) | Processor, memory, computer system, and method of authentication | |
| US20090193211A1 (en) | Software authentication for computer systems | |
| CN1795471B (en) | Security key generation method | |
| JP2017021434A (en) | Information processing apparatus and control method thereof | |
| US11270003B2 (en) | Semiconductor device including secure patchable ROM and patch method thereof | |
| EP1507414B1 (en) | Circuit for restricting data access | |
| CN108270767B (en) | Data verification method | |
| WO2019142307A1 (en) | Semiconductor device, update data-providing method, update data-receiving method, and program | |
| CN106384042A (en) | Electronic device and security system | |
| CN117708897A (en) | Method for protecting firmware data of embedded device and embedded device | |
| JP2018508063A (en) | Secure element | |
| KR20210134053A (en) | How to Validate Over-the-Air Updates | |
| CN119475442A (en) | Hardware Security Module Firmware Update | |
| US20200409572A1 (en) | Modification of a memory of a secure microprocessor | |
| AU2018398972B2 (en) | Checking the integrity of an electronic device | |
| CN117892319A (en) | Method and device for reading encrypted data of solid state disk and readable storage medium | |
| CN115037492B (en) | Method, system and computer storage medium for memory authentication |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20040824 |
|
| RD01 | Notification of change of attorney |
Free format text: JAPANESE INTERMEDIATE CODE: A7421 Effective date: 20060420 |
|
| A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20060519 |
|
| A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20060530 |
|
| A521 | Request for written amendment filed |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20060721 |
|
| A02 | Decision of refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A02 Effective date: 20070227 |