JP6499052B2 - IC card, IC module, and program - Google Patents

IC card, IC module, and program Download PDF

Info

Publication number
JP6499052B2
JP6499052B2 JP2015198439A JP2015198439A JP6499052B2 JP 6499052 B2 JP6499052 B2 JP 6499052B2 JP 2015198439 A JP2015198439 A JP 2015198439A JP 2015198439 A JP2015198439 A JP 2015198439A JP 6499052 B2 JP6499052 B2 JP 6499052B2
Authority
JP
Japan
Prior art keywords
data
storage unit
stored
identifier
dgi
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
JP2015198439A
Other languages
Japanese (ja)
Other versions
JP2017072932A (en
Inventor
昭紀 志賀
昭紀 志賀
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Toshiba Corp
Toshiba Infrastructure Systems and Solutions Corp
Original Assignee
Toshiba Corp
Toshiba Infrastructure Systems and Solutions Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Toshiba Corp, Toshiba Infrastructure Systems and Solutions Corp filed Critical Toshiba Corp
Priority to JP2015198439A priority Critical patent/JP6499052B2/en
Publication of JP2017072932A publication Critical patent/JP2017072932A/en
Application granted granted Critical
Publication of JP6499052B2 publication Critical patent/JP6499052B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Storage Device Security (AREA)

Description

本発明の実施形態は、ICカード、ICモジュール、及びプログラムに関する。   Embodiments described herein relate generally to an IC card, an IC module, and a program.

近年、IC(Integrated Circuit)チップを内蔵したICカードが広く使用されている。ICカードでは、用途に対応したICカードの動作に必要な情報を、書き込み要求のコマンドを含む発行コマンドを用いてICチップ内の不揮発性メモリに書き込む発行工程が実行される。しかしながら、従来のICカードでは、例えば、書き込んだ情報を確認する際に、発行コマンドとは異なる読み出しコマンドなどを使用する必要があり、発行装置が対応するコマンドの種類が多くなる場合があった。   In recent years, IC cards incorporating IC (Integrated Circuit) chips have been widely used. In the IC card, an issue process is executed in which information necessary for the operation of the IC card corresponding to the application is written into the nonvolatile memory in the IC chip using an issue command including a write request command. However, in the conventional IC card, for example, when the written information is confirmed, it is necessary to use a read command different from the issued command, and there are cases where the types of commands supported by the issuing device increase.

特開2011−216068号公報JP 2011-2160868 A

本発明が解決しようとする課題は、発行工程に使用するコマンドの種類を低減することができるICカード、ICモジュール、及びプログラムを提供することである。   The problem to be solved by the present invention is to provide an IC card, an IC module, and a program capable of reducing the types of commands used in the issuing process.

実施形態のICカードは、データ記憶部と、受信部と、データ識別子記憶部と、処理部と、送信部とを持つ。データ記憶部は、データを記憶する。受信部は、前記データ記憶部に記憶させるデータと、前記データを識別するデータ識別子とを含む書き込み要求を、外部装置から受信する。データ識別子記憶部は、前記データ記憶部に記憶されているデータに対応する前記データ識別子に関連する情報を記憶する。処理部は、前記データ識別子記憶部が記憶する前記データ識別子に関連する情報に基づいて、前記受信部によって受信した前記データ識別子に対応するデータが前記データ記憶部に記憶されているか否かを判定し、前記データ識別子に対応するデータが前記データ記憶部に記憶されていない場合に、前記書き込み要求に含まれるデータを前記データ記憶部に記憶させ、前記データ識別子に対応するデータが前記データ記憶部に記憶されている場合に、前記書き込み要求に含まれるデータと、前記データ記憶部に記憶されている前記データ識別子に対応するデータとが一致するか否かを判定する。送信部は、前記処理部によって判定された前記一致するか否かの判定結果を示す情報を含む応答を前記外部装置に送信する。   The IC card according to the embodiment includes a data storage unit, a reception unit, a data identifier storage unit, a processing unit, and a transmission unit. The data storage unit stores data. The receiving unit receives a write request including data to be stored in the data storage unit and a data identifier for identifying the data from an external device. The data identifier storage unit stores information related to the data identifier corresponding to the data stored in the data storage unit. The processing unit determines whether data corresponding to the data identifier received by the receiving unit is stored in the data storage unit based on information related to the data identifier stored in the data identifier storage unit When the data corresponding to the data identifier is not stored in the data storage unit, the data included in the write request is stored in the data storage unit, and the data corresponding to the data identifier is stored in the data storage unit. Is stored in the data request, it is determined whether the data included in the write request matches the data corresponding to the data identifier stored in the data storage unit. The transmission unit transmits a response including information indicating a determination result of whether or not the determination is made by the processing unit to the external device.

第1の実施形態のICカードの一例を示す外観図。1 is an external view showing an example of an IC card according to a first embodiment. 第1の実施形態のICカードのハードウェア構成例を示す図。1 is a diagram illustrating a hardware configuration example of an IC card according to a first embodiment. 第1の実施形態のICカードの機能構成例を示すブロック図。The block diagram which shows the function structural example of the IC card of 1st Embodiment. 第1の実施形態の過去受信DGI記憶部が記憶するデータ例を示す図。The figure which shows the example of data which the past reception DGI memory | storage part of 1st Embodiment memorize | stores. 第1の実施形態のDGIテーブル記憶部が記憶するデータ例を示す図。The figure which shows the example of data which the DGI table memory | storage part of 1st Embodiment memorize | stores. 第1の実施形態のファイル管理情報記憶部が記憶するデータ例を示す図。The figure which shows the example of data which the file management information storage part of 1st Embodiment memorize | stores. STORE DATAコマンドのデータ構成例を示す図。The figure which shows the data structural example of a STORE DATA command. 第1の実施形態のICカードのSTORE DATAコマンド処理の一例を示すフローチャート。5 is a flowchart illustrating an example of a STORE DATA command process of the IC card according to the first embodiment. 第2の実施形態のICカードの機能構成例を示すブロック図。The block diagram which shows the function structural example of the IC card of 2nd Embodiment. 第2の実施形態のファイル管理情報記憶部が記憶するデータ例を示す図。The figure which shows the example of data which the file management information storage part of 2nd Embodiment memorize | stores. 第2の実施形態のICカードのSTORE DATAコマンド処理の一例を示すフローチャート。9 is a flowchart illustrating an example of a STORE DATA command process of the IC card according to the second embodiment.

以下、実施形態のICカード、ICモジュール、及びプログラムを、図面を参照して説明する。   Hereinafter, an IC card, an IC module, and a program according to embodiments will be described with reference to the drawings.

(第1の実施形態)
図1は、第1の実施形態のICカード1の一例を示す外観図である。
図1に示すように、ICカード1は、ICモジュール10を備える。ICモジュール10は、ICカード1が接触式ICカードの場合は、コンタクト部3と、ICチップ100とを備える。なお、ICカード1が非接触式ICカードの場合は、ICモジュール10は、アンテナ部とICチップ100とを備える。ICカード1は、例えば、プラスチックのカード基材PT(カード本体の一例)に、ICモジュール10を実装して形成されている。すなわち、ICカード1は、ICモジュール10と、ICモジュール10が埋め込まれたカード基材PTとを備えている。また、ICカード1は、コンタクト部3を介して外部装置2と通信可能である。
(First embodiment)
FIG. 1 is an external view showing an example of an IC card 1 according to the first embodiment.
As shown in FIG. 1, the IC card 1 includes an IC module 10. The IC module 10 includes a contact portion 3 and an IC chip 100 when the IC card 1 is a contact IC card. When the IC card 1 is a non-contact IC card, the IC module 10 includes an antenna unit and an IC chip 100. The IC card 1 is formed, for example, by mounting an IC module 10 on a plastic card base PT (an example of a card body). That is, the IC card 1 includes an IC module 10 and a card substrate PT in which the IC module 10 is embedded. Further, the IC card 1 can communicate with the external device 2 via the contact unit 3.

ICカード1は、例えば、外部装置2が送信したコマンド(処理要求)を、コンタクト部3を介して受信し、受信したコマンドに応じた処理(コマンド処理)を実行する。そして、ICカード1は、コマンド処理の実行結果であるレスポンス(処理応答)を外部装置2にコンタクト部3を介して送信する。
ここで、外部装置2は、ICカード1と通信する上位装置であり、例えば、リーダ/ライタ装置、発行装置などである。
For example, the IC card 1 receives a command (processing request) transmitted from the external device 2 via the contact unit 3 and executes processing (command processing) according to the received command. Then, the IC card 1 transmits a response (processing response) that is an execution result of the command processing to the external device 2 via the contact unit 3.
Here, the external device 2 is a higher-level device that communicates with the IC card 1, and is, for example, a reader / writer device or an issuing device.

ICモジュール10は、コンタクト部3と、ICチップ100とを備え、例えば、テープ上にICモジュール10が複数配置されたCOT(Chip On Tape)などの形態で取引されるモジュールである。なお、テープから個片抜きして切り離した単体のICモジュール10をCOTという場合がある。   The IC module 10 includes a contact portion 3 and an IC chip 100, and is a module that is traded in a form such as COT (Chip On Tape) in which a plurality of IC modules 10 are arranged on a tape, for example. Note that the single IC module 10 that has been cut out and separated from the tape may be referred to as COT.

コンタクト部3は、ICカード1が動作するために必要な各種信号の端子を有している。ここで、各種信号の端子は、電源電圧、クロック信号、リセット信号などを外部装置2から供給を受ける端子、及び、外部装置2と通信するためのシリアルデ―タ入出力端子(SIO端子)を有する。
ICチップ100は、例えば、1チップのマイクロプロセッサなどのLSI(Large Scale Integration)である。
The contact part 3 has terminals for various signals necessary for the operation of the IC card 1. Here, the various signal terminals include a terminal for receiving a power supply voltage, a clock signal, a reset signal, and the like from the external device 2 and a serial data input / output terminal (SIO terminal) for communicating with the external device 2. .
The IC chip 100 is, for example, an LSI (Large Scale Integration) such as a one-chip microprocessor.

次に、図2を参照して、本実施形態のICカード1のハードウェア構成について説明する。
図2は、本実施形態のICカード1のハードウェア構成例を示す図である。
図2に示すように、ICカード1は、コンタクト部3と、ICチップ100とを備えたICモジュール10を備えている。そして、ICチップ100は、UART(Universal Asynchronous Receiver Transmitter)4と、CPU(Central Processing Unit)5と、ROM(Read Only Memory)6と、RAM(Random Access Memory)7と、EEPROM(Electrically Erasable Programmable ROM)8とを備えている。
Next, the hardware configuration of the IC card 1 of this embodiment will be described with reference to FIG.
FIG. 2 is a diagram illustrating a hardware configuration example of the IC card 1 according to the present embodiment.
As shown in FIG. 2, the IC card 1 includes an IC module 10 including a contact portion 3 and an IC chip 100. The IC chip 100 includes a UART (Universal Asynchronous Receiver Transmitter) 4, a CPU (Central Processing Unit) 5, a ROM (Read Only Memory) 6, a RAM (Random Access Memory) 7, and an EEPROM (Electrically Erasable Programmable ROM). ) 8.

UART4(通信部の一例)は、ICカード1と外部装置2との間の通信(コマンド/レスポンスの送受信)を行う。UART4は、例えば、EEPROM8に個人情報や内部制御用情報、等を設定する発行処理を要求する発行コマンド(発行処理要求)などの各種コマンドを外部装置2から受信する。また、UART4は、各種コマンドに応じた処理の実行結果であるレスポンスを外部装置2に送信する。   The UART 4 (an example of a communication unit) performs communication (transmission / reception of commands / responses) between the IC card 1 and the external device 2. The UART 4 receives various commands from the external device 2 such as an issue command (issue request) for requesting an issue process for setting personal information, internal control information, and the like in the EEPROM 8. In addition, the UART 4 transmits a response that is a result of execution of processing according to various commands to the external device 2.

