Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
JP6904286B2 - Electronic information storage medium and IC card - Google Patents
[go: Go Back, main page]

JP6904286B2 - Electronic information storage medium and IC card - Google Patents

Electronic information storage medium and IC card Download PDF

Info

Publication number
JP6904286B2
JP6904286B2 JP2018045654A JP2018045654A JP6904286B2 JP 6904286 B2 JP6904286 B2 JP 6904286B2 JP 2018045654 A JP2018045654 A JP 2018045654A JP 2018045654 A JP2018045654 A JP 2018045654A JP 6904286 B2 JP6904286 B2 JP 6904286B2
Authority
JP
Japan
Prior art keywords
command
cpu
issue
storage medium
data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
JP2018045654A
Other languages
Japanese (ja)
Other versions
JP2019159799A (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.)
Dai Nippon Printing Co Ltd
Original Assignee
Dai Nippon Printing Co Ltd
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 Dai Nippon Printing Co Ltd filed Critical Dai Nippon Printing Co Ltd
Priority to JP2018045654A priority Critical patent/JP6904286B2/en
Publication of JP2019159799A publication Critical patent/JP2019159799A/en
Application granted granted Critical
Publication of JP6904286B2 publication Critical patent/JP6904286B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Techniques For Improving Reliability Of Storages (AREA)
  • Storage Device Security (AREA)

Description

IC(Integrated Circuit)チップ等の電子情報記憶媒体の技術分野に関する。 The present invention relates to a technical field of an electronic information storage medium such as an IC (Integrated Circuit) chip.

ICカード等に搭載されるICチップといった電子情報記憶媒体は、CPU、RAM、不揮発性メモリ等を備えている。電子情報記憶媒体のCPUは、カード発行機やリーダ・ライタなど、外部からコマンドを受信すると、当該コマンドに応じた処理を実行し、実行結果に関するSW(Status Word)をレスポンスとして送信する。そのため、電子情報記憶媒体の不揮発性メモリは、コマンドに応じた一連の処理をCPUが実行するための処理が記述されたプログラム(以下、「コマンド実行用プログラム」という場合がある)を記憶している。 An electronic information storage medium such as an IC chip mounted on an IC card or the like includes a CPU, RAM, a non-volatile memory, and the like. When the CPU of the electronic information storage medium receives a command from the outside such as a card issuing machine or a reader / writer, it executes a process according to the command and transmits a SW (Status Word) related to the execution result as a response. Therefore, the non-volatile memory of the electronic information storage medium stores a program (hereinafter, may be referred to as a "command execution program") in which a process for executing a series of processes according to a command by the CPU is described. There is.

電子情報記憶媒体に対して送信されるコマンドには複数の種類があり、例えば、特許文献1に記載されているように、検査コマンドや発行コマンドといった、電子情報記憶媒体の検査時や、電子情報記憶媒体の発行前にのみ使用されるコマンド(以下、「発行前コマンド」という場合がある)が含まれている。 There are a plurality of types of commands transmitted to the electronic information storage medium. For example, as described in Patent Document 1, when inspecting an electronic information storage medium such as an inspection command or an issuing command, or electronic information. It contains commands that are used only before the storage medium is issued (hereinafter, may be referred to as "pre-issue commands").

特開2012−243133号公報Japanese Unexamined Patent Publication No. 2012-243133

しかしながら、発行前コマンドについては、発行後(すなわち、製品出荷後の運用中)に使用されることがないため、発行前コマンドに対応するプログラムは、不揮発性メモリから削除されることなく、不揮発性メモリの記憶領域を無駄に使用したままとなる。 However, since the pre-issue command is not used after it is issued (that is, during operation after the product is shipped), the program corresponding to the pre-issue command is non-volatile without being deleted from the non-volatile memory. The memory storage area remains wasted.

一方で、発行前コマンドと、電子情報記憶媒体の発行後(電子情報記憶媒体の運用中)にのみ使用されるコマンド(以下、「発行後コマンド」という場合がある)とには、コマンド受信時に実行されるプログラムに含まれる一部の処理が共通するコマンドがある。 On the other hand, the pre-issue command and the command used only after the electronic information storage medium is issued (during the operation of the electronic information storage medium) (hereinafter, may be referred to as "post-issue command") are when the command is received. There is a command that has some common processing included in the executed program.

そこで、本発明は、発行前コマンドと発行後コマンドについて、コマンド受信時に実行されるプログラムを統合して共用化することにより、当該プログラムを記憶する記憶領域を節約することができる電子情報記憶媒体等を提供することを課題とする。 Therefore, the present invention relates to an electronic information storage medium or the like that can save a storage area for storing a pre-issue command and a post-issue command by integrating and sharing a program executed at the time of command reception. The challenge is to provide.

上記課題を解決するために、請求項1に記載の発明は、コマンドに対応するプログラムを記憶する記憶部と、外部から受信した前記コマンドに対応する前記プログラムを実行する実行部と、を備える電子情報記憶媒体であって、複数種類の前記コマンドには、前記電子情報記憶媒体の発行の前に受信する前記コマンドである発行前コマンド、及び、前記発行の後に受信するコマンドである発行後コマンドが含まれ、前記記憶部は、複数種類の前記コマンドのうち、前記電子情報記憶媒体に対して共通の処理を実行させる前記発行前コマンドと前記発行後コマンドからなる組に対応する所定のプログラムと、前記電子情報記憶媒体が発行前か発行後かを示す発行情報と、を記憶し、前記所定のプログラムは、前記組を構成する前記発行前コマンドを受信した場合と前記組を構成する前記発行後コマンドを受信した場合の双方で実行される前記共通の処理と、前記発行情報が前記発行前を示している場合に実行される処理であって、前記組を構成する前記発行前コマンドに応じて実行される処理と、前記発行情報が前記発行後を示している場合に実行される処理であって、前記組を構成する前記発行後コマンドに応じて実行される処理と、を含むことを特徴とする。 In order to solve the above problems, the invention according to claim 1 is an electronic device including a storage unit for storing a program corresponding to a command and an execution unit for executing the program corresponding to the command received from the outside. In the information storage medium, the plurality of types of the commands include a pre-issue command, which is a command received before the issuance of the electronic information storage medium, and a post-issue command, which is a command received after the issuance. included, the storage unit, among a plurality of types of said commands, a predetermined program corresponding to the sets of the pre-issuing command and the issuing post command to perform common process to the electronic information storage medium the store and the electronic data storage medium issuing information indicating whether after issuing either before issuing the said predetermined program, said issuing constituting the set and when receiving the issued before command constituting the group and said common processing which are executed in both the case of receiving the post command, a process of the issuance information is performed when the identification information indicates previous the issuing, on the issue before commands that configure the group It includes a process executed in response to the issue and a process executed when the issue information indicates after the issue, and includes a process executed in response to the post-issue command constituting the set. It is characterized by.

請求項2に記載の発明は、請求項1に記載の電子情報記憶媒体であって、前記組を構成する前記発行前コマンドのCLA部と前記組を構成する前記発行後コマンドのCLA部、及び、前記組を構成する前記発行前コマンドのINS部と前記組を構成する前記発行後コマンドのINS部にはそれぞれ共通の値が設定され、前記所定のプログラムは、前記組を構成する前記発行前コマンドのCLA部と前記組を構成する前記発行後コマンドのCLA部に設定された値について共通に実行される処理、及び、前記組を構成する前記発行前コマンドのINS部と前記組を構成する前記発行後コマンドのINS部に設定された値について共通に実行される処理と、を含むことを特徴とする。 The invention according to claim 2 is the electronic information storage medium according to claim 1, wherein the CLA part of the pre-issuance command constituting the set, the CLA part of the post-issuance command constituting the set, and the CLA part of the post-issue command constituting the set. , wherein each common value in the INS unit of the issuing post commands constituting the set and INS portion of said issued before command constituting sets of the set, the predetermined program, the issue before configuring the sets process for the issuing post CLA unit set value commands constituting CLA of commands and the set is performed in common, and constitute the set and INS portion of said issued before command constituting the group It is characterized by including a process commonly executed for a value set in the INS part of the post-issue command.

請求項3に記載の発明は、請求項1に記載の電子情報記憶媒体であって、前記組を構成する前記発行前コマンドのCLA部と前記組を構成する前記発行後コマンドのCLA部、又は、前記組を構成する前記発行前コマンドのINS部と前記組を構成する前記発行後コマンドのINS部の少なくとも何れか一方は異なる値が設定され、前記所定のプログラムは、前記組を構成する前記発行前コマンドを受信した場合と前記組を構成する前記発行後コマンドを受信した場合の双方で、前記記憶部に対して共通に実行される処理を含むことを特徴とする。 The invention according to claim 3 is the electronic information storage medium according to claim 1, wherein the CLA part of the pre-issuance command constituting the set and the CLA part of the post-issuance command constituting the set, or , at least one of INS portion of the issuing post commands constituting the set and INS portion of said issued before command constituting said set are set different values, said predetermined program, said constituting the group It is characterized in that it includes processing that is commonly executed for the storage unit both when the pre-issuance command is received and when the post-issue command that constitutes the set is received.

請求項4に記載の発明は、請求項3に記載の電子情報記憶媒体であって、前記記憶部に対して共通に実行される処理は、前記記憶部にデータを書き込む処理、又は、前記記憶部のデータを読み出す処理であることを特徴とする。 The invention according to claim 4 is the electronic information storage medium according to claim 3, and the process commonly executed for the storage unit is a process for writing data to the storage unit or the storage unit. It is characterized in that it is a process of reading the data of a part.

請求項5に記載の発明は、請求項4に記載の電子情報記憶媒体であって、前記記憶部に対して共通に実行される処理は、前記組を構成する前記発行前コマンド及び前記組を構成する前記発行後コマンドにおけるData部に設定されているデータを前記記憶部に書き込む処理であることを特徴とする。
The invention according to claim 5 is the electronic information storage medium according to claim 4, and the processing commonly executed for the storage unit is the pre-issuance command and the set that constitute the set. It is characterized in that it is a process of writing the data set in the Data unit in the constituent post-issue command to the storage unit.

請求項6に記載の発明は、請求項1乃至5の何れか一項に記載の電子情報記憶媒体を備えるICカードである。 The invention according to claim 6 is an IC card including the electronic information storage medium according to any one of claims 1 to 5.

本発明によれば、記憶部が、発行前コマンド及び発行後コマンドの双方に対応する所定のプログラムであって、発行前コマンドを受信した場合と発行後コマンドを受信した場合の双方で、共通に実行される処理を含む所定のプログラムを記憶し、実行部が、発行前コマンド及び発行後コマンドを受信した場合に所定のプログラムを実行する。すなわち、発行前コマンドと発行後コマンドについて、コマンド受信時に実行されるプログラムを統合して共用化することにより、当該プログラムを記憶する記憶領域を節約することができる。 According to the present invention, the storage unit is a predetermined program corresponding to both the pre-issue command and the post-issue command, and is common to both the case where the pre-issue command is received and the case where the post-issue command is received. A predetermined program including a process to be executed is stored, and when the execution unit receives a pre-issue command and a post-issue command, the predetermined program is executed. That is, the storage area for storing the pre-issue command and the post-issue command can be saved by integrating and sharing the program executed when the command is received.

