JP6926945B2 - IC card and terminal equipment - Google Patents
IC card and terminal equipment Download PDFInfo
- Publication number
- JP6926945B2 JP6926945B2 JP2017206564A JP2017206564A JP6926945B2 JP 6926945 B2 JP6926945 B2 JP 6926945B2 JP 2017206564 A JP2017206564 A JP 2017206564A JP 2017206564 A JP2017206564 A JP 2017206564A JP 6926945 B2 JP6926945 B2 JP 6926945B2
- Authority
- JP
- Japan
- Prior art keywords
- command
- binary
- file
- card
- message
- 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
Landscapes
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Description
本発明は,半導体集積回路(ICチップ)を実装したカード媒体であるICカードと,ICカードと通信するターミナル装置に関する発明である。 The present invention relates to an IC card, which is a card medium on which a semiconductor integrated circuit (IC chip) is mounted, and a terminal device that communicates with the IC card.
半導体集積回路を実装したカード媒体であるICカードは,データを格納するファイルをメモリに記憶し,ファイルに格納したデータを扱うコマンドを備える。例えば,バイナリデータを格納するトランスペアレント(透過)型ファイルに対応したICカードは,トランスペアレント型ファイルに格納したバイナリデータを扱うコマンドであるバイナリコマンドを備える。なお,ICカードの分野では,データを格納するファイルのことをEF(Elementary File)やWEF(Work Elementary File)と呼ぶこともある。 An IC card, which is a card medium on which a semiconductor integrated circuit is mounted, stores a file for storing data in a memory and has a command for handling the data stored in the file. For example, an IC card that supports a transparent file that stores binary data includes a binary command that handles the binary data stored in the transparent file. In the field of IC cards, a file for storing data may be called an EF (Elementary File) or a WEF (Work Elementary File).
JIS X 6319-3等の規格に準拠したICカードは,バイナリデータの書込みを行う書込み・更新系のバイナリコマンドとして,トランスペアレント型ファイルに書き込まれているバイナリデータの初期値を書き換えるコマンドであるライトバイナリコマンドと,ライトバイナリコマンドによりトランスペアレント型ファイルに書き込まれたバイナリデータを更新するアップデートバイナリコマンドを実装する。また,JIS X 6319-3等の規格に準拠したICカードは,バイナリデータの読出しを行う読み出し系のバイナリコマンドとして,トランスペアレント型ファイルからバイナリデータを読み出すリードバイナリコマンドを実装する。 An IC card that conforms to standards such as JIS X 6319-3 is a write / update binary command that writes binary data, and is a command that rewrites the initial value of the binary data written in a transparent file. Implement the command and the update binary command that updates the binary data written to the transparent file by the write binary command. In addition, IC cards that comply with standards such as JIS X 6319-3 implement a read binary command that reads binary data from a transparent file as a read-type binary command that reads binary data.
JIS X 6319-3など多くの規格で規定されているコマンドメッセージは,コマンドのクラスを示すCLA,コマンドの識別に用いるINS,コマンドのパラメータとなるP1−P2を含み,バイナリコマンドの場合,P1−P2には,トランスペアレント型ファイルの先頭からの位置を示すアドレス情報となるオフセット値が少なくとも符号化される。バイナリコマンドに係る処理には,トランスペアレント型ファイルの先頭からの位置を示すアドレス情報の他に,バイナリコマンドに係る処理を行うバイナリデータのデータサイズが必要になり,書込み・更新系のバイナリコマンドのコマンドメッセージは,トランスペアレント型ファイルに書込むバイナリデータのデータサイズを示すLcを含む。また,読出し系のバイナリコマンドのコマンドメッセージは,トランスペアレント型ファイルから読み出すバイナリデータのデータサイズを示すLeを含む。 Command messages specified in many standards such as JIS X 6319-3 include CLA indicating the command class, INS used for command identification, and P1-P2 as command parameters. In the case of binary commands, P1- At least an offset value, which is address information indicating the position from the beginning of the transparent file, is encoded in P2. In addition to the address information indicating the position from the beginning of the transparent file, the data size of the binary data to be processed related to the binary command is required for the processing related to the binary command. The message contains an Lc indicating the data size of the binary data to be written to the transparent file. The command message of the read binary command includes Le indicating the data size of the binary data read from the transparent file.
なお,ICカードのメモリに記憶するファイルの型としては,トランスペアレント型ファイルの他に,レコード構造のデータを格納するレコード型ファイルがあり,レコード型ファイルの場合,レコードコマンドのコマンドメッセージに含ませるアドレス情報はレコード番号になる。 As the file type stored in the memory of the IC card, in addition to the transparent type file, there is a record type file that stores the data of the record structure. In the case of the record type file, the address to be included in the command message of the record command. The information will be the record number.
ファイルに格納されているデータ全てを読み出す場合など,所定のコマンドを連続してICカードに実行させるトランザクションを行う際,コマンドメッセージをICカードへ送信する装置となるターミナル装置は,コマンドの送信回数に応じて,ICカードに送信するコマンドメッセージに含ませるアドレス情報を変更することが必要になる。 When performing a transaction that causes the IC card to execute a predetermined command continuously, such as when reading all the data stored in a file, the terminal device, which is the device that sends the command message to the IC card, determines the number of command transmissions. Therefore, it is necessary to change the address information included in the command message sent to the IC card.
コマンドを連続してICカードに実行させるトランザクションを行う際,コマンドメッセージに含ませるアドレス情報は,ターミナル装置側が計算する値になるが,コマンドに係る処理を実行する従来のICカードは,コマンドに係る処理が終了した位置の次になるアドレス情報をターミナル装置側に通知できるように構成されていなかった。コマンドに係る処理が終了した位置の次になるアドレス情報をICカード側からターミナル装置側に通知できれば,コマンドメッセージに含ませるアドレス情報をターミナル装置が計算する手間を省くことができるし,ターミナル装置が計算したアドレス情報の正当性をターミナル装置側で検証するようにもできる。 When performing a transaction that causes an IC card to execute a command continuously, the address information included in the command message is a value calculated by the terminal device side, but the conventional IC card that executes the processing related to the command is related to the command. It was not configured to notify the terminal device side of the address information next to the position where the processing was completed. If the IC card side can notify the terminal device side of the address information next to the position where the processing related to the command is completed, the terminal device can save the trouble of calculating the address information included in the command message, and the terminal device can do it. The validity of the calculated address information can also be verified on the terminal device side.
コマンドのコマンドメッセージに含ませるアドレス情報の管理に係る発明として,例えば,特許文献1において,トランスペアレント型ファイルのファイルIDとデータのオフセット値を含むプロファイル情報をICカードに記憶させておくことにより,データのオフセット値をターミナル装置に予め登録しておかなくとも,トランスペアレント型ファイル内のデータにターミナル装置がアクセスできるようにした発明が開示されている。また,特許文献2では,オフセット値ではなくタグを用いて,トランスペアレント型ファイル内のデータにターミナル装置がアクセスできるようにした発明が開示されている。
As an invention relating to the management of address information included in a command message of a command, for example, in
しかしながら,コマンドのコマンドメッセージに含ませるアドレス情報の管理に係る従来の発明は,コマンドに係る処理が終了した位置の次になるアドレス情報をターミナル装置側にICカードが通知することに着目した発明ではない。 However, the conventional invention relating to the management of the address information included in the command message of the command is an invention focusing on the fact that the IC card notifies the terminal device side of the address information next to the position where the processing related to the command is completed. No.
そこで,本発明では,ファイルの先頭からの位置を示すアドレス情報を少なくともコマンドメッセージに含むコマンドを実行した後,コマンドに係る処理が終了した位置の次になるアドレス情報をターミナル装置に通知するICカードを提供する。加えて,本発明では,ICカードから通知されたアドレス情報を利用するターミナル装置をも提供する。 Therefore, in the present invention, after executing a command that includes at least the address information indicating the position from the beginning of the file in the command message, the IC card notifies the terminal device of the address information next to the position where the processing related to the command is completed. I will provide a. In addition, the present invention also provides a terminal device that uses the address information notified from the IC card.
上述した課題を解決する第1発明は,データを格納するファイルと,前記ファイルに格納されたデータを扱うコマンドに係る処理を実行するコマンド実行部を備え,前記コマンド実行部は,前記ファイルの先頭からの位置を示すアドレス情報とデータサイズを含む前記コマンドのコマンドメッセージが引き渡されると,前記コマンドのコマンドメッセージに含まれる前記アドレス情報を開始位置とし,前記コマンドのコマンドメッセージに含まれる前記データサイズをサイズとする前記ファイル内の領域に対して前記コマンドに係る処理を実行した後,前記コマンドに係る処理を実行した領域の次の位置を次のアドレス情報として特定し,前記次のアドレス情報を含ませた前記コマンドのレスポンスメッセージを生成することを特徴とするICカードである。 The first invention for solving the above-mentioned problems includes a file for storing data and a command execution unit for executing processing related to a command for handling the data stored in the file, and the command execution unit is the head of the file. When the command message of the command including the address information and the data size indicating the position from is passed, the address information included in the command message of the command is set as the start position, and the data size included in the command message of the command is used. After executing the process related to the command for the area in the file to be the size, the next position of the area where the process related to the command is executed is specified as the next address information, and the next address information is included. This is an IC card characterized by generating a response message for the above command.
更に,第2発明は,第1発明に係る前記コマンドをバイナリコマンドにした発明で,第2発明に係るICカードは,前記ファイルとして,バイナリデータを格納するトランスペアレント型ファイルを備え,前記コマンド実行部として,前記トランスペアレント型ファイルの先頭からの相対アドレスで表記するオフセット値を前記アドレス情報としてコマンドメッセージに含むバイナリコマンドに係る処理を実行する前記コマンド実行部を備え,前記バイナリコマンドに係る処理を実行する前記コマンド実行部は,コマンドメッセージに含まれていた前記オフセット値にコマンドメッセージに含まれていた前記データサイズを加算した位置に対応する相対アドレスを次のオフセット値とすることを特徴とする。 Further, the second invention is an invention in which the command according to the first invention is a binary command, and the IC card according to the second invention includes a transparent file for storing binary data as the file, and the command execution unit. The command execution unit for executing the processing related to the binary command including the offset value represented by the relative address from the beginning of the transparent file as the address information in the command message is provided, and the processing related to the binary command is executed. The command execution unit is characterized in that the relative address corresponding to the position obtained by adding the data size included in the command message to the offset value included in the command message is set as the next offset value.
更に,第3発明は,第1発明に係るICカード,すなわち,データを格納するファイルと,前記ファイルに格納されたデータを扱うコマンドに係る処理を実行するコマンド実行部を備え,前記コマンド実行部が,前記ファイルの先頭からの位置を示すアドレス情報とデータサイズを含む前記コマンドのコマンドメッセージが引き渡されると,前記コマンドのコマンドメッセージに含まれる前記アドレス情報を開始位置とし,前記コマンドのコマンドメッセージに含まれる前記データサイズをサイズとする前記ファイル内の領域に対して前記コマンドに係る処理を実行した後,前記コマンドに係る処理を実行した領域の次の位置を次のアドレス情報として特定し,前記次のアドレス情報を含ませた前記コマンドのレスポンスメッセージを生成するように構成されたICカードを利用したトランザクションを実行するターミナル装置に係る発明で,第3発明に係るターミナル装置は,前記アドレス情報を変えながら前記コマンドを連続して前記ICカードに実行させるトランザクションを行う際,前記コマンドのコマンドメッセージを送信した後,前記コマンドのレスポンスメッセージを前記ICカードから受信すると,前記コマンドのレスポンスメッセージに含まれる前記次のアドレス情報を利用して,次に前記ICカードへ送信する前記コマンドのコマンドメッセージを生成する処理を行うトランザクション管理部を備えることを特徴とする。 Further, the third invention includes an IC card according to the first invention, that is, a file for storing data and a command execution unit for executing processing related to a command for handling the data stored in the file. However, when the command message of the command including the address information indicating the position from the beginning of the file and the data size is passed, the address information included in the command message of the command is set as the start position, and the command message of the command is used. After executing the process related to the command for the area in the file whose size is the included data size, the next position of the area where the process related to the command is executed is specified as the next address information, and the above The invention relates to a terminal device that executes a transaction using an IC card configured to generate a response message for the command including the following address information, and the terminal device according to the third invention uses the address information. When a transaction for causing the IC card to execute the command continuously while changing the command is performed, if the response message of the command is received from the IC card after sending the command message of the command, it is included in the response message of the command. It is characterized by including a transaction management unit that performs a process of generating a command message of the command to be transmitted to the IC card next by using the following address information.
本発明に係るICカードは,バイナリコマンドに係る処理が終了した位置の次になるオフセット値を,ICカードを利用したトランザクションを実行するターミナル装置側に通知できるように, バイナリコマンドのレスポンスメッセージに次のオフセット値を含ませるように構成されている。また,本発明に係るターミナル装置は,本実施形態に係るICカードから通知された次のオフセット値を利用して,次にICカードへ送信するバイナリコマンドのコマンドメッセージを生成するように構成されている。 The IC card according to the present invention follows the response message of the binary command so that the offset value next to the position where the processing related to the binary command is completed can be notified to the terminal device side that executes the transaction using the IC card. It is configured to include the offset value of. Further, the terminal device according to the present invention is configured to generate a command message of a binary command to be transmitted to the IC card next by using the next offset value notified from the IC card according to the present embodiment. There is.
ここから,本発明の好適な実施形態について説明する。なお,以下の記載は本発明の技術的範囲を束縛するものでなく,発明の理解を助けるために記述するものである。 Hereinafter, preferred embodiments of the present invention will be described. The following description does not constrain the technical scope of the present invention, but is described to assist the understanding of the invention.
図1は,本実施形態に係るICカード1の構成を説明する図である。本実施形態に係るICカード1は,I/Oインターフェース124,プロセッサ120,RAM121(Random Access Memory),ROM122(Read-Only Memory),NVM123を実装したICチップ12を備え,NVM123には,データを格納するファイルとして,バイナリデータ(バイトの文字列)を格納するトランスペアレント型ファイル11が記憶されている。また,ICカード1には,ファイルを利用するコマンドとして,バイナリデータを扱うコマンドであるバイナリコマンドに係る処理を実行するコマンド実行部であるバイナリコマンド実行部10を備える。なお,コマンド実行部は,ICカード1が対応しているコマンドごとにICカード1に備えられる機能である。
FIG. 1 is a diagram illustrating a configuration of an
ICカード1のICチップ12に含まれるI/Oインターフェース124は,外部の装置と通信するための回路で,この回路を作動させるソフトウェアも含まれる。例えば,伝送路に有線を用いる場合,ICカード1は,I/Oインターフェース124としてコンタクトインターフェースを備え,伝送路に無線を用いる場合,ICカード1は,I/Oインターフェース124としてコンタクトレスインターフェースを備えることになる。
The I /
ICカード1のICチップ12に含まれるプロセッサ120は,ICカード1の動作を制御するデバイスである。ICカード1のICチップ12に含まれるRAM121は,プロセッサ120の主記憶装置となるメモリである。ICカード1のICチップ12に含まれるROM122は,電気的に書き換えできない補助記憶装置となるメモリで,ICカード1のICチップ12に含まれるNVM123は,電気的に書き換え可能な補助記憶装置となるメモリで,プロセッサ120を動作させるコンピュータプログラムは,ROM122やNVM123に格納される。
The
バイナリコマンドに係る処理を実行するバイナリコマンド実行部10は,バイナリコマンドに係る処理をプロセッサ120に実行させるコンピュータプログラムにより実現される機能である。バイナリコマンドには,トランスペアレント型ファイル11にバイナリデータを書き込む処理を行う書込み・更新系のコマンドと,トランスペアレント型ファイル11からバイナリデータを読み出す処理を行う読み出し系のコマンドがあるが,バイナリコマンドは,書込み・更新系のコマンドでも読み出し系のコマンドのいずれでもよい。
The binary
図2は,バイナリコマンドのコマンドメッセージを説明する図である。図2(a)は,書込み・更新系のコマンドであるバイナリコマンドのコマンドメッセージを説明する図,図2(b)は,書込み・更新系のコマンドであるバイナリコマンドのレスポンスメッセージを説明する図である。また,図2(c)は,読み出し系のコマンドであるバイナリコマンドのコマンドメッセージを説明する図,図2(d)は,読み出し系のコマンドであるバイナリコマンドのレスポンスメッセージを説明する図である。 FIG. 2 is a diagram illustrating a command message of a binary command. FIG. 2A is a diagram for explaining a command message of a binary command which is a write / update command, and FIG. 2B is a diagram for explaining a response message of a binary command which is a write / update command. be. Further, FIG. 2 (c) is a diagram for explaining a command message of a binary command which is a read system command, and FIG. 2 (d) is a diagram for explaining a response message of a binary command which is a read system command.
図2(a)で図示したコマンドメッセージは,JIS X 6319-3などの規格で規定されている内容に準拠する。図2(a)で図示したコマンドメッセージは,コマンドのクラスを示す1バイトのCLA,コマンドの識別に用いる1バイトのINS,コマンドのパラメータとなる2バイトのP1−P2,トランスペアレント型ファイル11に書込むバイナリデータのデータサイズを示す1または3バイトのLc,トランスペアレント型ファイル11に書込むバイナリデータの本体を含む。なお,2バイトのP1−P2には,バイナリコマンドの対象となるトランスペアレント型ファイル11と,トランスペアレント型ファイル11の先頭からの位置を示すアドレス情報となるオフセット値が符号化され,オフセット値は,トランスペアレント型ファイル11の先頭を0x0000(「0x」は16進表記を意味する)とする2バイトの相対アドレスで表記される。
The command message shown in Fig. 2 (a) conforms to the contents specified in standards such as JIS X 6319-3. The command message illustrated in FIG. 2A is written in a 1-byte CLA indicating the command class, a 1-byte INS used for command identification, a 2-byte P1-P2 as a command parameter, and a
図2(a)で図示したコマンドメッセージは,JIS X 6319-3などの規格で規定されている内容に準拠しているが,図2(b)で図示したレスポンスメッセージは,JIS X 6319-3などの規格で規定されている内容に準拠しておらず,書込み・更新系のバイナリコマンドの処理結果を示すSW(Status Word)に加え,次のオフセット値を含む。次のオフセット値とは,バイナリコマンドに係る処理を実行した領域の次の位置を示すオフセット値で,書込み・更新系のコマンドであるバイナリコマンドの場合,次のオフセット値は,トランスペアレント型ファイル11にバイナリデータを書込んだ領域の次の位置に対応する相対アドレスになる。
The command message shown in Fig. 2 (a) conforms to the contents specified by standards such as JIS X 6319-3, while the response message shown in Fig. 2 (b) conforms to JIS X 6319-3. It does not comply with the contents stipulated by standards such as, and includes the following offset values in addition to SW (Status Word) that shows the processing results of write / update binary commands. The next offset value is an offset value that indicates the next position of the area where the processing related to the binary command is executed. In the case of a binary command that is a write / update command, the next offset value is in the
図2(c)で図示したコマンドメッセージは,JIS X 6319-3などの規格で規定されている内容に準拠し,コマンドのクラスを示す1バイトのCLA,コマンドの識別に用いる1バイトのINS,コマンドのパラメータとなる2バイトのP1−P2,トランスペアレント型ファイル11から読出すバイナリデータのデータサイズを少なくとも示す1バイトまたは3バイトのLeを含む。なお,2バイトのP1−P2には,トランスペアレント型ファイル11の先頭からの位置を示すアドレス情報となるオフセット値が符号化される。
The command message shown in Fig. 2 (c) conforms to the contents specified in standards such as JIS X 6319-3, and has a 1-byte CLA indicating the command class and a 1-byte INS used for command identification. It contains at least 1 byte or 3 bytes of Le indicating the data size of the binary data read from the 2-byte P1-P2 and
図2(c)で図示したコマンドメッセージは,JIS X 6319-3などの規格で規定されている内容に準拠しているが,図2(d)で図示したレスポンスメッセージは,JIS X 6319-3などの規格で規定されている内容に準拠しておらず,読み出し系のバイナリコマンドの処理結果を示すSW(Status Word)に加え,次のオフセット値を含む。読み出し系のバイナリコマンドの場合,次のオフセット値は,トランスペアレント型ファイル11からバイナリデータを読み出した領域の次の位置に対応する相対アドレスになる。
The command message shown in Fig. 2 (c) conforms to the contents specified by standards such as JIS X 6319-3, while the response message shown in Fig. 2 (d) conforms to JIS X 6319-3. It does not comply with the contents specified in the standards such as, and includes the following offset values in addition to the SW (Status Word) that shows the processing result of the read binary command. In the case of a read-type binary command, the next offset value is the relative address corresponding to the next position in the area where the binary data is read from the
図3は,ICカード1が備えるバイナリコマンド実行部10の動作を説明する図である。
FIG. 3 is a diagram illustrating the operation of the binary
ICカード1が,I/Oインターフェース124を利用して,バイナリコマンドのコマンドメッセージを外部から受信すると,ICカード1は,ICカード1が備えるバイナリコマンド実行部10に,バイナリコマンドのコマンドメッセージを引き渡し,バイナリコマンド実行部10が起動する(S1)。ICカード1は,外部から受信したコマンドメッセージをRAM121に格納した後,コマンドメッセージに含まれるCLAとINSを利用して,コマンドメッセージに対応するコマンドを特定し,コマンドメッセージに対応するコマンドがバイナリコマンドの場合,ICカード1はバイナリコマンド実行部10を起動させる。なお,コマンドメッセージに対応するコマンドがバイナリコマンド以外の場合,ICカード1は,コマンドメッセージに対応するコマンドに係る処理に対応するコマンド実行部を起動させる。
When the
バイナリコマンドに係る処理を実行する際,ICカード1のバイナリコマンド実行部10は,バイナリコマンドに係る処理の対象となるトランスペアレント型ファイル11と,バイナリコマンドに係る処理を開始するトランスペアレント型ファイル11内の位置を特定する(S2)。バイナリコマンドに係る処理を開始するトランスペアレント型ファイル11内の位置は,バイナリコマンドのコマンドメッセージに含まれるP1−P2に符号化されたオフセット値に対応する位置になる。また,バイナリコマンドの対象となるトランスペアレント型ファイル11は,この時点でカレントになっているトランスペアレント型ファイル11になり,カレントのトランスペアレント型ファイル11は,P1−P2で示されるか,或いは, バイナリコマンドのコマンドメッセージを受信する前に選択されたトランスペアレント型ファイル11になる。
When executing the processing related to the binary command, the binary
ICカード1のバイナリコマンド実行部10は,バイナリコマンドのコマンドメッセージに含まれるオフセット値で示されるトランスペアレント型ファイル11内の位置を開始位置とし,バイナリコマンドのコマンドメッセージに含まれるデータサイズをサイズとするトランスペアレント型ファイル11内の領域に対して,バイナリコマンドに係る処理を実行する(S3)。
The binary
ICカード1のバイナリコマンド実行部10は,P1−P2に含まれるオフセット値で示されるトランスペアレント型ファイル11内の位置から開始したバイナリコマンドに係る処理が終了すると,バイナリコマンドに係る処理が正常終了したか否かを判定する(S4)。
When the binary
ICカード1のバイナリコマンド実行部10は,バイナリコマンドが異常終了した場合,バイナリコマンドのコマンドメッセージに含まれていたオフセット値を次のオフセット値として(S9),図3のS7に進む。なお,バイナリコマンドが異常終了した場合,バイナリコマンドのコマンドメッセージに含まれていたオフセット値を次のオフセット値とするのは,バイナリコマンドが異常終了した場合は,図3のS1でICカード1が受信したバイナリコマンドのコマンドメッセージに対応する処理が完了しておらず,オフセット値は変更にならないからである。
When the binary command terminates abnormally, the binary
また,ICカード1のバイナリコマンド実行部10は,バイナリコマンドに係る処理が正常終了した場合,バイナリコマンドに係る処理を実行した領域の次の位置がトランスペアレント型ファイル11の領域外になるか否かを判定する(S5)。バイナリコマンドに係る処理を実行した領域の次の位置がトランスペアレント型ファイル11の領域外になる場合,ICカード1のバイナリコマンド実行部10は,次のオフセット値をトランスペアレント型ファイル11の領域外になることを示す値(例えば,0xFFFF)にして(S10),図3のS7に進む。バイナリコマンドに係る処理を実行した領域の次の位置がトランスペアレント型ファイル11の領域外にならない場合,ICカード1のバイナリコマンド実行部10は,次のオフセット値を,バイナリコマンドに係る処理を実行した領域の次の位置に対応する相対アドレスにして(S6),図3のS7に進む。
Further, the binary
本実施形態では,オフセット値を相対アドレスにより表記しているので,コマンドメッセージのP1−P2に含まれるオフセット値に,バイナリコマンドで扱うバイナリデータのデータサイズ(例えば,Lcの値)を加算することで,次のオフセット値を求めることができる。コマンドメッセージのP1−P2に含まれるオフセット値に,バイナリコマンドで扱うバイナリデータのデータサイズを加算した値が,バイナリコマンドの対象となるトランスペアレント型ファイル11のサイズを超えていれば,バイナリコマンドに係る処理を実行した領域の次の位置がトランスペアレント型ファイル11の領域外になると判断できる。
In this embodiment, since the offset value is represented by a relative address, the data size of the binary data handled by the binary command (for example, the value of Lc) is added to the offset value included in P1-P2 of the command message. Then, the following offset value can be obtained. If the value obtained by adding the data size of the binary data handled by the binary command to the offset value included in P1-P2 of the command message exceeds the size of the
次に,ICカード1のバイナリコマンド実行部10は,次のオフセット値を含むバイナリコマンドのレスポンスメッセージをRAM121などに生成し(S7),ICカード1は,I/Oインターフェース124を利用して,次のオフセット値を含ませたバイナリコマンドのレスポンスメッセージを外部へ送信して(S8),この手順を終了する。
Next, the binary
図4は,バイナリコマンド実行部の動作説明を補足する図で,図4(a)は,16バイトのトランスペアレント型ファイル11の初期状態を説明する図,図4(b)は,0x0000から8バイトのバイナリデータを書き込んだ後のトランスペアレント型ファイル11を説明する図,図4(c)は,0x0008から8バイトのバイナリデータを書き込んだ後のトランスペアレント型ファイル11を説明する図である。
FIG. 4 is a diagram supplementing the operation explanation of the binary command execution unit, FIG. 4 (a) is a diagram explaining the initial state of the 16-byte
図4(a)で図示したように,NVMに創生された直後の状態である初期状態におけるトランスペアレント型ファイル11の領域全てには,バイナリデータの初期値となる0xFFが書き込まれている。
As shown in FIG. 4A, 0xFF, which is the initial value of the binary data, is written in all the areas of the
トランスペアレント型ファイル11におけるバイナリデータの初期値を更新するバイナリコマンドは,書込み・更新系のバイナリコマンドの一つであるライトバイナリコマンドになる。ライトバイナリコマンドを用い,図4(a)のトランスペアレント型ファイル11の0x0000から0x0007までの領域に8バイトのバイナリデータ(0xF0F1F2F3F4F5F6F7)を書込むことで,トランスペアレント型ファイル11の状態は図4(b)の状態になる。
The binary command for updating the initial value of the binary data in the
トランスペアレント型ファイル11の0x0000から0x0007までの領域に8バイトのバイナリデータ(0xF0F1F2F3F4F5F6F7)を書込む最初のライトバイナリコマンドのコマンドメッセージにおいて,P1−P2に含まれるオフセット値は0x0000で,書込みデータのデータサイズを示すLcは,0x08または0x000008になる。最初のライトバイナリコマンドが正常終了した場合,最初のライトバイナリコマンドのレスポンスメッセージは,次のオフセット値となる0x0008と正常終了を示すSWになる。また,本実施形態では,最初のライトバイナリコマンドが異常終了した場合,最初のライトバイナリコマンドのレスポンスメッセージは,次のオフセット値となる0x0000と異常終了を示すSWになる。なお,異常終了した場合の次のオフセット値である0x0000は,最初のライトバイナリコマンドのコマンドメッセージに含まれるオフセット値である。
In the command message of the first write binary command to write 8-byte binary data (0xF0F1F2F3F4F5F6F7) in the area from 0x0000 to 0x0007 of the
トランスペアレント型ファイル11の0x0008から0x000Fまでの領域に8バイトのバイナリデータ(0xF8F9FAFBFCFDFEFF)を書込む2回目のライトバイナリコマンドのコマンドメッセージにより,8バイトのバイナリデータが図4(b)のトランスペアレント型ファイル11の0x0008から0x000Fまでの領域に書込まれることで,トランスペアレント型ファイル11の状態は図4(c)の状態になる。
By the command message of the second write binary command to write the 8-byte binary data (0xF8F9FAFBFCDFFEFF) in the area from 0x0008 to 0x000F of the
2回目のライトバイナリコマンドのコマンドメッセージにおいて,P1−P2に含まれるオフセット値は0x0008で,書込むデータのデータサイズを示すLcは,0x08または0x000008になる。2回目のライトバイナリコマンドが正常終了した場合,バイナリコマンドに係る処理を実行した領域の次の位置がトランスペアレント型ファイル11の領域外になるため,2回目のライトバイナリコマンドのレスポンスメッセージは,トランスペアレント型ファイル11の領域外になることを示す次のオフセット値と正常終了を示すSWになる。なお,本実施形態では,2回目のライトバイナリコマンドが異常終了した場合,2回目のライトバイナリコマンドのレスポンスメッセージは,次のオフセット値となる0x0008と異常終了を示すSWになる。なお,異常終了した場合の次のオフセット値である0x0008は,2回目のライトバイナリコマンドのコマンドメッセージに含まれるオフセット値である。
In the command message of the second write binary command, the offset value included in P1-P2 is 0x0008, and the Lc indicating the data size of the data to be written is 0x08 or 0x000008. When the second write binary command ends normally, the position next to the area where the processing related to the binary command is executed is outside the area of the
なお,書込み・更新系のバイナリコマンドには,ライトバイナリコマンドの他にアップデートバイナリコマンドもあるが,アップデートバイナリコマンドについては,バイナリデータを書込む前の状態のバイナリデータの値が初期値でないことを除き,上述したライトバイナリコマンドと同じであるため,ここでは説明を省く。 In addition to the write binary command, there is also an update binary command for writing / updating binary commands, but for the update binary command, the value of the binary data in the state before writing the binary data is not the initial value. Except for this, it is the same as the write binary command described above, so the explanation is omitted here.
トランスペアレント型ファイル11からバイナリデータを読出すバイナリコマンドはリードバイナリコマンドになる。トランスペアレント型ファイル11の先頭である0x0000から8バイトのバイナリデータを読出す最初のリードバイナリコマンドを用いて,図4(c)の状態のトランスペアレント型ファイル11の先頭である0x0000から8バイトのバイナリデータを読出すとき,最初のリードバイナリコマンドのコマンドメッセージにおいて,P1−P2に含まれるオフセット値は0x0000で,読み出しデータのデータサイズを示すLeは,0x08または0x000008になる。
The binary command for reading the binary data from the
最初のリードバイナリコマンドが正常終了した場合,最初のリードバイナリコマンドのレスポンスメッセージは,トランスペアレント型ファイル11の先頭から8バイト目までに格納されているバイナリデータ(0xF0F1F2F3F4F5F6F7)と,次のオフセット値となる0x0008と,正常終了を示すSWになる。なお,本実施形態では,最初のリードバイナリコマンドが異常終了した場合,最初のリードバイナリコマンドのレスポンスメッセージは,次のオフセット値となる0x0000と異常終了を示すSWのみになる。なお,異常終了した場合の次のオフセット値である0x0000は,最初のリードバイナリコマンドのコマンドメッセージに含まれるオフセット値である。
When the first read binary command ends normally, the response message of the first read binary command is the binary data (0xF0F1F2F3F4F5F6F7) stored in the 8th byte from the beginning of the
図4(c)の状態のトランスペアレント型ファイル11の9バイト目になる0x0008から8バイトのバイナリデータを読出す2回目のリードバイナリコマンドを用いて,図4(c)の状態のトランスペアレント型ファイル11の9バイト目になる0x0008から8バイトのバイナリデータを読出すとき,2回目のリードバイナリコマンドのコマンドメッセージにおいて,P1−P2に含まれるオフセット値は0x0008で,読み出しデータのデータサイズを示すLeは,0x08または0x000008になる。2回目のリードバイナリコマンドが正常終了した場合,2回目のリードバイナリコマンドのレスポンスメッセージは,トランスペアレント型ファイル11の0x0008から0x000Fまでに格納されているバイナリデータ(0xF8F9FAFBFCFDFEFF)と,トランスペアレント型ファイル11の領域外になることを示す次のオフセット値と,正常終了を示すSWになる。なお,2回目のリードバイナリコマンドが異常終了した場合,2回目のリードバイナリコマンドのレスポンスメッセージは,次のオフセット値となる0x0008と異常終了を示すSWになる。なお,異常終了した場合の次のオフセット値である0x0008は,2回目のリードバイナリコマンドのコマンドメッセージに含まれるオフセット値である。
Using the second read binary command to read 8 bytes of binary data from 0x0008, which is the 9th byte of the
これまで述べたように,本実施形態に係るICカード1は,バイナリコマンドに係る処理が終了した位置の次になるオフセット値を,ICカード1を利用したトランザクションを実行するターミナル装置側に通知できるように, バイナリコマンドのレスポンスメッセージに次のオフセット値を含ませるように構成されている。バイナリコマンドに係る処理が終了した位置の次になるオフセット値となる次のオフセット値をICカード1側からターミナル装置側に通知できれば,バイナリコマンドに係る処理が終了した位置の次になるオフセット値をターミナル装置が計算する手間を省くことができるし,ターミナル装置が計算したオフセット値の正当性をターミナル装置側で検証することもできる。
As described above, the
ここから,本実施形態に係るICカード1を利用したトランザクションを実行するターミナル装置2について説明する。図5は,本実施形態に係るターミナル装置2の構成を説明する図である。
From here, the
本実施形態に係るターミナル装置2は,リーダライタ214,プロセッサ210,RAM211,ROM212,ストレージ213を含むハードウェア21を備え,ハードウェア21上で動作するソフトウェアにより実現される機能として,バイナリコマンドを少なくとも利用するトランザクションを管理するトランザクション管理部20を備える。
The
ターミナル装置2のハードウェア21に含まれるリーダライタ214は,ICカード1と通信するための回路で,この回路を作動させるソフトウェアも含まれる。ターミナル装置2のハードウェア21に含まれるリーダライタ214は,ICカード1のI/Oインターフェース124に対応する。ICカード1が,I/Oインターフェース124としてコンタクトインターフェースを備える場合,ターミナル装置2が備えるリーダライタ214はコンタクト用になり,ICカード1が,I/Oインターフェース124としてコンタクトレスインターフェースを備える場合,ターミナル装置2が備えるリーダライタ214はコンタクトレス用になる。
The reader /
ターミナル装置2のハードウェア21に含まれるプロセッサ210は,ターミナル装置2の動作を制御するデバイスである。ターミナル装置2のハードウェア21に含まれるRAM211は,ターミナル装置2の主記憶装置となるメモリである。ターミナル装置2のハードウェア21に含まれるROM212は,電気的に書き換えできない補助記憶装置となるメモリで,ターミナル装置2のハードウェア21に含まれるストレージ213は,電気的に書き換え可能な補助記憶装置となるハードディスクなどのメモリで,プロセッサ210を動作させるソフトウェアは,ROM212やストレージ213に格納される。
The
ターミナル装置2のトランザクション管理部20は,ICカード1に実装されたコマンドを利用する一連のトランザクションの実行を管理する機能を備え,一つのバイナリコマンドでは済まないほど長いデータサイズのバイナリデータを扱う場合など,オフセット値を変えながらバイナリコマンドを連続してICカード1に実行させるトランザクションを行う際,ICカード1から受信したバイナリコマンドのレスポンスメッセージに含まれる次のオフセット値を用いて,次にICカード1へ送信するバイナリコマンドのコマンドメッセージを生成する処理を行うように構成されている。
The
図6は,ターミナル装置2のトランザクション管理部20の動作を説明する図で,一つのバイナリコマンド(リードバイナリコマンドになる)では済まないほど長いデータサイズのバイナリデータをICカード1から読み出す場合におけるトランザクション管理部20の動作を図示している。
FIG. 6 is a diagram for explaining the operation of the
一つのバイナリコマンドでは済まないほど長いデータサイズのバイナリデータをICカード1から読み出す際,ターミナル装置2のトランザクション管理部20は,まず,リーダライタ214を利用して,バイナリコマンドを利用するトランザクションの対象になるトランスペアレント型ファイル11の先頭から所定のデータサイズのバイナリデータを読み出す最初のバイナリコマンドのコマンドメッセージをICカード1へ送信する処理を実行する(S20)。なお,図4(c)で図示したトランスペアレント型ファイル11の先頭から8バイトのバイナリデータを読み出す場合,最初のバイナリコマンドのコマンドメッセージに含まれるオフセット値は0x0000で,Leは,トランスペアレント型ファイル11から読み出すデータサイズは,0x08または0x000008になる。
When reading binary data having a data size that is too long for one binary command from the
ICカード1のバイナリコマンド実行部10が,ターミナル装置2が送信したバイナリコマンドのコマンドメッセージを処理して,バイナリコマンドのレスポンスメッセージを送信し,リーダライタ214を利用して,ターミナル装置2のトランザクション管理部20が,バイナリコマンドのレスポンスメッセージをICカード1から受信すると(S21),ターミナル装置2のトランザクション管理部20は,バイナリコマンドを利用するトランザクションで読み出すバイナリデータの読み出しが完了したか判定する処理を実行する(S22)。
The binary
トランスペアレント型ファイル11に格納されたバイナリデータ全てを読み出す場合,バイナリコマンドを利用するトランザクションで読み出すバイナリデータの読み出しが完了したかの判定に,バイナリコマンドのレスポンスメッセージに含まれる次のオフセット値を利用することもできるが,トランスペアレント型ファイル11に格納されたバイナリデータの一部を読み出す場合も考慮して,ターミナル装置2のトランザクション管理部20側で,バイナリコマンドを利用するトランザクションで読み出したバイナリデータのデータサイズを管理することが望ましい。例えば,バイナリコマンドを利用するトランザクションで読み出すバイナリデータのデータサイズと,ICカード1から読み出したバイナリデータのデータサイズの合計値を比較することで,バイナリコマンドを利用するトランザクションで読み出すバイナリデータの読み出しが完了したかを判定できる。
When reading all the binary data stored in the
ターミナル装置2のトランザクション管理部20は,バイナリコマンドを利用するトランザクションで読み出すバイナリデータの読み出しが完了している場合,図6で図示した手順を終了し,バイナリコマンドを利用するトランザクションで読み出すバイナリデータの読み出しが完了していない場合,バイナリコマンドのレスポンスメッセージに含まれる次のオフセット値を利用して,次にICカード1へ送信するバイナリコマンドのコマンドメッセージを生成する処理を実行する(S23)。
When the reading of the binary data read by the transaction using the binary command is completed, the
例えば,バイナリコマンドのレスポンスメッセージに含まれる次のオフセット値を,次にICカード1へ送信するバイナリコマンドのコマンドメッセージに含ませるオフセット値に用いることで,ターミナル装置2側でオフセット値を算出することなく,次にICカード1へ送信するバイナリコマンドのコマンドメッセージを生成できる。また,ターミナル装置2のトランザクション管理部20が,次にICカード1へ送信するバイナリコマンドのコマンドメッセージに含ませるオフセット値を算出する場合は,ターミナル装置2のトランザクション管理部20が算出したオフセット値と,バイナリコマンドのレスポンスメッセージに含まれる次のオフセット値を照合することで,次にICカード1へ送信するバイナリコマンドのコマンドメッセージに含ませるオフセット値の正当性を検証できる。
For example, the offset value can be calculated on the
ターミナル装置2のトランザクション管理部20は,バイナリコマンドのレスポンスメッセージに含まれる次のオフセット値を利用して,次にICカード1へ送信するバイナリコマンドのコマンドメッセージを生成すると,ターミナル装置2は,トランザクション管理部20が生成したバイナリコマンドのコマンドメッセージをICカード1へ送信して(S24),図6のS21に戻る。
When the
これまで述べたように,本実施形態に係るターミナル装置2は,本実施形態に係るICカード1から通知された次のオフセット値を利用して,次にICカード1へ送信するバイナリコマンドのコマンドメッセージを生成するように構成されている。ICカード1から通知された次のオフセット値を利用して,次にICカード1へ送信するバイナリコマンドのコマンドメッセージを生成することで,コマンドに係る処理が終了した位置の次になるオフセット値をターミナル装置2が計算する手間を省くことができるし,ターミナル装置2が計算したオフセット値の正当性をターミナル装置2側で検証することもできる。なお,本実施形態では,バイナリデータをICカード1から読み出すときの動作について説明したが,書込み・更新系のバイナリコマンドの場合についても同じである。
As described above, the
1 ICカード
10 バイナリコマンド実行部
11 トランスペアレント型ファイル
2 ターミナル装置
20 トランザクション管理部
1
Claims (3)
前記コマンド実行部は,前記ファイルの先頭からの位置を示すアドレス情報とデータサイズを含む前記コマンドのコマンドメッセージが引き渡されると,前記コマンドのコマンドメッセージに含まれる前記アドレス情報を開始位置とし,前記コマンドのコマンドメッセージに含まれる前記データサイズをサイズとする前記ファイル内の領域に対して前記コマンドに係る処理を実行した後,前記コマンドに係る処理を実行した領域の次の位置を次のアドレス情報として特定し,前記次のアドレス情報を含ませた前記コマンドのレスポンスメッセージを生成する,
ことを特徴とするICカード。 It is equipped with a file that stores data and a command execution unit that executes processing related to commands that handle the data stored in the file.
When the command message of the command including the address information indicating the position from the beginning of the file and the data size is passed, the command execution unit sets the address information included in the command message of the command as the start position and sets the command. After executing the process related to the command for the area in the file whose size is the data size included in the command message of, the next position of the area where the process related to the command is executed is set as the next address information. Identify and generate a response message for the command that includes the following address information:
An IC card characterized by this.
前記ターミナル装置は,前記アドレス情報を変えながら前記コマンドを連続して前記ICカードに実行させるトランザクションを行う際,前記コマンドのコマンドメッセージを送信した後,前記コマンドのレスポンスメッセージを前記ICカードから受信すると,前記コマンドのレスポンスメッセージに含まれる前記次のアドレス情報を利用して,次に前記ICカードへ送信する前記コマンドのコマンドメッセージを生成する処理を行うトランザクション管理部を備えた,
ことを特徴とするターミナル装置。
It is equipped with a file that stores data and a command execution unit that executes processing related to commands that handle the data stored in the file, and the command execution unit provides address information and data size that indicate the position from the beginning of the file. When the command message of the command including the command is passed, the address information included in the command message of the command is set as the start position, and the data size included in the command message of the command is set as the size of the area in the file. After executing the process related to the command, the next position of the area where the process related to the command is executed is specified as the next address information, and the response message of the command including the next address information is generated. It is a terminal device that executes a command using the IC card configured in.
When the terminal device performs a transaction to continuously execute the command on the IC card while changing the address information, the terminal device sends a command message of the command and then receives a response message of the command from the IC card. , A transaction management unit is provided that performs a process of generating a command message of the command to be transmitted to the IC card next by using the following address information included in the response message of the command.
A terminal device characterized by that.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2017206564A JP6926945B2 (en) | 2017-10-25 | 2017-10-25 | IC card and terminal equipment |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2017206564A JP6926945B2 (en) | 2017-10-25 | 2017-10-25 | IC card and terminal equipment |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| JP2019079349A JP2019079349A (en) | 2019-05-23 |
| JP6926945B2 true JP6926945B2 (en) | 2021-08-25 |
Family
ID=66627905
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP2017206564A Active JP6926945B2 (en) | 2017-10-25 | 2017-10-25 | IC card and terminal equipment |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JP6926945B2 (en) |
Family Cites Families (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JPS63785A (en) * | 1986-06-20 | 1988-01-05 | Toshiba Corp | Portable electronic equipment |
| JP2008310596A (en) * | 2007-06-14 | 2008-12-25 | Toshiba Corp | Portable electronic device and method for controlling portable electronic device |
| FR2983622B1 (en) * | 2011-12-02 | 2014-01-24 | Morpho | WRITING DATA IN A NON-VOLATILE MEMORY OF A CHIP CARD |
-
2017
- 2017-10-25 JP JP2017206564A patent/JP6926945B2/en active Active
Also Published As
| Publication number | Publication date |
|---|---|
| JP2019079349A (en) | 2019-05-23 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US9183400B2 (en) | IC card and IC card control method | |
| JP5259513B2 (en) | Portable electronic device, IC card, and portable electronic device control method | |
| JP2025097584A (en) | Electronic information storage medium, ic chip, ic card, element data storage method, and program | |
| JP4891587B2 (en) | Portable electronic device, IC card and IC module | |
| JP6926945B2 (en) | IC card and terminal equipment | |
| JP6769265B2 (en) | Electronic information storage medium, IC card, data abnormality confirmation method, and data abnormality confirmation program | |
| JP5301018B2 (en) | Portable electronic device | |
| JP7468757B1 (en) | ELECTRONIC INFORMATION STORAGE MEDIUM, IC CHIP, IC CARD, RESPONSE TRANSMISSION METHOD, AND PROGRAM | |
| EP3379424B1 (en) | Ic card, portable electronic device, program, processing apparatus, and processing system | |
| JP4868979B2 (en) | Portable electronic device and IC card | |
| JPH09231113A (en) | IC card | |
| JP6984328B2 (en) | Electronic information storage medium, IC card, external device, data writing method and data writing program | |
| JP7420179B1 (en) | Electronic information storage medium, IC card, issuance processing method, and program | |
| JP7438432B1 (en) | Electronic information storage medium, IC chip, IC card, record writing method, and program | |
| JP7468765B1 (en) | ELECTRONIC INFORMATION STORAGE MEDIUM, IC CHIP, IC CARD, ALL-IN-ONE DATA UPDATE METHOD, AND PROGRAM | |
| JP6325394B2 (en) | IC card, portable electronic device, and IC card processing device | |
| JP2016081344A (en) | Ic card, portable electronic device, and ic card processing device | |
| JPH05100961A (en) | Data storage system | |
| JP6823289B2 (en) | IC card and computer program | |
| US7346730B2 (en) | Mobile electronic device | |
| JP6039036B2 (en) | IC card, portable electronic device, and control method of IC card | |
| JPH04205291A (en) | Ic card and information transmitting system | |
| JP2025122710A (en) | Electronic information storage medium, IC chip, record processing method, and program | |
| JP5085055B2 (en) | IC card and IC module | |
| JP5492172B2 (en) | Portable electronic device, IC card and IC module |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20200828 |
|
| A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20210624 |
|
| TRDD | Decision of grant or rejection written | ||
| A01 | Written decision to grant a patent or to grant a registration (utility model) |
Free format text: JAPANESE INTERMEDIATE CODE: A01 Effective date: 20210706 |
|
| A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20210719 |
|
| R150 | Certificate of patent or registration of utility model |
Ref document number: 6926945 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R150 |