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

Electronic information storage medium and IC card Download PDF

Info

Publication number
JP2019159799A
JP2019159799A JP2018045654A JP2018045654A JP2019159799A JP 2019159799 A JP2019159799 A JP 2019159799A JP 2018045654 A JP2018045654 A JP 2018045654A JP 2018045654 A JP2018045654 A JP 2018045654A JP 2019159799 A JP2019159799 A JP 2019159799A
Authority
JP
Japan
Prior art keywords
command
cpu
data
issue
post
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.)
Granted
Application number
JP2018045654A
Other languages
Japanese (ja)
Other versions
JP6904286B2 (en
Inventor
正剛 福永
Masatake Fukunaga
正剛 福永
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

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

Abstract

To provide an electronic information storage medium or the like capable of saving a storage area which stores a program by integrating and sharing the program executed at a command reception in regard to a pre-issuance command that is received before the issuance of the electronic information storage medium and a post-issuance command that is received after the issuance thereof.SOLUTION: A storage part is a prescribed program corresponding to both of a pre-issuance command and a post-issuance command and stores the prescribed program containing a processing commonly executed in both cases of receiving the pre-issuance command and receiving the post-issuance command. An execution part executes the prescribed program in the case of receiving the pre-issuance command and receiving the post-issuance command.SELECTED DRAWING: Figure 5

Description

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

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, a RAM, a nonvolatile 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, the CPU executes a process according to the command and transmits a SW (Status Word) related to the execution result as a response. For this reason, the nonvolatile memory of the electronic information storage medium stores a program (hereinafter, also referred to as “command execution program”) in which a process for the CPU to execute a series of processes according to a command is described. Yes.

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

特開2012−243133号公報JP 2012-243133 A

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

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

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

上記課題を解決するために、請求項1に記載の発明は、コマンドに対応するプログラムを記憶する記憶部と、外部から受信した前記コマンドに対応する前記プログラムを実行する実行部と、を備える電子情報記憶媒体であって、前記記憶部は、前記電子情報記憶媒体の発行の前に受信する前記コマンドである発行前コマンド、及び、前記発行の後に受信するコマンドである発行後コマンドの双方に対応する所定の前記プログラムを記憶し、前記所定のプログラムは、前記発行前コマンドを受信した場合と前記発行後コマンドを受信した場合の双方で、共通に実行される処理を含むことを特徴とする。   In order to solve the above problem, an invention according to claim 1 is an electronic device comprising: a storage unit that stores a program corresponding to a command; and an execution unit that executes the program corresponding to the command received from the outside. An information storage medium, wherein the storage unit supports both a pre-issue command, which is the command received before issuing the electronic information storage medium, and a post-issue command, which is a command received after the issue. The predetermined program is stored, and the predetermined program includes a process that is commonly executed both when the pre-issue command is received and when the post-issue command is received.

請求項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-issue command, the CLA part of the post-issue command, the INS part of the pre-issue command, and the A common value is set in each INS part of the post-issue command, and the predetermined program is executed in common for the values set in the CLA part of the pre-issue command and the CLA part of the post-issue command, And a process that is commonly executed for the values set in the INS part of the pre-issue command and the INS part of the post-issue command.

請求項3に記載の発明は、請求項1に記載の電子情報記憶媒体であって、前記発行前コマンドのCLA部と前記発行後コマンドのCLA部、又は、前記発行前コマンドのINS部と前記発行後コマンドのINS部の少なくとも何れか一方は異なる値が設定され、前記所定のプログラムは、前記発行前コマンドを受信した場合と前記発行後コマンドを受信した場合の双方で、前記記憶部に対して共通に実行される処理を含むことを特徴とする。   A third aspect of the present invention is the electronic information storage medium according to the first aspect, wherein the CLA part of the pre-issue command and the CLA part of the post-issue command, or the INS part of the pre-issue command and the A different value is set in at least one of the INS portions of the post-issue command, and the predetermined program stores the pre-issue command and the post-issue command in response to the storage unit. And processing executed in common.

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

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

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

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

本実施形態に係るICカード1に搭載されるICチップ1aのハードウェア構成例を示す図である。It is a figure which shows the hardware structural example of IC chip 1a mounted in the IC card 1 which concerns on this embodiment. 発行前コマンド及び発行後コマンドの一例を含むコマンド一覧である。It is a command list including an example of a command before issue and a command after issue. 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 process example of a command execution program corresponding to a VERIFY (IS) command, and (B) shows a conventional process 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 process example of the program for command execution corresponding to the VERIFY (IS) command and VERIFY (USR) command which concern on this embodiment. (A)はSTORE DATAコマンドのコマンドフォーマットの一例を示す図であり、(B)はWRITE BINARYコマンドのコマンドフォーマットの一例を示す図である。(A) is a figure which shows an example of the command format of a STORE DATA command, (B) is a figure which shows an example of the command format of a WRITE BINARY command. (A)は、STORE DATAコマンドに対応するコマンド実行用プログラムの従来処理例を示すフローチャートであり、(B)は、WRITE BINARYに対応するコマンド実行用プログラムの従来処理例を示すフローチャートである。(A) is a flowchart which shows the example of the conventional process of the command execution program corresponding to a STORE DATA command, (B) is a flowchart which shows the example of the conventional process of the command execution program corresponding to WRITE BINARY. 本実施形態に係るSTORE DATAコマンド及びWRITE BINARYコマンドに対応するコマンド実行用プログラムの処理例を示すフローチャートである。It is a flowchart which shows the process example of the program for command execution corresponding to the STORE DATA command and WRITE BINARY command which concern on this embodiment. (A)はREAD DATAコマンドのコマンドフォーマットの一例を示す図であり、(B)はREAD BINARYコマンドのコマンドフォーマットの一例を示す図である。(A) is a figure which shows an example of the command format of a READ DATA command, (B) is a figure which shows an example of the command format of a READ BINARY command. (A)は、READ DATAコマンドに対応するコマンド実行用プログラムの従来処理例を示すフローチャートであり、(B)は、READ BINARYに対応するコマンド実行用プログラムの従来処理例を示すフローチャートである。(A) is a flowchart which shows the example of the conventional process of the command execution program corresponding to a READ DATA command, (B) is a flowchart which shows the example of the conventional process of the command execution program corresponding to READ BINARY. 本実施形態に係るREAD DATAコマンド及びREAD BINARYコマンドに対応するコマンド実行用プログラムの処理例を示すフローチャートである。It is a flowchart which shows the process example of the program for command execution corresponding to the READ DATA command and READ BINARY command which concern 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 illustrating a hardware configuration example of an IC chip 1 a mounted on the IC card 1. The IC card 1 of the present embodiment is a dual interface type IC card that has two communication functions of data communication by contact and data communication by non-contact. 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 that incorporates an antenna coil and wirelessly communicates 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 1 a includes a CPU (Central Processing Unit) 10, a RAM (Random Access Memory) 11, a ROM (Read Only Memory) 12, a nonvolatile memory 13, and an I / O circuit 14. Composed. The CPU 10 is a processor (computer) that executes various programs stored in the ROM 12 or the nonvolatile 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 or without contact with the external device 2 including the reader / writer. In the case of the contact type IC chip 1a, the I / O circuit 14 includes, for example, eight terminals C1 to C8. For example, the C1 terminal communicates with the power supply terminal (terminal for supplying power to the IC chip 1a), the C2 terminal with the reset terminal, the C3 terminal with the clock terminal, the C5 terminal with the ground terminal, and the C7 terminal with the external device 2. Terminal. On the other hand, in the case of the non-contact type IC chip 1a, the I / O circuit 14 includes, for example, an antenna and a modulation / demodulation circuit. Note that 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 nonvolatile memory 13 is configured by, for example, a flash memory or “Electrically Erasable Programmable Read-Only Memory”, and stores an OS, various applications, and data used by these. A part of the OS may be stored in the nonvolatile memory 13 and the other part may be stored in the ROM 12. The nonvolatile memory 13 also includes a command execution program including a process for the OS to execute a process according to the command when the 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 receiving a command from the external device 2, the CPU 10 executes a command execution program corresponding to the command and transmits the SW to the external device 2 as a response. Conventionally, commands include pre-issue commands and post-issue commands, and there are similar commands for pre-issue commands and post-issue commands. Some of the processes included in the corresponding command execution programs are common. Here, an example of them 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, a VERIFY (IS) command, which is a pre-issue command for authenticating an issuer, and a VERIFY (USR) command, which is a post-issue command for authenticating a user, are used for corresponding command execution. Some processes included in the program are common. Further, a STORE DATA command that is a pre-issue command for writing data to the nonvolatile memory 13 and a WRITE BINARY command that is a post-issue command for writing data to a file are included in the corresponding command execution programs. The processing of the part is common. Furthermore, a READ DATA command, which is a pre-issue command for reading data for the purpose of confirming that data has been correctly written, and a READ BINARY command, which is a post-issue command for reading file data, are 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 format of the VERIFY (IS) command and the VERIFY (USR) command will be described with reference to FIG. FIG. 3 shows an example of the command format 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, any command is “00h (fixed)” in the CLA part, “10h (fixed)” in the INS part, “00h (fixed)” in the P1 part, and “00h (fixed)” in the P2 part. , “01h” to “10h” are set in the Lc portion, and the PIN (Personal Identification Number) is used for authentication in the Data portion, and the issuer PIN (Personal Identification Number) is used in the Data portion, and the VERIFY (USR) command is used. Each user PIN) is set.