本実施形態に係るICカード1に搭載されるICチップ1aのハードウェア構成例を示す図である。It is a figure which shows the hardware configuration example of the IC chip 1a mounted on the IC card 1 which concerns on this embodiment. 発行前コマンド及び発行後コマンドの一例を含むコマンド一覧である。It is a command list including an example of a command before issuance and a command after issuance. VERIFY(IS)コマンドと、VERIFY(USR)コマンドのコマンドフォーマットの一例を示す図である。It is a figure which shows an example of the command format of a VERIFY (IS) command and a VERIFY (USR) command. (A)は、VERIFY(IS)コマンドに対応するコマンド実行用プログラムの従来処理例を示すフローチャートであり、(B)は、VERIFY(USR)コマンドに対応するコマンド実行用プログラムの従来処理例を示すフローチャートである。(A) is a flowchart showing a conventional processing example of a command execution program corresponding to a VERIFY (IS) command, and (B) shows a conventional processing example of a command execution program corresponding to a VERIFY (USR) command. It is a flowchart. 本実施形態に係るVERIFY(IS)コマンド及びVERIFY(USR)コマンドに対応するコマンド実行用プログラムの処理例を示すフローチャートである。It is a flowchart which shows the processing example of the command execution program corresponding to the VERIFY (IS) command and VERIFY (USR) command which concerns on this embodiment. (A)はSTORE DATAコマンドのコマンドフォーマットの一例を示す図であり、(B)はWRITE BINARYコマンドのコマンドフォーマットの一例を示す図である。(A) is a diagram showing an example of the command format of the STORE DATA command, and (B) is a diagram showing an example of the command format of the WRITE BINARY command. (A)は、STORE DATAコマンドに対応するコマンド実行用プログラムの従来処理例を示すフローチャートであり、(B)は、WRITE BINARYに対応するコマンド実行用プログラムの従来処理例を示すフローチャートである。(A) is a flowchart showing a conventional processing example of a command execution program corresponding to the STORE DATA command, and (B) is a flowchart showing a conventional processing example of a command execution program corresponding to WRITE BINARY. 本実施形態に係るSTORE DATAコマンド及びWRITE BINARYコマンドに対応するコマンド実行用プログラムの処理例を示すフローチャートである。It is a flowchart which shows the processing example of the command execution program corresponding to the STORE DATA command and WRITE BINARY command which concerns on this embodiment. (A)はREAD DATAコマンドのコマンドフォーマットの一例を示す図であり、(B)はREAD BINARYコマンドのコマンドフォーマットの一例を示す図である。(A) is a diagram showing an example of the command format of the READ DATA command, and (B) is a diagram showing an example of the command format of the READ BINARY command. (A)は、READ DATAコマンドに対応するコマンド実行用プログラムの従来処理例を示すフローチャートであり、(B)は、READ BINARYに対応するコマンド実行用プログラムの従来処理例を示すフローチャートである。(A) is a flowchart showing a conventional processing example of a command execution program corresponding to the READ DATA command, and (B) is a flowchart showing a conventional processing example of a command execution program corresponding to the READ BINARY. 本実施形態に係るREAD DATAコマンド及びREAD BINARYコマンドに対応するコマンド実行用プログラムの処理例を示すフローチャートである。It is a flowchart which shows the processing example of the command execution program corresponding to the READ DATA command and READ BINARY command which concerns on this embodiment.

以下、図面を参照して本発明の実施形態について詳細に説明する。以下に説明する実施形態は、ICチップ並びにICチップを搭載するICカードに対して本発明を適用した場合の実施の形態である。 Hereinafter, embodiments of the present invention will be described in detail with reference to the drawings. The embodiment described below is an embodiment when the present invention is applied to an IC chip and an IC card on which the IC chip is mounted.

[1.ICチップ1aの構成]
まず、図1を参照して、ICカード1に搭載されるICチップ1aの構成について説明する。図1は、ICカード1に搭載されるICチップ1aのハードウェア構成例を示す図である。本実施形態のICカード1は、接触によるデータ通信と非接触によるデータ通信の2つの通信機能を兼ね備えたデュアルインターフェース型ICカードである。但し、ICカード1の種類はデュアルインターフェース型ICカードに限定されず、キャッシュカードやクレジットカードと同じ大きさのプラスチック製カードにICチップ1aがエンベットされた接触型ICカードであってもよいし、また、アンテナコイルを内蔵し無線でリーダ・ライタとデータ通信する非接触型ICカードであってもよい。
[1. Configuration of IC chip 1a]
First, the configuration of the IC chip 1a mounted on the IC card 1 will be described with reference to FIG. FIG. 1 is a diagram showing a hardware configuration example of an IC chip 1a mounted on an IC card 1. The IC card 1 of the present embodiment is a dual interface type IC card having two communication functions of contact data communication and non-contact data communication. However, the type of the IC card 1 is not limited to the dual interface type IC card, and may be a contact type IC card in which the IC chip 1a is embedded in a plastic card having the same size as a cash card or a credit card. Further, it may be a non-contact type IC card having a built-in antenna coil and wirelessly communicating data with a reader / writer.

図1に示すように、ICチップ1aは、CPU(Central Processing Unit)10、RAM(Random Access Memory)11、ROM(Read Only Memory)12、不揮発性メモリ13、及びI/O回路14を備えて構成される。CPU10は、ROM12又は不揮発性メモリ13に記憶された各種プログラムを実行するプロセッサ(コンピュータ)である。なお、I/O回路14は、外部機器2とのインターフェイスを担う。これにより、ICチップ1aは、リーダ・ライタを備える外部機器2との間で接触又は非接触で通信を行うことができる。接触式のICチップ1aの場合、I/O回路14には、例えば、C1〜C8の8個の端子が備えられている。例えば、C1端子は電源端子(ICチップ1aへ電源供給する端子)、C2端子はリセット端子、C3端子はクロック端子、C5端子はグランド端子、C7端子は外部機器2との間で通信を行うための端子である。一方、非接触式のICチップ1aの場合、I/O回路14には、例えば、アンテナ、及び変復調回路が備えられている。なお、外部機器2の例としては、ICカード発行機やサーバ装置が挙げられる。 As shown in FIG. 1, the IC chip 1a includes a CPU (Central Processing Unit) 10, a RAM (Random Access Memory) 11, a ROM (Read Only Memory) 12, a non-volatile memory 13, and an I / O circuit 14. It is composed. The CPU 10 is a processor (computer) that executes various programs stored in the ROM 12 or the non-volatile memory 13. The I / O circuit 14 serves as an interface with the external device 2. As a result, the IC chip 1a can communicate with the external device 2 including the reader / writer in contact or non-contact. In the case of the contact type IC chip 1a, the I / O circuit 14 is provided with, for example, eight terminals C1 to C8. For example, the C1 terminal is a power supply terminal (terminal that supplies power to the IC chip 1a), the C2 terminal is a reset terminal, the C3 terminal is a clock terminal, the C5 terminal is a ground terminal, and the C7 terminal communicates with an external device 2. It is a terminal of. On the other hand, in the case of the non-contact type IC chip 1a, the I / O circuit 14 is provided with, for example, an antenna and a modulation / demodulation circuit. Examples of the external device 2 include an IC card issuing machine and a server device.

不揮発性メモリ13には、例えばフラッシュメモリ又は「Electrically Erasable Programmable Read-Only Memory」などで構成され、OS及び各種アプリケーションや、これらが使用するデータを記憶する。なお、OSについては、その一部を不揮発性メモリ13が記憶し、その他の部分をROM12が記憶することとしてもよい。また、不揮発性メモリ13には、外部機器2からコマンドを受信した場合に、OSが当該コマンドに応じた処理を実行し、実行結果に関するSWをレスポンスとして送信するための処理を含むコマンド実行用プログラムが記憶されている。 The non-volatile memory 13 is composed of, for example, a flash memory or an "Electrically Erasable Programmable Read-Only Memory", and stores an OS, various applications, and data used by these. The non-volatile memory 13 may store a part of the OS, and the ROM 12 may store the other part. Further, the non-volatile memory 13 is a command execution program including a process for the OS to execute a process corresponding to the command when a command is received from the external device 2 and to send a SW related to the execution result as a response. Is remembered.

[2.コマンドの種類]
CPU10は、外部機器2からコマンドを受信すると当該コマンドに応じたコマンド実行用プログラムを実行し、SWを応答として外部機器2に送信する。従来、コマンドには発行前コマンドと発行後コマンドがあり、発行前コマンドと発行後コマンドとで類似するコマンドがある。それらはそれぞれに対応するコマンド実行用プログラムに含まれる処理の一部が共通する。ここで、図2を用いて、それらの一例について説明する。
[2. Command type]
When the CPU 10 receives a command from the external device 2, it executes a command execution program corresponding to the command and transmits the SW as a response to the external device 2. Conventionally, there are pre-issue commands and post-issue commands as commands, and there are similar commands between pre-issue commands and post-issue commands. Some of the processing included in the command execution program corresponding to each of them is common. Here, an example thereof will be described with reference to FIG.

図2に示すように、発行者を認証するための発行前コマンドであるVERIFY(IS)コマンドと、ユーザを認証するための発行後コマンドであるVERIFY(USR)コマンドは、それぞれ対応するコマンド実行用プログラムに含まれる一部の処理が共通する。また、不揮発性メモリ13へデータを書き込むための発行前コマンドであるSTORE DATAコマンドと、ファイルへデータを書き込むための発行後コマンドであるWRITE BINARYコマンドは、それぞれ対応するコマンド実行用プログラムに含まれる一部の処理が共通する。更に、正しくデータが書き込まれていることを確認することを目的としてデータを読み出すための発行前コマンドであるREAD DATAコマンドと、ファイルのデータを読み出すための発行後コマンドであるREAD BINARYコマンドは、それぞれ対応するコマンド実行用プログラムに含まれる一部の処理が共通する。 As shown in FIG. 2, the VERIFY (IS) command, which is a pre-issue command for authenticating the issuer, and the VERIFY (USR) command, which is a post-issue command for authenticating the user, are for executing the corresponding commands. Some processes included in the program are common. Further, the STORE DATA command, which is a pre-issuance command for writing data to the non-volatile memory 13, and the WRITE BINARY command, which is a post-issue command for writing data to a file, are included in the corresponding command execution programs. The processing of the parts is common. Furthermore, the READ DATA command, which is a pre-issue command for reading data for the purpose of confirming that the data is written correctly, and the READ BINARY command, which is a post-issue command for reading file data, are used, respectively. Some processes included in the corresponding command execution program are common.

[2.1.VERIFY(IS)コマンドとVERIFY(USR)コマンド]
[2.1.1.コマンドフォーマット]
次に、図3を用いて、VERIFY(IS)コマンドと、VERIFY(USR)コマンドのコマンドフォーマットについて説明する。なお、図3はVERIFY(IS)コマンドと、VERIFY(USR)コマンドのコマンドフォーマットの一例を示す図である。図3に示すように、VERIFY(IS)コマンドと、VERIFY(USR)コマンドのコマンドフォーマットは共通である。すなわち、何れのコマンドも、CLA部には「00h(固定)」、INS部には「10h(固定)」、P1部には「00h(固定)」、P2部には「00h(固定)」、Lc部には「01h」〜「10h」が設定され、Data部には認証に用いるPIN(VERIFY(IS)コマンドであれば発行者PIN(Personal Identification Number)、VERIFY(USR)コマンドであればユーザPIN)がそれぞれ設定される。
[2.1. VERIFY (IS) command and VERIFY (USR) command]
[2.1.1. Command format]
Next, the command formats of the VERIFY (IS) command and the VERIFY (USR) command will be described with reference to FIG. Note that FIG. 3 is a diagram showing an example of the command formats of the VERIFY (IS) command and the VERIFY (USR) command. As shown in FIG. 3, the command formats of the VERIFY (IS) command and the VERIFY (USR) command are common. That is, each command is "00h (fixed)" for the CLA part, "10h (fixed)" for the INS part, "00h (fixed)" for the P1 part, and "00h (fixed)" for the P2 part. , "01h" to "10h" are set in the Lc part, and the PIN (Personal Identification Number for VERIFY (IS) command is the issuer PIN (Personal Identification Number) for the Data part, and the VERIFY (USR) command is used for the Data part. User PIN) is set respectively.

