JP5903945B2 - IC card and computer program - Google Patents
IC card and computer program Download PDFInfo
- Publication number
- JP5903945B2 JP5903945B2 JP2012055828A JP2012055828A JP5903945B2 JP 5903945 B2 JP5903945 B2 JP 5903945B2 JP 2012055828 A JP2012055828 A JP 2012055828A JP 2012055828 A JP2012055828 A JP 2012055828A JP 5903945 B2 JP5903945 B2 JP 5903945B2
- Authority
- JP
- Japan
- Prior art keywords
- program code
- area
- edc
- card
- nvm
- 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
Links
Images
Description
本発明は、電気的に書換え可能な不揮発性メモリにプログラムコードを格納するICカードに関し、更に詳しくは、該不揮発性メモリに格納されたプログラムコードの正当性を検証するための技術に関する。 The present invention relates to an IC card that stores a program code in an electrically rewritable nonvolatile memory, and more particularly, to a technique for verifying the validity of a program code stored in the nonvolatile memory.
従来の電子機器では、CPUを動作させるために必要なプログラムコードを大量生産に適した電気的に書換え不可能なマスクROMへ格納し、ユーザ毎に個別のデータや運用中に更新されるデータを電気的に書換え可能な不揮発性メモリ(以下、「NVM」と略す。NVM:Non-Volatile Memory) へ格納していたが、マスクROMの製造には2〜6ヶ月程度の期間を要するため、開発期間短縮の観点から、プログラムコードをマスクROMではなくNVMへ格納する動きがある。 In conventional electronic devices, the program code necessary for operating the CPU is stored in an electrically non-rewritable mask ROM suitable for mass production, and individual data for each user and data updated during operation are stored. Although it was stored in an electrically rewritable non-volatile memory (hereinafter abbreviated as “NVM”; NVM: Non-Volatile Memory), the development of the mask ROM requires about 2 to 6 months. From the viewpoint of shortening the period, there is a movement to store the program code in the NVM instead of the mask ROM.
近年ではEEPROMやフラッシュメモリなどのNVMに対する書き込み速度が劇的に改善されてきており、プログラムコードをNVMへ格納しても、大量生産における製造効率を阻害するレベルではなくなりつつあるが、配線の有無によって電流を制御して情報を表現するマスクROMと異なり、NVMはフローティングゲート方式を用いているため、NVMが表す情報の信頼性はマスクROMよりも低く、特に暗号化や認証等のセキュリティ関連処理を実施するICカードの分野では、NVMに格納したプログラムコードの正当性を検証することが必要とされていた。 In recent years, the writing speed to NVM such as EEPROM and flash memory has been dramatically improved, and even if the program code is stored in NVM, it is not at a level that hinders manufacturing efficiency in mass production. Unlike a mask ROM that expresses information by controlling current according to the NVM, the NVM uses a floating gate method. Therefore, the reliability of the information represented by the NVM is lower than that of the mask ROM, particularly security-related processing such as encryption and authentication. In the field of IC cards that implement the above, it is necessary to verify the validity of the program code stored in the NVM.
ICカードの分野において、NVMに格納したプログラムコードの正当性を検証する発明として、例えば、特許文献1では、リセット処理に対する初期応答メッセージを送信する前に、ICカードがプログラムコードの正当性を検証し、異常が確認された場合は無応答とする発明が開示されている。一般的にリセット処理はICカードが使用される際の最初に実行されるため、一連の処理を実行する前にプログラムコードの正当性を確認することは効果的である。
In the IC card field, as an invention for verifying the correctness of the program code stored in the NVM, for example, in
しかし、携帯電話用のSIMカード(Subscriber Identity Module Card)や現金自動預け払い機用のSAMカード(Secure Access Module Card)に代表される機器組み込み型のICカードは、機器に装着されたままの状態にて運用されるため、リセット処理を実施する回数が極端に少なく、リセット処理を実施する毎にプログラムコードの正当性を検証すると、プログラムコードの正当性を検証する頻度が極端に減少してしまい、誤動作を未然に防ぐことが困難になってしまう。 However, device-embedded IC cards such as mobile phone SIM cards (Subscriber Identity Module Cards) and SAM cards (Secure Access Module Cards) for automated teller machines remain in the devices. Therefore, if the validity of the program code is verified every time the reset process is performed, the frequency of verifying the validity of the program code is extremely reduced. This makes it difficult to prevent malfunctions.
リセット処理を実施する頻度が少ない運用形態であっても、プログラムコードの正当性検証を継続して実施する手法として、認証、暗号化または復号等の特定の命令を受信した際にプログラムコードの正当性を検証する手法が考えられるが、半導体製造技術の進歩によってNVMのメモリ容量は従来よりも大きくなり、NVMに格納されるプログラムコードのサイズも巨大化しつつあるため、プログラムコードの正当性検証に要する時間が長くなり、運用時にユーザの利便性が損なわれる問題点がある。 Even in the case of operation forms where the frequency of reset processing is low, as a method to continue verifying the validity of the program code, the validity of the program code when a specific command such as authentication, encryption, or decryption is received. Although a method for verifying the reliability is considered, the memory capacity of the NVM has become larger than before due to advances in semiconductor manufacturing technology, and the size of the program code stored in the NVM is becoming larger. There is a problem in that it takes a long time and the convenience of the user is impaired during operation.
そこで、本発明は、運用時にICカードが活性化されている間、ユーザの利便性を損なうことがなく、NVMに格納したプログラムコードの正当性を継続的に検証できるICカード及びICカードに実装されるコンピュータプログラムを提供することを目的とする。 Therefore, the present invention is mounted on an IC card and an IC card that can continuously verify the validity of the program code stored in the NVM without losing user convenience while the IC card is activated during operation. An object is to provide a computer program to be executed.
上述した課題を解決する第1の発明は、電気的に書換え可能な不揮発性メモリ(以下、「NVM」)を有するICカードであって、プログラムコードを格納したプログラムコード領域に加え、プログラムコード領域に格納したプログラムコードの正当性を検証できるように、前記プログラムコード領域を複数に分割して得られたブロック領域内のプログラムコードから演算した参照EDCを前記ブロック領域に対応させて格納した参照EDC領域がNVMに設けられる。 A first invention for solving the above-described problem is an IC card having an electrically rewritable nonvolatile memory (hereinafter referred to as “NVM”), in addition to a program code area storing a program code, a program code area The reference EDC calculated from the program code in the block area obtained by dividing the program code area into a plurality of parts is stored in correspondence with the block area so that the validity of the program code stored in A region is provided in the NVM.
また、コンピュータプログラムで実現される手段として、第1の発明に係るICカードは、前記ICカードの動作モードが運用モードに設定されている時に、外部から正当性検証を伴う命令を受信すると、正当性検証の対象となる前記ブロック領域を示す次ブロック番号に該当する前記ブロック領域内のプログラムコードから認証EDCを演算し、該ブロック領域に対応する前記参照EDCを前記参照EDC領域から検索した後、演算した前記認証EDCと検索した前記参照EDCを照合し、照合に成功すると、正当性検証の対象となる前記ブロック領域が次の前記ブロック領域に切り替わるように前記次ブロック番号を更新してから前記命令を実行し、照合に失敗すると前記命令を実行することなく、プログラムコードの正当性検証に失敗したことを示す情報をNVMに書き込む処理を、前記ICカードが活性化されている間、正当性検証の対象となる前記ブロック領域をサイクリックに切り替えて実施する正当性検証手段を備える。 Further, as a means realized by a computer program, the IC card according to the first aspect of the invention is valid when receiving an instruction accompanied by validity verification from the outside when the operation mode of the IC card is set to the operation mode. After calculating the authentication EDC from the program code in the block area corresponding to the next block number indicating the block area to be verified, and searching the reference EDC corresponding to the block area from the reference EDC area, The calculated authentication EDC and the searched reference EDC are collated, and if the collation is successful, the block area to be verified is updated to the next block area, and then the next block number is updated. If the instruction is executed and verification fails, the verification of the program code fails without executing the instruction. And the process of writing to the NVM information indicating that, while the IC card is activated, and a validity verification means for performing switches the block area to be validity verification cyclically.
更に、第2の発明は、第1の発明に記載したICカードにおいて、プログラムコード領域に格納したプログラムコードの正当性検証に失敗した後に前記ICカードが利用されることがないように、前記正当性検証手段は、外部から前記命令を受信すると、前記命令を実行する前に、プログラムコードの正当性検証に失敗したことを示す情報がNVMに書き込まれていないか確認し、該情報がNVMに書き込まれている場合は処理を停止することを特徴とする。 Further, the second invention is the IC card described in the first invention, wherein the IC card is not used after the verification of the validity of the program code stored in the program code area has failed. When receiving the instruction from the outside, the sex verification means checks whether information indicating that the verification of the validity of the program code has failed is written in the NVM before executing the instruction, and the information is stored in the NVM. If written, the process is stopped.
更に、第3の発明は、第1の発明または第2の発明に記載したICカードにおいて、製造時に前記参照EDCを前記ICカード側で演算できるように、外部から受信したプログラムコードを前記プログラムコード領域に書き込んだ後、複数の前記ブロック領域に前記プログラムコード領域を分割し、前記ブロック領域内のプログラムコードから演算した前記参照EDCを前記ブロック領域に対応付けて前記ブロック領域毎に前記参照EDC領域に書き込んだ後、前記動作モードを前記運用モードに遷移させる処理を実施する手段を備えていることを特徴とする。 Further, the third invention is the IC card according to the first invention or the second invention, wherein the program code received from the outside is calculated so that the reference EDC can be calculated on the IC card side at the time of manufacture. After writing in the area, the program code area is divided into a plurality of block areas, and the reference EDC calculated from the program code in the block area is associated with the block area, and the reference EDC area for each block area after you write to, characterized in that it comprises means for implementing the process for transitioning the operation mode to the operation mode.
更に、第4の発明は、コンピュータプログラムに係る発明で、プログラムコードを格納したプログラムコード領域と、前記プログラムコード領域を複数に分割して得られたブロック領域内のプログラムコードから演算した参照EDCを前記ブロック領域に対応させて前記ブロック領域毎に格納した参照EDC領域とが、電気的に書き換え可能な不揮発性メモリ(以下、「NVM」)に設けられたICカードを機能させるコンピュータプログラムであって、前記ICカードの動作モードが運用モードに設定されている時に、外部から正当性検証を伴う命令を受信すると、正当性検証の対象となる前記ブロック領域を示す次ブロック番号に該当する前記ブロック領域内のプログラムコードから認証EDCを演算し、該ブロック領域に対応する前記参照EDCを前記参照EDC領域から検索した後、演算した前記認証EDCと検索した前記参照EDCを照合し、照合に成功すると、正当性検証の対象となる前記ブロック領域がサイクリックに切り替わるように前記次ブロック番号を更新してから前記命令を実行し、照合に失敗すると前記命令を実行することなく、プログラムコードの正当性検証に失敗したことを示す情報をNVMに書き込む処理を、前記ICカードが活性化されている間、正当性検証の対象となる前記ブロック領域をサイクリックに切り替えて実施する正当性検証手段として機能させるためのコンピュータプログラムである。
Furthermore, the fourth invention is an invention relating to a computer program, wherein a reference EDC calculated from a program code area storing a program code and a program code in a block area obtained by dividing the program code area into a plurality of parts is obtained. A computer program for causing an IC card provided in an electrically rewritable nonvolatile memory (hereinafter, “NVM”) to function as a reference EDC area stored for each block area in association with the block area. When the operation mode of the IC card is set to the operation mode and the command accompanied by the validity verification is received from the outside, the block area corresponding to the next block number indicating the block area subject to the validity verification The authentication EDC is calculated from the program code in the block, and the block corresponding to the block area After the irradiation EDC retrieved from the reference EDC area collates the reference EDC retrieved and computed said authentication EDC, a successful verification, the so said block region to be validity verification is switched cyclically The IC card executes a process of writing the information indicating that the verification of the validity of the program code has failed into the NVM without executing the instruction if the instruction is executed after the next block number is updated and collation fails. It is a computer program for functioning as a legitimacy verification means for cyclically switching the block area to be legitimate for verification while being activated .
更に、第5の発明は、第4の発明に記載したコンピュータプログラムにおいて、外部から前記命令を受信すると、前記命令を実行する前に、プログラムコードの正当性検証に失敗したことを示す情報がNVMに書き込まれていないか確認し、該情報がNVMに書き込まれている場合は処理を停止する前記正当性検証手段として機能させるためのコンピュータプログラムである。 Further, according to a fifth aspect, in the computer program according to the fourth aspect, when the instruction is received from the outside, information indicating that the validity verification of the program code has failed before executing the instruction is NVM. Is a computer program for functioning as the validity verification means for confirming whether or not the information is written to the NVM and stopping the processing when the information is written to the NVM.
このように、本発明に係るICカードは、ICカードが活性化されている間、正当性検証を伴う命令を受信する毎に、ブロック領域を順次変更しながら、NVMに格納したプログラムコードの正当性をブロック領域単位で継続的に検証するため、リセット処理の実行回数が極端に少なかったとしても、NVMに格納したプログラムコードの正当性検証の頻度が少なくなることはなくなる。 As described above, the IC card according to the present invention can verify the validity of the program code stored in the NVM while sequentially changing the block area every time an instruction with validity verification is received while the IC card is activated. Therefore, even if the number of executions of the reset process is extremely small, the frequency of verifying the validity of the program code stored in the NVM is not reduced.
また、本発明に係るICカードは、NVMに格納したプログラムコードをブロック領域単位で検証するため、ブロック領域のサイズを小さくすれば、プログラムコードの正当性検証に要する時間が長くならず、運用時にユーザの利便性を損なうことがなくなる。 In addition, since the IC card according to the present invention verifies the program code stored in the NVM in block area units, if the size of the block area is reduced, the time required for verifying the correctness of the program code is not increased. There is no loss of user convenience.
ここから、本発明にかかるICカードの好適な実施形態について、図面を参照しながら詳細に説明する。なお、これから説明する実施形態は本発明の一実施形態にしか過ぎず、本発明は、これから説明する実施形態に限定されることなく、種々の変形や変更が可能である。 A preferred embodiment of the IC card according to the present invention will be described in detail with reference to the drawings. The embodiment described below is only one embodiment of the present invention, and the present invention is not limited to the embodiment described below, and various modifications and changes are possible.
図1は、本実施形態に係るICカード1を説明する図である。本実施形態に係るICカード1は、携帯電話や自動現金預け払い機などの外部機器4に設けられたリーダライタ部40に組み込まれて利用されるデバイスで、ICカード1に実装されたICモジュール2には、ISO/IEC 7816-1に準じて接触端子が設けられた接続基板2a上にICチップ3が実装され、ICチップ3の入出力端子それぞれは、ICチップ3の入出力端子に対応する該接触端子とワイヤボンディング2bで接続されている。
FIG. 1 is a diagram for explaining an
なお、図1において、ICカード1の形状は、携帯電話用のSIMや自動現金預け払い機用のSAMのように、ISO/IEC 7816-2で規格化されているPlug-in型としているが、ICカード1の形状は、ISO/IEC 7816-2で規格化されているIDカード型やMini型であってもよい。
In FIG. 1, the shape of the
図2は、ICモジュール2に実装されるICチップ3を説明する図である。図2に示したようにICチップ3は、演算機能等を有するCPU30(Central Processing Unit)、時間を計測するタイマー31、外部装置4との伝送制御の機能を担うUART32に加え、メモリとして、ROM34(Read Only Memory)、EEPROMやフラッシュメモリのように電気的に書換え可能な不揮発性メモリ35(NVM:Non Volatile Memory)、RAM33(Random Access Memory)を備えている。
FIG. 2 is a diagram illustrating the
ICチップ3のCPU30を動作させるためのプログラムコードは、ICチップ3のROM34及びNVM35に格納され、ROM34には、本発明に係る正当性検証手段として機能するプログラムモジュールや、製造時にプログラムコードをNVM35に書き込むためのプログラムモジュールなどが実装される。
The program code for operating the
図3は、ICチップ3のNVM35の構造を説明する図である。図3に図示したように、ICチップ3のNVM35には、プログラムコードを格納するプログラムコード領域35aと、データを格納するデータ領域35bが設けられ、プログラムコード領域35aは、複数のブロック領域350に分割されて管理される。
FIG. 3 is a diagram for explaining the structure of the
NVM35に設けられたプログラムコード領域35aには、運用時に用いられる命令に該当するプログラムコードがICカード1の製造時に書き込まれ、ICカード1は、動作モードが運用モードの際に外部機器4から正当性検証を伴う命令を受信すると、正当性検証の対象となるブロック領域350内のプログラムコードを検証する処理を、該命令を受信する毎に、正当性検証の対象となるブロック領域350を順次、ここではサイクリックに切替えて実行する。
In the program code area 35a provided in the
正当性検証の対象となるブロック領域350をサイクリックに切替え、該ブロック領域350内のプログラムコードの正当性を検証することで、一つのブロック領域350内のプログラムコードの正当性検証に要する時間は、プログラムコード領域35a内全てのプログラムコードの正当性検証に要する時間よりも短くなり、運用時にユーザの利便性を損なうことはなくなるし、該命令をブロック領域350の数だけ受信すれば、プログラムコード領域35a内のすべてのプログラムコードを検証することができるようになる。
By switching cyclically the
NVM35内におけるプログラムコード領域35aの先頭アドレスは任意で、ページング方式でNVM35を管理する場合、プログラムコード領域35aのサイズはページ単位(例えば、32バイト)の整数倍になり、また、ブロック領域350のサイズはプログラムコード領域35aをブロック領域350の数で除算したサイズになる。例えば、プログラムコード領域35aのサイズが1000ページ(例えば、32キロバイト)で、ブロック領域350の数が100個の場合、ブロック領域350のサイズは10ページ(例えば、320バイト)になる。
The start address of the program code area 35a in the
プログラムコードの正当性検証を実施する際に参照する参照EDC351(EDC: Error Detection Code)はデータ領域35bに記憶され、図3に図示したように、データ領域35bは、プログラムコード領域35aと重なり合うことがないようにNVM35内に設定され、NVM35に設けられたデータ領域35bには、プログラムコードの正当性検証に用いる参照EDC351を格納する参照EDC領域35cが設けられる。
A reference EDC 351 (EDC: Error Detection Code) that is referred to when the validity verification of the program code is performed is stored in the data area 35b, and the data area 35b overlaps with the program code area 35a as shown in FIG. In the data area 35b that is set in the
データ領域35b内に設けられる参照EDC領域35cのサイズは、参照EDC351のサイズとブロック領域350の数に依存する。例えば、参照EDC351を2バイトのCRCとしブロック領域350の数を100個とする場合、参照EDC領域35cのサイズは200バイトになる。
The size of the
本実施形態において、正当性検証を行う際、それぞれのブロック領域350はブロック番号を用いて管理され、それぞれのブロック領域350内のプログラムコードのダイジェストを計算した結果である参照EDC351はブロック番号順に参照EDC領域35cに格納される。
In the present embodiment, when the validity verification is performed, each
図3ではブロック番号を括弧で括って表記し、先頭のブロック領域350(1)の参照EDC351(1)は参照EDC領域35cの先頭に格納されている。また、2番目のブロック領域350(2)の参照EDC351(2)は、参照EDC351(1)の次、すなわち2番目に参照EDC領域35cに格納されている。
In FIG. 3, the block number is enclosed in parentheses, and the reference EDC 351 (1) of the head block area 350 (1) is stored at the head of the
また、NVM35のデータ領域35bには、プログラムコードの正当性検証の際に参照する参照EDC351以外に、ICカード1の動作モードを示すモード識別情報352と、プログラムコード領域35aの正当性検証結果を示す正当性検証情報353と、次に正当性を検証するブロック領域350を示す次ブロック番号354と、ブロック領域350の数としてブログラムコード領域35aの分割数355が記憶される。
In addition, in the data area 35b of the
ここから、製造時におけるICカード1の動作について説明する。図4は、製造時におけるICカード1の動作を説明する図である。ICカード1を発行する際、NVM35に記憶されているモード識別情報352は、NVM35に対してプログラムコードの書き込みが可能な製造モードを示す値で、ICカード1は、プログラムコードをNVM35に書き込む命令をICカード発行機から受信すると、NVM35に設けられたプログラムコード領域35aの先頭アドレスから順に、ICカード発行機から受信したプログラムコードを書き込みする(S1)。なお、NVM35にプログラムコードを書き込む命令はROM34に格納されている。
From here, operation | movement of the
NVM35へのプログラムコードの書き込みが完了すると、ICカード1は、プログラムコードの書き込みが不可能な運用モードへICカード1の動作モードを切り替えるためのモード遷移命令をICカード発行機から受信する(S2)。このモード遷移命令は、専用の命令であってもよいが、プログラムコードの書き込み完了をモード遷移命令として取り扱うようにすることもできる。
When the writing of the program code to the
ICカード1の動作モードを切り替えるためのモード遷移命令をICカード発行機から受信すると、ICカード1は、NVM35に記憶されているモード識別情報352を確認し(S3)、モード識別情報352によって製造モードが示されていなければ、ICカード1の状態が異常であると判断し、異常応答情報をICカード発行機へ返信して(S13)、この手順を終了する。
When a mode transition command for switching the operation mode of the
また、ICカード1は、モード識別情報352によって製造モードが示されていれば、参照EDC351を演算する際の先頭アドレスを示すコードアドレスポインタにプログラムコード領域35aの先頭アドレスを設定し(S4)、更に、参照EDC351を格納する先頭アドレスを示すEDCアドレスポインタに参照EDC領域35cの先頭アドレスを設定する(S5)。
Further, if the manufacturing mode is indicated by the mode identification information 352, the
次に、ICカード1は、コードアドレスポインタを先頭とするブロック領域350のダイジェストを該ブロック領域350の参照EDC351として演算し(S6)、EDCアドレスポインタで示される参照EDC領域35c内の領域に、演算した参照EDC351をコピーすることで、演算した参照EDC351をNVM35の参照EDC領域35cに書き込む。(S7)。
Next, the
ICカード1は、演算した参照EDC351をNVM35の参照EDC領域35cに書き込むと、コードアドレスポインタにブロック領域350のサイズを加算し(S8)、更に、EDCアドレスポインタにEDCのサイズを加算した後(S9)、コードアドレスポインタがプログラムコード領域35aの終端に達したか確認し(S10)、コードアドレスポインタがプログラムコード領域35aの終端に達していなければ、図4のS6に戻り、次のブロック領域350の参照EDC351を演算する。
When the
また、コードアドレスポインタがプログラムコード領域35aの終端に達している場合、ICカード1は、NVM35に記憶されているモード識別情報352を運用モードに示す値に書き換えることで、ICカード1の動作モードを製造モードから運用モードに遷移させた後(S11)、ICカード1の動作モードが正常に運用モードに遷移したことを示す正常応答情報をICカード発行機へ送信して(S12)、この手順を終了する。
When the code address pointer reaches the end of the program code area 35a, the
ここから、運用時におけるICカード1の動作について説明する。図5は、運用時におけるICカード1の動作を説明する第1図で、リセット処理時のICカード1の動作を説明する図である。
From here, the operation of the
外部機器4のリーダライタ部40からリセット信号を受信すると(S20)、ICカード1は、NVM35に記憶されたモード識別情報352を確認することで、この時点の動作モードを確認する(S21)。
When a reset signal is received from the reader /
ICカード1は、この時点の動作モードが運用モードの場合、NVM35に記憶されている次ブロック番号354を「1」に設定し(S22)、初期応答メッセージを外部機器4へ送信した後(S23)、ICカード1は命令受信待ちの状態になる(S24)。
When the operation mode at this time is the operation mode, the
また、ICカード1は、この時点の動作モードが運用モードでない場合、NVM35に記憶されている次ブロック番号354を「1」に設定することなく、初期応答情報を外部機器4へ送信した後(S23)、ICカード1は命令受信待ちの状態になる(S24)。
Further, when the operation mode at this time is not the operation mode, the
図6は、運用時におけるICカード1の動作を説明する第2図で、命令処理時のICカード1の動作を説明する図である。命令受信待ちの状態において、ICカード1が外部機器4から運用時の命令を受信する(S30)と、ICカード1は、まず、この時点の動作モードを確認し(S31)、この時点の動作モードが運用モードでない場合、ICカード1は処理を停止する(S45)。
FIG. 6 is a diagram illustrating the operation of the
また、この時点の動作モードが運用モードの場合、ICカード1は、NVM35に記憶されている正当性検証情報353を確認し(S32)、正当性検証情報353により「異常」が示されている場合、ICカード1は処理を停止する(S45)。
When the operation mode at this time is the operation mode, the
NVM35に記憶されている正当性検証情報353により「正常」が示されている場合、ICカード1は、外部機器4から受信した命令の種別を判断し、その命令に該当したプログラムコードを実行する(S33)。
When the normality verification information 353 stored in the
外部機器4から受信した命令が、プログラムコードの正当性検証を伴う命令でなければ、ICカード1は、該命令に該当するプログラムコードを実行し(S42)、ここでは、プログラムコードの正当性を検証するプログラムモジュールが作動することなく、命令の実行結果が外部機器4へ送信される(S43)。
If the instruction received from the
プログラムコードの正当性検証を伴う命令は、プログラムコードの正当性を検証するプログラムモジュールを作動するように記述されており、外部機器4から受信した命令が、プログラムコードの正当性検証を伴う命令の場合、該命令がこのプログラムモジュールを作動させることで、ICカード1はこれから述べる処理を行う。
The instruction accompanied by the verification of the correctness of the program code is described so as to operate the program module for verifying the correctness of the program code. In this case, the
プログラムコードの正当性検証を行う場合、まず、ICカード1は、データ領域35cから次ブロック番号354を取得し(S34)、ICカード1は、次ブロック番号354、ブロック領域350のサイズ及びプログラムコード領域35aの先頭アドレスを利用して、正当性検証の対象となるブロック領域350の先頭アドレスを求め(S35)、該先頭アドレスを先頭とするブロック領域350のダイジェストである認証EDCを演算する(S36)。
When verifying the validity of the program code, first, the
ICカード1は、認証EDCを演算すると、次ブロック番号354、参照EDC領域35cの先頭アドレス及びEDCのサイズを利用して、正当性検証の対象となるブロック領域350に該当する参照EDC351を、参照EDC領域35cから検索し(S37)、演算した認証EDCと検索した参照EDC351を照合する(S38)。
When the authentication EDC is calculated, the
ICカード1は、演算した認証EDCと検索した参照EDC351が一致しなかった場合、NVM35に記憶されている正当性検証情報353を「異常」に設定し(S44)、処理を停止する(S45)。
If the calculated authentication EDC and the retrieved
また、ICカード1は、演算した認証EDCと検索した参照EDC351が一致した場合、次ブロック番号354に「1」を加算した後(S39)、次ブロック番号354がプログラムコード領域35aの分割数355を超えたか確認する(S40)。
Further, when the calculated authentication EDC matches the searched
ICカード1は、次ブロック番号354がプログラムコード領域35aの分割数355を超えている場合、次ブロック番号354を「1」にした後(S41)、外部機器4から受信した命令に該当するプログラムコードを実行し(S42)、実行結果を外部機器4へ送信して(S43)、命令待ち状態に戻る。
When the
また、ICカード1は、次ブロック番号354がプログラムコード領域35aの分割数355を超えていない場合、次ブロック番号354を「1」にすることなく、外部機器4から受信した命令に該当するプログラムコードを実行し(S42)、実行結果を外部機器4へ送信して(S43)、命令待ち状態に戻る。
Further, the
1 ICカード
2 ICモジュール
3 ICチップ
30 CPU
34 ROM
35 NVM(Non Volatile Memory)
35a プログラムコード領域
35b データ領域
35c 参照EDC領域
350 ブロック領域
351 参照EDC
352 モード識別情報
353 正当性検証情報
354 次ブロック番号
355 分割数
4 外部装置
40 リーダライタ部
1
34 ROM
35 NVM (Non Volatile Memory)
35a Program code area
352 Mode identification information 353
Claims (5)
プログラムコードを格納したプログラムコード領域と、前記プログラムコード領域を複数に分割して得られたブロック領域内のプログラムコードから演算した参照EDCを前記ブロック領域に対応させて前記ブロック領域毎に格納した参照EDC領域がNVMに設けられ、
前記ICカードの動作モードが運用モードに設定されている時に、外部から正当性検証を伴う命令を受信すると、正当性検証の対象となる前記ブロック領域を示す次ブロック番号に該当する前記ブロック領域内のプログラムコードから認証EDCを演算し、該ブロック領域に対応する前記参照EDCを前記参照EDC領域から検索した後、演算した前記認証EDCと検索した前記参照EDCを照合し、照合に成功すると、正当性検証の対象となる前記ブロック領域が次の前記ブロック領域に切り替わるように前記次ブロック番号を更新してから前記命令を実行し、照合に失敗すると前記命令を実行することなく、プログラムコードの正当性検証に失敗したことを示す情報をNVMに書き込む処理を、前記ICカードが活性化されている間、正当性検証の対象となる前記ブロック領域をサイクリックに切り替えて実施する正当性検証手段を備えていること特徴とするICカード。 An IC card having an electrically rewritable nonvolatile memory (hereinafter, “NVM”),
A reference stored in each block area corresponding to the block area, a program code area storing the program code, and a reference EDC calculated from the program code in the block area obtained by dividing the program code area into a plurality of blocks An EDC region is provided in the NVM,
When the operation mode of the IC card is set to the operation mode, if an instruction with validity verification is received from the outside, the block area corresponding to the next block number indicating the block area subject to the validity verification of calculating the program code from the authentication EDC, after searching the reference EDC corresponding to the block region from the reference EDC area collates the reference EDC retrieved and computed said authentication EDC, a successful verification, legitimate The next block number is updated so that the block area to be verified is switched to the next block area, the instruction is executed, and if verification fails, the program code is validated without executing the instruction. the process of writing the information indicating the failure in sex validation NVM, while the IC card is activated, a positive IC card according to claim that it comprises a validity verification means for performing switches the block area to be sexual verification cyclically.
前記ICカードの動作モードが運用モードに設定されている時に、外部から正当性検証を伴う命令を受信すると、正当性検証の対象となる前記ブロック領域を示す次ブロック番号に該当する前記ブロック領域内のプログラムコードから認証EDCを演算し、該ブロック領域に対応する前記参照EDCを前記参照EDC領域から検索した後、演算した前記認証EDCと検索した前記参照EDCを照合し、照合に成功すると、正当性検証の対象となる前記ブロック領域が次の前記ブロック領域に切り替わるように前記次ブロック番号を更新してから前記命令を実行し、照合に失敗すると前記命令を実行することなく、プログラムコードの正当性検証に失敗したことを示す情報をNVMに書き込む処理を、前記ICカードが活性化されている間、正当性検証の対象となる前記ブロック領域をサイクリックに切り替えて実施する正当性検証手段として機能させるためのコンピュータプログラム。 A reference stored in each block area corresponding to the block area, a program code area storing the program code, and a reference EDC calculated from the program code in the block area obtained by dividing the program code area into a plurality of blocks The EDC area is a computer program for causing an IC card provided in an electrically rewritable nonvolatile memory (hereinafter referred to as “NVM”) to function.
When the operation mode of the IC card is set to the operation mode, if an instruction with validity verification is received from the outside, the block area corresponding to the next block number indicating the block area subject to the validity verification of calculating the program code from the authentication EDC, after searching the reference EDC corresponding to the block region from the reference EDC area collates the reference EDC retrieved and computed said authentication EDC, a successful verification, legitimate The next block number is updated so that the block area to be verified is switched to the next block area, the instruction is executed, and if verification fails, the program code is validated without executing the instruction. the process of writing the information indicating the failure in sex validation NVM, while the IC card is activated, a positive Computer program for functioning as a validity verification means for implementing switches the block area to be sexual verification cyclically.
When the instruction is received from the outside, before executing the instruction, it is confirmed whether information indicating that the verification of the validity of the program code has failed is written in the NVM, and the information is written in the NVM. The computer program according to claim 4, which functions as the validity verification unit that stops processing.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2012055828A JP5903945B2 (en) | 2012-03-13 | 2012-03-13 | IC card and computer program |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2012055828A JP5903945B2 (en) | 2012-03-13 | 2012-03-13 | IC card and computer program |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2013190923A JP2013190923A (en) | 2013-09-26 |
JP5903945B2 true JP5903945B2 (en) | 2016-04-13 |
Family
ID=49391117
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2012055828A Active JP5903945B2 (en) | 2012-03-13 | 2012-03-13 | IC card and computer program |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP5903945B2 (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2013222348A (en) * | 2012-04-17 | 2013-10-28 | Dainippon Printing Co Ltd | Ic card and computer program |
Family Cites Families (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPS63234375A (en) * | 1987-03-23 | 1988-09-29 | Toshiba Corp | Processing system |
JPH01237786A (en) * | 1988-03-18 | 1989-09-22 | Canon Inc | Card processor |
JPH03147086A (en) * | 1989-11-01 | 1991-06-24 | Hitachi Maxell Ltd | Ic card |
JPH0436848A (en) * | 1990-05-31 | 1992-02-06 | Matsushita Electric Ind Co Ltd | Memory error detecting method |
JPH08242323A (en) * | 1994-12-20 | 1996-09-17 | Canon Inc | Communication equipment |
JP4135413B2 (en) * | 2002-07-03 | 2008-08-20 | ソニー株式会社 | MEMORY CHECK SYSTEM, MEMORY CHECK METHOD, SIGNAL PROCESSING DEVICE, SIGNAL PROCESSING DEVICE MEMORY CHECK METHOD, AND MEMORY CHECK PROGRAM |
-
2012
- 2012-03-13 JP JP2012055828A patent/JP5903945B2/en active Active
Also Published As
Publication number | Publication date |
---|---|
JP2013190923A (en) | 2013-09-26 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US20070136797A1 (en) | Secure device and system for issuing ic cards | |
JP2007026118A (en) | Ic card, and program for ic card | |
JP5259513B2 (en) | Portable electronic device, IC card, and portable electronic device control method | |
US8112662B2 (en) | Portable electronic apparatus, processing apparatus for portable electronic apparatus, and data processing method in portable electronic apparatus | |
CN106709386B (en) | Smart card data writing method and device | |
JP5903945B2 (en) | IC card and computer program | |
JP2013222348A (en) | Ic card and computer program | |
JP2011022841A (en) | Processing system for portable electronic apparatus, portable electronic apparatus, and processing apparatus for portable electronic apparatus | |
US20140289874A1 (en) | Integrated circuit (ic) chip and method of verifying data thereof | |
JP7284002B2 (en) | Semiconductor device, control method and program | |
JP5786702B2 (en) | Security token, instruction execution method in security token, and computer program | |
JP6182940B2 (en) | IC card, status word output method, and status word output processing program | |
JP2017228222A (en) | Electronic information storage medium, abnormality detection method and abnormality detection program | |
JP2014002471A (en) | Ic card processor and ic card | |
KR101660180B1 (en) | Ic card, portable electronic apparatus, and ic card processing apparatus | |
JP2005258968A (en) | Validity verification method of data written in ic card, and program for ic card | |
JP6009854B2 (en) | IC card, portable electronic device, and IC card control program | |
JP2006268779A (en) | Portable electronic device | |
JP2013011988A (en) | Diagnostic method for ic cards and program codes | |
JP7444197B2 (en) | Electronic information storage medium, cryptographic operation method selection method, and program | |
JP7459899B2 (en) | Electronic information storage medium, verification method, and program | |
JP5367236B2 (en) | Portable electronic device and IC card | |
JP2011013830A (en) | Ic card, ic card processing apparatus, and ic card processing system | |
JP2015187896A (en) | Security token, execution method for instruction in security token, and computer program | |
CN113535201A (en) | Firmware loading and upgrading mechanism for improving success rate of firmware upgrading |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
RD01 | Notification of change of attorney |
Free format text: JAPANESE INTERMEDIATE CODE: A7421 Effective date: 20130809 |
|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20150116 |
|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20151110 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20151117 |
|
A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20160118 |
|
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: 20160216 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20160229 |
|
R150 | Certificate of patent or registration of utility model |
Ref document number: 5903945 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R150 |