CPU5は、ROM6又はEEPROM8に記憶されているプログラムを実行して、ICカード1の各種処理を行う。CPU5は、例えば、コンタクト部3を介して、UART4が受信したコマンドに応じたコマンド処理を実行する。また、CPU5は、実行したコマンド処理のレスポンスをUART4に送信させる。   The CPU 5 executes programs stored in the ROM 6 or the EEPROM 8 to perform various processes of the IC card 1. For example, the CPU 5 executes command processing according to the command received by the UART 4 via the contact unit 3. Further, the CPU 5 causes the UART 4 to transmit a response of the executed command processing.

ROM6は、例えば、マスクROMなどの不揮発性メモリであり、ICカード1の各種処理を実行するためのプログラム、及びコマンドテーブルなどのデータを記憶する。
RAM7は、例えば、SRAM(Static RAM)などの揮発性メモリであり、ICカード1の各種処理を行う際に利用されるデータを一時記憶する。RAM7は、受信バッファ71と、送信バッファ72とを備えている。
受信バッファ71は、UART4が受信したコマンドなどのデータを記憶する。また、送信バッファ72は、UART4が送信するレスポンスなどのデータを記憶する。
The ROM 6 is a non-volatile memory such as a mask ROM, for example, and stores a program for executing various processes of the IC card 1 and data such as a command table.
The RAM 7 is a volatile memory such as SRAM (Static RAM), for example, and temporarily stores data used when performing various processes of the IC card 1. The RAM 7 includes a reception buffer 71 and a transmission buffer 72.
The reception buffer 71 stores data such as commands received by the UART 4. Further, the transmission buffer 72 stores data such as a response transmitted by the UART 4.

EEPROM8は、例えば、電気的に書き換え可能な不揮発性メモリである。EEPROM8は、ICカード1が利用する各種データを記憶する。EEPROM8は、例えば、使用者氏名、使用者ID、カードID、各種鍵情報、内部制御用情報などをICカード1の用途に応じて記憶する。   The EEPROM 8 is, for example, an electrically rewritable nonvolatile memory. The EEPROM 8 stores various data used by the IC card 1. The EEPROM 8 stores, for example, a user name, a user ID, a card ID, various key information, information for internal control, and the like according to the use of the IC card 1.

次に、図3を参照して、本実施形態によるICカード1の機能構成例について説明する。
図3は、本実施形態のICカード1の機能構成例を示すブロック図である。
図3に示すように、ICカード1は、UART4と、制御部50と、DGIテーブル記憶部60と、過去受信DGI記憶部70と、データ記憶部80と、ファイル管理情報記憶部81とを備えている。
ここで、図3に示されるICカード1の各部は、図2に示されるICカード1のハードウェアを用いて実現される。
Next, a functional configuration example of the IC card 1 according to the present embodiment will be described with reference to FIG.
FIG. 3 is a block diagram showing a functional configuration example of the IC card 1 of the present embodiment.
As shown in FIG. 3, the IC card 1 includes a UART 4, a control unit 50, a DGI table storage unit 60, a past received DGI storage unit 70, a data storage unit 80, and a file management information storage unit 81. ing.
Here, each part of the IC card 1 shown in FIG. 3 is realized by using the hardware of the IC card 1 shown in FIG.

過去受信DGI記憶部70は、例えば、RAM7により構成され、データ記憶部80に既に記憶されているデータに対応するDGI(Data Grouping Identifier)を記憶する。ここで、DGIとは、データ記憶部80に記憶させるデータを識別するデータ識別子のことである。また、過去受信DGI記憶部70は、データ記憶部80に既に記憶されているデータに対応するDGIに関連する情報を記憶するデータ識別子記憶部の一例である。DGIに関連する情報には、DGIが含まれる。過去受信DGI記憶部70は、例えば、データ記憶部80にデータを書き込む(記憶させる)STORE DATAコマンド(書き込み要求)が既に実行されたDGIを、図4に示すように記憶する。なお、STORE DATAコマンドは、発行コマンドの一例であり、詳細は後述する。   The past received DGI storage unit 70 is constituted by, for example, the RAM 7 and stores a DGI (Data Grouping Identifier) corresponding to data already stored in the data storage unit 80. Here, the DGI is a data identifier that identifies data to be stored in the data storage unit 80. The past received DGI storage unit 70 is an example of a data identifier storage unit that stores information related to DGI corresponding to data already stored in the data storage unit 80. The information related to DGI includes DGI. The past received DGI storage unit 70 stores, for example, a DGI in which a STORE DATA command (write request) for writing (storing) data in the data storage unit 80 has already been executed, as shown in FIG. The STORE DATA command is an example of an issue command, and details will be described later.

図4は、本実施形態の過去受信DGI記憶部70が記憶するデータ例を示す図である。
図4に示すように、過去受信DGI記憶部70は、「過去受信DGI」を記憶する。ここで、「過去受信DGI」は、既に実行したSTORE DATAコマンドに含まれていたDGIであり、例えば、UART4を介して過去に受信したDGIである。すなわち、過去受信DGI記憶部70は、過去に受信したDGIのリストを記憶する。
図4に示す例では、過去受信DGI記憶部70は、「過去受信DGI」として、“0x0101”、“0x0201”、・・・を記憶する。すなわち、DGIが“0x0101”、“0x0201”、・・・であるデータに対して、既にSTORE DATAコマンドが実行された状態であり、当該過去受信DGIに対応するデータが、データ記憶部80に既に記憶されていることを示している。ここで、データ冒頭の“0x”は、16進法(ヘキサデシマル)の表記であることを示している。
FIG. 4 is a diagram illustrating an example of data stored in the past reception DGI storage unit 70 of the present embodiment.
As illustrated in FIG. 4, the past received DGI storage unit 70 stores “past received DGI”. Here, the “past received DGI” is the DGI included in the already executed STORE DATA command, for example, the DGI received in the past via the UART 4. That is, the past received DGI storage unit 70 stores a list of DGI received in the past.
In the example illustrated in FIG. 4, the past received DGI storage unit 70 stores “0x0101”, “0x0201”,... As “past received DGI”. That is, the STORE DATA command has already been executed for the data whose DGI is “0x0101,” “0x0201,”..., And the data corresponding to the past received DGI has already been stored in the data storage unit 80. Indicates that it is remembered. Here, “0x” at the beginning of the data indicates that it is expressed in hexadecimal (hexadecimal).

図3の説明に戻り、データ記憶部80は、例えば、EEPROM8により構成され、ICカード1の用途に応じた各種データを記憶する。データ記憶部80は、ICカード1の発行によって、アプリケーションに対応したDF(Dedicated File)と、アプリケーションにおいて利用される各種データ及び内部制御用のデータを記憶するEF(Elementary File)とが構築(確保)される。データ記憶部80の各EFには、例えば、発行工程において、STORE DATAコマンドによって、データが記憶される。   Returning to the description of FIG. 3, the data storage unit 80 is configured by, for example, the EEPROM 8 and stores various data according to the use of the IC card 1. The data storage unit 80 is constructed (secured) by issuing an IC card 1 and DF (Dedicated File) corresponding to the application and EF (Elementary File) storing various data used in the application and data for internal control. ) For example, in the issuing process, data is stored in each EF of the data storage unit 80 by a STORE DATA command.

DGIテーブル記憶部60は、例えば、ROM6により構成され、図5に示すように、「DGI」と、「ファイル識別子」とを対応付けたDGIテーブルを記憶する。なお、「ファイル識別子」は、データ記憶部80に記憶されるファイル(例えば、EF)を識別する識別情報である。
図5は、本実施形態のDGIテーブル記憶部60が記憶するデータ例を示す図である。
図5が示す例では、「DGI」が“0x0101”に対応するデータが、「ファイル識別子」が“0x0001”のEFに記憶されることを示している。また、「DGI」が“0x0201”に対応するデータが、「ファイル識別子」が“0x0002”のEFに記憶されることを示している。また、「DGI」が“0x0301”に対応するデータが、「ファイル識別子」が“0x0003”のEFに記憶されることを示している。
The DGI table storage unit 60 includes, for example, the ROM 6 and stores a DGI table in which “DGI” and “file identifier” are associated with each other as shown in FIG. The “file identifier” is identification information for identifying a file (for example, EF) stored in the data storage unit 80.
FIG. 5 is a diagram illustrating an example of data stored in the DGI table storage unit 60 of the present embodiment.
The example shown in FIG. 5 indicates that data corresponding to “DGI” “0x0101” is stored in the EF having “file identifier” “0x0001”. In addition, data corresponding to “0x0201” in “DGI” is stored in the EF having “0x0002” in “file identifier”. In addition, data corresponding to “DGI” “0x0301” is stored in the EF having “file identifier” “0x0003”.

再び図3に戻り、ファイル管理情報記憶部81は、例えば、EEPROM8により構成され、図6に示すように、「ファイル識別子」と、「ファイル格納先のEEPROM8の先頭アドレス」とを対応付けて記憶する。すなわち、ファイル管理情報記憶部81は、EFと、当該EFに対応するEEPROM8の先頭アドレスとを対応付けて記憶する。なお、ファイル管理情報記憶部81には、例えば、EFが作成(構築)された際に、作成されたEFに対する「ファイル識別子」と、「ファイル格納先のEEPROM8の先頭アドレス」とが、追加されて記憶される。   Returning to FIG. 3 again, the file management information storage unit 81 includes, for example, the EEPROM 8 and stores “file identifier” and “first address of the file storage destination EEPROM 8” in association with each other as shown in FIG. To do. That is, the file management information storage unit 81 stores the EF and the start address of the EEPROM 8 corresponding to the EF in association with each other. For example, when the EF is created (constructed), the “file identifier” for the created EF and the “first address of the EEPROM 8 as the file storage destination” are added to the file management information storage unit 81. Is memorized.

図6は、本実施形態のファイル管理情報記憶部81が記憶するデータ例を示す図である。
図6に示す例では、「ファイル識別子」が“0x0001”であるEFは、「ファイル格納先のEEPROM8の先頭アドレス」が“0x805000”であることを示している。また、「ファイル識別子」が“0x0002”であるEFは、「ファイル格納先のEEPROM8の先頭アドレス」が“0x804F00”であることを示している。
FIG. 6 is a diagram illustrating an example of data stored in the file management information storage unit 81 of the present embodiment.
In the example shown in FIG. 6, an EF with a “file identifier” of “0x0001” indicates that the “start address of the file storage destination EEPROM 8” is “0x805000”. An EF with a “file identifier” of “0x0002” indicates that the “head address of the file storage destination EEPROM 8” is “0x804F00”.

再び図3に戻り、制御部50は、例えば、CPU5と、RAM7と、ROM6又はEEPROM8とにより実現され、ICカード1を統括的に制御する。制御部50は、例えば、外部装置2からICカード1に送信された各種コマンドを、UART4を介して受信し、受信したコマンドの処理(コマンド処理)を実行する。また、制御部50は、例えば、実行したコマンド処理の結果を含むレスポンスを、UART4を介して外部装置2に出力する。また、制御部50は、受信処理部51と、コマンド処理部52と、送信処理部53とを備えている。   Returning to FIG. 3 again, the control unit 50 is realized by, for example, the CPU 5, the RAM 7, and the ROM 6 or the EEPROM 8, and comprehensively controls the IC card 1. For example, the control unit 50 receives various commands transmitted from the external device 2 to the IC card 1 via the UART 4 and executes processing of the received command (command processing). For example, the control unit 50 outputs a response including the result of the executed command processing to the external device 2 via the UART 4. The control unit 50 includes a reception processing unit 51, a command processing unit 52, and a transmission processing unit 53.

受信処理部51(受信部の一例)は、UART4が外部装置2から受信したコマンドを受信バッファ71に記憶させる。受信処理部51は、例えば、データ記憶部80に記憶させるデータと、当該データを識別するDGIとを含むSTORE DATAコマンドを、UART4を介して受信する。ここで、図7を参照して、STORE DATAコマンドのデータ構成例について説明する。   The reception processing unit 51 (an example of a reception unit) stores a command received by the UART 4 from the external device 2 in the reception buffer 71. For example, the reception processing unit 51 receives a STORE DATA command including data to be stored in the data storage unit 80 and DGI for identifying the data via the UART 4. Here, a data configuration example of the STORE DATA command will be described with reference to FIG.