[2.1.2.従来の処理フロー]
[2.1.2.1.VERIFY(IS)コマンド受信時]
次に、図4を用いて、VERIFY(IS)コマンドと、VERIFY(USR)コマンドを受信した場合に実行される従来のコマンド実行用プログラムの処理例について説明する。なお、図4(A)は、VERIFY(IS)コマンドに対応するコマンド実行用プログラムの従来処理例を示すフローチャートであり、図4(B)は、VERIFY(USR)コマンドに対応するコマンド実行用プログラムの従来処理例を示すフローチャートである。
[2.1.2. Conventional processing flow]
[2.1.2.1. When receiving a VERIFY (IS) command]
Next, a processing example of a VERIFY (IS) command and a conventional command execution program executed when a VERIFY (USR) command is received will be described with reference to FIG. Note that FIG. 4A is a flowchart showing a conventional processing example of a command execution program corresponding to the VERIFY (IS) command, and FIG. 4B is a command execution program corresponding to the VERIFY (USR) command. It is a flowchart which shows the conventional processing example of.

図4(A)に示すように、VERIFY(IS)コマンドを受信したICチップ1aのCPU10は、まず、CLA部にセットされている値をチェックする(ステップS101)。例えば、図3に示すコマンドフォーマットであれば「00h」がセットされているかをチェックする。 As shown in FIG. 4A, the CPU 10 of the IC chip 1a that has received the VERIFY (IS) command first checks the value set in the CLA unit (step S101). For example, in the command format shown in FIG. 3, it is checked whether "00h" is set.

次いで、CPU10は、INS部にセットされている値をチェックする(ステップS102)。例えば、図3に示すコマンドフォーマットであれば「10h」がセットされているかをチェックする。 Next, the CPU 10 checks the value set in the INS unit (step S102). For example, in the command format shown in FIG. 3, it is checked whether "10h" is set.

次いで、Lc部にセットされている値とData部の長さとで整合性がとれているかチェックする(ステップS103)。 Next, it is checked whether the value set in the Lc portion and the length of the Data portion are consistent (step S103).

なお、図示しないが、CPU10は、ステップS101〜ステップS103の処理におけるチェックの結果、正常でないと判定した場合には、コマンドの送信元に異常を示すSW(「異常SW」)による応答をし(ステップS108)、当該フローチャートに示す処理を終了する。 Although not shown, when the CPU 10 determines that the command is not normal as a result of the checks in the processes of steps S101 to S103, the CPU 10 responds with a SW (“abnormal SW”) indicating an abnormality to the command source (“abnormal SW”). Step S108), the process shown in the flowchart is terminated.

次に、CPU10は、Data部に設定されている発行者のPINに基づく認証を行う(ステップS104)。次いで、CPU10は、認証結果が一致か否かを判定する(ステップS105)。 Next, the CPU 10 authenticates based on the PIN of the issuer set in the Data unit (step S104). Next, the CPU 10 determines whether or not the authentication results match (step S105).

CPU10は、認証結果が一致であると判定した場合には(ステップS105:YES)、認証結果として発行者認証済みを設定し(ステップS106)、コマンドの送信元に正常を示すSW(「正常SW」)による応答をし(ステップS107)、当該フローチャートに示す処理を終了する。一方、CPU10は、認証結果が一致でないと判定した場合には(ステップS105:NO)、コマンドの送信元に異常SWによる応答をし(ステップS108)、当該フローチャートに示す処理を終了する。 When the CPU 10 determines that the authentication results match (step S105: YES), the CPU 10 sets the issuer authentication completed as the authentication result (step S106), and sets the command source to indicate normality (“normal SW”). ”) (Step S107), and the process shown in the flowchart is terminated. On the other hand, when the CPU 10 determines that the authentication results do not match (step S105: NO), the CPU 10 responds to the command source by the abnormal SW (step S108), and ends the process shown in the flowchart.

[2.1.2.2.VERIFY(USR)コマンド受信時]
一方、図4(B)に示すように、VERIFY(USR)コマンドを受信したICチップ1aのCPU10は、まず、CLA部にセットされている値をチェックする(ステップS111)。例えば、図3に示すコマンドフォーマットであれば「00h」がセットされているかをチェックする。
[2.1.2.2. When receiving a VERIFY (USR) command]
On the other hand, as shown in FIG. 4B, the CPU 10 of the IC chip 1a that has received the VERIFY (USR) command first checks the value set in the CLA unit (step S111). For example, in the command format shown in FIG. 3, it is checked whether "00h" is set.

次いで、CPU10は、INS部にセットされている値をチェックする(ステップS112)。例えば、図3に示すコマンドフォーマットであれば「10h」がセットされているかをチェックする。 Next, the CPU 10 checks the value set in the INS unit (step S112). For example, in the command format shown in FIG. 3, it is checked whether "10h" is set.

次いで、Lc部にセットされている値とData部の長さとで整合性がとれているかチェックする(ステップS113)。 Next, it is checked whether the value set in the Lc portion and the length of the Data portion are consistent (step S113).

このように、ステップS111〜ステップS113の処理は、図4(A)のステップS101〜ステップS103の処理と同一の処理である。 As described above, the processes of steps S111 to S113 are the same as the processes of steps S101 to S103 of FIG. 4 (A).

次に、CPU10は、Data部に設定されているユーザのPINに基づく認証を行う(ステップS114)。次いで、CPU10は、認証結果が一致か否かを判定する(ステップS115)。 Next, the CPU 10 authenticates based on the PIN of the user set in the Data unit (step S114). Next, the CPU 10 determines whether or not the authentication results match (step S115).

CPU10は、認証結果が一致であると判定した場合には(ステップS115:YES)、認証結果としてユーザ認証済みを設定し(ステップS116)、コマンドの送信元に正常SWによる応答をし(ステップS117)、当該フローチャートに示す処理を終了する。一方、CPU10は、認証結果が一致でないと判定した場合には(ステップS115:NO)、コマンドの送信元に異常SWによる応答をし(ステップS118)、当該フローチャートに示す処理を終了する。 When the CPU 10 determines that the authentication results match (step S115: YES), the CPU 10 sets the user authentication completed as the authentication result (step S116), and responds to the command source by the normal SW (step S117). ), The process shown in the flowchart is terminated. On the other hand, when the CPU 10 determines that the authentication results do not match (step S115: NO), the CPU 10 responds to the command source by the abnormal SW (step S118), and ends the process shown in the flowchart.

このように、VERIFY(IS)コマンドと、VERIFY(USR)コマンドを受信した場合の従来の処理例を比較すると、ステップS101〜ステップS103(ステップS111〜ステップS113)の処理が共通する。これは、VERIFY(IS)コマンドと、VERIFY(USR)コマンドのコマンドフォーマットが共通することに基づく。そこで、本実施形態では、VERIFY(IS)コマンドに対応するコマンド実行用プログラムと、VERIFY(USR)コマンドに対応するコマンド実行用プログラムを共通化したコマンド実行用プログラムを作成して記憶させ、従来のVERIFY(IS)コマンドに対応するコマンド実行用プログラムと、VERIFY(USR)コマンドに対応するコマンド実行用プログラムを記憶させないことにより不揮発性メモリ13の記憶領域を節約する。 As described above, comparing the conventional processing examples when the VERIFY (IS) command and the VERIFY (USR) command are received, the processing of steps S101 to S103 (steps S111 to S113) is common. This is based on the fact that the VERIFY (IS) command and the VERIFY (USR) command have a common command format. Therefore, in the present embodiment, a command execution program in which a command execution program corresponding to the VERIFY (IS) command and a command execution program corresponding to the VERIFY (USR) command are shared is created and stored, and is stored in the conventional command execution program. The storage area of the non-volatile memory 13 is saved by not storing the command execution program corresponding to the VERIFY (IS) command and the command execution program corresponding to the VERIFY (USR) command.

[2.1.3.本実施形態の処理フロー]
以下、図5を用いて、共通化したコマンド実行用プログラムによる処理例について説明する。なお、図5は、VERIFY(IS)コマンド及びVERIFY(USR)コマンドに対応するコマンド実行用プログラムの処理例を示すフローチャートである。
[2.1.3. Processing flow of this embodiment]
Hereinafter, a processing example by the common command execution program will be described with reference to FIG. Note that FIG. 5 is a flowchart showing a processing example of a command execution program corresponding to the VERIFY (IS) command and the VERIFY (USR) command.

図5に示すように、ICチップ1aのCPU10は、まず、CLA部にセットされている値をチェックする(ステップS121)。例えば、図3に示すコマンドフォーマットであれば「00h」がセットされているかをチェックする。 As shown in FIG. 5, the CPU 10 of the IC chip 1a first checks the value set in the CLA unit (step S121). For example, in the command format shown in FIG. 3, it is checked whether "00h" is set.

次いで、CPU10は、INS部にセットされている値をチェックする(ステップS122)。例えば、図3に示すコマンドフォーマットであれば「10h」がセットされているかをチェックする。 Next, the CPU 10 checks the value set in the INS unit (step S122). For example, in the command format shown in FIG. 3, it is checked whether "10h" is set.

次いで、Lc部にセットされている値とDataの長さとで整合性がとれているかチェックする(ステップS123)。なお、図示しないが、CPU10は、ステップS121〜ステップS123の処理におけるチェックの結果、正常でないと判定した場合には、コマンドの送信元に異常SWによる応答をし(ステップS129)、当該フローチャートに示す処理を終了する。 Next, it is checked whether the value set in the Lc portion and the length of Data are consistent (step S123). Although not shown, if the CPU 10 determines that the command is not normal as a result of the checks in the processes of steps S121 to S123, the CPU 10 responds to the command source by an abnormal SW (step S129), and is shown in the flowchart. End the process.

このように、ステップS121〜ステップS123の処理は、図4(A)のステップS101〜ステップS103(図4(B)のステップS111〜ステップS113)の処理と同一の処理である。 As described above, the processes of steps S121 to S123 are the same as the processes of steps S101 to S103 of FIG. 4 (A) (steps S111 to S113 of FIG. 4 (B)).

次に、CPU10は、発行フラグがオンであるか否かを判定する(ステップS124)。発行フラグは、ICカード1の発行前の状態であれば「オン」が設定され、ICカード1の発行後の状態であれば「オフ」が設定される。CPU10は、発行フラグがオンである(発行前である)と判定した場合には(ステップS124:YES)、Data部に設定されている発行者のPINに基づく認証を行う(ステップS125)。次いで、CPU10は、認証結果が一致か否かを判定する(ステップS126)。 Next, the CPU 10 determines whether or not the issue flag is on (step S124). The issuance flag is set to "on" if the state is before the issuance of the IC card 1, and is set to "off" if the state is after the issuance of the IC card 1. When the CPU 10 determines that the issuance flag is on (before issuance) (step S124: YES), the CPU 10 authenticates based on the issuer's PIN set in the Data unit (step S125). Next, the CPU 10 determines whether or not the authentication results match (step S126).