[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 VERIFY (IS) command is received]
Next, a processing example of a conventional command execution program executed when a VERIFY (IS) command and a VERIFY (USR) command are received will be described with reference to FIG. 4A is a flowchart showing a conventional process 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 example of conventional processing.

図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 or not there is consistency between the value set in the Lc portion and the length of the Data portion (step S103).

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

次に、CPU10は、Data部に設定されている発行者のPINに基づく認証を行う(ステップS104)。次いで、CPU10は、認証結果が一致か否かを判定する(ステップS105)。   Next, the CPU 10 performs authentication based on the issuer's PIN set in the Data section (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)、当該フローチャートに示す処理を終了する。   If the CPU 10 determines that the authentication results are the same (step S105: YES), the CPU 10 sets the issuer authenticated as the authentication result (step S106), and indicates the SW that indicates normality as the command transmission source (“normal SW”). ]) (Step S107), and the process shown in the flowchart is terminated. On the other hand, if the CPU 10 determines that the authentication results do not match (step S105: NO), the CPU 10 responds to the command transmission source by the abnormal SW (step S108) and ends the processing 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 a VERIFY (USR) command is received]
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 or not there is consistency between the value set in the Lc portion and the length of the Data portion (step S113).

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

次に、CPU10は、Data部に設定されているユーザのPINに基づく認証を行う(ステップS114)。次いで、CPU10は、認証結果が一致か否かを判定する(ステップS115)。   Next, the CPU 10 performs authentication based on the user's PIN set in the Data section (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)、当該フローチャートに示す処理を終了する。   If 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 with a normal SW to the command transmission source (step S117). ), The process shown in the flowchart is terminated. On the other hand, if the CPU 10 determines that the authentication results do not match (step S115: NO), the CPU 10 responds to the command transmission source by the abnormal SW (step S118), and ends the processing 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, when the VERIFY (IS) command and the conventional processing example when the VERIFY (USR) command is received are compared, the processes in steps S101 to S103 (steps S111 to S113) are common. This is based on the common command format of the VERIFY (IS) command and the VERIFY (USR) command. Therefore, in this 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 made common and created is stored. The storage area of the nonvolatile 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 using a common command execution program will be described with reference to FIG. 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 or not there is consistency between the value set in the Lc portion and the length of Data (step S123). Although not shown in the figure, when the CPU 10 determines that the result of the check in steps S121 to S123 is not normal, the CPU 10 responds to the command source with 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 processing in steps S121 to S123 is the same as the processing in steps S101 to S103 in FIG. 4A (steps S111 to S113 in FIG. 4B).

