JP2012252655A - Portable electronic device, ic card and control method of portable electronic device - Google Patents

Portable electronic device, ic card and control method of portable electronic device Download PDF

Info

Publication number
JP2012252655A
JP2012252655A JP2011126735A JP2011126735A JP2012252655A JP 2012252655 A JP2012252655 A JP 2012252655A JP 2011126735 A JP2011126735 A JP 2011126735A JP 2011126735 A JP2011126735 A JP 2011126735A JP 2012252655 A JP2012252655 A JP 2012252655A
Authority
JP
Japan
Prior art keywords
data
memory
card
address
portable electronic
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
JP2011126735A
Other languages
Japanese (ja)
Other versions
JP5684051B2 (en
Inventor
Yoshio Ichinohe
美穂 一戸
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Toshiba Corp
Original Assignee
Toshiba Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Toshiba Corp filed Critical Toshiba Corp
Priority to JP2011126735A priority Critical patent/JP5684051B2/en
Publication of JP2012252655A publication Critical patent/JP2012252655A/en
Application granted granted Critical
Publication of JP5684051B2 publication Critical patent/JP5684051B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Techniques For Improving Reliability Of Storages (AREA)

Abstract

PROBLEM TO BE SOLVED: To provide a portable electronic device which operates more stably, an IC card and a control method of the portable electronic device.SOLUTION: The portable electronic device comprises: a first memory for storing data; a second memory for storing a restoration address and restoration data in association with each other as memory guarantee data; a reception part for receiving a write command transmitted from an external device; a control part for acquiring an address and write data from the write command, identifying a region on the first memory on the basis of the address and a data size of the write data, storing data in the identified region as restoration data in the second memory and storing the address as a restoration address in the second memory; and a write processing part for writing the write data in the identified region of the first memory.

Description

本発明の実施形態は、携帯可能電子装置、ICカード、及び携帯可能電子装置の制御方法に関する。   Embodiments described herein relate generally to a portable electronic device, an IC card, and a method for controlling the portable electronic device.

一般的に、携帯可能電子装置として用いられるICカードは、プラスチックなどで形成されたカード状の本体と本体に埋め込まれたICモジュールとを備えている。ICモジュールは、ICチップを有している。ICチップは、電源が無い状態でもデータを保持することができるEEPROM(Electrically Erasable Programmable Read−Only Memory)またはフラッシュROMなどの不揮発性メモリと、種々の演算を実行するCPUとを有している。   In general, an IC card used as a portable electronic device includes a card-like main body formed of plastic or the like and an IC module embedded in the main body. The IC module has an IC chip. The IC chip has a nonvolatile memory such as an EEPROM (Electrically Erasable Programmable Read-Only Memory) or a flash ROM that can hold data even in the absence of a power source, and a CPU that executes various operations.

ICカードは、例えば、国際標準規格ISO/IEC7816に準拠したICカードである。ICカードは、携帯性に優れ、且つ、外部装置との通信及び複雑な演算処理を行う事ができる。また、偽造が難しい為、ICカードは、機密性の高い情報などを格納してセキュリティシステム、電子商取引などに用いられることが想定される。   The IC card is, for example, an IC card conforming to the international standard ISO / IEC7816. The IC card is excellent in portability and can perform communication with an external device and complicated calculation processing. Further, since it is difficult to forge, the IC card is assumed to store highly confidential information and be used for a security system, electronic commerce, and the like.

ICカードは、ICカードを処理する処理装置からコマンドを受信した場合、受信したコマンドに応じてアプリケーションを実行する。これにより、ICカードは、種々の機能を実現することができる。例えば、ICカードは、書き込みコマンドを受信した場合、受信した書込みコマンドに基づいてデータを不揮発性メモリに書き込む。   When receiving a command from a processing device that processes the IC card, the IC card executes an application in accordance with the received command. Thereby, the IC card can realize various functions. For example, when the IC card receives a write command, the IC card writes data to the nonvolatile memory based on the received write command.

特開2007−320456号公報JP 2007-320456 A

ICカードが1つのコマンドで受信することができるデータサイズは、通信方式に応じた制限値が存在する。ICカードに書き込むデータ量が、1つのコマンドに付加することができるデータ量を上回る場合、処理装置は、データを複数のデータに分割し、分割されたデータを複数の書き込みコマンドに付加してICカードに送信する。   The data size that the IC card can receive with one command has a limit value corresponding to the communication method. When the amount of data to be written to the IC card exceeds the amount of data that can be added to one command, the processing device divides the data into a plurality of data, and adds the divided data to the plurality of write commands. Send to card.

しかし、複数の書き込みコマンドに応じてデータの書き込みを行っている際に処理装置からの電源の供給が断たれた場合、ICカードの不揮発性メモリ内のデータに不整合が生じる可能性がある。   However, if the power supply from the processing device is interrupted while data is being written in response to a plurality of write commands, there is a possibility that data in the nonvolatile memory of the IC card will be inconsistent.

そこで、より安定して動作する携帯可能電子装置、ICカード、及び携帯可能電子装置の制御方法を提供することを目的とする。   Therefore, an object of the present invention is to provide a portable electronic device, an IC card, and a portable electronic device control method that operate more stably.

一実施形態に係る携帯可能電子装置は、データを記憶する第1のメモリと、復元アドレスと復元データとを対応付けてメモリ保障データとして記憶する第2のメモリと、外部機器から送信された書込みコマンドを受信する受信部と、前記書込みコマンドからアドレス及び書込みデータを取得し、前記アドレスと、前記書込みデータのデータサイズと、に基づいて前記第1のメモリ上の領域を特定し、特定された前記領域のデータを復元データとして前記第2のメモリに記憶し、前記アドレスを復元アドレスとして前記第2のメモリに記憶する制御部と、特定された前記第1のメモリ上の領域に前記書込みデータを書込む書込み処理部と、を具備する。   A portable electronic device according to an embodiment includes a first memory for storing data, a second memory for storing the restoration address and the restoration data in association with each other, and storing the data as memory guarantee data, and the writing transmitted from the external device A receiving unit that receives a command, an address and write data are obtained from the write command, an area on the first memory is specified based on the address and the data size of the write data, and specified A controller that stores data in the area as restored data in the second memory and stores the address in the second memory as a restored address; and the write data in the specified area on the first memory A write processing unit for writing

図1は、一実施形態に係るICカード処理システムの例について説明するための図である。FIG. 1 is a diagram for explaining an example of an IC card processing system according to an embodiment. 図2は、一実施形態に係るICカードの例について説明するための図である。FIG. 2 is a diagram for explaining an example of an IC card according to an embodiment. 図3は、一実施形態に係るICカード処理システムの例について説明するための図である。FIG. 3 is a diagram for explaining an example of an IC card processing system according to an embodiment. 図4は、一実施形態に係るICカード処理システムの例について説明するための図である。FIG. 4 is a diagram for explaining an example of an IC card processing system according to an embodiment. 図5は、一実施形態に係るICカード処理システムの例について説明するための図である。FIG. 5 is a diagram for explaining an example of an IC card processing system according to an embodiment.

以下、図面を参照しながら、一実施形態に係る携帯可能電子装置、ICカード、及び携帯可能電子装置の制御方法について詳細に説明する。   Hereinafter, a portable electronic device, an IC card, and a method for controlling the portable electronic device according to an embodiment will be described in detail with reference to the drawings.

本実施形態に係る携帯可能電子装置(ICカード)20及びICカード20を処理する処理装置(端末装置)10は、例えば、接触通信、及び/または非接触通信の機能を備える。これにより、ICカード20及び端末装置10は、互いにデータの送受信を行うことができる。   The portable electronic device (IC card) 20 and the processing device (terminal device) 10 that processes the IC card 20 according to the present embodiment have, for example, functions of contact communication and / or non-contact communication. Thereby, the IC card 20 and the terminal device 10 can transmit and receive data to and from each other.

図1は、一実施形態に係るICカード処理システム1の構成例を示す。
ICカード処理システム1は、ICカード20を処理する端末装置10と、ICカード20と、を備える。
FIG. 1 shows a configuration example of an IC card processing system 1 according to an embodiment.
The IC card processing system 1 includes a terminal device 10 that processes the IC card 20 and an IC card 20.

端末装置10は、CPU11、ROM12、RAM13、不揮発性メモリ14、カードリーダライタ15、操作部17、ディスプレイ18、及び電源部19を備える。CPU11、ROM12、RAM13、不揮発性メモリ14、カードリーダライタ15、操作部17、及びディスプレイ18は、それぞれバスを介して互いに接続されている。   The terminal device 10 includes a CPU 11, a ROM 12, a RAM 13, a nonvolatile memory 14, a card reader / writer 15, an operation unit 17, a display 18, and a power supply unit 19. The CPU 11, the ROM 12, the RAM 13, the nonvolatile memory 14, the card reader / writer 15, the operation unit 17, and the display 18 are connected to each other via a bus.

CPU11は、端末装置10全体の制御を司る制御部として機能する。CPU11は、ROM12又は不揮発性メモリ14に記憶されている制御プログラム及び制御データに基づいて種々の処理を行う。例えば、CPU11は、カードリーダライタ15を介してICカード20とコマンド及びレスポンスの送受信を行う。   The CPU 11 functions as a control unit that controls the entire terminal device 10. The CPU 11 performs various processes based on the control program and control data stored in the ROM 12 or the nonvolatile memory 14. For example, the CPU 11 transmits and receives commands and responses to and from the IC card 20 via the card reader / writer 15.

ROM12は、予め制御用のプログラム及び制御データなどを記憶する不揮発性のメモリである。RAM13は、ワーキングメモリとして機能する揮発性のメモリである。RAM13は、CPU11の処理中のデータなどを一時的に格納する。例えば、RAM13は、カードリーダライタ15を介して外部の機器と送受信するデータを一時的に格納する。また、RAM13は、CPU11が実行するプログラムを一時的に格納する。   The ROM 12 is a non-volatile memory that stores a control program and control data in advance. The RAM 13 is a volatile memory that functions as a working memory. The RAM 13 temporarily stores data being processed by the CPU 11. For example, the RAM 13 temporarily stores data to be transmitted / received to / from an external device via the card reader / writer 15. The RAM 13 temporarily stores a program executed by the CPU 11.

不揮発性メモリ14は、例えばEEPROM、FRAMなどを備える。不揮発性メモリ14は、例えば、制御用のプログラム、制御データ、アプリケーション、及びアプリケーションに用いられるデータなどを記憶する。   The nonvolatile memory 14 includes, for example, an EEPROM, an FRAM, and the like. The nonvolatile memory 14 stores, for example, a control program, control data, an application, and data used for the application.

カードリーダライタ15は、ICカード20と通信を行うためのインターフェース装置である。カードリーダライタ15は、接触通信、または非接触通信によりICカード20とデータの送受信を行う。   The card reader / writer 15 is an interface device for communicating with the IC card 20. The card reader / writer 15 transmits / receives data to / from the IC card 20 by contact communication or non-contact communication.

接触通信のインターフェースとして用いられる場合、カードリーダライタ15は、ICカード20が装着されるスロットと、ICカード20が備えるコンタクトパターンと接続される複数の接触端子を備える。   When used as an interface for contact communication, the card reader / writer 15 includes a slot in which the IC card 20 is mounted and a plurality of contact terminals connected to a contact pattern included in the IC card 20.

スロットにICカード20が装着される場合、カードリーダライタ15の複数の接触端子は、ICカード20のコンタクトパターンに接続される。これにより、端末装置10とICカード20とは電気的に接続される。カードリーダライタ15は、スロットに装着されるICカード20に対して、電力の供給、クロックの供給、リセット信号の入力、及びデータの送受信などを行う。   When the IC card 20 is mounted in the slot, the plurality of contact terminals of the card reader / writer 15 are connected to the contact pattern of the IC card 20. Thereby, the terminal device 10 and the IC card 20 are electrically connected. The card reader / writer 15 performs power supply, clock supply, reset signal input, data transmission / reception, and the like to the IC card 20 installed in the slot.

また、非接触通信のインターフェースとして用いられる場合、カードリーダライタ15は、送受信するデータに対して信号処理を施す信号処理部と、所定の共振周波数を有するアンテナとを備える。   When used as an interface for non-contact communication, the card reader / writer 15 includes a signal processing unit that performs signal processing on data to be transmitted and received, and an antenna having a predetermined resonance frequency.

カードリーダライタ15は、例えば、信号処理部により、送受信するデータに対して符号化、復号、変調、及び復調などの信号処理を行なう。また、カードリーダライタ15は、符号化及び変調を施したデータをアンテナに供給する。アンテナは、供給されたデータに応じて磁界を発生させる。これにより、端末装置10は、通信可能範囲に存在するICカード20に対してデータを非接触で送信することができる。   For example, the card reader / writer 15 performs signal processing such as encoding, decoding, modulation, and demodulation on data to be transmitted and received by a signal processing unit. The card reader / writer 15 supplies the encoded and modulated data to the antenna. The antenna generates a magnetic field according to the supplied data. Thereby, the terminal device 10 can transmit data to the IC card 20 existing in the communicable range in a non-contact manner.

さらに、カードリーダライタ15のアンテナは、磁界を検知し、検知した磁界に応じて信号を生成する。これにより、カードリーダライタ15は、信号を非接触で受信することができる。信号処理部は、アンテナにより受信された信号に対して復調及び復号を行う。これにより、端末装置10は、ICカード20から送信された元のデータを取得することができる。   Further, the antenna of the card reader / writer 15 detects a magnetic field and generates a signal according to the detected magnetic field. Thereby, the card reader / writer 15 can receive a signal in a non-contact manner. The signal processing unit demodulates and decodes the signal received by the antenna. Thereby, the terminal device 10 can acquire the original data transmitted from the IC card 20.

操作部17は、例えば操作キーなどを備え、操作者により入力される操作に基づいて、操作信号を生成する。操作部17は、生成した操作信号をCPUに入力する。これにより、CPU11は、操作者により入力された操作に基づいて処理を事項することができる。   The operation unit 17 includes, for example, operation keys and generates an operation signal based on an operation input by the operator. The operation unit 17 inputs the generated operation signal to the CPU. Thereby, CPU11 can matter about processing based on operation inputted by an operator.

ディスプレイ18は、CPU11、または図示されないグラフィックコントローラなどの表示処理モジュールから入力される映像を表示するための信号に基づいて種々の情報を表示する。   The display 18 displays various information based on signals for displaying video input from the CPU 11 or a display processing module such as a graphic controller (not shown).

電源部19は、端末装置10の各部に電力を供給する。電源部19は、例えば、商用電源より電力を受け取り、所定の電圧に変換し、端末装置10の各部に供給する。   The power supply unit 19 supplies power to each unit of the terminal device 10. For example, the power supply unit 19 receives power from a commercial power supply, converts the power into a predetermined voltage, and supplies the voltage to each unit of the terminal device 10.

図2は、一実施形態に係るICカード20の構成例を示す。
図2に示すように、ICカード20は、例えば、矩形状の本体21と、本体21内に内蔵されたICモジュール22とを備える。ICモジュール22は、ICチップ23と、通信部24とを備える。ICチップ23と通信部24とは、互いに接続された状態でICモジュール22内に形成されている。
FIG. 2 shows a configuration example of the IC card 20 according to one embodiment.
As shown in FIG. 2, the IC card 20 includes, for example, a rectangular main body 21 and an IC module 22 built in the main body 21. The IC module 22 includes an IC chip 23 and a communication unit 24. The IC chip 23 and the communication unit 24 are formed in the IC module 22 while being connected to each other.

なお、本体21は、少なくとも通信部24が配設されるICモジュール22を設置可能な形状であれば、矩形状に限らず如何なる形状であっても良い。   The main body 21 is not limited to a rectangular shape, and may have any shape as long as the IC module 22 in which at least the communication unit 24 is disposed can be installed.

ICチップ23は、通信部24、CPU25、ROM26、RAM27、不揮発性メモリ28、電源部31、及びロジック部32などを備える。通信部24、CPU25、ROM26、RAM27、不揮発性メモリ28、電源部31、及びロジック部32は、バスを介して互いに接続されている。   The IC chip 23 includes a communication unit 24, a CPU 25, a ROM 26, a RAM 27, a nonvolatile memory 28, a power supply unit 31, a logic unit 32, and the like. The communication unit 24, the CPU 25, the ROM 26, the RAM 27, the nonvolatile memory 28, the power supply unit 31, and the logic unit 32 are connected to each other via a bus.

通信部24は、端末装置(外部機器)10のカードリーダライタ15と通信を行うためのインターフェースである。通信部24は、接触通信、または非接触通信により、端末装置10とデータの送受信を行う。   The communication unit 24 is an interface for communicating with the card reader / writer 15 of the terminal device (external device) 10. The communication unit 24 transmits / receives data to / from the terminal device 10 by contact communication or non-contact communication.

接触通信のインターフェースとして用いられる場合、通信部24は、カードリーダライタ15の接触端子と接続されるコンタクトパターンを備える。コンタクトパターンは、導電性を有する金属などによりICモジュール22の表面に形成される接触端子である。即ち、コンタクトパターンは、端末装置10のカードリーダライタ15の接触端子と接触可能に形成されている。   When used as an interface for contact communication, the communication unit 24 includes a contact pattern connected to a contact terminal of the card reader / writer 15. The contact pattern is a contact terminal formed on the surface of the IC module 22 with a conductive metal or the like. That is, the contact pattern is formed so as to be in contact with the contact terminal of the card reader / writer 15 of the terminal device 10.

コンタクトパターンは、金属により形成される面が複数のエリアに区切られて形成される。区切られた各エリアは、それぞれ端子として機能する。通信部24は、コンタクトパターンを介してカードリーダライタ15とデータの送受信を行うことができる。   The contact pattern is formed by dividing a surface formed of metal into a plurality of areas. Each divided area functions as a terminal. The communication unit 24 can transmit / receive data to / from the card reader / writer 15 via the contact pattern.

また、非接触通信のインターフェースとして用いられる場合、通信部24は、信号処理部とアンテナとを備える。   When used as an interface for non-contact communication, the communication unit 24 includes a signal processing unit and an antenna.

信号処理部は、端末装置10に送信するデータに対して符号化、負荷変調などの信号処理を行う。例えば、信号処理部は、端末装置10に送信するデータの変調(増幅)を行う。信号処理部は、信号処理を施したデータをアンテナに供給する。   The signal processing unit performs signal processing such as encoding and load modulation on data to be transmitted to the terminal device 10. For example, the signal processing unit modulates (amplifies) data to be transmitted to the terminal device 10. The signal processing unit supplies the signal-processed data to the antenna.

アンテナは、例えば、ICモジュール22内に所定の形状で配設される金属線により構成される。ICカード20は、端末装置10に送信するデータに応じてアンテナにより磁界を発生させる。これにより、ICカード20は、端末装置10に対してデータを送信することができる。また、ICカード20は、電磁誘導によりアンテナに発生する誘導電流に基づいて端末装置10から送信されるデータを認識する。   The antenna is constituted by, for example, a metal wire disposed in a predetermined shape in the IC module 22. The IC card 20 generates a magnetic field by an antenna according to data transmitted to the terminal device 10. Thereby, the IC card 20 can transmit data to the terminal device 10. Further, the IC card 20 recognizes data transmitted from the terminal device 10 based on an induced current generated in the antenna by electromagnetic induction.

例えば、信号処理部は、アンテナに発生する誘導電流に対して復調、及び復号を行う。例えば、信号処理部は、アンテナにより受信する信号の解析を行う。これにより、通信部24は、2値の論理データを取得する。通信部24は、解析したデータをバスを介してCPU25に送信する。   For example, the signal processing unit demodulates and decodes the induced current generated in the antenna. For example, the signal processing unit analyzes a signal received by the antenna. As a result, the communication unit 24 acquires binary logical data. The communication unit 24 transmits the analyzed data to the CPU 25 via the bus.

CPU25は、ICカード20全体の制御を司る制御部として機能する。CPU25は、ROM26あるいは不揮発性メモリ28に記憶されている制御プログラム及び制御データに基づいて種々の処理を行う。例えば、端末装置10から受信したコマンドに応じて種々の処理を行い、処理結果としてのレスポンスなどのデータの生成を行なう。   The CPU 25 functions as a control unit that controls the entire IC card 20. The CPU 25 performs various processes based on the control program and control data stored in the ROM 26 or the nonvolatile memory 28. For example, various processes are performed in accordance with commands received from the terminal device 10 and data such as responses as processing results is generated.

ROM26は、予め制御用のプログラム及び制御データなどを記憶する不揮発性のメモリである。ROM26は、製造段階で制御プログラム及び制御データなどを記憶した状態でICカード20内に組み込まれる。即ち、ROM26に記憶される制御プログラム及び制御データは、予めICカード20の仕様に応じて組み込まれる。   The ROM 26 is a non-volatile memory that stores a control program and control data in advance. The ROM 26 is incorporated in the IC card 20 in a state where a control program, control data, and the like are stored at the manufacturing stage. That is, the control program and control data stored in the ROM 26 are incorporated in advance according to the specifications of the IC card 20.

RAM27は、ワーキングメモリとして機能する揮発性のメモリである。RAM27は、CPU25の処理中のデータなどを一時的に格納する。例えば、RAM27は、通信部24を介して端末装置10から受信したデータを一時的に格納する。またRAM27は、通信部24を介して端末装置10に送信するデータを一時的に格納する。またさらに、RAM27は、CPU25が実行するプログラムを一時的に格納する。   The RAM 27 is a volatile memory that functions as a working memory. The RAM 27 temporarily stores data being processed by the CPU 25. For example, the RAM 27 temporarily stores data received from the terminal device 10 via the communication unit 24. The RAM 27 temporarily stores data to be transmitted to the terminal device 10 via the communication unit 24. Furthermore, the RAM 27 temporarily stores a program executed by the CPU 25.

不揮発性メモリ28は、例えば、EEPROMあるいはフラッシュROMなどのデータの書き込み及び書換えが可能な不揮発性のメモリを備える。不揮発性メモリ28は、ICカード20の運用用途に応じて制御プログラム及び種々のデータを格納する。   The non-volatile memory 28 includes a non-volatile memory capable of writing and rewriting data, such as an EEPROM or a flash ROM. The nonvolatile memory 28 stores a control program and various data according to the usage application of the IC card 20.

たとえば、不揮発性メモリ28では、プログラムファイル及びデータファイルなどが創成される。創成された各ファイルには、制御プログラム及び種々のデータなどが書き込まれる。CPU25は、不揮発性メモリ28、または、ROM26に記憶されているプログラムを実行することにより、種々の処理を実現することができる。   For example, in the nonvolatile memory 28, a program file and a data file are created. A control program and various data are written in each created file. The CPU 25 can implement various processes by executing programs stored in the nonvolatile memory 28 or the ROM 26.

例えば、不揮発性メモリ28は、Master File(MF)、Dedicated File(DF)、及びElementary File(EF)などを有する。   For example, the non-volatile memory 28 includes a master file (MF), a dedicated file (DF), and an elementary file (EF).

MFは、ファイル構造の根幹となるファイルである。DFは、MFの下位に創成される。DFは、アプリケーション及びアプリケーションに用いられるデータなどをグループ化して格納するファイルである。EFは、DFの下位に創成される。EFは、様々なデータを格納するためのファイルである。また、MFの直下にEFが置かれる場合もある。   The MF is a file that is the basis of the file structure. The DF is created below the MF. The DF is a file that stores applications and data used for the applications in groups. EF is created below DF. The EF is a file for storing various data. In some cases, an EF is placed directly under the MF.

EFには、Working Elementary File(WEF)及びInternal Elementary File(IEF)などの種類がある。WEFは、作業用EFであり、個人情報などを格納する。IEFは、内部EFであり、例えば、セキュリティのための暗号鍵(暗証番号)などのデータを記憶する。   There are various types of EFs, such as Working Elementary File (WEF) and Internal Elementary File (IEF). The WEF is a working EF and stores personal information and the like. The IEF is an internal EF and stores data such as an encryption key (password) for security.

さらに、不揮発性メモリ28内には、管理ファイルなどが格納される。ICカード20は、管理ファイルにより、不揮発性メモリ28内のデータをファイル構造として認識することができる。   Further, a management file or the like is stored in the nonvolatile memory 28. The IC card 20 can recognize the data in the nonvolatile memory 28 as a file structure from the management file.

また、不揮発性メモリ28は、自身が保持しているデータを保障する処理(メモリ保障処理)に用いるコミットバッファメモリ(コミットバッファ)28aを有する。メモリ保障処理、及びコミットバッファについては後述する。   In addition, the nonvolatile memory 28 includes a commit buffer memory (commit buffer) 28a used for a process (memory guarantee process) for guaranteeing data held by itself. The memory guarantee process and the commit buffer will be described later.

電源部31は、端末装置10の各部に電力を供給する。ICカード20が接触通信を行う構成を備える場合、電源部31は、通信部24のコンタクトパターンを介してカードリーダライタ15から供給される電力をICカード20の各部に供給する。   The power supply unit 31 supplies power to each unit of the terminal device 10. When the IC card 20 has a configuration for performing contact communication, the power supply unit 31 supplies power supplied from the card reader / writer 15 to each unit of the IC card 20 via the contact pattern of the communication unit 24.

また、ICカード20が非接触通信を行う構成を備える場合、カードリーダライタ15のアンテナから送信される電波、特にキャリア波に基づいて電力を生成する。さらに、電源部31は、動作クロックを生成する。電源部31は、発生させた電力及び動作クロックをICカード20の各部に電力を供給する。ICカード20の各部は、電力の供給を受けた場合、動作可能な状態になる。   In addition, when the IC card 20 has a configuration for performing contactless communication, power is generated based on radio waves transmitted from the antenna of the card reader / writer 15, particularly carrier waves. Furthermore, the power supply unit 31 generates an operation clock. The power supply unit 31 supplies the generated power and operation clock to each unit of the IC card 20. Each unit of the IC card 20 becomes operable when supplied with power.

ロジック部32は、演算処理をハードウエアにより行う演算部である。例えば、ロジック部32は、端末装置10からのコマンドに基づいて、暗号化、復号、ハッシュ計算、及び乱数の生成などの処理を行う。例えば、端末装置10から相互認証コマンドを受信する場合、ロジック部32は、乱数を生成し、生成した乱数をCPU25に伝送する。   The logic unit 32 is an arithmetic unit that performs arithmetic processing by hardware. For example, the logic unit 32 performs processes such as encryption, decryption, hash calculation, and random number generation based on a command from the terminal device 10. For example, when receiving a mutual authentication command from the terminal device 10, the logic unit 32 generates a random number and transmits the generated random number to the CPU 25.

例えば、端末装置10は、1つのコマンドで送信することができるデータ量を上回るデータをICカード20に書き込む場合、データを複数のデータに分割し、分割されたデータを複数の書き込みコマンドに付加してICカード20に送信する。なお、本例では、ICカード20に書き込むデータを第1の書込みコマンド、第2の書込みコマンド、及び第3の書込みコマンドに付加する。   For example, when writing data exceeding the amount of data that can be transmitted with one command to the IC card 20, the terminal device 10 divides the data into a plurality of data, and adds the divided data to the plurality of write commands. To the IC card 20. In this example, data to be written to the IC card 20 is added to the first write command, the second write command, and the third write command.

図3は、端末装置10によるICカード20の発行処理の例を示す。
まず、端末装置10は、ICカード20にコマンドを送信することにより、ICカード20との間で論理チャネルを開設することができる。これにより、端末装置10は、ICカード20との間で通信路が確立される。さらに、端末装置10は、不揮発性メモリ28内のファイルを選択する為のコマンドをICカード20に送信する。これにより、ICカード20は、コマンドにより指定されたファイルを選択する状態になる。
FIG. 3 shows an example of the issuing process of the IC card 20 by the terminal device 10.
First, the terminal device 10 can establish a logical channel with the IC card 20 by transmitting a command to the IC card 20. As a result, the terminal device 10 establishes a communication path with the IC card 20. Further, the terminal device 10 transmits a command for selecting a file in the nonvolatile memory 28 to the IC card 20. As a result, the IC card 20 enters a state of selecting the file specified by the command.

ここで、メモリ保障処理を用いてICカード20にデータ(書込みデータ)を書き込む場合、端末装置10は、ICカード20の不揮発性メモリ28のコミットバッファ28aの容量を問い合わせるコマンド(コミットバッファ問合せコマンド)をICカード20に送信する(ステップS11)。   Here, when data (write data) is written to the IC card 20 using the memory guarantee process, the terminal device 10 inquires the capacity of the commit buffer 28a of the nonvolatile memory 28 of the IC card 20 (commit buffer inquiry command). Is transmitted to the IC card 20 (step S11).

コミットバッファ28aは、ICカード20のオペレーティングシステムにより管理されるシステムエリアである。コミットバッファ28aは、不揮発性メモリ28内のファイルに用いられなかった領域である。即ち、コミットバッファ28aのサイズ(容量)は、不揮発性メモリ28のスペック、及び不揮発性メモリ28内のファイルの容量に関連する。   The commit buffer 28a is a system area managed by the operating system of the IC card 20. The commit buffer 28 a is an area that is not used for a file in the nonvolatile memory 28. That is, the size (capacity) of the commit buffer 28 a is related to the specifications of the nonvolatile memory 28 and the capacity of the file in the nonvolatile memory 28.

ICカード20は、コミットバッファ問合せコマンドを受信した場合、自身の不揮発性メモリ28のコミットバッファ28aの容量を確認する(ステップS12)。例えば、ICカード20は、自身が保持する仕様書と、ファイルとして用いられている容量とに基づいて、コミットバッファ28aの容量を算出する。ICカード20は、コミットバッファ28aの容量を示す情報を含むレスポンスを生成し、生成されたレスポンスを端末装置10に送信する(ステップS13)。   When receiving the commit buffer inquiry command, the IC card 20 checks the capacity of the commit buffer 28a of its own nonvolatile memory 28 (step S12). For example, the IC card 20 calculates the capacity of the commit buffer 28a based on the specifications held by itself and the capacity used as a file. The IC card 20 generates a response including information indicating the capacity of the commit buffer 28a, and transmits the generated response to the terminal device 10 (step S13).

端末装置10は、受信したレスポンスを解析することにより、ICカード20のコミットバッファ28aの容量を認識する。さらに、端末装置10は、コミットバッファ28aの容量と、ICカード20に書き込む書込みデータの容量とに基づいて、メモリ保障処理の実行の可否を判断する。例えば、端末装置10は、コミットバッファ28aの容量が書込みデータの容量以上である場合、メモリ保障処理を実行可能と判断する。   The terminal device 10 recognizes the capacity of the commit buffer 28a of the IC card 20 by analyzing the received response. Further, the terminal device 10 determines whether or not to execute the memory guarantee process based on the capacity of the commit buffer 28a and the capacity of the write data to be written to the IC card 20. For example, when the capacity of the commit buffer 28a is equal to or larger than the capacity of the write data, the terminal device 10 determines that the memory guarantee process can be executed.

端末装置10は、ICカード20に送信する書込みコマンドを生成する(ステップS14)。上記したように、端末装置10は、書込みデータが1つのコマンドで送信することができるデータ量を上回る場合、書込みデータを複数の書込みデータに分割する。端末装置10は、分割した各書込みデータをそれぞれ有する書込みコマンドを生成する。   The terminal device 10 generates a write command to be transmitted to the IC card 20 (Step S14). As described above, when the write data exceeds the amount of data that can be transmitted with one command, the terminal device 10 divides the write data into a plurality of write data. The terminal device 10 generates a write command having each divided write data.

例えば、書込みデータを第1の書込みデータ、第2の書込みデータ、及び第3の書込みデータに分割した場合、端末装置10は、第1の書込みデータを有する第1の書込みコマンド、第2の書込みデータを有する第2の書込みコマンド、及び第3の書込みデータを有する第3の書込みコマンドを生成する。   For example, when the write data is divided into first write data, second write data, and third write data, the terminal device 10 uses the first write command having the first write data, the second write data, A second write command having data and a third write command having third write data are generated.

さらに、端末装置10は、メモリ保障処理の開始、または終了を示す情報を上記の各書込みコマンドに付加する。例えば、第1の書込みコマンド、第2の書込みコマンド、第3の書込みコマンドの順でコマンドがICカード20に送信される場合、端末装置10は、第1の書込みコマンドにメモリ保障処理の開始を示す情報を付加し、第3の書込みコマンドにメモリ保障処理の終了を示す情報を付加する。   Further, the terminal device 10 adds information indicating the start or end of the memory guarantee process to each write command. For example, when commands are transmitted to the IC card 20 in the order of the first write command, the second write command, and the third write command, the terminal device 10 sets the first write command to start the memory guarantee process. Information indicating the end of the memory guarantee process is added to the third write command.

端末装置10は、生成した書込みコマンドをICカード20に順次送信する。まず、端末装置10は、第1の書込みコマンドをICカード20に送信する(ステップS15)。ICカード20は、受信した書込みコマンドがメモリ保障処理の開始を示す情報を有する場合、メモリ保障処理を用いてデータの書込みを行う(ステップS16)。ICカード20は、メモリ保障処理の結果に基づいてレスポンスを生成し、生成されたレスポンスを端末装置10に送信する(ステップS17)。   The terminal device 10 sequentially transmits the generated write command to the IC card 20. First, the terminal device 10 transmits a first write command to the IC card 20 (step S15). If the received write command has information indicating the start of the memory guarantee process, the IC card 20 writes data using the memory guarantee process (step S16). The IC card 20 generates a response based on the result of the memory guarantee process, and transmits the generated response to the terminal device 10 (step S17).

端末装置10は、第1の書込みコマンドに対するレスポンスを受信した場合、第2の書込みコマンドをICカード20に送信する(ステップS18)。ICカード20は、既にメモリ保障処理が開始されている場合、メモリ保障処理を用いてデータの書込みを行う(ステップS19)。ICカード20は、メモリ保障処理の結果に基づいてレスポンスを生成し、生成されたレスポンスを端末装置10に送信する(ステップS20)。   When the terminal device 10 receives the response to the first write command, the terminal device 10 transmits the second write command to the IC card 20 (step S18). If the memory guarantee process has already been started, the IC card 20 writes data using the memory guarantee process (step S19). The IC card 20 generates a response based on the result of the memory guarantee process, and transmits the generated response to the terminal device 10 (step S20).

端末装置10は、第2の書込みコマンドに対するレスポンスを受信した場合、第3の書込みコマンドをICカード20に送信する(ステップS21)。ICカード20は、既にメモリ保障処理が開始されている場合、メモリ保障処理を用いてデータの書込みを行う(ステップS22)。ICカード20は、メモリ保障処理の結果に基づいてレスポンスを生成し、生成されたレスポンスを端末装置10に送信する(ステップS23)。   When receiving a response to the second write command, the terminal device 10 transmits a third write command to the IC card 20 (step S21). If the memory guarantee process has already been started, the IC card 20 writes data using the memory guarantee process (step S22). The IC card 20 generates a response based on the result of the memory guarantee process, and transmits the generated response to the terminal device 10 (step S23).

さらに、ICカード20は、受信した書込みコマンドがメモリ保障処理の終了を示す情報を有する場合、コミットバッファ28a内の全てのデータを消去する。即ち、ICカード20は、コミットバッファ28aをクリアする。   Furthermore, when the received write command has information indicating the end of the memory guarantee process, the IC card 20 erases all the data in the commit buffer 28a. That is, the IC card 20 clears the commit buffer 28a.

図4は、ICカード20の処理の例を示す。
ICカード20は、起動した場合、端末装置10からのコマンドを待つ状態を保持する。ICカード20は、端末装置から受信するコマンドに応じて初期設定を行い、論理チャネルを開設する。さらに、ICカード20は、端末装置10から受信したコマンドに応じて、不揮発性メモリ28内のファイルを選択する。
FIG. 4 shows an example of processing of the IC card 20.
When activated, the IC card 20 holds a state of waiting for a command from the terminal device 10. The IC card 20 performs initial setting according to a command received from the terminal device, and opens a logical channel. Further, the IC card 20 selects a file in the nonvolatile memory 28 in accordance with the command received from the terminal device 10.

ここで、ICカード20は、端末装置10から送信された書込みコマンドを受信する(ステップS31)。さらに、ICカード20は、受信した書込みコマンドを解析する(ステップS32)。これにより、ICカード20は、書込みコマンドから書込みデータと、書込みデータの書込み先を示すアドレスと、メモリ保障処理に関する情報と、を取得する。   Here, the IC card 20 receives the write command transmitted from the terminal device 10 (step S31). Further, the IC card 20 analyzes the received write command (step S32). Thereby, the IC card 20 acquires the write data, the address indicating the write destination of the write data, and the information related to the memory guarantee process from the write command.

書込みコマンドは、例えば「CLA」、「INS」、「P1」、「P2」、「Lc」、「Data」、及び「Le」を有する。   The write command includes, for example, “CLA”, “INS”, “P1”, “P2”, “Lc”, “Data”, and “Le”.

「CLA」は、コマンドの層別を示すclass byteである。「INS」は、コマンドの種別を示すinstruction byteである。「P1」及び「P2」は、「INS」に応じたパラメータを示すparameter byteである。   “CLA” is a class byte indicating the stratification of the command. “INS” is an instruction byte indicating the type of command. “P1” and “P2” are parameter bytes indicating parameters according to “INS”.

「Lc」は、「Data」のデータの長さ(バイト数)を示すlength field for cording number Ncである。「Data」は、当該コマンドのデータ本体を示すcommand data fieldである。「Le」は、当該コマンドに対するレスポンスのデータ長を示すlength field for cording number Neである。   “Lc” is a length field for coding number Nc indicating the length (number of bytes) of data of “Data”. “Data” is a command data field indicating the data body of the command. “Le” is a length field for coding number Ne indicating the data length of the response to the command.

即ち、「CLA」及び「INS」により、当該コマンドが書込みコマンドであるのか、または他のコマンドであるのかが示される。ICカード20は、受信したコマンドの「CLA」及び「INS」の値を解析することにより、受信したコマンドの種類を認識することができる。   That is, “CLA” and “INS” indicate whether the command is a write command or another command. The IC card 20 can recognize the type of the received command by analyzing the “CLA” and “INS” values of the received command.

例えば、コマンドが書込みコマンドである場合、ICカード20は、「Data」内から書込みデータを取得する。また、ICカード20は、「Data」、「P1」、または「P2」などからアドレスを取得する。また、ICカード20は、「Data」、「P1」、または「P2」などからメモリ保障処理に関する情報を取得する。メモリ保障処理に関する情報は、メモリ保障処理の開始を示す情報、またはメモリ保障処理の終了を示す情報である。   For example, when the command is a write command, the IC card 20 acquires write data from within “Data”. Further, the IC card 20 acquires an address from “Data”, “P1”, “P2”, or the like. Further, the IC card 20 acquires information related to the memory guarantee process from “Data”, “P1”, “P2”, or the like. The information related to the memory guarantee process is information indicating the start of the memory guarantee process or information indicating the end of the memory guarantee process.

ICカード20は、メモリ保障処理を開始するか否か判定する(ステップS33)。即ち、ICカード20は、受信した書込みコマンドにメモリ保障処理の開始を示す情報が含まれている場合、メモリ保障処理を開始すると判定する。   The IC card 20 determines whether or not to start the memory guarantee process (step S33). That is, the IC card 20 determines to start the memory guarantee process when the received write command includes information indicating the start of the memory guarantee process.

ステップS33で、受信した書込みコマンドにメモリ保障処理の開始を示す情報が含まれていると判定した場合、ICカード20は、復元アドレスをセットする(ステップS34)。すなわち、ICカード20は、書込みコマンドから取得したアドレスを復元アドレスとして不揮発性メモリ28のコミットバッファ28aに記憶する。   If it is determined in step S33 that the received write command includes information indicating the start of the memory guarantee process, the IC card 20 sets a restoration address (step S34). That is, the IC card 20 stores the address acquired from the write command in the commit buffer 28a of the nonvolatile memory 28 as a restoration address.

また、ステップS33で、受信した書込みコマンドにメモリ保障処理の開始を示す情報が含まれていないと判定した場合、ICカード20は、ステップS35に移行する。   If it is determined in step S33 that the received write command does not include information indicating the start of the memory guarantee process, the IC card 20 proceeds to step S35.

ICカード20は、メモリ保障処理が継続中であるか否か判定する(ステップS35)。ICカード20は、上記のステップS33において、メモリ保障処理を開始すると判定した場合、メモリ保障処理が継続中であることを示す情報をRAM27、または不揮発性メモリ28に記憶する。ICカード20は、メモリ保障処理が継続中であることを示す情報の有無に基づいて、メモリ保障処理が継続中であるか否か判定する。   The IC card 20 determines whether the memory guarantee process is ongoing (step S35). If it is determined in step S33 that the memory guarantee process is started, the IC card 20 stores information indicating that the memory guarantee process is continuing in the RAM 27 or the nonvolatile memory 28. The IC card 20 determines whether or not the memory guarantee process is ongoing based on the presence / absence of information indicating that the memory guarantee process is ongoing.

ステップS35でメモリ保障処理が継続中であると判定した場合、ICカード20は、データサイズをセットする(ステップS36)。ICカード20は、取得した書込みデータのサイズに基づいて書込みデータのサイズを示す情報(データサイズ)を生成し、不揮発性メモリ28のコミットバッファ28aに記憶する。ICカード20は、ステップS34でコミットバッファ28aに記憶した復元アドレスに対応付けてデータサイズを記憶する。また、既に復元アドレスにデータサイズが対応付けられている場合、生成したデータサイズが示す値を、復元アドレスに対応付けられているデータサイズに加算する。   If it is determined in step S35 that the memory guarantee process is continuing, the IC card 20 sets the data size (step S36). The IC card 20 generates information (data size) indicating the size of the write data based on the acquired size of the write data, and stores it in the commit buffer 28 a of the nonvolatile memory 28. The IC card 20 stores the data size in association with the restoration address stored in the commit buffer 28a in step S34. If the data size is already associated with the restoration address, the value indicated by the generated data size is added to the data size associated with the restoration address.

ICカード20は、メモリ保障処理を実行することが出来るか否か判定する(ステップS37)。例えば、ICカード20は、復元アドレスに対応付けられているデータサイズが示す容量が、自身のコミットバッファ28aの容量以下であるか否か判定する。ICカード20は、復元アドレスに対応付けられているデータサイズが示す容量が、自身のコミットバッファ28aの容量以下である場合、メモリ保障処理を実行することが出来ると判定する。   The IC card 20 determines whether or not the memory guarantee process can be executed (step S37). For example, the IC card 20 determines whether or not the capacity indicated by the data size associated with the restoration address is less than or equal to the capacity of its own commit buffer 28a. The IC card 20 determines that the memory guarantee process can be executed when the capacity indicated by the data size associated with the restoration address is less than or equal to the capacity of its own commit buffer 28a.

ステップS37で、メモリ保障処理を実行することが出来ると判定した場合、ICカード20は、書込みコマンドから取得したアドレスにより示される位置に記憶されているデータを退避する(ステップS38)。   If it is determined in step S37 that the memory guarantee process can be executed, the IC card 20 saves the data stored at the position indicated by the address acquired from the write command (step S38).

ICカード20は、不揮発性メモリ28から、書込みコマンドから取得したアドレスにより示される位置から、書込みコマンドに含まれている書込みデータのデータサイズに相当する量のデータを読み出す。即ち、ICカード20は、書込みコマンドから取得したアドレスと、書込みデータのデータサイズとに基づいて不揮発性メモリ28上の領域を特定し、特定した領域に記憶されているデータを読み出す。   The IC card 20 reads from the nonvolatile memory 28 an amount of data corresponding to the data size of the write data included in the write command from the position indicated by the address acquired from the write command. That is, the IC card 20 specifies an area on the nonvolatile memory 28 based on the address acquired from the write command and the data size of the write data, and reads the data stored in the specified area.

ICカード20は、読み出したデータをコミットバッファ28a中の復元アドレスに対応付けて復元データとして記憶する。即ち、ICカード20は、書込みデータが書き込まれる位置に記憶されているデータをコミットバッファ28aに退避させる。また、既に復元アドレスに復元データが対応付けられている場合、復元データを既に記憶されている復元データに追記する。   The IC card 20 stores the read data as restoration data in association with the restoration address in the commit buffer 28a. That is, the IC card 20 saves the data stored at the position where the write data is written to the commit buffer 28a. If the restoration data is already associated with the restoration address, the restoration data is added to the restoration data already stored.

上記の処理により、不揮発性メモリ28のコミットバッファ28a内には、図5により示されるようにメモリ保障データ281が記憶される。メモリ保障データ281は、復元アドレスと、データサイズと、復元データとを対応付けて記憶する。また、不揮発性メモリ28のコミットバッファ28a内には、メモリ保障データ281の復元アドレスとは異なる復元アドレスを有するメモリ保障データ282をさらに記憶する構成であってもよい。この場合、不揮発性メモリ28中の連続していない複数の領域のデータを保障することができる。なお、連続していない複数の領域のデータを保障する処理については後述する。   Through the above processing, the memory guarantee data 281 is stored in the commit buffer 28a of the nonvolatile memory 28 as shown in FIG. The memory guarantee data 281 stores a restoration address, a data size, and restoration data in association with each other. Further, the commit buffer 28a of the nonvolatile memory 28 may be configured to further store memory guarantee data 282 having a restoration address different from the restoration address of the memory guarantee data 281. In this case, data of a plurality of non-contiguous areas in the nonvolatile memory 28 can be ensured. A process for ensuring data in a plurality of non-continuous areas will be described later.

また、ステップS35でメモリ保障処理が継続中ではないと判定した場合、ICカード20は、ステップS39に移行する。   If it is determined in step S35 that the memory guarantee process is not continuing, the IC card 20 proceeds to step S39.

ICカード20は、書込みコマンドから取得したアドレスにより示される不揮発性メモリ28上の領域に、書込みコマンドから取得した書込みデータを書き込む(ステップS39)。   The IC card 20 writes the write data acquired from the write command in the area on the nonvolatile memory 28 indicated by the address acquired from the write command (step S39).

ICカード20は、メモリ保障処理を終了するか否か判定する(ステップS40)。即ち、ICカード20は、受信した書込みコマンドにメモリ保障処理の終了を示す情報が含まれている場合、メモリ保障処理を終了すると判定する。   The IC card 20 determines whether or not to end the memory guarantee process (step S40). In other words, the IC card 20 determines to end the memory guarantee process when the received write command includes information indicating the end of the memory guarantee process.

ステップS40で、受信した書込みコマンドにメモリ保障処理の終了を示す情報が含まれていると判定した場合、ICカード20は、コミットバッファ28aをクリアする(ステップS41)。すなわち、ICカード20は、コミットバッファ28aにより記憶されているメモリ保障データのうち、受信した書込みコマンドに対応するメモリ保障データを削除する。   If it is determined in step S40 that the received write command includes information indicating the end of the memory guarantee process, the IC card 20 clears the commit buffer 28a (step S41). That is, the IC card 20 deletes the memory security data corresponding to the received write command from the memory security data stored in the commit buffer 28a.

ステップS40で、受信した書込みコマンドにメモリ保障処理の終了を示す情報が含まれていないと判定した場合、ICカード20は、ステップS42に移行する。   If it is determined in step S40 that the received write command does not include information indicating the end of the memory guarantee process, the IC card 20 proceeds to step S42.

ICカード20は、受信した書込みコマンドに基づいて実行した処理の結果に基づいて、レスポンスを生成する(ステップS42)。即ち、ICカード20は、書込み処理を正常に完了させることができた場合、正常終了を示すレスポンスを生成する。ICカード20は、書込み処理においてエラーが発生した場合、エラーが発生したことを示すレスポンスを生成する。   The IC card 20 generates a response based on the result of the process executed based on the received write command (step S42). That is, the IC card 20 generates a response indicating normal end when the writing process can be normally completed. When an error occurs in the writing process, the IC card 20 generates a response indicating that an error has occurred.

また、ステップS37で、メモリ保障処理を実行することが出来ないと判定した場合、ICカード20は、メモリ保障処理においてエラー(オーバーフロー)が発生したことを示すレスポンスを生成する(ステップS43)。   If it is determined in step S37 that the memory guarantee process cannot be executed, the IC card 20 generates a response indicating that an error (overflow) has occurred in the memory guarantee process (step S43).

ICカード20は、生成したレスポンスを端末装置10に送信し、1つのコマンドに基づく処理を終了する。   The IC card 20 transmits the generated response to the terminal device 10 and ends the process based on one command.

ここで、図3に示すように関連する複数の書込みコマンドの処理中にICカード20に対する電力の供給が断たれた場合、ICカード20は、上記のメモリ保障データをコミットバッファ28aに記憶したまま停止する。   Here, when the supply of power to the IC card 20 is interrupted during processing of a plurality of related write commands as shown in FIG. 3, the IC card 20 keeps storing the memory security data in the commit buffer 28a. Stop.

ICカード20は、次に起動した際に、コミットバッファ28a内にメモリ保障データが存在するか否か判定する。即ち、ICカード20は、起動した場合、コミットバッファ28aを参照し、メモリ保障データの有無を判定する。   When the IC card 20 is activated next time, it determines whether or not memory guarantee data exists in the commit buffer 28a. That is, when the IC card 20 is activated, the IC card 20 refers to the commit buffer 28a and determines the presence / absence of memory guarantee data.

ICカード20は、メモリ保障データがコミットバッファ28aに存在すると判定した場合、メモリ保障データの復元アドレスに基づいて、不揮発性メモリ28内の位置を特定する。ICカード20は、メモリ保障データの復元データを読み出し、読み出した復元データを特定した位置から書き込む。これにより、ICカード20は、不揮発性メモリ28のデータを復元することができる。さらに、ICカード20は、復元に用いたメモリ保障データをコミットバッファ28aから削除する。   When it is determined that the memory guarantee data exists in the commit buffer 28a, the IC card 20 specifies the position in the nonvolatile memory 28 based on the restoration address of the memory guarantee data. The IC card 20 reads the restoration data of the memory security data and writes the read restoration data from the specified position. Thereby, the IC card 20 can restore the data in the nonvolatile memory 28. Further, the IC card 20 deletes the memory guarantee data used for the restoration from the commit buffer 28a.

また、ICカード20は、端末装置10から所定のコマンドを受信した場合に上記の復元を行う構成であってもよい。例えば、ICカード20は、端末装置10から書込み処理の中止を指示するコマンドを受信した場合に上記の復元を行う構成であってもよい。   Further, the IC card 20 may be configured to perform the above restoration when a predetermined command is received from the terminal device 10. For example, the IC card 20 may be configured to perform the above restoration when receiving a command for instructing to stop the writing process from the terminal device 10.

また、ICカード20は、書込みコマンドに基づく書込み処理を中止する必要があると自身で判定した場合に上記の復元を行う構成であってもよい。例えば、ICカード20は、コミットバッファ28aのオーバーフローが発生した場合、端末装置10側で異常が検知された場合、または後続の書込みコマンドが端末装置10から送信されなくなった場合などに復元を行う。   Further, the IC card 20 may be configured to perform the above restoration when it is determined that it is necessary to stop the writing process based on the writing command. For example, the IC card 20 performs restoration when an overflow of the commit buffer 28a occurs, when an abnormality is detected on the terminal device 10 side, or when a subsequent write command is no longer transmitted from the terminal device 10.

上記したように、ICカード20は、不揮発性メモリ28上の書込みデータを書き込む先に既に記憶されているデータをアドレスと供にメモリ保障データとしてコミットバッファ28aに記憶する。さらに、ICカード20は、起動時にメモリ保障データの有無を確認し、メモリ保障データが存在する場合、メモリ保障データに基づいて、不揮発性メモリ28のデータを復元する。   As described above, the IC card 20 stores the data already stored in the destination to which the write data on the nonvolatile memory 28 is written together with the address in the commit buffer 28a as the memory security data. Further, the IC card 20 checks the presence / absence of the memory guarantee data at the time of activation, and restores the data in the nonvolatile memory 28 based on the memory guarantee data when the memory guarantee data exists.

これにより、連続する複数の書込みコマンドの処理の途中でICカード20が停止した場合であっても、不揮発性メモリ28のデータを復元することが出来る。これにより、不揮発性メモリ28上のデータに不整合が生じることを防ぐことができる。この結果、より安定して動作する携帯可能電子装置、ICカード、及び携帯可能電子装置の制御方法を提供することができる。   Thereby, even if the IC card 20 is stopped in the middle of processing of a plurality of continuous write commands, the data in the nonvolatile memory 28 can be restored. Thereby, it is possible to prevent inconsistency in data on the nonvolatile memory 28. As a result, a portable electronic device, an IC card, and a method for controlling the portable electronic device that operate more stably can be provided.

また、上記したように、ICカード20は、不揮発性メモリ28上の不連続な領域のデータを保障することもできる。   Further, as described above, the IC card 20 can guarantee data in a discontinuous area on the nonvolatile memory 28.

この場合、ICカード20は、書込みコマンドから取得したアドレス毎にメモリ保障データを生成する。ICカード20は、例えば、書込みコマンドに含まれるアドレスに基づいて、対応するメモリ保障データを特定することができる。新たに書込みコマンドを受信した場合、ICカード20は、書込みコマンドからアドレスを取得し、取得したアドレスに対応するメモリ保障データに対して、データサイズのセット、及び復元データの退避を行う。これにより、ICカード20は、不揮発性メモリ28上の複数の不連続な領域のデータを保障することができる。   In this case, the IC card 20 generates memory guarantee data for each address acquired from the write command. The IC card 20 can specify the corresponding memory security data based on, for example, the address included in the write command. When a new write command is received, the IC card 20 acquires an address from the write command, and sets the data size and saves the restored data for the memory security data corresponding to the acquired address. Thereby, the IC card 20 can guarantee data of a plurality of discontinuous areas on the nonvolatile memory 28.

上記した実施形態では、ICカード20は、コミットバッファ問合せコマンドを受信した場合、コミットバッファ28aの容量を端末装置10に通知する構成として説明したが、この構成に限定されない。例えば、ICカード20は、論理チャネルの確立などを指示する初期設定コマンドを端末装置10から受信した場合にコミットバッファ28aの容量を端末装置10に通知する構成であってもよい。   In the above-described embodiment, the IC card 20 has been described as a configuration that notifies the terminal device 10 of the capacity of the commit buffer 28a when receiving a commit buffer inquiry command. However, the configuration is not limited to this configuration. For example, the IC card 20 may be configured to notify the terminal device 10 of the capacity of the commit buffer 28a when receiving an initial setting command instructing establishment of a logical channel from the terminal device 10.

また、端末装置10は、メモリ保障処理の開始または終了を示す情報を書込みコマンドに付加する構成として説明したが、この構成に限定されない。   Further, although the terminal device 10 has been described as a configuration in which information indicating the start or end of the memory guarantee process is added to the write command, the terminal device 10 is not limited to this configuration.

例えば、端末装置10は、関連するコマンドの数を示す情報を書込みコマンドに付加する構成であってもよい。この場合、ICカード20は、書込みコマンドに付加された関連するコマンドの数に基づいて、メモリ保障処理を行うコマンドを特定する。   For example, the terminal device 10 may be configured to add information indicating the number of related commands to the write command. In this case, the IC card 20 specifies a command for performing the memory guarantee process based on the number of related commands added to the write command.

また、例えば、端末装置10は、関連するコマンドがさらに存在するか否かを示す情報を書込みコマンドに付加する構成であってもよい。この場合、ICカード20は、関連するコマンドがさらに存在しないことを示す情報を受信するまでの間、メモリ保障処理を行う。   Further, for example, the terminal device 10 may be configured to add information indicating whether or not there is a related command to the write command. In this case, the IC card 20 performs a memory guarantee process until it receives information indicating that there is no further related command.

また、例えば、端末装置10は、メモリ保障処理の開始と終了とを所定のコマンドで指示する構成であってもよい。この場合、ICカード20は、メモリ保障処理の開始を指示するコマンドを受信してから、メモリ保障処理の終了を指示するコマンドを受信するまでの間、メモリ保障処理を行う。   Further, for example, the terminal device 10 may be configured to instruct the start and end of the memory guarantee process with a predetermined command. In this case, the IC card 20 performs the memory security process after receiving the command instructing the start of the memory security process until receiving the command instructing the end of the memory security process.

なお、上述の各実施の形態で説明した機能は、ハードウエアを用いて構成するに留まらず、ソフトウエアを用いて各機能を記載したプログラムをコンピュータに読み込ませて実現することもできる。また、各機能は、適宜ソフトウエア、ハードウエアのいずれかを選択して構成するものであっても良い。   It should be noted that the functions described in the above embodiments are not limited to being configured using hardware, but can be realized by causing a computer to read a program describing each function using software. Each function may be configured by appropriately selecting either software or hardware.

なお、本発明は上記実施形態そのままに限定されるものではなく、実施段階ではその要旨を逸脱しない範囲で構成要素を変形して具体化できる。また、上記実施形態に開示されている複数の構成要素の適宜な組み合せにより種々の発明を形成できる。例えば、実施形態に示される全構成要素から幾つかの構成要素を削除してもよい。更に、異なる実施形態に亘る構成要素を適宜組み合せてもよい。   Note that the present invention is not limited to the above-described embodiment as it is, and can be embodied by modifying the constituent elements without departing from the scope of the invention in the implementation stage. Further, various inventions can be formed by appropriately combining a plurality of constituent elements disclosed in the embodiment. For example, some components may be deleted from all the components shown in the embodiment. Furthermore, you may combine suitably the component covering different embodiment.

1…ICカード処理システム、10…端末装置、11…CPU、12…ROM、13…RAM、14…不揮発性メモリ、15…カードリーダライタ、17…操作部、18…ディスプレイ、19…電源部、20…ICカード、21…本体、22…ICモジュール、23…ICチップ、24…通信部、25…CPU、26…ROM、27…RAM、28…不揮発性メモリ、28a…コミットバッファ、31…電源部、32…ロジック部。   DESCRIPTION OF SYMBOLS 1 ... IC card processing system, 10 ... Terminal device, 11 ... CPU, 12 ... ROM, 13 ... RAM, 14 ... Non-volatile memory, 15 ... Card reader / writer, 17 ... Operation part, 18 ... Display, 19 ... Power supply part, DESCRIPTION OF SYMBOLS 20 ... IC card, 21 ... Main body, 22 ... IC module, 23 ... IC chip, 24 ... Communication part, 25 ... CPU, 26 ... ROM, 27 ... RAM, 28 ... Non-volatile memory, 28a ... Commit buffer, 31 ... Power supply Part, 32... Logic part.

Claims (9)

データを記憶する第1のメモリと、
復元アドレスと復元データとを対応付けてメモリ保障データとして記憶する第2のメモリと、
外部機器から送信された書込みコマンドを受信する受信部と、
前記書込みコマンドからアドレス及び書込みデータを取得し、前記アドレスと、前記書込みデータのデータサイズと、に基づいて前記第1のメモリ上の領域を特定し、特定された前記領域のデータを復元データとして前記第2のメモリに記憶し、前記アドレスを復元アドレスとして前記第2のメモリに記憶する制御部と、
特定された前記第1のメモリ上の領域に前記書込みデータを書込む書込み処理部と、
を具備する携帯可能電子装置。
A first memory for storing data;
A second memory for storing the restoration address and the restoration data in association with each other as memory guarantee data;
A receiving unit that receives a write command transmitted from an external device;
An address and write data are obtained from the write command, an area on the first memory is specified based on the address and the data size of the write data, and the data in the specified area is used as restoration data A controller that stores in the second memory and stores the address in the second memory as a restored address;
A write processing unit for writing the write data to the specified area on the first memory;
A portable electronic device comprising:
前記第2のメモリは、異なる復元アドレス毎に前記メモリ保障データを記憶する、請求項1に記載の携帯可能電子装置。   The portable electronic device according to claim 1, wherein the second memory stores the memory guarantee data for each different restoration address. 前記制御部は、当該携帯可能電子装置の起動時に前記第2のメモリに前記メモリ保障データが存在する場合、前記メモリ保障データの前記復元アドレスに基づいて前記第1のメモリ上の位置を特定し、特定された位置に前記メモリ保障データの前記復元データを書き込む、請求項1または2に記載の携帯可能電子装置。   The control unit specifies a position on the first memory based on the restoration address of the memory security data when the memory security data exists in the second memory when the portable electronic device is activated. The portable electronic device according to claim 1, wherein the restoration data of the memory guarantee data is written in the specified position. レスポンスを前記外部機器に送信する送信部をさらに具備し、
前記制御部は、前記外部機器から前記第2のメモリの容量を問い合わせるコマンドを受信した場合、前記第2のメモリの容量を確認し、前記第2のメモリの容量に基づいて前記レスポンスを生成する、請求項1または2に記載の携帯可能電子装置。
Further comprising a transmitter for transmitting a response to the external device;
When receiving a command for inquiring the capacity of the second memory from the external device, the control unit checks the capacity of the second memory and generates the response based on the capacity of the second memory. The portable electronic device according to claim 1 or 2.
レスポンスを前記外部機器に送信する送信部をさらに具備し、
前記制御部は、前記第2のメモリの容量が前記書込みデータのデータサイズ未満である場合、エラーを示す前記レスポンスを生成する請求項1または2に記載の携帯可能電子装置。
Further comprising a transmitter for transmitting a response to the external device;
The portable electronic device according to claim 1, wherein the control unit generates the response indicating an error when a capacity of the second memory is less than a data size of the write data.
前記受信部は、前記外部機器から開始を示す情報と、終了を示す情報とを受信し、
前記制御部は、前記受信部により前記開始を示す情報を受信してから、前記終了を示す情報を受信するまでの間、前記復元データ及び前記復元アドレスを前記第2のメモリに記憶する、請求項1または2に記載の携帯可能電子装置。
The receiving unit receives information indicating start and information indicating end from the external device,
The control unit stores the restoration data and the restoration address in the second memory after receiving the information indicating the start by the receiving unit until receiving the information indicating the end. Item 3. The portable electronic device according to Item 1 or 2.
前記制御部は、前記受信部により前記終了を示す情報を受信した場合、前記第2のメモリにより記憶されている前記メモリ保障データを削除する、請求項6に記載の携帯可能電子装置。   The portable electronic device according to claim 6, wherein the control unit deletes the memory guarantee data stored in the second memory when the information indicating the end is received by the receiving unit. 前記各部を備えるICモジュールと、
前記ICモジュールが配設される本体と、
を具備する請求項1または2に記載のICカード。
An IC module comprising the above-mentioned parts;
A main body on which the IC module is disposed;
The IC card according to claim 1, further comprising:
データを記憶する第1のメモリと、復元アドレスと復元データとを対応付けてメモリ保障データとして記憶する第2のメモリと、を具備する携帯可能電子装置に用いられる携帯可能電子装置の制御方法であって、
外部機器から送信された書込みコマンドを受信し、
前記書込みコマンドからアドレス及び書込みデータを取得し、前記アドレスと、前記書込みデータのデータサイズと、に基づいて前記第1のメモリ上の領域を特定し、特定された前記領域のデータを復元データとして前記第2のメモリに記憶し、前記アドレスを復元アドレスとして前記第2のメモリに記憶し、
特定された前記第1のメモリ上の領域に前記書込みデータを書込む、
携帯可能電子装置の制御方法。
A method for controlling a portable electronic device used in a portable electronic device comprising: a first memory that stores data; and a second memory that stores the restored address and restored data in association with each other and stores them as memory security data. There,
Receives a write command sent from an external device,
An address and write data are obtained from the write command, an area on the first memory is specified based on the address and the data size of the write data, and the data in the specified area is used as restoration data Storing in the second memory, storing the address in the second memory as a restored address;
Writing the write data in the identified area on the first memory;
Control method of portable electronic device.
JP2011126735A 2011-06-06 2011-06-06 Portable electronic device, IC card, and control method for portable electronic device Expired - Fee Related JP5684051B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2011126735A JP5684051B2 (en) 2011-06-06 2011-06-06 Portable electronic device, IC card, and control method for portable electronic device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2011126735A JP5684051B2 (en) 2011-06-06 2011-06-06 Portable electronic device, IC card, and control method for portable electronic device

Publications (2)

Publication Number Publication Date
JP2012252655A true JP2012252655A (en) 2012-12-20
JP5684051B2 JP5684051B2 (en) 2015-03-11

Family

ID=47525376

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2011126735A Expired - Fee Related JP5684051B2 (en) 2011-06-06 2011-06-06 Portable electronic device, IC card, and control method for portable electronic device

Country Status (1)

Country Link
JP (1) JP5684051B2 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2020112855A (en) * 2019-01-08 2020-07-27 凸版印刷株式会社 IC chip and IC card

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2009009602A (en) * 2008-08-25 2009-01-15 Dainippon Printing Co Ltd Ic card and ic card program

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2009009602A (en) * 2008-08-25 2009-01-15 Dainippon Printing Co Ltd Ic card and ic card program

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2020112855A (en) * 2019-01-08 2020-07-27 凸版印刷株式会社 IC chip and IC card

Also Published As

Publication number Publication date
JP5684051B2 (en) 2015-03-11

Similar Documents

Publication Publication Date Title
JP5795921B2 (en) IC card, portable electronic device, and IC card control method
KR101601395B1 (en) Ic card, electronic device and portable electronic device
JP2012208910A (en) Portable electronic device and processing system for portable electronic device
JP5684051B2 (en) Portable electronic device, IC card, and control method for portable electronic device
JP5823109B2 (en) Portable electronic device and method for controlling portable electronic device
JP5490044B2 (en) Portable electronic device and method for controlling portable electronic device
JP5957577B2 (en) IC card, portable electronic device, and IC card control method
JP6092342B2 (en) Non-contact portable electronic device and method for issuing non-contact portable electronic device
JP5693824B2 (en) IC card processing device, IC card, and IC card processing system
JP2013125400A (en) Ic card, portable electronic device, and control program for ic card
JP2013118473A (en) Ic card, portable electronic device and control program of ic card
JP5677195B2 (en) Portable electronic device and method for controlling portable electronic device
JP5726659B2 (en) IC card, IC card processing device, and IC card processing system
JP2014186385A (en) Ic card and ic card control method
JP2013196010A (en) Portable electronic device, portable electronic device processor and portable electronic device control program
JP2012198682A (en) Portable electronic device, processor of portable electronic device, and processing system of portable electronic device
JP5684059B2 (en) IC card and control method of IC card
JP5875772B2 (en) Portable electronic device, control method for portable electronic device, and processing system for portable electronic device
JP6046068B2 (en) Portable electronic device and method for controlling portable electronic device
JP5832940B2 (en) IC card and portable electronic device
JP6178387B2 (en) Electronic device and method for controlling electronic device
JP5726700B2 (en) IC card and IC card processing method
JP5787692B2 (en) IC card, portable electronic device, and IC card control method
JP2014160499A (en) Portable electronic device and portable electronic device control method
JP2013069108A (en) Ic card, portable electronic device and ic card control method

Legal Events

Date Code Title Description
RD04 Notification of resignation of power of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7424

Effective date: 20131205

RD04 Notification of resignation of power of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7424

Effective date: 20131212

RD04 Notification of resignation of power of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7424

Effective date: 20131219

RD04 Notification of resignation of power of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7424

Effective date: 20131226

RD04 Notification of resignation of power of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7424

Effective date: 20140109

A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20140307

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20140917

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20140924

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20141125

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20150114

R151 Written notification of patent or utility model registration

Ref document number: 5684051

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R151

LAPS Cancellation because of no payment of annual fees