CPU10は、認証結果が一致であると判定した場合には(ステップS126:YES)、認証結果として発行者認証済みを設定し(ステップS127)、コマンドの送信元に正常SWによる応答をし(ステップS128)、当該フローチャートに示す処理を終了する。一方、CPU10は、認証結果が一致でないと判定した場合には(ステップS126:NO)、コマンドの送信元に異常SWによる応答をし(ステップS129)、当該フローチャートに示す処理を終了する。 When the CPU 10 determines that the authentication results match (step S126: YES), the CPU 10 sets the issuer authentication completed as the authentication result (step S127), and responds to the command source by the normal SW (step S126). S128), the process shown in the flowchart is terminated. On the other hand, when the CPU 10 determines that the authentication results do not match (step S126: NO), the CPU 10 responds to the command transmission source by the abnormal SW (step S129), and ends the process shown in the flowchart.

一方、CPU10は、発行フラグがオンでない(発行後である)と判定した場合には(ステップS124:NO)、Data部に設定されているユーザのPINに基づく認証を行う(ステップS130)。次いで、CPU10は、認証結果が一致か否かを判定する(ステップS131)。 On the other hand, when the CPU 10 determines that the issuance flag is not on (after issuance) (step S124: NO), the CPU 10 authenticates based on the PIN of the user set in the Data unit (step S130). Next, the CPU 10 determines whether or not the authentication results match (step S131).

CPU10は、認証結果が一致であると判定した場合には(ステップS131:YES)、認証結果としてユーザ認証済みを設定し(ステップS132)、コマンドの送信元に正常SWによる応答をし(ステップS133)、当該フローチャートに示す処理を終了する。一方、CPU10は、認証結果が一致でないと判定した場合には(ステップS131:NO)、コマンドの送信元に異常SWによる応答をし(ステップS129)、当該フローチャートに示す処理を終了する。 When the CPU 10 determines that the authentication results match (step S131: YES), the CPU 10 sets the user authentication completed as the authentication result (step S132), and responds to the command source by the normal SW (step S133). ), The process shown in the flowchart is terminated. On the other hand, when the CPU 10 determines that the authentication results do not match (step S131: NO), the CPU 10 responds to the command transmission source by the abnormal SW (step S129), and ends the process shown in the flowchart.

[2.2.STORE DATAコマンドとWRITE BINARYコマンド]
[2.2.1.コマンドフォーマット]
次に、図6を用いて、STORE DATAコマンドと、WRITE BINARYコマンドのコマンドフォーマットについて説明する。なお、図6(A)はSTORE DATAコマンドのコマンドフォーマットの一例を示す図であり、図6(B)はWRITE BINARYコマンドのコマンドフォーマットの一例を示す図である。図6(A)に示すように、STORE DATAコマンドのコマンドフォーマットは、CLA部には「00h(固定)」、INS部には「20h(固定)」、P1部には「00h(固定)」、P2部には「00h(固定)」、Lc部にはData部の長さが設定され、Data部にはデータの書き込み先である不揮発性メモリ13上のアドレス(4バイト)と、書き込むデータ(任意のデータ長)が設定される。
[2.2. STORE DATA command and WRITE BINARY command]
[2.2.1. Command format]
Next, the command formats of the STORE DATA command and the WRITE BINARY command will be described with reference to FIG. Note that FIG. 6A is a diagram showing an example of the command format of the STORE DATA command, and FIG. 6B is a diagram showing an example of the command format of the WRITE BINARY command. As shown in FIG. 6A, the command format of the STORE DATA command is "00h (fixed)" for the CLA part, "20h (fixed)" for the INS part, and "00h (fixed)" for the P1 part. , "00h (fixed)" is set in the P2 section, the length of the Data section is set in the Lc section, and the address (4 bytes) on the non-volatile memory 13 to which the data is written is set in the Data section and the data to be written. (Arbitrary data length) is set.

一方、図6(B)に示すように、WRITE BINARYコマンドのコマンドフォーマットは、CLA部には「00h(固定)」、INS部には「30h(固定)」、P1部には「FID(File identifier)」、P2部には「FID」、Lc部にはData部の長さが設定され、Data部には書き込むデータ(任意のデータ長)が設定される。なお、P1部とP2部に設定されるFIDは、データの書き込み先である不揮発性メモリ13上のファイルを示す。 On the other hand, as shown in FIG. 6B, the command format of the WRITE BINARY command is "00h (fixed)" for the CLA part, "30h (fixed)" for the INS part, and "FID (File)" for the P1 part. "Identifier)", "FID" is set in the P2 part, the length of the Data part is set in the Lc part, and the data to be written (arbitrary data length) is set in the Data part. The FIDs set in the P1 part and the P2 part indicate a file on the non-volatile memory 13 to which the data is written.

すなわち、STORE DATAコマンドには、データの書き込み先であるアドレスが設定されているため、CPU10は、当該アドレスの示す記憶領域にデータを直接書き込むことができる。一方、WRITE BINARYコマンドには、データの書き込み先であるファイルが設定されているため、CPU10は、当該ファイルに基づいてデータの書き込み先であるアドレスを特定してから、当該特定したアドレスの示す記憶領域にデータを書き込む必要がある。その一方で、STORE DATAコマンドもWRITE BINARYコマンドも、データの書き込み先が確定すると、その後はデータを書き込む点で共通する。 That is, since the address to which the data is written is set in the STORE DATA command, the CPU 10 can directly write the data to the storage area indicated by the address. On the other hand, since the file to which the data is written is set in the WRITE BINARY command, the CPU 10 specifies the address to which the data is written based on the file, and then stores the specified address. You need to write data to the area. On the other hand, both the STORE DATA command and the WRITE BINARY command are common in that once the data writing destination is determined, the data is written thereafter.

なお、図6の例では、STORE DATAコマンドとWRITE BINARYコマンドにおけるCLA部に共通して「00h」が設定されるが、異なる値が設定されることとしてもよい。この場合、STORE DATAコマンドとWRITE BINARYコマンドのINS部に共通の値が設定されることとしてもよい。 In the example of FIG. 6, "00h" is set in common for the CLA part in the STORE DATA command and the WRITE BINARY command, but different values may be set. In this case, a common value may be set in the INS part of the STORE DATA command and the WRITE BINARY command.

[2.2.2.従来の処理フロー]
[2.2.2.1.STORE DATAコマンド受信時]
次に、図7を用いて、STORE DATAコマンドと、WRITE BINARYコマンドを受信した場合に実行される従来のコマンド実行用プログラムの処理例について説明する。なお、図7(A)は、STORE DATAコマンドに対応するコマンド実行用プログラムの従来処理例を示すフローチャートであり、図7(B)は、WRITE BINARYに対応するコマンド実行用プログラムの従来処理例を示すフローチャートである。
[2.2.2. Conventional processing flow]
[2.2.2.1. When receiving STORE DATA command]
Next, a processing example of a conventional command execution program executed when a STORE DATA command and a WRITE BINARY command are received will be described with reference to FIG. 7. Note that FIG. 7 (A) is a flowchart showing a conventional processing example of a command execution program corresponding to the STORE DATA command, and FIG. 7 (B) is a conventional processing example of a command execution program corresponding to LIGHT BINARY. It is a flowchart which shows.

図7(A)に示すように、STORE DATAコマンドを受信したICチップ1aのCPU10は、まず、CLA部にセットされている値をチェックする(ステップS201)。例えば、図6(A)に示すコマンドフォーマットであれば「00h」がセットされているかをチェックする。 As shown in FIG. 7A, the CPU 10 of the IC chip 1a that has received the STORE DATA command first checks the value set in the CLA unit (step S201). For example, in the case of the command format shown in FIG. 6A, it is checked whether "00h" is set.

次いで、CPU10は、INS部にセットされている値をチェックする(ステップS202)。例えば、図6(A)に示すコマンドフォーマットであれば「20h」がセットされているかをチェックする。 Next, the CPU 10 checks the value set in the INS unit (step S202). For example, in the case of the command format shown in FIG. 6A, it is checked whether "20h" is set.

次いで、CPU10は、Lc部にセットされている値とData部の長さとで整合性がとれているかチェックする(ステップS203)。なお、図示しないが、CPU10は、ステップS201〜ステップS203の処理におけるチェックの結果、正常でないと判定した場合には、コマンドの送信元に異常SWによる応答をし(ステップS208)、当該フローチャートに示す処理を終了する。 Next, the CPU 10 checks whether the value set in the Lc unit and the length of the Data unit are consistent (step S203). Although not shown, if the CPU 10 determines that the command is not normal as a result of the checks in the processes of steps S201 to S203, the CPU 10 responds to the command source by an abnormal SW (step S208), and is shown in the flowchart. End the process.

次に、CPU10は、Data部に設定されているアドレスを取得する(ステップS204)。 Next, the CPU 10 acquires the address set in the Data unit (step S204).

次に、CPU10は、ステップS204の処理で取得したアドレスに、Data部に設定されているデータを書き込む(ステップS205)。次いで、CPU10は、書き込みは成功か否かを判定する(ステップS206)。 Next, the CPU 10 writes the data set in the Data unit to the address acquired in the process of step S204 (step S205). Next, the CPU 10 determines whether or not the writing is successful (step S206).

CPU10は、書き込みが成功であると判定した場合には(ステップS206:YES)、コマンドの送信元に正常SWによる応答をし(ステップS207)、当該フローチャートに示す処理を終了する。一方、CPU10は、書き込みが成功でないと判定した場合には(ステップS206:NO)、コマンドの送信元に異常SWによる応答をし(ステップS208)、当該フローチャートに示す処理を終了する。 When the CPU 10 determines that the writing is successful (step S206: YES), the CPU 10 responds to the command source by the normal SW (step S207), and ends the process shown in the flowchart. On the other hand, when it is determined that the writing is not successful (step S206: NO), the CPU 10 responds to the command source by the abnormal SW (step S208), and ends the process shown in the flowchart.

[2.2.2.2.WRITE BINARYコマンド受信時]
一方、図7(B)に示すように、WRITE BINARYコマンドを受信したICチップ1aのCPU10は、まず、CLA部にセットされている値をチェックする(ステップS211)。例えば、図6(B)に示すコマンドフォーマットであれば「00h」がセットされているかをチェックする。
[2.2.2.2. When receiving the LIGHT BINARY command]
On the other hand, as shown in FIG. 7B, the CPU 10 of the IC chip 1a that has received the WRITE BINARY command first checks the value set in the CLA unit (step S211). For example, in the case of the command format shown in FIG. 6B, it is checked whether "00h" is set.

次いで、CPU10は、INS部にセットされている値をチェックする(ステップS212)。例えば、図6(B)に示すコマンドフォーマットであれば「30h」がセットされているかをチェックする。 Next, the CPU 10 checks the value set in the INS unit (step S212). For example, in the case of the command format shown in FIG. 6B, it is checked whether "30h" is set.