次に、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 IC card 1 has not been issued, and is set to “OFF” if the IC card 1 has been issued. If the CPU 10 determines that the issuance flag is on (before issuance) (step S124: YES), the CPU 10 performs authentication based on the issuer's PIN set in the Data section (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)、当該フローチャートに示す処理を終了する。   If the CPU 10 determines that the authentication results are identical (step S126: YES), the CPU 10 sets the issuer authenticated as the authentication result (step S127), and replies with a normal SW to the command transmission source (step S127). S128), the process shown in the flowchart is terminated. On the other hand, if 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 processing shown in the flowchart.

一方、CPU10は、発行フラグがオンでない(発行後である)と判定した場合には(ステップS124:NO)、Data部に設定されているユーザのPINに基づく認証を行う(ステップS130)。次いで、CPU10は、認証結果が一致か否かを判定する(ステップS131)。   On the other hand, if the CPU 10 determines that the issue flag is not on (after issue) (step S124: NO), the CPU 10 performs authentication based on the user's PIN set in the Data section (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)、当該フローチャートに示す処理を終了する。   If 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 with a normal SW to the command transmission source (step S133). ), The process shown in the flowchart is terminated. On the other hand, if 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 processing 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 format of the STORE DATA command and the WRITE BINARY command will be described with reference to FIG. 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 portion, the length of the Data portion is set in the Lc portion, the address (4 bytes) on the nonvolatile memory 13 that is the data write destination, and the data to be written in the Data portion (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 ”in the P2 part, the length of the Data part is set in the Lc part, and data to be written (arbitrary data length) is set in the Data part. The FID set in the P1 part and the P2 part indicates a file on the nonvolatile memory 13 to which data is written.

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