図7は、STORE DATAコマンドのデータ構成例を示す図である。
この図に示すように、STORE DATAコマンド(書き込み要求の一例)は、コマンドヘッダと、コマンドボディとを有している。コマンドヘッダは、「CLA」(クラスバイト)、「INS」(命令バイト)、「P1」(パラメータ1)、及び「P2」(パラメータ2)を有している。なお、「CLA」、「INS」、「P1」、及び「P2」のぞれぞれは、1バイトで構成されている。また、コマンドボディは、「Lc」(データ長)、及び「DATA」(データ)を有している。なお、「Lc」は、1バイトで構成され、「DATA」は、「Lc」によって指定されたデータ長(例えば、mバイト)のデータである。
FIG. 7 is a diagram illustrating a data configuration example of the STORE DATA command.
As shown in this figure, a STORE DATA command (an example of a write request) has a command header and a command body. The command header has “CLA” (class byte), “INS” (instruction byte), “P1” (parameter 1), and “P2” (parameter 2). Each of “CLA”, “INS”, “P1”, and “P2” is composed of 1 byte. The command body has “Lc” (data length) and “DATA” (data). “Lc” is composed of 1 byte, and “DATA” is data having a data length (for example, m bytes) designated by “Lc”.

また、STORE DATAコマンドの「DATA」は、「DGI」と、「DGI長」と、「DGI DATA」とを含んでいる。なお、「DGI」は、2バイトで構成され、「DGI長」は、1バイトで構成される。また、「DGI DATA」は、「DGI長」によって指定されたデータ長(例えば、nバイト)のデータである。
例えば、図7に示す例では、STORE DATAコマンドは、「DGI」が“0x0101”のEFに対して、「DGI DATA」が“0x1122334455”の5バイトのデータを記憶させる(書き込む)処理要求をICカード1に行うことを示している。このように、STORE DATAコマンドには、データ記憶部80に記憶させるデータ(「DGI DATA」)と、データ識別子(「DGI」)とを含んでいる。
Further, “DATA” of the STORE DATA command includes “DGI”, “DGI length”, and “DGI DATA”. “DGI” is composed of 2 bytes, and “DGI length” is composed of 1 byte. “DGI DATA” is data having a data length (for example, n bytes) designated by “DGI length”.
For example, in the example shown in FIG. 7, the STORE DATA command is a processing request for storing (writing) a 5-byte data of “DGI DATA” “0x12123345455” with respect to an EF of “DGI” “0x0101”. This shows what to do with card 1. Thus, the STORE DATA command includes data (“DGI DATA”) to be stored in the data storage unit 80 and a data identifier (“DGI”).

再び図3に戻り、コマンド処理部52(処理部の一例)は、受信処理部51によって受信したコマンドに応じて、各種コマンド処理を実行する。コマンド処理部52は、例えば、受信バッファ71に記憶されているコマンドを取得し、コマンドに応じて、各種コマンド処理を実行する。コマンド処理部52は、例えば、STORE DATAコマンドを取得した場合に、過去受信DGI記憶部70が記憶する「過去受信DGI」(DGIに関連する情報の一例)に基づいて、受信処理部51によって受信したDGIに対応するデータがデータ記憶部80に既に記憶されているか否かを判定する。   Returning to FIG. 3 again, the command processing unit 52 (an example of a processing unit) executes various command processes in accordance with the command received by the reception processing unit 51. For example, the command processing unit 52 acquires a command stored in the reception buffer 71 and executes various command processes according to the command. For example, when the command processing unit 52 acquires a STORE DATA command, the command processing unit 52 receives the past processing DGI storage unit 70 based on “past reception DGI” (an example of information related to DGI). It is determined whether or not data corresponding to the DGI is already stored in the data storage unit 80.

例えば、コマンド処理部52は、STORE DATAコマンドに含まれるDGIが、過去受信DGI記憶部70に記憶されているか否かに基づいて、当該DGIに対応するデータがデータ記憶部80に既に記憶されているか否かを判定する。すなわち、コマンド処理部52は、例えば、過去受信DGI記憶部70に記憶されている過去受信DGIを検索し、受信したSTORE DATAコマンドに含まれるDGIと一致する過去受信DGIがあるか否かを判定する。コマンド処理部52は、受信したSTORE DATAコマンドに含まれるDGIが、過去受信DGI記憶部70に記憶されている場合に、当該DGIに対応するデータがデータ記憶部80に既に記憶されていると判定する。また、コマンド処理部52は、受信したSTORE DATAコマンドに含まれるDGIが、過去受信DGI記憶部70に記憶されていない場合に、当該DGIに対応するデータがデータ記憶部80に記憶されていないと判定する。   For example, based on whether or not the DGI included in the STORE DATA command is stored in the past received DGI storage unit 70, the command processing unit 52 has already stored data corresponding to the DGI in the data storage unit 80. It is determined whether or not. That is, for example, the command processing unit 52 searches for a past reception DGI stored in the past reception DGI storage unit 70 and determines whether there is a past reception DGI that matches the DGI included in the received STORE DATA command. To do. The command processing unit 52 determines that the data corresponding to the DGI is already stored in the data storage unit 80 when the DGI included in the received STORE DATA command is stored in the past received DGI storage unit 70. To do. In addition, when the DGI included in the received STORE DATA command is not stored in the past received DGI storage unit 70, the command processing unit 52 determines that the data corresponding to the DGI is not stored in the data storage unit 80. judge.

コマンド処理部52は、受信したDGIに対応するデータがデータ記憶部80に記憶されていない場合に、STORE DATAコマンドに含まれるデータをデータ記憶部80に記憶させる(書き込む)。すなわち、コマンド処理部52は、データ記憶部80のDGIに対応するEFに受信したデータを記憶させる。この場合、コマンド処理部52は、例えば、DGIテーブル記憶部60を参照して、DGIに対応するEFのファイル識別子をDGIテーブル記憶部60から取得する。また、コマンド処理部52は、ファイル管理情報記憶部81を参照し、取得したファイル識別子に対応するEEPROM8の先頭アドレスをファイル管理情報記憶部81から取得する。コマンド処理部52は、取得したEEPROM8の先頭アドレスから順に、受信したデータを記憶させる。すなわち、コマンド処理部52は、データ記憶部80のDGIに対応するデータ領域(EF)に、受信したデータを記憶させる。
また、コマンド処理部52は、STORE DATAコマンドに含まれるデータをデータ記憶部80に記憶させる場合に、STORE DATAコマンドに含まれるDGIに関する情報を過去受信DGI記憶部70に記憶させる。コマンド処理部52は、例えば、受信したDGIを、図4に示すように、過去受信DGIのリストに追加する。
When the data corresponding to the received DGI is not stored in the data storage unit 80, the command processing unit 52 stores (writes) the data included in the STORE DATA command in the data storage unit 80. That is, the command processing unit 52 stores the received data in the EF corresponding to the DGI in the data storage unit 80. In this case, for example, the command processing unit 52 refers to the DGI table storage unit 60 and acquires the file identifier of the EF corresponding to the DGI from the DGI table storage unit 60. Further, the command processing unit 52 refers to the file management information storage unit 81 and acquires the start address of the EEPROM 8 corresponding to the acquired file identifier from the file management information storage unit 81. The command processing unit 52 stores the received data in order from the start address of the acquired EEPROM 8. That is, the command processing unit 52 stores the received data in the data area (EF) corresponding to the DGI in the data storage unit 80.
Further, when the data included in the STORE DATA command is stored in the data storage unit 80, the command processing unit 52 stores information related to the DGI included in the STORE DATA command in the past reception DGI storage unit 70. For example, the command processing unit 52 adds the received DGI to the list of past received DGIs as shown in FIG.

また、コマンド処理部52は、受信したDGIに対応するデータがデータ記憶部80に既に記憶されている場合に、STORE DATAコマンドに含まれるデータと、データ記憶部80に記憶されている当該DGIに対応するデータとが一致するか否かを判定する。この場合、コマンド処理部52は、上述した書き込みの場合と同様に、DGIテーブル記憶部60からDGIに対応するEFのファイル識別子を取得し、ファイル管理情報記憶部81から取得したファイル識別子に対応するEEPROM8の先頭アドレスを取得する。コマンド処理部52は、取得したEEPROM8の先頭アドレスから読み出したデータと、STORE DATAコマンドに含まれるデータとが一致するか否かを判定する。すなわち、コマンド処理部52は、受信したデータと、データ記憶部80のDGIに対応するデータ領域(EF)に記憶されているデータとが一致するか否かを判定する。   In addition, when data corresponding to the received DGI is already stored in the data storage unit 80, the command processing unit 52 stores the data included in the STORE DATA command and the DGI stored in the data storage unit 80. It is determined whether or not the corresponding data matches. In this case, the command processing unit 52 acquires the file identifier of the EF corresponding to the DGI from the DGI table storage unit 60 and corresponds to the file identifier acquired from the file management information storage unit 81, as in the case of the writing described above. The top address of the EEPROM 8 is acquired. The command processing unit 52 determines whether or not the data read from the start address of the acquired EEPROM 8 matches the data included in the STORE DATA command. That is, the command processing unit 52 determines whether or not the received data matches the data stored in the data area (EF) corresponding to the DGI in the data storage unit 80.

また、コマンド処理部52は、上述したSTORE DATAコマンドの処理結果であるレスポンス(応答)を、例えば、送信バッファ72に記憶させる。すなわち、受信したデータをデータ記憶部80に記憶させる場合には、コマンド処理部52は、データの書き込みが完了したことを示す情報を含むレスポンスを生成し、生成したレスポンスを送信バッファ72に記憶させる。また、受信したデータをデータ記憶部80に記憶しているデータと比較する場合には、コマンド処理部52は、STORE DATAコマンドに含まれるデータと、データ記憶部80に記憶されている当該DGIに対応するデータとが一致するか否かの判定結果を示す情報を含むレスポンスを生成する。そして、コマンド処理部52は、生成したレスポンスを送信バッファ72に記憶させる。   Further, the command processing unit 52 stores a response (response) that is a processing result of the above-described STORE DATA command in the transmission buffer 72, for example. That is, when the received data is stored in the data storage unit 80, the command processing unit 52 generates a response including information indicating that the data writing has been completed, and stores the generated response in the transmission buffer 72. . When comparing the received data with the data stored in the data storage unit 80, the command processing unit 52 compares the data included in the STORE DATA command with the DGI stored in the data storage unit 80. A response including information indicating a determination result of whether or not corresponding data matches is generated. Then, the command processing unit 52 stores the generated response in the transmission buffer 72.

送信処理部53(送信部の一例)は、コマンド処理部52が実行したコマンド処理の結果を含むレスポンスを、UART4を介して外部装置2に出力する。送信処理部53は、例えば、送信バッファ72に記憶されているレスポンスのデータをUART4に送信し、UART4に外部装置2に向けて送信させる。送信処理部53は、例えば、STORE DATAコマンドにおいて、受信したデータをデータ記憶部80に記憶しているデータと比較した場合には、当該判定結果を示す情報を含むレスポンスを、UART4を介して送信する。すなわち、送信処理部53は、コマンド処理部52によって判定された、上述の一致するか否かの判定結果を示す情報を含むレスポンスを、UART4を介して外部装置2に送信する。また、送信処理部53は、例えば、STORE DATAコマンドにおいて、データを書き込む場合には、データの書き込みが完了したことを示す情報を含むレスポンスを、UART4を介して外部装置2に送信する。   The transmission processing unit 53 (an example of a transmission unit) outputs a response including the result of the command processing executed by the command processing unit 52 to the external device 2 via the UART 4. For example, the transmission processing unit 53 transmits response data stored in the transmission buffer 72 to the UART 4 and causes the UART 4 to transmit the data to the external device 2. For example, when the received data is compared with the data stored in the data storage unit 80 in the STORE DATA command, the transmission processing unit 53 transmits a response including information indicating the determination result via the UART 4. To do. That is, the transmission processing unit 53 transmits the response including the information indicating the above-described determination result of whether or not the same determined by the command processing unit 52 to the external device 2 via the UART 4. For example, in the case of writing data in the STORE DATA command, the transmission processing unit 53 transmits a response including information indicating that the data writing has been completed to the external device 2 via the UART 4.