次いで、CPU10は、Lc部にセットされている値とData部の長さとで整合性がとれているかチェックする(ステップS213)。なお、図示しないが、CPU10は、ステップS211〜ステップS213の処理におけるチェックの結果、正常でないと判定した場合には、コマンドの送信元に異常SWによる応答をし(ステップS218)、当該フローチャートに示す処理を終了する。 Next, the CPU 10 checks whether the value set in the Lc unit and the length of the Data unit are consistent (step S213). Although not shown, if the CPU 10 determines that the command is not normal as a result of the checks in the processes of steps S211 to S213, the CPU 10 responds to the command source by an abnormal SW (step S218) and is shown in the flowchart. End the process.

次に、CPU10は、P1部、P2部に設定されているFIDに基づいてデータの書き込み先のアドレスを取得する(ステップS214)。 Next, the CPU 10 acquires the address of the data writing destination based on the FID set in the P1 unit and the P2 unit (step S214).

次に、CPU10は、ステップS214の処理で取得したアドレスに、Data部に設定されているデータを書き込む(ステップS215)。次いで、CPU10は、書き込みは成功か否かを判定する(ステップS216)。 Next, the CPU 10 writes the data set in the Data unit to the address acquired in the process of step S214 (step S215). Next, the CPU 10 determines whether or not the writing is successful (step S216).

CPU10は、書き込みが成功であると判定した場合には(ステップS216:YES)、コマンドの送信元に正常SWによる応答をし(ステップS217)、当該フローチャートに示す処理を終了する。一方、CPU10は、書き込みが成功でないと判定した場合には(ステップS216:NO)、コマンドの送信元に異常SWによる応答をし(ステップS218)、当該フローチャートに示す処理を終了する。 When the CPU 10 determines that the writing is successful (step S216: YES), the CPU 10 responds to the command source by the normal SW (step S217), and ends the process shown in the flowchart. On the other hand, when it is determined that the writing is not successful (step S216: NO), the CPU 10 responds to the command transmission source by the abnormal SW (step S218), and ends the process shown in the flowchart.

このように、STORE DATAコマンドと、WRITE BINARYコマンドを受信した場合の従来の処理例を比較すると、ステップS205〜ステップS208(ステップS215〜ステップS218)の処理が共通する。これは、STORE DATAコマンドと、WRITE BINARYコマンドの機能(不揮発性メモリ13にデータを書き込む機能)が共通することによる。そこで、本実施形態では、STORE DATAコマンドに対応するコマンド実行用プログラムと、WRITE BINARYコマンドに対応するコマンド実行用プログラムを共通化したコマンド実行用プログラムを作成して記憶させ、従来のSTORE DATAコマンドに対応するコマンド実行用プログラムと、WRITE BINARYコマンドに対応するコマンド実行用プログラムを記憶させないことにより不揮発性メモリ13の記憶領域を節約する。 As described above, comparing the conventional processing examples when the STORE DATA command and the LIGHT BINARY command are received, the processing of steps S205 to S208 (steps S215 to S218) is common. This is because the functions of the STORE DATA command and the WRITE BINARY command (the function of writing data to the non-volatile memory 13) are common. Therefore, in the present embodiment, a command execution program in which a command execution program corresponding to the STORE DATA command and a command execution program corresponding to the LIGHT BINARY command are shared is created and stored, and stored in the conventional STORE DATA command. The storage area of the non-volatile memory 13 is saved by not storing the corresponding command execution program and the command execution program corresponding to the LIGHT BINARY command.

[2.2.3.本実施形態の処理フロー]
以下、図8を用いて、共通化したコマンド実行用プログラムによる処理例について説明する。なお、図8は、STORE DATAコマンド及びWRITE BINARYコマンドに対応するコマンド実行用プログラムの処理例を示すフローチャートである。
[2.22.3. Processing flow of this embodiment]
Hereinafter, a processing example by the common command execution program will be described with reference to FIG. Note that FIG. 8 is a flowchart showing a processing example of a command execution program corresponding to the STORE DATA command and the WRITE BINARY command.

図8に示すように、ICチップ1aのCPU10は、まず、受信したコマンドがSTORE DATAコマンドであるか否かを判定する(ステップS221)。CPU10は、受信したコマンドがSTORE DATAコマンドであると判定した場合には(ステップS221:YES)、次いで、CLA部にセットされている値をチェックする(ステップS222)。例えば、図6(A)に示すコマンドフォーマットであれば「00h」がセットされているかをチェックする。 As shown in FIG. 8, the CPU 10 of the IC chip 1a first determines whether or not the received command is a STORE DATA command (step S221). When the CPU 10 determines that the received command is a STORE DATA command (step S221: YES), the CPU 10 then checks the value set in the CLA unit (step S222). For example, in the case of the command format shown in FIG. 6A, it is checked whether "00h" is set.

次いで、CPU10は、INS部にセットされている値をチェックする(ステップS223)。例えば、図6(A)に示すコマンドフォーマットであれば「20h」がセットされているかをチェックする。 Next, the CPU 10 checks the value set in the INS unit (step S223). For example, in the case of the command format shown in FIG. 6A, it is checked whether "20h" is set.

次いで、CPU10は、Lc部にセットされている値とData部の長さとで整合性がとれているかチェックする(ステップS224)。なお、図示しないが、CPU10は、ステップS222〜ステップS224の処理におけるチェックの結果、正常でないと判定した場合には、コマンドの送信元に異常SWによる応答をし(ステップS233)、当該フローチャートに示す処理を終了する。 Next, the CPU 10 checks whether the value set in the Lc unit and the length of the Data unit are consistent (step S224). Although not shown, if the CPU 10 determines that the command is not normal as a result of the check in the processes of steps S222 to S224, the CPU 10 responds to the command source by an abnormal SW (step S233), and is shown in the flowchart. End the process.

次に、CPU10は、Data部に設定されているアドレスを取得し(ステップS225)、ステップS230の処理に移行する。 Next, the CPU 10 acquires the address set in the Data unit (step S225), and proceeds to the process of step S230.

一方、CPU10は、受信したコマンドがSTORE DATAコマンドではないと判定した場合には(ステップS221:NO)、次いで、CLA部にセットされている値をチェックする(ステップS226)。例えば、図6(B)に示すコマンドフォーマットであれば「00h」がセットされているかをチェックする。 On the other hand, when the CPU 10 determines that the received command is not a STORE DATA command (step S221: NO), the CPU 10 then checks the value set in the CLA unit (step S226). For example, in the case of the command format shown in FIG. 6B, it is checked whether "00h" is set.

次いで、CPU10は、INS部にセットされている値をチェックする(ステップS227)。例えば、図6(B)に示すコマンドフォーマットであれば「30h」がセットされているかをチェックする。 Next, the CPU 10 checks the value set in the INS unit (step S227). For example, in the case of the command format shown in FIG. 6B, it is checked whether "30h" is set.

次いで、CPU10は、Lc部にセットされている値とData部の長さとで整合性がとれているかチェックする(ステップS228)。なお、図示しないが、CPU10は、ステップS226〜ステップS227の処理におけるチェックの結果、正常でないと判定した場合には、コマンドの送信元に異常SWによる応答をし(ステップS233)、当該フローチャートに示す処理を終了する。 Next, the CPU 10 checks whether the value set in the Lc unit and the length of the Data unit are consistent (step S228). Although not shown, if the CPU 10 determines that the command is not normal as a result of the checks in the processes of steps S226 to S227, the CPU 10 responds to the command source by an abnormal SW (step S233), and is shown in the flowchart. End the process.

次に、CPU10は、P1部、P2部に設定されているFIDに基づいてデータの書き込み先のアドレスを取得し(ステップS229)、ステップS230の処理に移行する。 Next, the CPU 10 acquires the address of the data writing destination based on the FID set in the P1 unit and the P2 unit (step S229), and proceeds to the process of step S230.

次に、CPU10は、ステップS225又はステップS229の処理で取得したアドレスに、Data部に設定されているデータを書き込む(ステップS230)。次いで、CPU10は、書き込みは成功か否かを判定する(ステップS231)。 Next, the CPU 10 writes the data set in the Data unit to the address acquired in the process of step S225 or step S229 (step S230). Next, the CPU 10 determines whether or not the writing is successful (step S231).

CPU10は、書き込みが成功であると判定した場合には(ステップS231:YES)、コマンドの送信元に正常SWによる応答をし(ステップS232)、当該フローチャートに示す処理を終了する。一方、CPU10は、書き込みが成功でないと判定した場合には(ステップS231:NO)、コマンドの送信元に異常SWによる応答をし(ステップS233)、当該フローチャートに示す処理を終了する。 When the CPU 10 determines that the writing is successful (step S231: YES), the CPU 10 responds to the command source by the normal SW (step S232), and ends the process shown in the flowchart. On the other hand, when it is determined that the writing is not successful (step S231: NO), the CPU 10 responds to the command transmission source by the abnormal SW (step S233), and ends the process shown in the flowchart.

[2.3.READ DATAコマンドとREAD BINARYコマンド]
[2.3.1.コマンドフォーマット]
次に、図9を用いて、READ DATAコマンドと、READ BINARYコマンドのコマンドフォーマットについて説明する。なお、図9(A)はREAD DATAコマンドのコマンドフォーマットの一例を示す図であり、図9(B)はREAD BINARYコマンドのコマンドフォーマットの一例を示す図である。図9(A)に示すように、READ DATAコマンドのコマンドフォーマットは、CLA部には「00h(固定)」、INS部には「40h(固定)」、P1部には「00h(固定)」、P2部には「00h(固定)」、Lc部には「08h(固定)」、Data部には読み出すデータの不揮発性メモリ13上の開始アドレス(4バイト)と終了アドレス(4バイト)が設定される。
[2.3. READ DATA command and READ BINARY command]
[2.3.1. Command format]
Next, the command formats of the READ DATA command and the READ BINARY command will be described with reference to FIG. Note that FIG. 9A is a diagram showing an example of the command format of the READ DATA command, and FIG. 9B is a diagram showing an example of the command format of the READ BINARY command. As shown in FIG. 9A, the command format of the READ DATA command is "00h (fixed)" for the CLA part, "40h (fixed)" for the INS part, and "00h (fixed)" for the P1 part. , P2 part has "00h (fixed)", Lc part has "08h (fixed)", and Data part has a start address (4 bytes) and an end address (4 bytes) on the non-volatile memory 13 of the data to be read. Set.

一方、図9(B)に示すように、READ BINARYコマンドのコマンドフォーマットは、CLA部には「00h(固定)」、INS部には「50h(固定)」、P1部には「FID(File identifier)」、P2部には「FID」が設定される。なお、P1部とP2部に設定されるFIDは、読み出すデータを含む、不揮発性メモリ13上のファイルを示す。 On the other hand, as shown in FIG. 9B, the command format of the READ BINARY command is "00h (fixed)" in the CLA part, "50h (fixed)" in the INS part, and "FID (File)" in the P1 part. "Identifier)", "FID" is set in the P2 part. The FIDs set in the P1 part and the P2 part indicate a file on the non-volatile memory 13 including the data to be read.