なお、図6の例では、STORE DATAコマンドとWRITE BINARYコマンドにおけるCLA部に共通して「00h」が設定されるが、異なる値が設定されることとしてもよい。この場合、STORE DATAコマンドとWRITE BINARYコマンドのINS部に共通の値が設定されることとしてもよい。   In the example of FIG. 6, “00h” is set in common in the CLA portion 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 a STORE DATA command is received]
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. 7A is a flowchart showing an example of conventional processing of a command execution program corresponding to the STORE DATA command, and FIG. 7B is an example of conventional processing of a command execution program corresponding to WRITE BINARY. It is a flowchart to show.

図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 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 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 or not there is consistency between the value set in the Lc portion and the length of the Data portion (step S203). Although not shown, when the CPU 10 determines that the result of the check in steps S201 to S203 is not normal, the CPU 10 responds to the command source with an abnormal SW (step S208), and is shown in the flowchart. End the process.

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

次に、CPU10は、ステップS204の処理で取得したアドレスに、Data部に設定されているデータを書き込む(ステップS205)。次いで、CPU10は、書き込みは成功か否かを判定する(ステップS206)。   Next, the CPU 10 writes the data set in the Data portion 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)、当該フローチャートに示す処理を終了する。   If the CPU 10 determines that the writing is successful (step S206: YES), the CPU 10 responds to the command transmission source with the normal SW (step S207) and ends the processing shown in the flowchart. On the other hand, when the CPU 10 determines that the writing is not successful (step S206: NO), the CPU 10 responds to the command transmission source by the abnormal SW (step S208), and ends the processing 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 a WRITE BINARY command is received]
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 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 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 or not there is consistency between the value set in the Lc portion and the length of the Data portion (step S213). Although not shown in the figure, when the CPU 10 determines that the result of the check in steps S211 to S213 is not normal, the CPU 10 responds to the command transmission 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 write destination based on the FID set in the P1 part and the P2 part (step S214).

次に、CPU10は、ステップS214の処理で取得したアドレスに、Data部に設定されているデータを書き込む(ステップS215)。次いで、CPU10は、書き込みは成功か否かを判定する(ステップS216)。   Next, the CPU 10 writes the data set in the Data section 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)、当該フローチャートに示す処理を終了する。   If the CPU 10 determines that the writing is successful (step S216: YES), the CPU 10 responds to the command transmission source with the normal SW (step S217), and ends the processing shown in the flowchart. On the other hand, if the CPU 10 determines 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 processing 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, when the STORE DATA command and the conventional processing example when the WRITE BINARY command is received are compared, the processing of step S205 to step S208 (step S215 to step S218) is common. This is because the functions of the STORE DATA command and the WRITE BINARY command (the function of writing data in the nonvolatile memory 13) are common. Therefore, in this 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 WRITE BINARY command are created and stored is stored in the conventional STORE DATA command. The storage area of the nonvolatile memory 13 is saved by not storing the corresponding command execution program and the command execution program corresponding to the WRITE BINARY command.

[2.2.3.本実施形態の処理フロー]
以下、図8を用いて、共通化したコマンド実行用プログラムによる処理例について説明する。なお、図8は、STORE DATAコマンド及びWRITE BINARYコマンドに対応するコマンド実行用プログラムの処理例を示すフローチャートである。
[2.2.3. Processing flow of this embodiment]
Hereinafter, a processing example using a common command execution program will be described with reference to FIG. 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). If 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 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 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 or not there is consistency between the value set in the Lc portion and the length of the Data portion (step S224). Although not shown, if the CPU 10 determines that the result of the check in steps S222 to S224 is not normal, the CPU 10 responds to the command source with 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 section (step S225), and proceeds to the process of step S230.