次に、図8を参照して、本実施形態のICカード1の動作について説明する。
図8は、本実施形態のICカード1のSTORE DATAコマンド処理の一例を示すフローチャートである。
図8に示すように、外部装置2とICカード1とがコンタクト部3を介して接続され、ICカード1が活性化された状態において、ICカード1は、コマンドを受信したか否かを判定する(ステップS101)。すなわち、ICカード1の受信処理部51は、UART4を介して、外部装置2からコマンドを受信したか否かを判定する。受信処理部51は、コマンドを受信した場合(ステップS101:YES)に、受信したコマンドを受信バッファ71に記憶させて、処理をステップS102に進める。また、受信処理部51は、コマンドを受信していない場合(ステップS101:NO)に、処理をステップS101に戻し、ステップS101の処理を繰り返す。
Next, the operation of the IC card 1 of the present embodiment will be described with reference to FIG.
FIG. 8 is a flowchart showing an example of the STORE DATA command processing of the IC card 1 of this embodiment.
As shown in FIG. 8, in a state where the external device 2 and the IC card 1 are connected via the contact part 3 and the IC card 1 is activated, the IC card 1 determines whether or not a command has been received. (Step S101). That is, the reception processing unit 51 of the IC card 1 determines whether or not a command is received from the external device 2 via the UART 4. When the reception processing unit 51 receives a command (step S101: YES), the reception processing unit 51 stores the received command in the reception buffer 71, and advances the processing to step S102. Further, when the command is not received (step S101: NO), the reception processing unit 51 returns the process to step S101 and repeats the process of step S101.

ステップS102において、ICカード1のコマンド処理部52は、コマンドを取得する。すなわち、コマンド処理部52は、受信バッファ71に記憶されているコマンドを取得する。   In step S102, the command processing unit 52 of the IC card 1 acquires a command. That is, the command processing unit 52 acquires a command stored in the reception buffer 71.

次に、コマンド処理部52は、受信したコマンドがSTORE DATAコマンドであるか否かを判定する(ステップS103)。コマンド処理部52は、受信バッファ71から取得したコマンドのうちの「CLA」及び「INS」に基づいて、受信したコマンドがSTORE DATAコマンドであるか否かを判定する。コマンド処理部52は、受信したコマンドがSTORE DATAコマンドである場合(ステップS103:YES)に、処理をステップS104に進める。また、コマンド処理部52は、受信したコマンドがSTORE DATAコマンドでない場合(ステップS103:NO)に、処理をステップS110に進める。   Next, the command processing unit 52 determines whether or not the received command is a STORE DATA command (step S103). The command processing unit 52 determines whether the received command is a STORE DATA command based on “CLA” and “INS” of the commands acquired from the reception buffer 71. If the received command is a STORE DATA command (step S103: YES), the command processing unit 52 advances the process to step S104. If the received command is not a STORE DATA command (step S103: NO), the command processing unit 52 advances the process to step S110.

ステップS104において、コマンド処理部52は、受信したDGIが、過去受信DGI記憶部70に記憶されているか否かを判定する。すなわち、コマンド処理部52は、例えば、過去受信DGI記憶部70に記憶されている過去受信DGIを検索し、受信したSTORE DATAコマンドに含まれるDGIと一致する過去受信DGIがあるか否かを判定する。なお、以下の説明において、受信したDGIのことを「受信DGI」ということがある。コマンド処理部52は、受信DGIが、過去受信DGI記憶部70に記憶されている場合(ステップS104:YES)に、当該DGIに対応する「DGI DATA」(図7参照)が既にデータ記憶部80に記憶されていると判定し、処理をステップS108に進める。また、コマンド処理部52は、受信DGIが、過去受信DGI記憶部70に記憶されていない場合(ステップS104:NO)に、当該DGIに対応する「DGI DATA」がまだデータ記憶部80に記憶されていないと判定し、処理をステップS105に進める。   In step S104, the command processing unit 52 determines whether or not the received DGI is stored in the past received DGI storage unit 70. That is, for example, the command processing unit 52 searches for a past reception DGI stored in the past reception DGI storage unit 70 and determines whether there is a past reception DGI that matches the DGI included in the received STORE DATA command. To do. In the following description, the received DGI may be referred to as “received DGI”. When the received DGI is stored in the past received DGI storage unit 70 (step S104: YES), the command processing unit 52 has already stored “DGI DATA” (see FIG. 7) corresponding to the DGI in the data storage unit 80. And the process proceeds to step S108. In addition, when the received DGI is not stored in the past received DGI storage unit 70 (step S104: NO), the command processing unit 52 still stores “DGI DATA” corresponding to the DGI in the data storage unit 80. If it is not determined, the process proceeds to step S105.

ステップS105において、コマンド処理部52は、STORE DATAコマンドに含まれる「DGI DATA」(図7参照)をEEPROM8に書き込む。すなわち、コマンド処理部52は、「DGI DATA」を、受信DGIに対応するデータ記憶部80のEFに記憶させる。具体的には、コマンド処理部52は、DGIテーブル記憶部60を参照して、受信DGIに対応するEFのファイル識別子をDGIテーブル記憶部60から取得する。次に、コマンド処理部52は、ファイル管理情報記憶部81を参照し、取得したファイル識別子に対応するEEPROM8の先頭アドレスをファイル管理情報記憶部81から取得する。そして、コマンド処理部52は、取得したEEPROM8の先頭アドレスから順に、受信したデータ(「DGI DATA」)を記憶させる。   In step S <b> 105, the command processing unit 52 writes “DGI DATA” (see FIG. 7) included in the STORE DATA command in the EEPROM 8. That is, the command processing unit 52 stores “DGI DATA” in the EF of the data storage unit 80 corresponding to the received DGI. Specifically, the command processing unit 52 refers to the DGI table storage unit 60 and acquires the file identifier of the EF corresponding to the received DGI from the DGI table storage unit 60. Next, the command processing unit 52 refers to the file management information storage unit 81 and acquires the start address of the EEPROM 8 corresponding to the acquired file identifier from the file management information storage unit 81. Then, the command processing unit 52 stores the received data (“DGI DATA”) in order from the start address of the acquired EEPROM 8.

次に、コマンド処理部52は、受信DGIを過去受信DGI記憶部70に記憶させる(ステップS106)。
次に、ICカード1は、レスポンスを外部装置2に送信する(ステップS107)。すなわち、コマンド処理部52は、データの書き込みが完了したことを示す情報を含むレスポンスを生成し、送信バッファ72に記憶させる。ICカード1の送信処理部53は、送信バッファ72に記憶されている当該レスポンスを、UART4を介して外部装置2に送信する。ステップS107の処理後に、送信処理部53は、処理をステップS101に戻す。
Next, the command processing unit 52 stores the received DGI in the past received DGI storage unit 70 (step S106).
Next, the IC card 1 transmits a response to the external device 2 (step S107). That is, the command processing unit 52 generates a response including information indicating that data writing has been completed and stores the response in the transmission buffer 72. The transmission processing unit 53 of the IC card 1 transmits the response stored in the transmission buffer 72 to the external device 2 via the UART 4. After the process of step S107, the transmission processing unit 53 returns the process to step S101.

また、ステップS108において、コマンド処理部52は、STORE DATAコマンドに含まれる「DGI DATA」(図7参照)と、EEPROM8に記憶されているデータとを比較する。すなわち、コマンド処理部52は、「DGI DATA」と、受信DGIに対応するデータ記憶部80のEFに記憶されているデータとを比較し、両データが一致するか否かを判定する。具体的には、コマンド処理部52は、DGIテーブル記憶部60を参照して、受信DGIに対応するEFのファイル識別子をDGIテーブル記憶部60から取得する。次に、コマンド処理部52は、ファイル管理情報記憶部81を参照し、取得したファイル識別子に対応するEEPROM8の先頭アドレスをファイル管理情報記憶部81から取得する。そして、コマンド処理部52は、取得したEEPROM8の先頭アドレスから順に読み出したデータと、受信したデータ(「DGI DATA」)とを比較して、両データが一致するか否かを判定する。   In step S <b> 108, the command processing unit 52 compares “DGI DATA” (see FIG. 7) included in the STORE DATA command with the data stored in the EEPROM 8. That is, the command processing unit 52 compares “DGI DATA” with data stored in the EF of the data storage unit 80 corresponding to the received DGI, and determines whether or not the two data match. Specifically, the command processing unit 52 refers to the DGI table storage unit 60 and acquires the file identifier of the EF corresponding to the received DGI from the DGI table storage unit 60. Next, the command processing unit 52 refers to the file management information storage unit 81 and acquires the start address of the EEPROM 8 corresponding to the acquired file identifier from the file management information storage unit 81. Then, the command processing unit 52 compares the acquired data sequentially read from the top address of the EEPROM 8 with the received data (“DGI DATA”) to determine whether or not the two data match.

次に、ICカード1は、比較結果を示す情報を含むレスポンスを外部装置2に送信する(ステップS109)。すなわち、コマンド処理部52は、上述した比較結果(両データが一致するか否かの判定結果)を示す情報を含むレスポンスを生成し、送信バッファ72に記憶させる。送信処理部53は、送信バッファ72に記憶されている当該レスポンスを、UART4を介して外部装置2に送信する。ステップS109の処理後に、送信処理部53は、処理をステップS101に戻す。   Next, the IC card 1 transmits a response including information indicating the comparison result to the external device 2 (step S109). That is, the command processing unit 52 generates a response including information indicating the above-described comparison result (determination result as to whether or not both data match), and stores the response in the transmission buffer 72. The transmission processing unit 53 transmits the response stored in the transmission buffer 72 to the external device 2 via the UART 4. After the process of step S109, the transmission processing unit 53 returns the process to step S101.

また、ステップS110おいて、コマンド処理部52は、他のコマンド処理を実行する。ここで、他のコマンド処理とは、STORE DATAコマンド以外の「CLA」及び「INS」に対応するコマンドの処理を示す。   In step S110, the command processing unit 52 executes other command processing. Here, the other command processing indicates processing of commands corresponding to “CLA” and “INS” other than the STORE DATA command.

次に、ICカード1は、レスポンスを外部装置2に送信する(ステップS111)。すなわち、コマンド処理部52は、コマンド処理の結果を含むレスポンスを生成し、送信バッファ72に記憶させる。送信処理部53は、送信バッファ72に記憶されている当該レスポンスを、UART4を介して外部装置2に送信する。ステップS111の処理後に、送信処理部53は、処理をステップS101に戻す。   Next, the IC card 1 transmits a response to the external device 2 (step S111). That is, the command processing unit 52 generates a response including the result of command processing and stores it in the transmission buffer 72. The transmission processing unit 53 transmits the response stored in the transmission buffer 72 to the external device 2 via the UART 4. After the process of step S111, the transmission processing unit 53 returns the process to step S101.