すなわち、READ DATAコマンドには、読み出すデータが記憶された領域を示すアドレスが設定されているため、CPU10は、当該アドレスの示す記憶領域からデータを読み出すことができる。一方、READ BINARYコマンドには、読み出すデータを含むファイルが設定されているため、CPU10は、当該ファイルに基づいて当該ファイルに含まれるデータの記憶領域を示すアドレスを特定してから、当該特定したアドレスの示す記憶領域に記憶されているデータを読み出す必要がある。その一方で、READ DATAコマンドもREAD BINARYコマンドも、読み出すデータが記憶されている記憶領域が特定されると、その後はデータを読み出す点で共通する。 That is, since the READ DATA command is set with an address indicating an area in which the data to be read is stored, the CPU 10 can read the data from the storage area indicated by the address. On the other hand, since a file including data to be read is set in the READ BINARY command, the CPU 10 specifies an address indicating a storage area of data included in the file based on the file, and then the specified address. It is necessary to read the data stored in the storage area indicated by. On the other hand, both the READ DATA command and the READ BINARY command are common in that once the storage area in which the data to be read is stored is specified, the data is read after that.

なお、図9の例では、READ DATAコマンドとREAD BINARYコマンドにおけるCLA部に共通して「00h」が設定されるが、異なる値が設定されることとしてもよい。この場合、READ DATAコマンドとREAD BINARYコマンドのINS部に共通の値が設定されることとしてもよい。 In the example of FIG. 9, "00h" is set in common for the CLA part in the READ DATA command and the READ BINARY command, but different values may be set. In this case, a common value may be set in the INS part of the READ DATA command and the READ BINARY command.

[2.3.2.従来の処理フロー]
[2.3.2.1.READ DATAコマンド受信時]
次に、図10を用いて、READ DATAコマンドと、READ BINARYコマンドを受信した場合に実行される従来のコマンド実行用プログラムの処理例について説明する。なお、図10(A)は、READ DATAコマンドに対応するコマンド実行用プログラムの従来処理例を示すフローチャートであり、図10(B)は、READ BINARYに対応するコマンド実行用プログラムの従来処理例を示すフローチャートである。
[2.3.3. Conventional processing flow]
[2.3.2.1. When receiving the READ DATA command]
Next, a processing example of a conventional command execution program executed when a READ DATA command and a READ BINARY command are received will be described with reference to FIG. Note that FIG. 10A is a flowchart showing a conventional processing example of a command execution program corresponding to the READ DATA command, and FIG. 10B is a conventional processing example of a command execution program corresponding to the READ BINARY. It is a flowchart which shows.

図10(A)に示すように、READ DATAコマンドを受信したICチップ1aのCPU10は、まず、CLA部にセットされている値をチェックする(ステップS301)。例えば、図9(A)に示すコマンドフォーマットであれば「00h」がセットされているかをチェックする。 As shown in FIG. 10A, the CPU 10 of the IC chip 1a that has received the READ DATA command first checks the value set in the CLA unit (step S301). For example, in the case of the command format shown in FIG. 9A, it is checked whether "00h" is set.

次いで、CPU10は、INS部にセットされている値をチェックする(ステップS302)。例えば、図9(A)に示すコマンドフォーマットであれば「40h」がセットされているかをチェックする。 Next, the CPU 10 checks the value set in the INS unit (step S302). For example, in the case of the command format shown in FIG. 9A, it is checked whether "40h" is set.

次いで、CPU10は、Lc部にセットされている値をチェックする(ステップS303)。例えば、図9(A)に示すコマンドフォーマットであれば「08h」がセットされているかをチェックする。なお、図示しないが、CPU10は、ステップS301〜ステップS303の処理におけるチェックの結果、正常でないと判定した場合には、コマンドの送信元に異常SWによる応答をし(ステップS308)、当該フローチャートに示す処理を終了する。 Next, the CPU 10 checks the value set in the Lc unit (step S303). For example, in the case of the command format shown in FIG. 9A, it is checked whether "08h" is set. Although not shown, if the CPU 10 determines that the command is not normal as a result of the checks in the processes of steps S301 to S303, the CPU 10 responds to the command source by an abnormal SW (step S308), and is shown in the flowchart. End the process.

次に、CPU10は、Data部に設定されている開始アドレスと終了アドレスを取得する(ステップS304)。 Next, the CPU 10 acquires the start address and the end address set in the Data unit (step S304).

次に、CPU10は、ステップS304の処理で取得した開始アドレスと終了アドレスで特定される記憶領域に記憶されているデータを取得する(ステップS305)。次いで、CPU10は、取得成功か否かを判定する(ステップS306)。 Next, the CPU 10 acquires the data stored in the storage area specified by the start address and the end address acquired in the process of step S304 (step S305). Next, the CPU 10 determines whether or not the acquisition is successful (step S306).

CPU10は、取得成功であると判定した場合には(ステップS306:YES)、コマンドの送信元に、ステップS305の処理で取得したデータ及び正常SWによる応答をし(ステップS307)、当該フローチャートに示す処理を終了する。一方、CPU10は、取得成功でないと判定した場合には(ステップS306:NO)、コマンドの送信元に異常SWによる応答をし(ステップS308)、当該フローチャートに示す処理を終了する。 When the CPU 10 determines that the acquisition is successful (step S306: YES), the CPU 10 responds to the command source with the data acquired in the process of step S305 and the normal SW (step S307), and is shown in the flowchart. End the process. On the other hand, when it is determined that the acquisition is not successful (step S306: NO), the CPU 10 responds to the command transmission source by the abnormal SW (step S308), and ends the process shown in the flowchart.

[2.3.2.2.READ BINARYコマンド受信時]
一方、図10(B)に示すように、READ BINARYコマンドを受信したICチップ1aのCPU10は、まず、CLA部にセットされている値をチェックする(ステップS311)。例えば、図9(B)に示すコマンドフォーマットであれば「00h」がセットされているかをチェックする。
[2.3.2.2. When receiving the READ BINARY command]
On the other hand, as shown in FIG. 10B, the CPU 10 of the IC chip 1a that has received the READ BINARY command first checks the value set in the CLA unit (step S311). For example, in the case of the command format shown in FIG. 9B, it is checked whether "00h" is set.

次いで、CPU10は、INS部にセットされている値をチェックする(ステップS312)。例えば、図9(B)に示すコマンドフォーマットであれば「50h」がセットされているかをチェックする。なお、図示しないが、CPU10は、ステップS311〜ステップS312の処理におけるチェックの結果、正常でないと判定した場合には、コマンドの送信元に異常SWによる応答をし(ステップS317)、当該フローチャートに示す処理を終了する。 Next, the CPU 10 checks the value set in the INS unit (step S312). For example, in the case of the command format shown in FIG. 9B, it is checked whether "50h" is set. Although not shown, if the CPU 10 determines that the command is not normal as a result of the checks in the processes of steps S311 to S312, the CPU 10 responds to the command source by an abnormal SW (step S317) and is shown in the flowchart. End the process.

次に、CPU10は、P1部、P2部に設定されているFIDに基づいて読み出すデータが記憶されている記憶領域を示す開始アドレス及び終了アドレスを取得する(ステップS313)。 Next, the CPU 10 acquires a start address and an end address indicating a storage area in which data to be read based on the FID set in the P1 unit and the P2 unit is stored (step S313).

次に、CPU10は、ステップS313の処理で取得した開始アドレスと終了アドレスで特定される記憶領域に記憶されているデータを取得する(ステップS314)。次いで、CPU10は、取得成功か否かを判定する(ステップS315)。 Next, the CPU 10 acquires the data stored in the storage area specified by the start address and the end address acquired in the process of step S313 (step S314). Next, the CPU 10 determines whether or not the acquisition is successful (step S315).

CPU10は、取得成功であると判定した場合には(ステップS315:YES)、コマンドの送信元に、ステップS314の処理で取得したデータ及び正常SWによる応答をし(ステップS316)、当該フローチャートに示す処理を終了する。一方、CPU10は、取得成功でないと判定した場合には(ステップS315:NO)、コマンドの送信元に異常SWによる応答をし(ステップS317)、当該フローチャートに示す処理を終了する。 When the CPU 10 determines that the acquisition is successful (step S315: YES), the CPU 10 responds to the command source with the data acquired in the process of step S314 and the normal SW (step S316), and is shown in the flowchart. End the process. On the other hand, when it is determined that the acquisition is not successful (step S315: NO), the CPU 10 responds to the command transmission source by the abnormal SW (step S317), and ends the process shown in the flowchart.

このように、READ DATAコマンドと、READ BINARYコマンドを受信した場合の従来の処理例を比較すると、ステップS305〜ステップS308(ステップS314〜ステップS317)の処理が共通する。これは、READ DATAコマンドと、READ BINARYコマンドの機能(不揮発性メモリ13にデータを読み出す機能)が共通することによる。そこで、本実施形態では、READ DATAコマンドに対応するコマンド実行用プログラムと、READ BINARYコマンドに対応するコマンド実行用プログラムを共通化したコマンド実行用プログラムを作成して記憶させ、従来のREAD DATAコマンドに対応するコマンド実行用プログラムと、READ BINARYコマンドに対応するコマンド実行用プログラムを記憶させないことにより不揮発性メモリ13の記憶領域を節約する。 As described above, comparing the conventional processing examples when the READ DATA command and the READ BINARY command are received, the processing of steps S305 to S308 (steps S314 to S317) is common. This is because the functions of the READ DATA command and the READ BINARY command (the function of reading data to the non-volatile memory 13) are common. Therefore, in the present embodiment, a command execution program in which a command execution program corresponding to the READ DATA command and a command execution program corresponding to the READ BINARY command are shared is created and stored, and stored in the conventional READ DATA command. The storage area of the non-volatile memory 13 is saved by not storing the corresponding command execution program and the command execution program corresponding to the READ BINARY command.

[2.3.3.本実施形態の処理フロー]
以下、図11を用いて、共通化したコマンド実行用プログラムによる処理例について説明する。なお、図11は、READ DATAコマンド及びREAD BINARYコマンドに対応するコマンド実行用プログラムの処理例を示すフローチャートである。
[2.3.3. Processing flow of this embodiment]
Hereinafter, a processing example by the common command execution program will be described with reference to FIG. Note that FIG. 11 is a flowchart showing a processing example of a command execution program corresponding to the READ DATA command and the READ BINARY command.

図11に示すように、ICチップ1aのCPU10は、まず、受信したコマンドがREAD DATAコマンドであるか否かを判定する(ステップS321)。CPU10は、受信したコマンドがREAD DATAコマンドであると判定した場合には(ステップS321:YES)、次いで、CLA部にセットされている値をチェックする(ステップS322)。例えば、図9(A)に示すコマンドフォーマットであれば「00h」がセットされているかをチェックする。 As shown in FIG. 11, the CPU 10 of the IC chip 1a first determines whether or not the received command is a READ DATA command (step S321). When the CPU 10 determines that the received command is a READ DATA command (step S321: YES), the CPU 10 then checks the value set in the CLA unit (step S322). For example, in the case of the command format shown in FIG. 9A, it is checked whether "00h" is set.

次いで、CPU10は、INS部にセットされている値をチェックする(ステップS323)。例えば、図9(A)に示すコマンドフォーマットであれば「40h」がセットされているかをチェックする。 Next, the CPU 10 checks the value set in the INS unit (step S323). For example, in the case of the command format shown in FIG. 9A, it is checked whether "40h" is set.

次いで、CPU10は、Lc部にセットされている値をチェックする(ステップS324)。例えば、図9(A)に示すコマンドフォーマットであれば「08h」がセットされているかをチェックする。なお、図示しないが、CPU10は、ステップS322〜ステップS324の処理におけるチェックの結果、正常でないと判定した場合には、コマンドの送信元に異常SWによる応答をし(ステップS332)、当該フローチャートに示す処理を終了する。 Next, the CPU 10 checks the value set in the Lc unit (step S324). For example, in the case of the command format shown in FIG. 9A, it is checked whether "08h" is set. Although not shown, if the CPU 10 determines that the command is not normal as a result of the check in the processes of steps S322 to S324, the CPU 10 responds to the command source by an abnormal SW (step S332) and is shown in the flowchart. End the process.