一方、CPU10は、受信したコマンドがSTORE DATAコマンドではないと判定した場合には(ステップS221:NO)、次いで、CLA部にセットされている値をチェックする(ステップS226)。例えば、図6(B)に示すコマンドフォーマットであれば「00h」がセットされているかをチェックする。   On the other hand, if the CPU 10 determines that the received command is not a STORE DATA command (step S221: NO), the CPU 10 checks the value set in the CLA unit (step S226). For example, in 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 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 or not there is consistency between the value set in the Lc portion and the length of the Data portion (step S228). Although not shown in the figure, if the CPU 10 determines that the result of the check in steps S226 to S227 is not normal, the CPU 10 responds to the command source with 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 write destination based on the FID set in the P1 part and the P2 part (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 portion 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)、当該フローチャートに示す処理を終了する。   If the CPU 10 determines that the writing is successful (step S231: YES), the CPU 10 responds to the command transmission source with the normal SW (step S232) and ends the processing shown in the flowchart. On the other hand, if the CPU 10 determines 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 processing 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 format of the READ DATA command and the READ BINARY command will be described with reference to FIG. 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. , “00h (fixed)” in the P2 portion, “08h (fixed)” in the Lc portion, and the start address (4 bytes) and the end address (4 bytes) on the nonvolatile memory 13 of the data to be read out in the Data portion Is 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)” for the CLA part, “50h (fixed)” for the INS part, and “FID (File) for the P1 part. identifier) ”and“ FID ”are set in the P2 part. The FID set in the P1 part and the P2 part indicates a file on the non-volatile memory 13 that includes data to be read.

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

なお、図9の例では、READ DATAコマンドとREAD BINARYコマンドにおけるCLA部に共通して「00h」が設定されるが、異なる値が設定されることとしてもよい。この場合、READ DATAコマンドとREAD BINARYコマンドのINS部に共通の値が設定されることとしてもよい。   In the example of FIG. 9, “00h” is set in common in 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.2. Conventional processing flow]
[2.3.2.1. When a READ DATA command is received]
Next, a processing example of a conventional command execution program that is executed when a READ DATA command and a READ BINARY command are received will be described with reference to FIG. 10A is a flowchart showing an example of conventional processing of a command execution program corresponding to a READ DATA command, and FIG. 10B is an example of conventional processing of a command execution program corresponding to READ BINARY. It is a flowchart to show.

図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 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 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 part (step S303). For example, in the command format shown in FIG. 9A, it is checked whether “08h” is set. Although not shown, when the CPU 10 determines that the result of the check in steps S301 to S303 is not normal, the CPU 10 responds to the command source with an abnormal SW (step S308) and is shown in the flowchart. End the process.

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

次に、CPU10は、ステップS304の処理で取得した開始アドレスと終了アドレスで特定される記憶領域に記憶されているデータを取得する(ステップS305)。次いで、CPU10は、取得成功か否かを判定する(ステップS306)。   Next, the CPU 10 acquires data stored in the storage area specified by the start address and 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)、当該フローチャートに示す処理を終了する。   If 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 step S305 and the normal SW (step S307), and is shown in the flowchart. End the process. On the other hand, if the CPU 10 determines 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 processing 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 READ BINARY command is received]
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 section (step S311). For example, in 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 command format shown in FIG. 9B, it is checked whether “50h” is set. Although not shown, when the CPU 10 determines that the result of the check in steps S311 to S312 is not normal, the CPU 10 responds to the command source with 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 is stored based on the FID set in the P1 part and the P2 part (step S313).

次に、CPU10は、ステップS313の処理で取得した開始アドレスと終了アドレスで特定される記憶領域に記憶されているデータを取得する(ステップS314)。次いで、CPU10は、取得成功か否かを判定する(ステップS315)。   Next, the CPU 10 acquires data stored in the storage area specified by the start address and 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)、当該フローチャートに示す処理を終了する。   If 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 step S314 and the normal SW (step S316), and is shown in the flowchart. End the process. On the other hand, if the CPU 10 determines 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 processing 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, when the conventional processing example when the READ DATA command and the READ BINARY command are received is compared, the processes in steps S305 to S308 (steps S314 to S317) are common. This is because the functions of the READ DATA command and the READ BINARY command (the function of reading data into the nonvolatile memory 13) are common. Therefore, in this embodiment, a command execution program in which the command execution program corresponding to the READ DATA command and the command execution program corresponding to the READ BINARY command are created and stored is 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 using a common command execution program will be described with reference to FIG. 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). If the CPU 10 determines that the received command is a READ DATA command (step S321: YES), it next checks the value set in the CLA unit (step S322). For example, in 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 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 portion (step S324). For example, in the command format shown in FIG. 9A, it is checked whether “08h” is set. Although not shown, if the CPU 10 determines that the result of the check in steps S322 to S324 is not normal, the CPU 10 responds to the command source with an abnormal SW (step S332), and is shown in the flowchart. End the process.