上述したフローチャートにおいて、ステップS101が、データ記憶部80に記憶させるデータと、データを識別するDGIとを含むSTORE DATAコマンドを、UART4を介して受信する受信ステップに対応する。また、ステップS104が、判定ステップに対応する。判定ステップにおいて、コマンド処理部52は、過去受信DGI記憶部70が記憶するDGIに関連する情報に基づいて、受信ステップによって受信したDGIに対応するデータがデータ記憶部80に既に記憶されているか否かを判定する。また、ステップS105、ステップS106、及びステップS108が、処理ステップに対応する。処理ステップにおいて、コマンド処理部52は、DGIに対応するデータがデータ記憶部80に既に記憶されていない場合に、STORE DATAコマンドに含まれるデータをデータ記憶部80に記憶させる。また、コマンド処理部52は、DGIに対応するデータがデータ記憶部80に既に記憶されている場合に、STORE DATAコマンドに含まれるデータと、データ記憶部80に記憶されているDGIに対応するデータとが一致するか否かを判定する。また、ステップS109が、処理ステップによって判定された一致するか否かの判定結果を示す情報を含む応答を、UART4を介して外部装置2に送信する送信ステップに対応する。   In the flowchart described above, step S101 corresponds to a reception step of receiving via the UART 4 a STORE DATA command including data to be stored in the data storage unit 80 and DGI for identifying the data. Step S104 corresponds to a determination step. In the determination step, the command processing unit 52 determines whether the data corresponding to the DGI received in the reception step is already stored in the data storage unit 80 based on the information related to the DGI stored in the past reception DGI storage unit 70. Determine whether. Steps S105, S106, and S108 correspond to processing steps. In the processing step, the command processing unit 52 stores data included in the STORE DATA command in the data storage unit 80 when data corresponding to DGI is not already stored in the data storage unit 80. In addition, when data corresponding to the DGI is already stored in the data storage unit 80, the command processing unit 52 includes data included in the STORE DATA command and data corresponding to the DGI stored in the data storage unit 80. Is matched. Further, step S109 corresponds to a transmission step of transmitting a response including information indicating a determination result of whether or not they are determined determined in the processing step to the external apparatus 2 via the UART 4.

なお、外部装置2は、発行工程において、ICカード1に対して、まず、DGI及び書き込むデータを含むSTORE DATAコマンドを送信して、データ記憶部80の当該DGIに対応するEFに、データを記憶させる。そして、外部装置2は、次に、同一のDGI及びデータを含むSTORE DATAコマンドを送信して、前回のSTORE DATAコマンドにおいて、データの書き込みが正常に実行されたか否かを確認する。   In the issuing process, the external device 2 first transmits a STORE DATA command including DGI and data to be written to the IC card 1 and stores the data in the EF corresponding to the DGI in the data storage unit 80. Let Next, the external device 2 transmits a STORE DATA command including the same DGI and data, and confirms whether or not data writing has been normally executed in the previous STORE DATA command.