次に、CPU10は、Data部に設定されている開始アドレスと終了アドレスを取得し(ステップS325)、ステップS329の処理に移行する。 Next, the CPU 10 acquires the start address and end address set in the Data unit (step S325), and proceeds to the process of step S329.

一方、CPU10は、受信したコマンドがREAD DATAコマンドではないと判定した場合には(ステップS321:NO)、次いで、CLA部にセットされている値をチェックする(ステップS326)。例えば、図9(B)に示すコマンドフォーマットであれば「00h」がセットされているかをチェックする。 On the other hand, when the CPU 10 determines that the received command is not a READ DATA command (step S321: NO), the CPU 10 then checks the value set in the CLA unit (step S326). For example, in the case of the command format shown in FIG. 9B, it is checked whether "00h" is set.

次いで、CPU10は、INS部にセットされている値をチェックする(ステップS327)。例えば、図9(B)に示すコマンドフォーマットであれば「50h」がセットされているかをチェックする。なお、図示しないが、CPU10は、ステップS326〜ステップS327の処理におけるチェックの結果、正常でないと判定した場合には、コマンドの送信元に異常SWによる応答をし(ステップS332)、当該フローチャートに示す処理を終了する。 Next, the CPU 10 checks the value set in the INS unit (step S327). For example, in the case of the command format shown in FIG. 9B, it is checked whether "50h" is set. Although not shown, if the CPU 10 determines that the command is not normal as a result of the checks in the processes of steps S326 to S327, the CPU 10 responds to the command source by an abnormal SW (step S332) and is shown in the flowchart. End the process.

次に、CPU10は、P1部、P2部に設定されているFIDに基づいて読み出すデータが記憶されている記憶領域を示す開始アドレス及び終了アドレスを取得し(ステップS328)、ステップS329の処理に移行する。 Next, the CPU 10 acquires a start address and an end address indicating a storage area in which data to be read based on the FID set in the P1 unit and the P2 unit is stored (step S328), and proceeds to the process of step S329. To do.

次に、CPU10は、ステップS325又はステップS328の処理で取得した開始アドレスと終了アドレスで特定される記憶領域に記憶されているデータを取得する(ステップS329)。次いで、CPU10は、取得成功か否かを判定する(ステップS330)。 Next, the CPU 10 acquires the data stored in the storage area specified by the start address and the end address acquired in the process of step S325 or step S328 (step S329). Next, the CPU 10 determines whether or not the acquisition is successful (step S330).

CPU10は、取得成功であると判定した場合には(ステップS330:YES)、コマンドの送信元に、ステップS325又はステップS328の処理で取得したデータ及び正常SWによる応答をし(ステップS331)、当該フローチャートに示す処理を終了する。一方、CPU10は、取得成功でないと判定した場合には(ステップS330:NO)、コマンドの送信元に異常SWによる応答をし(ステップS332)、当該フローチャートに示す処理を終了する。 When the CPU 10 determines that the acquisition is successful (step S330: YES), the CPU 10 responds to the command source with the data acquired in the process of step S325 or step S328 and the normal SW (step S331). The process shown in the flowchart ends. On the other hand, when it is determined that the acquisition is not successful (step S330: NO), the CPU 10 responds to the command transmission source by the abnormal SW (step S332), and ends the process shown in the flowchart.

以上のように、本実施形態のICチップ1a(「電子情報記憶媒体」の一例)は、コマンドに対応するプログラムを記憶する不揮発性メモリ13(「記憶部」の一例)と、外部機器2から受信したコマンドに対応するコマンド実行用プログラム(「プログラム」の一例)を実行するCPU10(「実行部」の一例)と、を備え、不揮発性メモリ13は、発行前コマンド、及び、発行後コマンドの双方に対応する共通化したコマンド実行用プログラム(「所定のコマンド実行用プログラム」の一例)を記憶し、共通化したコマンド実行用プログラムは、発行前コマンドを受信した場合と発行後コマンドを受信した場合の双方で、共通に実行される処理(例えば、図5のステップS121〜ステップS123の処理、図8のステップS230〜ステップS233の処理、図11のステップS329〜ステップS332の処理)を含む。 As described above, the IC chip 1a (an example of the "electronic information storage medium") of the present embodiment is derived from the non-volatile memory 13 (an example of the "storage unit") for storing the program corresponding to the command and the external device 2. The non-volatile memory 13 includes a CPU 10 (an example of an "execution unit") that executes a command execution program (an example of a "program") corresponding to a received command, and the non-volatile memory 13 is a command before issuance and a command after issuance. A common command execution program (an example of a "predetermined command execution program") corresponding to both is stored, and the common command execution program receives a pre-issue command and a post-issue command. In both cases, the processes commonly executed (for example, the processes of steps S121 to S123 in FIG. 5, the processes of steps S230 to S233 in FIG. 8, and the processes of steps S329 to S332 in FIG. 11) are included.

したがって、本実施形態のICチップ1aによれば、不揮発性メモリ13が、発行前コマンド及び発行後コマンドの双方に対応する共通化したコマンド実行用プログラムであって、発行前コマンドを受信した場合と発行後コマンドを受信した場合の双方で、共通に実行される処理を含む共通化したコマンド実行用プログラムを記憶し、CPU10が、発行前コマンド及び発行後コマンドを受信した場合にコマンド実行用プログラムを実行する。すなわち、発行前コマンドと発行後コマンドについて、コマンド受信時に実行されるコマンド実行用プログラムを統合して共用化することにより、当該コマンド実行用プログラムを記憶する記憶領域を節約することができる。 Therefore, according to the IC chip 1a of the present embodiment, the non-volatile memory 13 is a common command execution program corresponding to both the pre-issue command and the post-issue command, and the case where the pre-issue command is received. A common command execution program including processes to be executed in common is stored in both cases when a post-issue command is received, and when the CPU 10 receives a pre-issue command and a post-issue command, the command execution program is stored. Execute. That is, the storage area for storing the command execution program can be saved by integrating and sharing the command execution program executed when the command is received for the pre-issue command and the post-issue command.

なお、図5を用いて説明した、共通化したコマンド実行用プログラムでは発行フラグ及び発行フラグを用いた判定(ステップS124)が追加される分だけソースコードのデータ量が増え、不揮発性メモリ13が記憶するデータ量は増えるが、コマンド実行用プログラムにおける処理(ステップS121〜ステップS123の処理)を統一することによるデータ削減量の方が大きい。特に、ステップS121〜ステップS123のチェック処理に係るソースコードのデータ量は多いため、当該チェック処理を共通化することによるデータ削減量の方が大きい。 In the common command execution program described with reference to FIG. 5, the amount of source code data is increased by the amount of the issuance flag and the determination using the issuance flag (step S124), and the non-volatile memory 13 is increased. Although the amount of data to be stored increases, the amount of data reduction by unifying the processes (processes of steps S121 to S123) in the command execution program is larger. In particular, since the amount of source code data related to the check processing in steps S121 to S123 is large, the amount of data reduction by standardizing the check processing is larger.

また、本実施形態のVERIFY(IS)コマンド(「発行前コマンド」の一例)のCLA部とVERIFY(USR)コマンド(「発行後コマンド」の一例)のCLA部、及び、VERIFY(IS)コマンドのINS部とVERIFY(USR)コマンドのINS部にはそれぞれ共通の値が設定され、共通化したコマンド実行用プログラムは、VERIFY(IS)コマンドのCLA部とVERIFY(USR)コマンドのCLA部に設定された値について共通に実行される処理(図5のステップS121の処理)、及び、VERIFY(IS)コマンドのINS部とVERIFY(USR)コマンドのINS部に設定された値について共通に実行される処理(図5のステップS122の処理)と、を含む。これにより、ステップS121及びステップS122で実行される処理を共用化することができ、コマンド実行用プログラムを記憶する記憶領域を節約することができる Further, the CLA part of the VERIFY (IS) command (an example of the "pre-issue command") of the present embodiment, the CLA part of the VERIFY (USR) command (an example of the "post-issue command"), and the VERIFY (IS) command. Common values are set in the INS part and the INS part of the VERIFY (USR) command, and the common command execution program is set in the CLA part of the VERIFY (IS) command and the CLA part of the VERIFY (USR) command. Processes that are commonly executed for the values (process in step S121 in FIG. 5) and processes that are commonly executed for the values set in the INS part of the VERIFY (IS) command and the INS part of the VERIFY (USR) command. (Processing in step S122 of FIG. 5) and. As a result, the processes executed in steps S121 and S122 can be shared, and the storage area for storing the command execution program can be saved.

更に、本実施形態のSTORE DATAコマンド(「発行前コマンド」の一例)のCLA部とWRITE BINARYコマンド(「発行後コマンド」の一例)のCLA部、又は、STORE DATAコマンドのINS部とWRITE BINARYコマンドのINS部の少なくとも何れか一方は異なる値が設定され、共通化したコマンド実行用プログラムは、STORE DATAコマンドを受信した場合とWRITE BINARYコマンドを受信した場合の双方で、不揮発性メモリ13に対して共通に実行される処理(図8のステップS230〜ステップS233の処理)を含む。これにより、不揮発性メモリ13に対して共通に実行される処理を共用化することができ、コマンド実行用プログラムを記憶する記憶領域を節約することができる。 Further, the CLA part of the STORE DATA command (an example of "pre-issuance command") and the CLA part of the WRITE command (an example of "post-issue command") of the present embodiment, or the INS part and WRITE BINARY command of the STORE DATA command. A different value is set for at least one of the INS parts of the above, and the common command execution program is for the non-volatile memory 13 both when the STORE DATA command is received and when the WRITE BINARY command is received. A commonly executed process (processes in steps S230 to S233 in FIG. 8) is included. As a result, the processes commonly executed for the non-volatile memory 13 can be shared, and the storage area for storing the command execution program can be saved.

更にまた、STORE DATAコマンド及びWRITE BINARYコマンドに対応する共通化したコマンド実行用プログラムにおいて不揮発性メモリ13に対して共通に実行される処理は、不揮発性メモリ13にデータを書き込む処理であり、より具体的には、STORE DATAコマンド及びWRITE BINARYコマンドにおけるData部に設定されているデータを、不揮発性メモリ13に書き込む処理である。これにより、不揮発性メモリ13にデータを書き込む処理(図8のステップS230〜ステップS233の処理)を共用化することができ、コマンド実行用プログラムを記憶する記憶領域を節約することができる。 Furthermore, the process commonly executed for the non-volatile memory 13 in the common command execution program corresponding to the STORE DATA command and the WRITE BINARY command is a process of writing data to the non-volatile memory 13, and is more specific. Specifically, it is a process of writing the data set in the Data unit in the STORE DATA command and the WRITE BINARY command to the non-volatile memory 13. As a result, the process of writing data to the non-volatile memory 13 (processes of steps S230 to S233 in FIG. 8) can be shared, and the storage area for storing the command execution program can be saved.