次に、CPU10は、Data部に設定されている開始アドレスと終了アドレスを取得し(ステップS325)、ステップS329の処理に移行する。   Next, the CPU 10 acquires a start address and an end address set in the Data section (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 checks the value set in the CLA unit (step S326). For example, in 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 command format shown in FIG. 9B, it is checked whether “50h” is set. Although not shown in the figure, when the CPU 10 determines that the result of the check in steps S326 to S327 is not normal, the CPU 10 responds to the command transmission source by an abnormal SW (step S332), and is shown in the flowchart. The process ends.

次に、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 is stored based on the FID set in the P1 part and the P2 part (step S328), and proceeds to the process of step S329. To do.

次に、CPU10は、ステップS325又はステップS328の処理で取得した開始アドレスと終了アドレスで特定される記憶領域に記憶されているデータを取得する(ステップS329)。次いで、CPU10は、取得成功か否かを判定する(ステップS330)。   Next, the CPU 10 acquires 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 determining that the acquisition is successful (step S330: YES), the CPU 10 responds to the command transmission 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 determining 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”) according to the present embodiment includes the nonvolatile memory 13 (an example of the “storage unit”) that stores the program corresponding to the command and the external device 2. And a CPU 10 (an example of an “execution unit”) that executes a command execution program (an example of a “program”) corresponding to the received command, and the nonvolatile memory 13 includes a pre-issue command and a post-issue command. A common command execution program (an example of a “predetermined command execution program”) corresponding to both is stored, and the common command execution program has received a pre-issue command and a post-issue command. In both cases, the processes executed in common (for example, the processes in steps S121 to S123 in FIG. 5 and the processes in steps S230 to S123 in FIG. Processing-up S233, including the processing of step S329~ step S332 of FIG. 11).

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

なお、図5を用いて説明した、共通化したコマンド実行用プログラムでは発行フラグ及び発行フラグを用いた判定(ステップS124)が追加される分だけソースコードのデータ量が増え、不揮発性メモリ13が記憶するデータ量は増えるが、コマンド実行用プログラムにおける処理(ステップS121〜ステップS123の処理)を統一することによるデータ削減量の方が大きい。特に、ステップS121〜ステップS123のチェック処理に係るソースコードのデータ量は多いため、当該チェック処理を共通化することによるデータ削減量の方が大きい。   In the common command execution program described with reference to FIG. 5, the amount of data in the source code is increased by the addition of the issue flag and the determination using the issue flag (step S124). Although the amount of data to be stored increases, the amount of data reduction by unifying the processing in the command execution program (steps S121 to S123) is larger. In particular, since the amount of data of the source code related to the check processing in steps S121 to S123 is large, the amount of data reduction by sharing 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で実行される処理を共用化することができ、コマンド実行用プログラムを記憶する記憶領域を節約することができる   In addition, the CLA part of the VERIFY (IS) command (an example of “command before issue”), the CLA part of the VERIFY (USR) command (an example of “command after issue”), and the VERIFY (IS) command of this embodiment A common value is set in each of 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. The processing executed in common for the values (the processing in step S121 in FIG. 5) and the processing executed in common for the values set in the INS portion of the VERIFY (IS) command and the INS portion of the VERIFY (USR) command (The process of step S122 in FIG. 5). As a result, the processing 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 and WRITE BINARY command (an example of “post-issue command”) of the STORE DATA command (an example of “pre-issue command”) or the INS part and the WRITE BINARY command of the STORE DATA command of the present embodiment. A different value is set in at least one of the INS sections of the INS section, and the common command execution program is stored in the nonvolatile memory 13 both when the STORE DATA command is received and when the WRITE BINARY command is received. This includes the processes that are executed in common (the processes in steps S230 to S233 in FIG. 8). As a result, it is possible to share the processing that is commonly executed for the nonvolatile memory 13 and to save the storage area for storing the command execution program.

更にまた、STORE DATAコマンド及びWRITE BINARYコマンドに対応する共通化したコマンド実行用プログラムにおいて不揮発性メモリ13に対して共通に実行される処理は、不揮発性メモリ13にデータを書き込む処理であり、より具体的には、STORE DATAコマンド及びWRITE BINARYコマンドにおけるData部に設定されているデータを、不揮発性メモリ13に書き込む処理である。これにより、不揮発性メモリ13にデータを書き込む処理(図8のステップS230〜ステップS233の処理)を共用化することができ、コマンド実行用プログラムを記憶する記憶領域を節約することができる。   Furthermore, the process that is commonly executed on the nonvolatile 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 nonvolatile memory 13, and more specifically. Specifically, this is a process of writing the data set in the Data section in the STORE DATA command and the WRITE BINARY command to the nonvolatile memory 13. This makes it possible to share the process of writing data to the nonvolatile memory 13 (the process of steps S230 to S233 in FIG. 8), and saves a storage area for storing the command execution program.