以上説明したように、本実施形態によるICカード1は、データ記憶部80と、受信処理部51(受信部)と、過去受信DGI記憶部70(データ識別子記憶部)と、コマンド処理部52(処理部)と、送信処理部53(送信部)とを備えている。データ記憶部80は、データを記憶する。受信処理部51は、データ記憶部80に記憶させるデータと、データを識別するデータ識別子(例えば、DGI)とを含む書き込み要求(例えば、STORE DATAコマンド)を、外部装置2から受信する。また、過去受信DGI記憶部70は、データ記憶部80に記憶されているデータに対応するDGIに関連する情報(例えば、過去受信DGI)を記憶する。コマンド処理部52は、過去受信DGI記憶部70が記憶する過去受信DGIに基づいて、受信処理部51によって受信したDGIに対応するデータがデータ記憶部80に記憶されているか否かを判定する。コマンド処理部52は、DGIに対応するデータがデータ記憶部80に記憶されていない場合に、STORE DATAコマンドに含まれるデータをデータ記憶部80に記憶させる。また、コマンド処理部52は、受信処理部51によって受信したDGIに対応するデータがデータ記憶部80に記憶されている場合に、STORE DATAコマンドに含まれるデータと、データ記憶部80に記憶されている受信DGIに対応するデータとが一致するか否かを判定する。そして、送信処理部53は、コマンド処理部52によって判定された一致するか否かの判定結果を示す情報を含むレスポンス(応答)を、外部装置2に送信する。   As described above, the IC card 1 according to the present embodiment includes the data storage unit 80, the reception processing unit 51 (reception unit), the past reception DGI storage unit 70 (data identifier storage unit), and the command processing unit 52 ( And a transmission processing unit 53 (transmission unit). The data storage unit 80 stores data. The reception processing unit 51 receives a write request (for example, a STORE DATA command) including data to be stored in the data storage unit 80 and a data identifier (for example, DGI) for identifying the data from the external device 2. The past received DGI storage unit 70 stores information related to the DGI corresponding to the data stored in the data storage unit 80 (for example, the past received DGI). The command processing unit 52 determines whether data corresponding to the DGI received by the reception processing unit 51 is stored in the data storage unit 80 based on the past reception DGI stored in the past reception DGI storage unit 70. The command processing unit 52 stores data included in the STORE DATA command in the data storage unit 80 when data corresponding to DGI is not stored in the data storage unit 80. The command processing unit 52 stores the data included in the STORE DATA command and the data storage unit 80 when the data corresponding to the DGI received by the reception processing unit 51 is stored in the data storage unit 80. It is determined whether or not the data corresponding to the received DGI matches. Then, the transmission processing unit 53 transmits to the external device 2 a response (response) including information indicating the determination result of whether or not the determination is made by the command processing unit 52.

これにより、本実施形態によるICカード1は、同一の書き込み要求(例えば、STORE DATAコマンド)によって、データの書き込みと、書き込んだデータの確認との2種類の処理を実行する。そのため、本実施形態によるICカード1は、書き込んだデータを確認する際に、発行コマンドとは異なる読み出しコマンドなどを使用する必要がなく、外部装置2が対応するコマンドの種類を低減することができる。すなわち、本実施形態によるICカード1は、発行工程に使用するコマンドの種類を低減することができる。   As a result, the IC card 1 according to the present embodiment executes two types of processing, that is, data writing and confirmation of the written data in accordance with the same write request (for example, STORE DATA command). Therefore, the IC card 1 according to the present embodiment does not need to use a read command or the like different from the issued command when confirming written data, and can reduce the types of commands supported by the external device 2. . That is, the IC card 1 according to the present embodiment can reduce the types of commands used in the issuing process.

また、本実施形態によるICカード1では、コマンド処理部52が、例えば、STORE DATAコマンドに含まれるデータと、データ記憶部80に記憶されている受信DGIに対応するデータとが一致するか否かを判定する。そのため、本実施形態によるICカード1は、鍵情報やパスワードなどの秘密情報が正常に書き込まれたか否かを検査する際に、ICカード1の外部に、秘密情報を読み出す必要がない。よって、本実施形態によるICカード1は、セキュリティを低下させずに、書き込んだデータを確認することができる。   In the IC card 1 according to the present embodiment, for example, the command processing unit 52 determines whether the data included in the STORE DATA command matches the data corresponding to the received DGI stored in the data storage unit 80. Determine. Therefore, the IC card 1 according to the present embodiment does not need to read out the secret information to the outside of the IC card 1 when checking whether the secret information such as the key information and the password is normally written. Therefore, the IC card 1 according to the present embodiment can confirm the written data without deteriorating security.

また、本実施形態では、コマンド処理部52は、STORE DATAコマンドに含まれるデータをデータ記憶部80に記憶させる場合に、STORE DATAコマンドに含まれるDGIに関する情報(例えば、受信DGI)を過去受信DGI記憶部70に記憶させる。
これにより、本実施形態によるICカード1は、例えば、過去受信DGI記憶部70を検索するという簡易な手段により、受信したDGIに対応するデータがデータ記憶部80に記憶されているか否かを判定することができる。
Further, in the present embodiment, when the command processing unit 52 stores the data included in the STORE DATA command in the data storage unit 80, the command processing unit 52 receives information (for example, received DGI) related to the DGI included in the STORE DATA command in the past received DGI. The data is stored in the storage unit 70.
Thereby, the IC card 1 according to the present embodiment determines whether or not the data corresponding to the received DGI is stored in the data storage unit 80 by a simple means of searching the past received DGI storage unit 70, for example. can do.

また、本実施形態では、DGIに関連する情報には、DGIが含まれる。すなわち、過去受信DGI記憶部70は、DGIを、DGIに関連する情報として記憶する。コマンド処理部52は、STORE DATAコマンドに含まれるDGIが、過去受信DGI記憶部70に記憶されているか否かに基づいて、DGIに対応するデータがデータ記憶部80に記憶されているか否かを判定する。
これにより、本実施形態によるICカード1は、DGIが過去受信DGI記憶部70に記憶されているか否かというより簡易な手段により、受信したDGIに対応するデータがデータ記憶部80に記憶されているか否かを判定することができる。
In the present embodiment, the information related to DGI includes DGI. That is, the past received DGI storage unit 70 stores the DGI as information related to the DGI. The command processing unit 52 determines whether or not data corresponding to the DGI is stored in the data storage unit 80 based on whether or not the DGI included in the STORE DATA command is stored in the past received DGI storage unit 70. judge.
Thereby, in the IC card 1 according to the present embodiment, the data corresponding to the received DGI is stored in the data storage unit 80 by a simpler means whether or not the DGI is stored in the past received DGI storage unit 70. It can be determined whether or not.

また、本実施形態では、過去受信DGI記憶部70は、揮発性メモリ(例えば、RAM7)である。
これにより、本実施形態によるICカード1は、リセットすることにより、過去受信DGI記憶部70に記憶している過去受信DGIを消去することができる。よって、本実施形態によるICカード1は、発行工程に使用する過去受信DGIを消去できるので、発行工程の影響を残さずに、アプリケーションに利用することができる。
In the present embodiment, the past received DGI storage unit 70 is a volatile memory (for example, the RAM 7).
Thereby, the IC card 1 according to the present embodiment can erase the past received DGI stored in the past received DGI storage unit 70 by resetting. Therefore, the IC card 1 according to the present embodiment can erase the past received DGI used in the issuing process, and thus can be used for an application without leaving the influence of the issuing process.

また、本実施形態によれるICモジュール10は、上述したUART4(通信部)と、受信処理部51(受信部)と、過去受信DGI記憶部70(データ識別子記憶部)と、コマンド処理部52(処理部)と、送信処理部53(送信部)とを備えている。
これにより、本実施形態によれるICモジュール10は、ICカード1と同様の効果を奏する。
The IC module 10 according to the present embodiment includes the UART 4 (communication unit), the reception processing unit 51 (reception unit), the past received DGI storage unit 70 (data identifier storage unit), and the command processing unit 52 described above. (Processing unit) and a transmission processing unit 53 (transmission unit).
Thereby, the IC module 10 according to this embodiment has the same effect as the IC card 1.

(第2の実施形態)
次に、図面を参照して、第2の実施形態のICカードについて説明する。
第2の実施形態では、上述した過去受信DGI記憶部70を用いずに、受信したDGIに対応するデータがデータ記憶部80に既に記憶されているか否かを判定する一例について説明する。なお、本実施形態では、DGIに関連する情報は、DGIに対応するデータ領域に既にデータが記憶されているか否かを示す情報である。
(Second Embodiment)
Next, an IC card according to the second embodiment will be described with reference to the drawings.
In the second embodiment, an example will be described in which it is determined whether data corresponding to the received DGI is already stored in the data storage unit 80 without using the above-described past reception DGI storage unit 70. In the present embodiment, the information related to DGI is information indicating whether data is already stored in the data area corresponding to DGI.

図9は、第2の実施形態のICカード1aの機能構成例を示すブロック図である。
図9に示すように、ICカード1aは、UART4と、制御部50aと、DGIテーブル記憶部60と、データ記憶部80と、ファイル管理情報記憶部81aとを備えている。
なお、本実施形態のICカード1aの外観図及びハード構成は、図1及び図2に示す第1の実施形態と同様であるのでその説明を省略する。また、図9において、図3に示す構成と同一の構成については同一の符号を付し、その説明を省略する。
FIG. 9 is a block diagram illustrating a functional configuration example of the IC card 1a according to the second embodiment.
As shown in FIG. 9, the IC card 1a includes a UART 4, a control unit 50a, a DGI table storage unit 60, a data storage unit 80, and a file management information storage unit 81a.
The external view and hardware configuration of the IC card 1a of this embodiment are the same as those of the first embodiment shown in FIGS. 9, the same components as those shown in FIG. 3 are denoted by the same reference numerals, and the description thereof is omitted.

ファイル管理情報記憶部81a(データ識別子記憶部の一例)は、例えば、EEPROM8により構成され、図10に示すように、「ファイル識別子」と、「ファイル格納先のEEPROM8の先頭アドレス」と、「書き込み済みフラグ」とを対応付けて記憶する。ここで、「書き込み済みフラグ」は、DGIに対応するEF(データ領域)に既にデータが記憶されているか否かを示す情報である。例えば、「書き込み済みフラグ」が“1”である場合に、当該EFにデータが書き込み済みであり、「書き込み済みフラグ」が“0”である場合に、当該EFにデータが未書き込みである。このように、ファイル管理情報記憶部81aは、EFと、当該EFに対応するEEPROM8の先頭アドレスとを対応付けて記憶するとともに、既にデータが記憶されているか否かを示す情報を記憶する。すなわち、ファイル管理情報記憶部81aは、DGIに対応するEFに既にデータが記憶されているか否かを示す情報を、DGIに関連する情報として記憶する。なお、ファイル管理情報記憶部81aには、例えば、EFが作成(構築)された際に、作成されたEFに対する「ファイル識別子」と、「ファイル格納先のEEPROM8の先頭アドレス」と“0”の「書き込み済みフラグ」とが、追加されて記憶される。   The file management information storage unit 81a (an example of a data identifier storage unit) is composed of, for example, the EEPROM 8, and as shown in FIG. 10, “file identifier”, “start address of the file storage destination EEPROM 8”, and “write "Completed flag" is stored in association with each other. Here, the “written flag” is information indicating whether data is already stored in the EF (data area) corresponding to the DGI. For example, when the “written flag” is “1”, the data has been written to the EF, and when the “written flag” is “0”, the data has not been written to the EF. As described above, the file management information storage unit 81a stores the EF and the start address of the EEPROM 8 corresponding to the EF in association with each other, and also stores information indicating whether data is already stored. That is, the file management information storage unit 81a stores information indicating whether or not data is already stored in the EF corresponding to the DGI as information related to the DGI. In the file management information storage unit 81a, for example, when the EF is created (constructed), the “file identifier” for the created EF, “the top address of the EEPROM 8 as the file storage destination”, and “0” are stored. A “written flag” is added and stored.

図10は、本実施形態のファイル管理情報記憶部81aが記憶するデータ例を示す図である。
図10に示す例では、「ファイル識別子」が“0x0001”であるEFは、「ファイル格納先のEEPROM8の先頭アドレス」が“0x805000”であることを示している。また、この「ファイル識別子」が“0x0001”であるEFは、「書き込み済みフラグ」が“1”であり、既にデータが書き込み済みである(STORE DATAコマンドが既に実行されている)ことお示している。また、「ファイル識別子」が“0x0003”であるEFは、「ファイル格納先のEEPROM8の先頭アドレス」が“0x804A50”であることを示している。また、この「ファイル識別子」が“0x0003”であるEFは、「書き込み済みフラグ」が“0”であり、まだデータが書き込まれていない(STORE DATAコマンドがまだ実行されていない)ことお示している。
FIG. 10 is a diagram illustrating an example of data stored in the file management information storage unit 81a of the present embodiment.
In the example shown in FIG. 10, the EF whose “file identifier” is “0x0001” indicates that the “start address of the file storage destination EEPROM 8” is “0x805000”. In addition, the EF whose “file identifier” is “0x0001” indicates that the “written flag” is “1” and the data has already been written (STORE DATA command has already been executed). Yes. An EF with a “file identifier” of “0x0003” indicates that the “first address of the file storage destination EEPROM 8” is “0x804A50”. In addition, the EF whose “file identifier” is “0x0003” indicates that the “written flag” is “0” and data has not been written yet (STORE DATA command has not yet been executed). Yes.

図9に戻り、制御部50aは、例えば、CPU5と、RAM7と、ROM6又はEEPROM8とにより実現され、ICカード1aを統括的に制御する。制御部50aは、例えば、受信処理部51と、コマンド処理部52aと、送信処理部53とを備えている。
コマンド処理部52a(処理部の一例)は、基本的な機能は、第1の実施形態のコマンド処理部52と同様であるが、STORE DATAコマンドが既に実行されているか否かの判定方法が異なる。コマンド処理部52aは、コマンド処理部52は、DGIに対応するEFに既にデータが記憶されているか否かを示す情報(例えば、「書き込み済みフラグ」)に基づいて、DGIに対するSTORE DATAコマンドが既に実行されているか否かを判定する。
Returning to FIG. 9, the control unit 50 a is realized by, for example, the CPU 5, the RAM 7, and the ROM 6 or the EEPROM 8, and comprehensively controls the IC card 1 a. The control unit 50a includes, for example, a reception processing unit 51, a command processing unit 52a, and a transmission processing unit 53.
The basic function of the command processing unit 52a (an example of the processing unit) is the same as that of the command processing unit 52 of the first embodiment, but the method for determining whether or not the STORE DATA command has already been executed is different. . The command processing unit 52a determines that the command processing unit 52 has already received a STORE DATA command for the DGI based on information indicating whether or not data is already stored in the EF corresponding to the DGI (for example, “written flag”). Determine if it is running.

例えば、コマンド処理部52aは、まず、DGIテーブル記憶部60を参照して、受信DGIに対応するEFのファイル識別子をDGIテーブル記憶部60から取得する。次に、コマンド処理部52aは、ファイル管理情報記憶部81aを参照し、取得したファイル識別子に対応する書き込み済みフラグをファイル管理情報記憶部81aから取得する。コマンド処理部52aは、取得した書き込み済みフラグが“1”である場合に、対応するデータがデータ記憶部80に既に記憶されていると判定する。また、コマンド処理部52aは、取得した書き込み済みフラグが“0”である場合に、STORE DATAコマンドがまだ実行されていないと判定する。このように、コマンド処理部52aは、受信したDGIを用いてファイル管理情報記憶部81aを参照して得られる、DGIに対応するデータ領域(EF)に既にデータが記憶されているか否かを示す情報(書き込み済みフラグ)に基づいて、DGIに対応するデータがデータ記憶部80に既に記憶されているか否かを判定する。   For example, the command processing unit 52 a first refers to the DGI table storage unit 60 and acquires the file identifier of the EF corresponding to the received DGI from the DGI table storage unit 60. Next, the command processing unit 52a refers to the file management information storage unit 81a and acquires a written flag corresponding to the acquired file identifier from the file management information storage unit 81a. The command processing unit 52a determines that the corresponding data has already been stored in the data storage unit 80 when the acquired written flag is “1”. Further, when the acquired written flag is “0”, the command processing unit 52a determines that the STORE DATA command has not been executed yet. Thus, the command processing unit 52a indicates whether or not data is already stored in the data area (EF) corresponding to the DGI obtained by referring to the file management information storage unit 81a using the received DGI. Based on the information (written flag), it is determined whether or not the data corresponding to the DGI is already stored in the data storage unit 80.

また、コマンド処理部52aは、受信したDGIに対応するデータがデータ記憶部80に既に記憶されていない場合に、STORE DATAコマンドに含まれるデータをデータ記憶部80に記憶させる(書き込む)とともに、ファイル管理情報記憶部81aの上述した書き込み済みフラグを“1”に変更する。このように、コマンド処理部52aは、STORE DATAコマンドに含まれるデータをデータ記憶部80に記憶させる場合に、STORE DATAコマンドに含まれるDGIに関する情報(例えば、書き込み済みフラグの“1”)をファイル管理情報記憶部81aに記憶させる。   The command processing unit 52a stores (writes) the data included in the STORE DATA command in the data storage unit 80 when the data corresponding to the received DGI is not already stored in the data storage unit 80. The above-mentioned written flag in the management information storage unit 81a is changed to “1”. As described above, when the data included in the STORE DATA command is stored in the data storage unit 80, the command processing unit 52a stores the information related to the DGI included in the STORE DATA command (for example, “1” of the written flag). The information is stored in the management information storage unit 81a.

次に、図11を参照して、本実施形態のICカード1aの動作について説明する。
図11は、本実施形態のICカード1aのSTORE DATAコマンド処理の一例を示すフローチャートである。
図11において、ステップS201からステップS203までの処理は、図8に示すステップS101からステップS103までの処理と同様であるので、ここではその説明を省略する。
Next, the operation of the IC card 1a of this embodiment will be described with reference to FIG.
FIG. 11 is a flowchart showing an example of the STORE DATA command processing of the IC card 1a of this embodiment.
In FIG. 11, the process from step S201 to step S203 is the same as the process from step S101 to step S103 shown in FIG.

ステップS204において、コマンド処理部52aは、受信したDGIに対応する書き込み済みフラグが“1”であるか否かを判定する。すなわち、コマンド処理部52aは、例えば、DGIテーブル記憶部60を参照して、受信DGIに対応するEFのファイル識別子をDGIテーブル記憶部60から取得する。コマンド処理部52aは、ファイル管理情報記憶部81aを参照し、取得したファイル識別子に対応する書き込み済みフラグが“1”であるか否かを判定する。コマンド処理部52aは、受信したDGIに対応する書き込み済みフラグが“1”である場合(ステップS204:YES)に、当該DGIに対応するデータがデータ記憶部80に既に記憶されていると判定し、処理をステップS208に進める。また、コマンド処理部52aは、受信したDGIに対応する書き込み済みフラグが“0”である場合(ステップS204:NO)に、当該DGIに対応するデータがデータ記憶部80にまだ記憶されていないと判定し、処理をステップS205に進める。   In step S204, the command processing unit 52a determines whether or not the written flag corresponding to the received DGI is “1”. That is, for example, the command processing unit 52 a refers to the DGI table storage unit 60 and acquires the file identifier of the EF corresponding to the received DGI from the DGI table storage unit 60. The command processing unit 52a refers to the file management information storage unit 81a and determines whether or not the written flag corresponding to the acquired file identifier is “1”. When the written flag corresponding to the received DGI is “1” (step S204: YES), the command processing unit 52a determines that the data corresponding to the DGI is already stored in the data storage unit 80. Then, the process proceeds to step S208. Further, when the written flag corresponding to the received DGI is “0” (step S204: NO), the command processing unit 52a indicates that the data corresponding to the DGI is not yet stored in the data storage unit 80. Determination is made, and the process proceeds to step S205.

続くステップS205の処理、及びステップS207からステップS211までの処理は、図8に示すステップS105の処理、及びステップS107からステップS111までの処理と同様であるので、ここではその説明を省略する。
ステップS206において、コマンド処理部52aは、ファイル管理情報記憶部81a内の受信したDGIに対応する書き込み済みフラグに“1”を記憶させる。すなわち、コマンド処理部52aは、受信したDGIに対応する書き込み済みフラグを“1”に変更する。
The subsequent processing in step S205 and the processing from step S207 to step S211 are the same as the processing in step S105 and the processing from step S107 to step S111 shown in FIG.
In step S206, the command processing unit 52a stores “1” in the written flag corresponding to the received DGI in the file management information storage unit 81a. That is, the command processing unit 52a changes the written flag corresponding to the received DGI to “1”.

以上説明したように、本実施形態によるICカード1aは、UART4(通信部)と、受信処理部51(受信部)と、ファイル管理情報記憶部81a(データ識別子記憶部)と、コマンド処理部52a(処理部)と、送信処理部53(送信部)とを備えている。
これにより、本実施形態によるICカード1aは、第1の実施形態と同様に、書き込んだデータを確認する際に、発行コマンドとは異なる読み出しコマンドなどを使用する必要がなく、外部装置2が対応するコマンドの種類を低減することができる。すなわち、本実施形態によるICカード1aは、第1の実施形態と同様に、発行工程に使用するコマンドの種類を低減することができる。
As described above, the IC card 1a according to the present embodiment includes the UART 4 (communication unit), the reception processing unit 51 (reception unit), the file management information storage unit 81a (data identifier storage unit), and the command processing unit 52a. (Processing unit) and a transmission processing unit 53 (transmission unit).
As a result, the IC card 1a according to the present embodiment does not need to use a read command or the like different from the issued command when confirming the written data, as in the first embodiment. The types of commands to be performed can be reduced. That is, the IC card 1a according to the present embodiment can reduce the types of commands used in the issuing process, as in the first embodiment.

また、本実施形態では、DGIに関連する情報には、DGIに対応するデータ領域(例えば、EF)に既にデータが記憶されているか否かを示す情報(例えば、書き込み済みフラグ)が含まれる。すなわち、ファイル管理情報記憶部81aは、DGIに対応するデータ領域(例えば、EF)に既にデータが記憶されているか否かを示す情報(例えば、書き込み済みフラグ)を、DGIに関連する情報として記憶する。コマンド処理部52aは、受信したDGIを用いてファイル管理情報記憶部81aを参照して得られる、DGIに対応するデータ領域(例えば、EF)に既にデータが記憶されているか否かを示す情報(例えば、書き込み済みフラグ)に基づいて、DGIに対応するデータがデータ記憶部80に既に記憶されているか否かを判定する。
これにより、本実施形態によるICカード1aは、DGIに対応するデータ領域(例えば、EF)に既にデータが記憶されているか否かを示す情報(例えば、書き込み済みフラグ)により簡易な手段により、DGIに対応するデータがデータ記憶部80に既に記憶されているか否かを判定することができる。
In the present embodiment, the information related to DGI includes information (for example, a written flag) indicating whether data is already stored in a data area (for example, EF) corresponding to DGI. That is, the file management information storage unit 81a stores information (for example, a written flag) indicating whether or not data is already stored in a data area (for example, EF) corresponding to DGI as information related to DGI. To do. The command processing unit 52a refers to the file management information storage unit 81a using the received DGI, and indicates whether or not data has already been stored in a data area (for example, EF) corresponding to the DGI ( For example, based on the written flag), it is determined whether or not data corresponding to DGI is already stored in the data storage unit 80.
As a result, the IC card 1a according to the present embodiment uses the DGI by simple means using information (for example, a written flag) indicating whether or not data is already stored in the data area (for example, EF) corresponding to the DGI. It can be determined whether or not data corresponding to is already stored in the data storage unit 80.

また、本実施形態では、ファイル管理情報記憶部81a(データ識別子記憶部)は、電気的に書き換え可能な不揮発性メモリ(例えば、EEPROM8)である。
これにより、本実施形態によるICカード1aは、リセットされてもDGIに関連する情報が消えないため、発行工程の途中でリセットを行う場合や、発行工程を複数の工程に分割する場合などに対応することができる。
In the present embodiment, the file management information storage unit 81a (data identifier storage unit) is an electrically rewritable nonvolatile memory (for example, EEPROM 8).
As a result, the IC card 1a according to the present embodiment does not erase information related to DGI even if it is reset, so it corresponds to a case where resetting is performed during the issuing process or a case where the issuing process is divided into a plurality of processes. can do.

上記の第1の実施形態では過去受信DGI記憶部70は、RAM7により構成される例を説明したが、電気的に書き換え可能な不揮発性メモリ(例えば、EEPROM8)によって構成されるようにしてもよい。これにより、ICカード1は、第2の実施形態と同様に、リセットされても過去受信DGIが消えないため、発行工程の途中でリセットを行う場合や、発行工程を複数の工程に分割する場合などに対応することができる。   In the first embodiment, the past reception DGI storage unit 70 has been described as being configured by the RAM 7. However, the past reception DGI storage unit 70 may be configured by an electrically rewritable nonvolatile memory (for example, EEPROM 8). . As a result, as in the second embodiment, since the past received DGI does not disappear even if the IC card 1 is reset, the IC card 1 is reset during the issuing process or the issuing process is divided into a plurality of processes. Etc.

また、上記の各実施形態において、書き込み要求(書き込みコマンド)の一例として、STORE DATAコマンドにおける例を説明したが、他の書き込み要求(書き込みコマンド)に対して適用してもよい。
また、上記の各実施形態において、ICカード1(1a)は、コンタクト部3を介して外部装置2と通信する例を説明したが、コイルなどを用いたコンタクトレスインターフェースを介して外部装置2と通信するように構成してもよい。
In each of the above embodiments, the example of the STORE DATA command has been described as an example of the write request (write command). However, the present embodiment may be applied to other write requests (write commands).
In each of the above embodiments, the IC card 1 (1a) has been described as communicating with the external device 2 via the contact unit 3. You may comprise so that it may communicate.

また、上記の各実施形態において、ICカード1(1a)は、書き換え可能な不揮発性メモリとして、EEPROM8を備える構成としたが、これに限定されるものではない。例えば、ICカード1(1a)は、EEPROM8の代わりに、フラッシュメモリ、FeRAM(Ferroelectric Random Access Memory:強誘電体メモリ)などを備えてもよい。   In each of the above embodiments, the IC card 1 (1a) is configured to include the EEPROM 8 as a rewritable nonvolatile memory, but the present invention is not limited to this. For example, the IC card 1 (1a) may include a flash memory, a FeRAM (Ferroelectric Random Access Memory), etc. instead of the EEPROM 8.

以上説明した少なくともひとつの実施形態によれば、データ記憶部80に記憶させるデータと、データを識別するDGIとを含むSTORE DATAコマンドを、外部装置2から受信する受信処理部51と、データ記憶部80に記憶されているデータに対応するDGIに関連する情報を記憶する過去受信DGI記憶部70と、過去受信DGI記憶部70が記憶するDGIに関連する情報に基づいて、受信したDGIに対応するデータがデータ記憶部80に記憶されているか否かを判定し、DGIに対応するデータがデータ記憶部80に記憶されていない場合に、STORE DATAコマンドに含まれるデータをデータ記憶部80に記憶させ、DGIに対応するデータがデータ記憶部80に記憶されている場合に、STORE DATAコマンドに含まれるデータと、データ記憶部80に記憶されているDGIに対応するデータとが一致するか否かを判定するコマンド処理部52と、コマンド処理部52によって判定された一致するか否かの判定結果を示す情報を含むレスポンスを、外部装置2に送信する送信処理部53とを持つことにより、発行工程に使用するコマンドの種類を低減することができる。   According to at least one embodiment described above, the reception processing unit 51 that receives the STORE DATA command including the data to be stored in the data storage unit 80 and the DGI for identifying the data from the external device 2, and the data storage unit The past received DGI storage unit 70 for storing information related to the DGI corresponding to the data stored in 80, and the received DGI based on the information related to the DGI stored in the past received DGI storage unit 70 It is determined whether or not data is stored in the data storage unit 80, and when data corresponding to DGI is not stored in the data storage unit 80, the data included in the STORE DATA command is stored in the data storage unit 80. , STORE DATA frame when data corresponding to DGI is stored in the data storage unit 80. The command processing unit 52 that determines whether or not the data included in the command matches the data corresponding to the DGI stored in the data storage unit 80, and whether or not they match as determined by the command processing unit 52 By having the response including the information indicating the determination result, the transmission processing unit 53 that transmits the response to the external device 2, the types of commands used in the issuing process can be reduced.

上記実施形態は、以下のように表現することができる。
コンタクト部を介して外部装置と通信する通信部と、
データ記憶部に記憶させるデータと、前記データを識別するデータ識別子とを含む書き込み要求を、前記通信部を介して受信する受信部と、
前記データ記憶部に記憶されているデータに対応する前記データ識別子を記憶するデータ識別子記憶部と、
前記受信部によって受信した前記データ識別子に対する前記書き込み要求に含まれる前記データ識別子が、前記データ識別子記憶部に記憶されていない場合に、前記書き込み要求に含まれるデータを前記データ記憶部に記憶させ、前記データ識別子が前記データ識別子記憶部に記憶されている場合に、前記書き込み要求に含まれるデータと、前記データ記憶部に記憶されている前記データ識別子に対応するデータとが一致するか否かを判定する処理部と、
前記処理部によって判定された前記一致するか否かの判定結果を示す情報を含む応答を、前記通信部を介して前記外部装置に送信する送信部と
を備えるICカード。
The above embodiment can be expressed as follows.
A communication unit that communicates with an external device via a contact unit;
A receiving unit for receiving a write request including data to be stored in a data storage unit and a data identifier for identifying the data via the communication unit;
A data identifier storage unit for storing the data identifier corresponding to the data stored in the data storage unit;
When the data identifier included in the write request for the data identifier received by the reception unit is not stored in the data identifier storage unit, the data included in the write request is stored in the data storage unit, If the data identifier is stored in the data identifier storage unit, whether or not the data included in the write request matches the data corresponding to the data identifier stored in the data storage unit A processing unit for determining;
An IC card comprising: a transmission unit that transmits a response including information indicating the determination result of whether or not they are determined determined by the processing unit to the external device via the communication unit.

なお、実施形態におけるICカード1(1a)が備える各構成の機能を実現するためのプログラムをコンピュータ読み取り可能な記録媒体に記録して、この記録媒体に記録されたプログラムをコンピュータシステムに読み込ませ、実行することにより上述したICカード1(1a)が備える各構成における処理を行ってもよい。ここで、「記録媒体に記録されたプログラムをコンピュータシステムに読み込ませ、実行する」とは、コンピュータシステムにプログラムをインストールすることを含む。ここでいう「コンピュータシステム」とは、OSや周辺機器等のハードウェアを含むものとする。
また、「コンピュータ読み取り可能な記録媒体」とは、フレキシブルディスク、光磁気ディスク、ROM、CD−ROM等の可搬媒体、コンピュータシステムに内蔵されるハードディスク等の記憶装置のことをいう。
In addition, the program for realizing the function of each component included in the IC card 1 (1a) in the embodiment is recorded on a computer-readable recording medium, and the program recorded on the recording medium is read into a computer system, By executing, the processing in each configuration included in the IC card 1 (1a) described above may be performed. Here, “loading and executing a program recorded on a recording medium into a computer system” includes installing the program in the computer system. The “computer system” here includes an OS and hardware such as peripheral devices.
The “computer-readable recording medium” refers to a storage device such as a flexible medium, a magneto-optical disk, a portable medium such as a ROM and a CD-ROM, and a hard disk incorporated in a computer system.

本発明のいくつかの実施形態を説明したが、これらの実施形態は、例として提示したものであり、発明の範囲を限定することは意図していない。これら実施形態は、その他の様々な形態で実施されることが可能であり、発明の要旨を逸脱しない範囲で、種々の省略、置き換え、変更を行うことができる。これら実施形態やその変形は、発明の範囲や要旨に含まれると同様に、特許請求の範囲に記載された発明とその均等の範囲に含まれるものである。   Although several embodiments of the present invention have been described, these embodiments are presented by way of example and are not intended to limit the scope of the invention. These embodiments can be implemented in various other forms, and various omissions, replacements, and changes can be made without departing from the spirit of the invention. These embodiments and their modifications are included in the scope and gist of the invention, and are also included in the invention described in the claims and the equivalents thereof.

1,1a…ICカード、2…外部装置、3…コンタクト部、4…UART、5…CPU、6…ROM、7…RAM、8…EEPROM、10‥ICモジュール、50,50a…制御部、51…受信処理部、52,52a…コマンド処理部、53…送信処理部、60…DGIテーブル記憶部、70…過去受信DGI記憶部、71…受信バッファ、72…送信バッファ、80…データ記憶部、81,81a…ファイル管理情報記憶部、100…ICチップ、PT…カード基材   DESCRIPTION OF SYMBOLS 1, 1a ... IC card, 2 ... External device, 3 ... Contact part, 4 ... UART, 5 ... CPU, 6 ... ROM, 7 ... RAM, 8 ... EEPROM, 10 ... IC module, 50, 50a ... Control part, 51 ... Reception processing unit, 52, 52a ... Command processing unit, 53 ... Transmission processing unit, 60 ... DGI table storage unit, 70 ... Past reception DGI storage unit, 71 ... Reception buffer, 72 ... Transmission buffer, 80 ... Data storage unit, 81, 81a ... file management information storage unit, 100 ... IC chip, PT ... card substrate

Claims (9)

データを記憶するデータ記憶部と、
前記データ記憶部に記憶させるデータと、前記データを識別するデータ識別子とを含む書き込み要求を、外部装置から受信する受信部と、
前記データ記憶部に記憶されているデータに対応する前記データ識別子に関連する情報を記憶するデータ識別子記憶部と、
前記データ識別子記憶部が記憶する前記データ識別子に関連する情報に基づいて、前記受信部によって受信した前記データ識別子に対応するデータが前記データ記憶部に記憶されているか否かを判定し、前記データ識別子に対応するデータが前記データ記憶部に記憶されていない場合に、前記書き込み要求に含まれるデータを前記データ記憶部に記憶させ、前記データ識別子に対応するデータが前記データ記憶部に記憶されている場合に、前記書き込み要求に含まれるデータと、前記データ記憶部に記憶されている前記データ識別子に対応するデータとが一致するか否かを判定する処理部と、
前記処理部によって判定された前記一致するか否かの判定結果を示す情報を含む応答を前記外部装置に送信する送信部と
を備えるICカード。
A data storage unit for storing data;
A receiving unit for receiving a write request including data to be stored in the data storage unit and a data identifier for identifying the data from an external device;
A data identifier storage unit for storing information related to the data identifier corresponding to the data stored in the data storage unit;
Based on information related to the data identifier stored in the data identifier storage unit, it is determined whether data corresponding to the data identifier received by the receiving unit is stored in the data storage unit, and the data When data corresponding to an identifier is not stored in the data storage unit, data included in the write request is stored in the data storage unit, and data corresponding to the data identifier is stored in the data storage unit. A processing unit that determines whether data included in the write request matches data corresponding to the data identifier stored in the data storage unit,
An IC card comprising: a transmission unit configured to transmit a response including information indicating the determination result of whether or not they match determined by the processing unit to the external device.
前記処理部は、前記書き込み要求に含まれるデータを前記データ記憶部に記憶させる場合に、前記書き込み要求に含まれる前記データ識別子に関する情報を前記データ識別子記憶部に記憶させる
請求項1に記載のICカード。
The IC according to claim 1, wherein when the data included in the write request is stored in the data storage unit, the processing unit stores information on the data identifier included in the write request in the data identifier storage unit. card.
前記データ識別子記憶部は、前記データ識別子を、前記データ識別子に関連する情報として記憶し、
前記処理部は、
前記書き込み要求に含まれる前記データ識別子が、前記データ識別子記憶部に記憶されているか否かに基づいて、前記データ識別子に対応するデータが前記データ記憶部に記憶されているか否かを判定する
請求項1又は請求項2に記載のICカード。
The data identifier storage unit stores the data identifier as information related to the data identifier,
The processor is
And determining whether data corresponding to the data identifier is stored in the data storage unit based on whether the data identifier included in the write request is stored in the data identifier storage unit. The IC card according to claim 1 or 2.
前記データ識別子記憶部は、前記データ識別子に対応する前記データ記憶部のデータ領域に既にデータが記憶されているか否かを示す情報を、前記データ識別子に関連する情報として記憶し、
前記処理部は、受信した前記データ識別子を用いて前記データ識別子記憶部を参照して得られる、前記データ識別子に対応する前記データ記憶部のデータ領域に既にデータが記憶されているか否かを示す情報に基づいて、前記データ識別子に対応するデータが前記データ記憶部に記憶されているか否かを判定する
請求項1又は請求項2に記載のICカード。
The data identifier storage unit stores information indicating whether data is already stored in a data area of the data storage unit corresponding to the data identifier as information related to the data identifier,
The processing unit indicates whether data is already stored in a data area of the data storage unit corresponding to the data identifier obtained by referring to the data identifier storage unit using the received data identifier The IC card according to claim 1, wherein it is determined based on the information whether data corresponding to the data identifier is stored in the data storage unit.
前記データ識別子記憶部は、揮発性メモリである
請求項1乃至請求項4のいずれか一項に記載のICカード。
The IC card according to any one of claims 1 to 4, wherein the data identifier storage unit is a volatile memory.
前記データ識別子記憶部は、電気的に書き換え可能な不揮発性メモリである
請求項1乃至請求項4のいずれか一項に記載のICカード。
The IC card according to any one of claims 1 to 4, wherein the data identifier storage unit is an electrically rewritable nonvolatile memory.
データを記憶するデータ記憶部と、
前記データ記憶部に記憶させるデータと、前記データを識別するデータ識別子とを含む書き込み要求を、外部装置から受信する受信部と、
前記データ記憶部に記憶されているデータに対応する前記データ識別子に関連する情報を記憶するデータ識別子記憶部と、
前記データ識別子記憶部が記憶する前記データ識別子に関連する情報に基づいて、前記受信部によって受信した前記データ識別子に対応するデータが前記データ記憶部に記憶されているか否かを判定し、前記データ識別子に対応するデータが前記データ記憶部に記憶されていない場合に、前記書き込み要求に含まれるデータを前記データ記憶部に記憶させ、前記データ識別子に対応するデータが前記データ記憶部に記憶されている場合に、前記書き込み要求に含まれるデータと、前記データ記憶部に記憶されている前記データ識別子に対応するデータとが一致するか否かを判定する処理部と、
前記処理部によって判定された前記一致するか否かの判定結果を示す情報を含む応答を前記外部装置に送信する送信部と
を備えるICモジュール。
A data storage unit for storing data;
A receiving unit for receiving a write request including data to be stored in the data storage unit and a data identifier for identifying the data from an external device;
A data identifier storage unit for storing information related to the data identifier corresponding to the data stored in the data storage unit;
Based on information related to the data identifier stored in the data identifier storage unit, it is determined whether data corresponding to the data identifier received by the receiving unit is stored in the data storage unit, and the data When data corresponding to an identifier is not stored in the data storage unit, data included in the write request is stored in the data storage unit, and data corresponding to the data identifier is stored in the data storage unit. A processing unit that determines whether data included in the write request matches data corresponding to the data identifier stored in the data storage unit,
An IC module comprising: a transmission unit that transmits a response including information indicating the determination result of whether or not they match determined by the processing unit to the external device.
請求項7に記載のICモジュールと、
前記ICモジュールが埋め込まれたカード本体と
を備えるICカード。
An IC module according to claim 7;
An IC card comprising: a card body in which the IC module is embedded.
データを記憶するデータ記憶部と、前記データを識別するデータ識別子であって、前記データ記憶部に記憶されているデータに対応する前記データ識別子に関連する情報を記憶するデータ識別子記憶部とを備えるICカードが有するコンピュータに、
データ記憶部に記憶させるデータと、前記データを識別するデータ識別子とを含む書き込み要求を、外部装置から受信する受信ステップと、
前記データ識別子記憶部が記憶する前記データ識別子に関連する情報に基づいて、前記受信ステップによって受信した前記データ識別子に対応するデータが前記データ記憶部に記憶されているか否かを判定する判定ステップと、
前記データ識別子に対応するデータが前記データ記憶部に記憶されていない場合に、前記書き込み要求に含まれるデータを前記データ記憶部に記憶させ、前記データ識別子に対応するデータが前記データ記憶部に記憶されている場合に、前記書き込み要求に含まれるデータと、前記データ記憶部に記憶されている前記データ識別子に対応するデータとが一致するか否かを判定する処理ステップと、
前記処理ステップによって判定された前記一致するか否かの判定結果を示す情報を含む応答を前記外部装置に送信する送信ステップと
を実行させるためのプログラム。
A data storage unit that stores data; and a data identifier storage unit that stores information related to the data identifier corresponding to the data stored in the data storage unit, the data identifier identifying the data To the computer that the IC card has,
A reception step of receiving a write request including data to be stored in the data storage unit and a data identifier for identifying the data from an external device;
A determination step for determining whether data corresponding to the data identifier received by the reception step is stored in the data storage unit based on information related to the data identifier stored in the data identifier storage unit; ,
When data corresponding to the data identifier is not stored in the data storage unit, data included in the write request is stored in the data storage unit, and data corresponding to the data identifier is stored in the data storage unit A process step for determining whether or not the data included in the write request and the data corresponding to the data identifier stored in the data storage unit match,
A program for executing a transmission step of transmitting a response including information indicating the determination result of whether or not they are determined determined by the processing step to the external device.
JP2015198439A 2015-10-06 2015-10-06 IC card, IC module, and program Active JP6499052B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2015198439A JP6499052B2 (en) 2015-10-06 2015-10-06 IC card, IC module, and program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2015198439A JP6499052B2 (en) 2015-10-06 2015-10-06 IC card, IC module, and program

Publications (2)

Publication Number Publication Date
JP2017072932A JP2017072932A (en) 2017-04-13
JP6499052B2 true JP6499052B2 (en) 2019-04-10

Family

ID=58537710

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2015198439A Active JP6499052B2 (en) 2015-10-06 2015-10-06 IC card, IC module, and program

Country Status (1)

Country Link
JP (1) JP6499052B2 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP7468757B1 (en) 2023-06-29 2024-04-16 大日本印刷株式会社 ELECTRONIC INFORMATION STORAGE MEDIUM, IC CHIP, IC CARD, RESPONSE TRANSMISSION METHOD, AND PROGRAM

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH03175596A (en) * 1989-12-04 1991-07-30 Toshiba Corp Portable electronic equipment
JP5454933B2 (en) * 2009-09-11 2014-03-26 株式会社東芝 Portable electronic device, IC card, and control method for portable electronic device

Also Published As

Publication number Publication date
JP2017072932A (en) 2017-04-13

Similar Documents

Publication Publication Date Title
US7775423B2 (en) Portable electronic device and control method of portable electronic device
US9183400B2 (en) IC card and IC card control method
JP5976458B2 (en) IC card and portable electronic device
KR101783526B1 (en) Ic card, electronic device and portable electronic device
JP6499052B2 (en) IC card, IC module, and program
JP7020969B2 (en) Portable electronic devices and IC cards
JP2020013212A (en) Portable electronic device, IC card, and issuing device
JP7005934B2 (en) Electronic information storage medium, IC card, data transmission method, data writing method, data transmission program and data writing program
US10068168B2 (en) IC card and IC module
JP4950730B2 (en) Portable electronic device, file access method and IC card in portable electronic device
JP5932588B2 (en) IC card, portable electronic device, and IC card processing device
JP2006293706A (en) Multi-application ic card with application updating function
JP4533665B2 (en) Portable electronic device
JP7439847B2 (en) Electronic information storage medium, key data setting method, and program
JP6556489B2 (en) IC card, IC module, issuing device, issuing method, and issuing program
JP2016212779A (en) Portable electronic device and IC card
JP5957347B2 (en) IC card and portable electronic device
JP7468757B1 (en) ELECTRONIC INFORMATION STORAGE MEDIUM, IC CHIP, IC CARD, RESPONSE TRANSMISSION METHOD, AND PROGRAM
JP2014059806A (en) Ic card, portable electronic device, and ic card processor
JP2008299416A (en) Portable electronic device, file access method in portable electronic device, and ic card
US20200057732A1 (en) Ic card and method of controlling ic card
JP2019160189A (en) Portable electronic device and IC card
JP6039036B2 (en) IC card, portable electronic device, and control method of IC card
JP2019160190A (en) Portable electronic device and IC card
JP2016126441A (en) Portable electronic device

Legal Events

Date Code Title Description
A711 Notification of change in applicant

Free format text: JAPANESE INTERMEDIATE CODE: A711

Effective date: 20170912

Free format text: JAPANESE INTERMEDIATE CODE: A712

Effective date: 20170912

A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20180501

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20181113

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20181114

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20190314

R150 Certificate of patent or registration of utility model

Ref document number: 6499052

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250