更にまた、本実施形態のREAD DATAコマンド(「発行前コマンド」の一例)のCLA部とREAD BINARYコマンド(「発行後コマンド」の一例)のCLA部、又は、READ DATAコマンドのINS部とREAD BINARYコマンドのINS部の少なくとも何れか一方は異なる値が設定され、共通化したコマンド実行用プログラムは、READ DATAコマンドを受信した場合とREAD BINARYコマンドを受信した場合の双方で、不揮発性メモリ13に対して共通に実行される処理(図11のステップS329〜ステップS332の処理)を含む。これにより、不揮発性メモリ13に対して共通に実行される処理(図11のステップS329〜ステップS332の処理)を共用化することができ、コマンド実行用プログラムを記憶する記憶領域を節約することができる。 Furthermore, the CLA part of the READ DATA command (an example of the "pre-issue command") and the CLA part of the READ BINARY command (an example of the "post-issue command") of the present embodiment, or the INS part and the READ BINARY of the READ DATA command. Different values are set for at least one of the INS parts of the command, and the common command execution program is for the non-volatile memory 13 both when the READ DATA command is received and when the READ BINARY command is received. The processes commonly executed (processes in steps S329 to S332 of FIG. 11) are included. As a result, the processes commonly executed for the non-volatile memory 13 (processes in steps S329 to S332 of FIG. 11) can be shared, and the storage area for storing the command execution program can be saved. it can.

更にまた、READ DATAコマンド及びREAD BINARYコマンドに対応する共通化したコマンド実行用プログラムにおいて不揮発性メモリ13に対して共通に実行される処理は、不揮発性メモリ13のデータを読み出す処理(図11のステップS329〜ステップS332の処理)である。これにより、不揮発性メモリ13のデータを読み出す処理(図11のステップS329〜ステップS332の処理)を共用化することができ、コマンド実行用プログラムを記憶する記憶領域を節約することができる。 Furthermore, the process commonly executed for the non-volatile memory 13 in the common command execution program corresponding to the READ DATA command and the READ BINARY command is the process of reading the data of the non-volatile memory 13 (step of FIG. 11). (Processing of S329 to S332). As a result, the process of reading the data of the non-volatile memory 13 (processes of steps S329 to S332 of FIG. 11) can be shared, and the storage area for storing the command execution program can be saved.

1 ICカード
1a ICチップ
10 CPU
11 RAM
12 ROM
13 不揮発性メモリ
14 I/O回路
2 外部機器
1 IC card 1a IC chip 10 CPU
11 RAM
12 ROM
13 Non-volatile memory 14 I / O circuit 2 External device

Claims (6)

コマンドに対応するプログラムを記憶する記憶部と、外部から受信した前記コマンドに対応する前記プログラムを実行する実行部と、を備える電子情報記憶媒体であって、
複数種類の前記コマンドには、前記電子情報記憶媒体の発行の前に受信する前記コマンドである発行前コマンド、及び、前記発行の後に受信するコマンドである発行後コマンドが含まれ、
前記記憶部は、
複数種類の前記コマンドのうち、前記電子情報記憶媒体に対して共通の処理を実行させる前記発行前コマンドと前記発行後コマンドからなる組に対応する所定のプログラムと、
前記電子情報記憶媒体が発行前か発行後かを示す発行情報と、
を記憶し、
前記所定のプログラムは、
前記組を構成する前記発行前コマンドを受信した場合と前記組を構成する前記発行後コマンドを受信した場合の双方で実行される前記共通の処理と、
前記発行情報が前記発行前を示している場合に実行される処理であって、前記組を構成する前記発行前コマンドに応じて実行される処理と、
前記発行情報が前記発行後を示している場合に実行される処理であって、前記組を構成する前記発行後コマンドに応じて実行される処理と、
を含むことを特徴とする電子情報記憶媒体。
An electronic information storage medium including a storage unit for storing a program corresponding to a command and an execution unit for executing the program corresponding to the command received from the outside.
The plurality of types of the commands include a pre-issuance command, which is a command received before the issuance of the electronic information storage medium, and a post-issue command, which is a command received after the issuance.
The storage unit
Among a plurality of types of said commands, a predetermined program corresponding to the set to be the pre-issuing command to perform common process to the electronic information storage medium from the after issuing the command,
Issuance information indicating whether the electronic information storage medium is before or after issuance, and
Remember,
The predetermined program
And said common processing which are executed in both the case of receiving the issued after the command to configure the set with the case of receiving the issued before command constituting the sets,
A process that is executed when the issue information indicates before the issue, and a process that is executed in response to the pre-issue command that constitutes the set.
A process that is executed when the issue information indicates the post-issue, and a process that is executed in response to the post-issue command that constitutes the set.
An electronic information storage medium comprising.
請求項1に記載の電子情報記憶媒体であって、
前記組を構成する前記発行前コマンドのCLA部と前記組を構成する前記発行後コマンドのCLA部、及び、前記組を構成する前記発行前コマンドのINS部と前記組を構成する前記発行後コマンドのINS部にはそれぞれ共通の値が設定され、
前記所定のプログラムは、前記組を構成する前記発行前コマンドのCLA部と前記組を構成する前記発行後コマンドのCLA部に設定された値について共通に実行される処理、及び、前記組を構成する前記発行前コマンドのINS部と前記組を構成する前記発行後コマンドのINS部に設定された値について共通に実行される処理と、を含むことを特徴とする電子情報記憶媒体。
The electronic information storage medium according to claim 1.
CLA portion of the issuing post commands that configure the set with CLA portion of said issued before command constituting the sets, and said after issuance command to configure the set with INS portion of said issued before command constituting the group Common values are set for each INS part of
The predetermined program constitutes a process commonly executed for a value set in the CLA part of the pre-issuance command constituting the set and the CLA part of the post-issuance command constituting the set, and the set. An electronic information storage medium comprising: a process commonly executed for a value set in the INS unit of the pre-issue command and the INS unit of the post-issue command constituting the set.
請求項1に記載の電子情報記憶媒体であって、
前記組を構成する前記発行前コマンドのCLA部と前記組を構成する前記発行後コマンドのCLA部、又は、前記組を構成する前記発行前コマンドのINS部と前記組を構成する前記発行後コマンドのINS部の少なくとも何れか一方は異なる値が設定され、
前記所定のプログラムは、前記組を構成する前記発行前コマンドを受信した場合と前記組を構成する前記発行後コマンドを受信した場合の双方で、前記記憶部に対して共通に実行される処理を含むことを特徴とする電子情報記憶媒体。
The electronic information storage medium according to claim 1.
CLA portion of the issuing post commands that configure the set with CLA portion of said issued before command constituting the group or the after issuance command to configure the set with INS portion of said issued before command constituting the group Different values are set for at least one of the INS parts of
The predetermined program performs processing that is commonly executed for the storage unit both when the pre-issuance command constituting the set is received and when the post-issue command constituting the set is received. An electronic information storage medium comprising.
請求項3に記載の電子情報記憶媒体であって、
前記記憶部に対して共通に実行される処理は、前記記憶部にデータを書き込む処理、又は、前記記憶部のデータを読み出す処理であることを特徴とする電子情報記憶媒体。
The electronic information storage medium according to claim 3.
An electronic information storage medium characterized in that a process commonly executed for the storage unit is a process of writing data to the storage unit or a process of reading data from the storage unit.
請求項4に記載の電子情報記憶媒体であって、
前記記憶部に対して共通に実行される処理は、前記組を構成する前記発行前コマンド及び前記組を構成する前記発行後コマンドにおけるData部に設定されているデータを前記記憶部に書き込む処理であることを特徴とする電子情報記憶媒体。
The electronic information storage medium according to claim 4.
It processing performed in common for the memory unit, the process of writing the data set in the Data part of the issuing post commands constituting the issue prior command and said set constituting the sets in the storage unit An electronic information storage medium characterized by being present.
請求項1乃至5の何れか一項に記載の電子情報記憶媒体を備えるICカード。 An IC card including the electronic information storage medium according to any one of claims 1 to 5.
JP2018045654A 2018-03-13 2018-03-13 Electronic information storage medium and IC card Active JP6904286B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2018045654A JP6904286B2 (en) 2018-03-13 2018-03-13 Electronic information storage medium and IC card

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2018045654A JP6904286B2 (en) 2018-03-13 2018-03-13 Electronic information storage medium and IC card

Publications (2)

Publication Number Publication Date
JP2019159799A JP2019159799A (en) 2019-09-19
JP6904286B2 true JP6904286B2 (en) 2021-07-14

Family

ID=67997043

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2018045654A Active JP6904286B2 (en) 2018-03-13 2018-03-13 Electronic information storage medium and IC card

Country Status (1)

Country Link
JP (1) JP6904286B2 (en)

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP3231467B2 (en) * 1993-03-24 2001-11-19 大日本印刷株式会社 Information recording medium with built-in CPU
JP3195122B2 (en) * 1993-04-26 2001-08-06 大日本印刷株式会社 Check method of instruction format given to IC card
JPH07175619A (en) * 1993-12-20 1995-07-14 Fujitsu Ltd Interactive data entry system
JP2002352205A (en) * 2001-05-29 2002-12-06 Toshiba Corp Portable electronic device and access management method
JP4457573B2 (en) * 2003-04-10 2010-04-28 凸版印刷株式会社 IC card and program writing method
JP4527434B2 (en) * 2004-04-16 2010-08-18 大日本印刷株式会社 Portable information storage medium and program thereof
JP4774681B2 (en) * 2004-05-18 2011-09-14 大日本印刷株式会社 Multi-application IC card with common command application

Also Published As

Publication number Publication date
JP2019159799A (en) 2019-09-19

Similar Documents

Publication Publication Date Title
US9418224B2 (en) Portable electronic device and control method of portable electronic device
US9183400B2 (en) IC card and IC card control method
EP2296108A1 (en) Portable electronic device and control method thereof
JPH07507896A (en) Reading data from smart card
US20090177921A1 (en) Portable electronic device and control method thereof
JP6904286B2 (en) Electronic information storage medium and IC card
CN112527341B (en) Vehicle system upgrading method, vehicle system and computer storage medium
JP3923546B2 (en) IC card
US20120234926A1 (en) Portable electronic apparatus
JP2008310596A (en) Portable electronic device and method for controlling portable electronic device
JP5892818B2 (en) Portable electronic device and control program for portable electronic device
JP2004192447A (en) IC card and IC card data management method
US20040133800A1 (en) Method of manufacturing smart cards
JP2005011147A (en) IC card and IC card program
JP6984328B2 (en) Electronic information storage medium, IC card, external device, data writing method and data writing program
JP7005934B2 (en) Electronic information storage medium, IC card, data transmission method, data writing method, data transmission program and data writing program
JP7619138B2 (en) Electronic information storage medium, processing method, and program
JP7438432B1 (en) Electronic information storage medium, IC chip, IC card, record writing method, and program
JP7420179B1 (en) Electronic information storage medium, IC card, issuance processing method, and program
JP2024139134A (en) Electronic information storage medium, IC chip, method for writing issuance data, and program
CN101326552A (en) Method of initializing and/or personalizing a portable data carrier
JP2019168944A (en) Electronic information storage medium, IC card, command group execution method, and command group execution program
JP2014203248A (en) Ic card, status word output method, and status word output processing program
US9672390B2 (en) IC card and command processing method for IC card
JP2006302130A (en) IC card and IC card program

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20201106

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20210216

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20210414

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20210607

R150 Certificate of patent or registration of utility model

Ref document number: 6904286

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150