更にまた、本実施形態の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”), or the INS part and the READ BINARY of the READ DATA command of the present embodiment. A different value is set in at least one of the INS parts of the command, and the common command execution program is stored in the nonvolatile memory 13 both when the READ DATA command is received and when the READ BINARY command is received. And processes executed in common (the processes in steps S329 to S332 in FIG. 11). As a result, it is possible to share the processing executed in common with respect to the nonvolatile memory 13 (the processing from step S329 to step S332 in FIG. 11), and to save the storage area for storing the command execution program. it can.

更にまた、READ DATAコマンド及びREAD BINARYコマンドに対応する共通化したコマンド実行用プログラムにおいて不揮発性メモリ13に対して共通に実行される処理は、不揮発性メモリ13のデータを読み出す処理(図11のステップS329〜ステップS332の処理)である。これにより、不揮発性メモリ13のデータを読み出す処理(図11のステップS329〜ステップS332の処理)を共用化することができ、コマンド実行用プログラムを記憶する記憶領域を節約することができる。   Furthermore, the process that is commonly executed for the nonvolatile memory 13 in the common command execution program corresponding to the READ DATA command and the READ BINARY command is a process of reading data from the nonvolatile memory 13 (step of FIG. 11). S329 to step S332). As a result, the process of reading data from the nonvolatile memory 13 (the process of steps S329 to S332 in 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 Nonvolatile Memory 14 I / O Circuit 2 External Device

Claims (6)

コマンドに対応するプログラムを記憶する記憶部と、外部から受信した前記コマンドに対応する前記プログラムを実行する実行部と、を備える電子情報記憶媒体であって、
前記記憶部は、前記電子情報記憶媒体の発行の前に受信する前記コマンドである発行前コマンド、及び、前記発行の後に受信するコマンドである発行後コマンドの双方に対応する所定の前記プログラムを記憶し、
前記所定のプログラムは、前記発行前コマンドを受信した場合と前記発行後コマンドを受信した場合の双方で、共通に実行される処理を含むことを特徴とする電子情報記憶媒体。
An electronic information storage medium comprising: a storage unit that stores a program corresponding to a command; and an execution unit that executes the program corresponding to the command received from the outside,
The storage unit stores the predetermined program corresponding to both a pre-issue command that is the command received before issuing the electronic information storage medium and a post-issue command that is a command received after the issue. And
2. The electronic information storage medium according to claim 1, wherein the predetermined program includes a process that is commonly executed both when the pre-issue command is received and when the post-issue command is received.
請求項1に記載の電子情報記憶媒体であって、
前記発行前コマンドのCLA部と前記発行後コマンドのCLA部、及び、前記発行前コマンドのINS部と前記発行後コマンドのINS部にはそれぞれ共通の値が設定され、
前記所定のプログラムは、前記発行前コマンドのCLA部と前記発行後コマンドのCLA部に設定された値について共通に実行される処理、及び、前記発行前コマンドのINS部と前記発行後コマンドのINS部に設定された値について共通に実行される処理と、を含むことを特徴とする電子情報記憶媒体。
The electronic information storage medium according to claim 1,
Common values are set in the CLA part of the pre-issue command and the CLA part of the post-issue command, and the INS part of the pre-issue command and the INS part of the post-issue command,
The predetermined program includes processing executed in common for values set in the CLA part of the pre-issue command and the CLA part of the post-issue command, and the INS part of the pre-issue command and the INS of the post-issue command An electronic information storage medium comprising: a process executed in common with respect to a value set in the section.
請求項1に記載の電子情報記憶媒体であって、
前記発行前コマンドのCLA部と前記発行後コマンドのCLA部、又は、前記発行前コマンドのINS部と前記発行後コマンドのINS部の少なくとも何れか一方は異なる値が設定され、
前記所定のプログラムは、前記発行前コマンドを受信した場合と前記発行後コマンドを受信した場合の双方で、前記記憶部に対して共通に実行される処理を含むことを特徴とする電子情報記憶媒体。
The electronic information storage medium according to claim 1,
A different value is set in at least one of the CLA portion of the pre-issue command and the CLA portion of the post-issue command, or the INS portion of the pre-issue command and the INS portion of the post-issue command,
The predetermined program includes a process that is commonly executed on the storage unit both when the pre-issue command is received and when the post-issue command is received. .
請求項3に記載の電子情報記憶媒体であって、
前記記憶部に対して共通に実行される処理は、前記記憶部にデータを書き込む処理、又は、前記記憶部のデータを読み出す処理であることを特徴とする電子情報記憶媒体。
The electronic information storage medium according to claim 3,
An electronic information storage medium characterized in that the process executed in common with respect to the storage unit is a process of writing data to the storage unit or a process of reading data of the storage unit.
請求項4に記載の電子情報記憶媒体であって、
前記記憶部に対して共通に実行される処理は、前記発行前コマンド及び前記発行後コマンドにおけるData部に設定されているデータを前記記憶部に書き込む処理であることを特徴とする電子情報記憶媒体。
The electronic information storage medium according to claim 4,
The process executed in common for the storage unit is a process for writing data set in the Data unit in the pre-issue command and the post-issue command to the storage unit. .
請求項1乃至5の何れか一項に記載の電子情報記憶媒体を備えるICカード。   An IC card comprising 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 true JP2019159799A (en) 2019-09-19
JP6904286B2 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)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH06282700A (en) * 1993-03-24 1994-10-07 Dainippon Printing Co Ltd Information recording medium containing cpu
JPH07175619A (en) * 1993-12-20 1995-07-14 Fujitsu Ltd Interactive data input system
JP3195122B2 (en) * 1993-04-26 2001-08-06 大日本印刷株式会社 Check method of instruction format given to IC card
JP2002352205A (en) * 2001-05-29 2002-12-06 Toshiba Corp Portable electronic equipment and access management method
JP2005301938A (en) * 2004-04-16 2005-10-27 Dainippon Printing Co Ltd Portable information storage medium and program therefor
JP2005332083A (en) * 2004-05-18 2005-12-02 Dainippon Printing Co Ltd Multi-application type ic card mounted with common command application
JP4457573B2 (en) * 2003-04-10 2010-04-28 凸版印刷株式会社 IC card and program writing method

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH06282700A (en) * 1993-03-24 1994-10-07 Dainippon Printing Co Ltd Information recording medium containing 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 input system
JP2002352205A (en) * 2001-05-29 2002-12-06 Toshiba Corp Portable electronic equipment and access management method
JP4457573B2 (en) * 2003-04-10 2010-04-28 凸版印刷株式会社 IC card and program writing method
JP2005301938A (en) * 2004-04-16 2005-10-27 Dainippon Printing Co Ltd Portable information storage medium and program therefor
JP2005332083A (en) * 2004-05-18 2005-12-02 Dainippon Printing Co Ltd Multi-application type ic card mounted with common command application

Also Published As

Publication number Publication date
JP6904286B2 (en) 2021-07-14

Similar Documents

Publication Publication Date Title
US9183400B2 (en) IC card and IC card control method
US9418224B2 (en) Portable electronic device and control method of portable electronic device
CN114003538B (en) Identification method of intelligent network card and intelligent network card
JP4776462B2 (en) Portable electronic device and method for controlling portable electronic device
EP1560154B1 (en) Entertainment system, information processing unit and portable storage device
JP6904286B2 (en) Electronic information storage medium and IC card
JP5085254B2 (en) Portable electronic device, IC card, and command processing method in portable electronic device
JP2008310596A (en) Portable electronic equipment and control method for potable electronic equipment
JP2007087120A (en) Ic card mounted with multiple os (operating system) and issue consignment method
JP2004192447A (en) Ic card and data management method for ic card
JP7005934B2 (en) Electronic information storage medium, IC card, data transmission method, data writing method, data transmission program and data writing program
JP4784138B2 (en) IC card and IC card program
CN111061651A (en) Method and device for identifying serial EEPROM (electrically erasable programmable read-Only memory) model and storage medium
JP2005011147A (en) Ic card and ic card program
JP2006293706A (en) Multi-application ic card with application updating function
US20070134988A1 (en) Information processing apparatus in which memory cards of different sizes can be used
JP7420179B1 (en) Electronic information storage medium, IC card, issuance processing method, and program
CN111596976B (en) Information reading and writing method, device, equipment and storage medium based on RFID
US9672390B2 (en) IC card and command processing method for IC card
JP7468757B1 (en) ELECTRONIC INFORMATION STORAGE MEDIUM, IC CHIP, IC CARD, RESPONSE TRANSMISSION METHOD, AND PROGRAM
JP7218621B2 (en) Electronic information storage medium, communication device, communication system, communication method, communication program, command execution method, command execution program, response determination method and response determination program
US9202157B2 (en) RFID tag with an improved communication between an external logic element conductively connected thereto and an interrogator as well as a method for such communication
US10068168B2 (en) IC card and IC module
JP6823289B2 (en) IC card and computer program
JP6556489B2 (en) IC card, IC module, issuing device, issuing method, and issuing 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 Request for written amendment filed

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