JP2007122394A - Portable electronic device, and ic card - Google Patents

Portable electronic device, and ic card Download PDF

Info

Publication number
JP2007122394A
JP2007122394A JP2005313458A JP2005313458A JP2007122394A JP 2007122394 A JP2007122394 A JP 2007122394A JP 2005313458 A JP2005313458 A JP 2005313458A JP 2005313458 A JP2005313458 A JP 2005313458A JP 2007122394 A JP2007122394 A JP 2007122394A
Authority
JP
Japan
Prior art keywords
data
writing
identifier
address
check
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.)
Pending
Application number
JP2005313458A
Other languages
Japanese (ja)
Inventor
Hitoshi Komatsu
仁 小松
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 JP2005313458A priority Critical patent/JP2007122394A/en
Publication of JP2007122394A publication Critical patent/JP2007122394A/en
Pending legal-status Critical Current

Links

Images

Abstract

<P>PROBLEM TO BE SOLVED: To provide a portable electronic device and an IC card enabling to reuse a data area by writing data from an opposite direction in the same area when all data can not be written due to communication failure or the like in the middle of data writing, for example, in writing large quantities of data in the data area in which data writing is allowed only once. <P>SOLUTION: The IC card is provided with a memory for storing the data, and a control element for reading and/or writing the data from/in the memory, executes processing corresponding to a command input from the outside, and outputs a result to the outside. At least one or more data areas in which the data writing is allowed only once are set in the memory. When all of the data can not be written due to the communication failure or the like in the middle of the data writing in wiring the data (especially the large quantities of the data such as image data) in the data area in which the data writing is allowed only once, the data is written from the opposite direction in the same area. <P>COPYRIGHT: (C)2007,JPO&INPIT

Description

本発明は、たとえば、書込み、書換え可能な不揮発性メモリおよびCPU(セントラル・プロセッシング・ユニット)などの制御素子を有するIC(集積回路)チップを内蔵し、外部から供給されるコマンドに基づき各種処理を実行してその結果を外部へ出力するICカードなどの携帯可能電子装置およびICカードに関する。   The present invention incorporates an IC (Integrated Circuit) chip having control elements such as a writable and rewritable nonvolatile memory and a CPU (Central Processing Unit), and performs various processes based on commands supplied from the outside. The present invention relates to a portable electronic device such as an IC card that executes and outputs the result to the outside, and an IC card.

最近、携帯可能電子装置として、不揮発性メモリとしてのEEPROM、揮発性メモリとしてのRAM、これらのメモリに対してアクセス(データの読出しおよびまたは書込み等)を行なう制御素子としてのCPU、および、CPUの動作用プログラム等を格納したROMを有し、外部装置(ICカードリーダ・ライタ)から供給されるコマンドに対応した処理を実行してその結果を外部装置へ出力する手段を備えたICチップを内蔵したICカードが産業各方面で利用されている。   Recently, as a portable electronic device, an EEPROM as a nonvolatile memory, a RAM as a volatile memory, a CPU as a control element for accessing (reading or writing data, etc.) the memory, and the CPU Built-in IC chip with ROM that stores operation programs, etc., and means for executing processing corresponding to commands supplied from an external device (IC card reader / writer) and outputting the result to the external device IC cards are used in various industries.

この種のICカードにおいて、不揮発性メモリには、メモリ容量が大容量で、バイナリデータを1回だけ書込めて書換えができないデータ領域(バイナリ・エレメンタリ・ファイル)が設定されているものがある(たとえば、非特許文献1参照)。
このような1回だけデータの書込みが許可されたデータ領域に対して、たとえば、特に画像データ等の長いデータを書込む場合、分割して外部から入力されたデータを順次書込むことになる。その書込み途中において、通信異常等でデータの書込みが中断された場合、再度同一コマンドを実行しても途中までデータが書込まれているため、書込み異常となり、当該ICカードを再利用することはできない。
日本工業規格準拠 JICSAP 外部端子付きICカード 仕様(平成10年7月 第1.1版)
In this type of IC card, some nonvolatile memories have a large memory capacity and a data area (binary elementary file) in which binary data is written only once and cannot be rewritten is set ( For example, refer nonpatent literature 1).
For example, when long data such as image data is written in the data area in which data writing is permitted only once, data input from the outside is divided and written sequentially. If the data writing is interrupted due to a communication error in the middle of the writing, even if the same command is executed again, the data has been written halfway. Can not.
Japanese Industrial Standards compliant JICSAP IC card with external terminal specifications (July 1998, 1.1 version)

しかし、上記した従来の技術では、1回だけデータの書込みが許可されたデータ領域に対して特に長いデータを書込む途中において、データの書込みが中断された場合、再度同一コマンドを実行しても途中までデータが書込まれているため、書込み異常となり、当該ICカードを再利用することはできず、効率的ではないという問題がある。   However, in the conventional technique described above, if data writing is interrupted in the middle of writing a particularly long data in a data area in which data writing is permitted only once, the same command may be executed again. Since the data has been written halfway, there is a problem that the writing is abnormal, the IC card cannot be reused, and it is not efficient.

そこで、本発明は、たとえば、1回だけデータの書込みが許可されたデータ領域に対して大量のデータを書込む際に、データ書込みの途中で通信異常等により全てのデータが書込めなかった場合、同じ領域内で逆方向からデータを書込むことにより、データ領域を再利用できる携帯可能電子装置およびICカードを提供することを目的とする。   Therefore, in the present invention, for example, when a large amount of data is written in a data area in which data writing is permitted only once, all data cannot be written due to a communication error or the like during the data writing. An object of the present invention is to provide a portable electronic device and an IC card that can reuse a data area by writing data from the opposite direction in the same area.

本発明の携帯可能電子装置は、データを記憶するためのメモリと、このメモリに対してデータの読出しおよびまたは書込みを行なう制御素子を有し、外部から入力されるコマンドに対応した処理を実行してその結果を外部へ出力し、かつ、前記メモリには、1回だけデータの書込みが許可されたデータ領域が少なくとも1つ以上設定されている携帯可能電子装置において、前記データ領域におけるデータの並び方向が「先頭アドレスから最終アドレスに向う」あるいは「最終アドレスから先頭アドレスに向う」あるいは「両方向で書込み不能」であるかを表すもので、初期状態は「先頭アドレスから最終アドレスに向う」に設定されている第1の識別子と、前記メモリの1回だけデータの書込みが許可されたデータ領域に対してデータの書込みを行なう際、前記第1の識別子の状態をチェックする第1のチェック手段と、この第1のチェック手段によるチェックの結果、第1の識別子がデータの並び方向が「先頭アドレスから最終アドレスに向う」となっていた場合、先頭アドレスからの並び方向で当該データ領域に対してデータを書込む第1の書込み手段と、この第1の書込み手段によるデータの書込み時に書込みエラーが発生した場合、前記第1の識別子をデータの並び方向は「最終アドレスから先頭アドレスに向う」に切換え設定する第1の制御手段と、前記第1のチェック手段によるチェックの結果、第1の識別子がデータの並び方向は「最終アドレスから先頭アドレスに向う」となっていた場合、最終アドレスからの並び方向で当該データ領域に対してデータを書込む第2の書込み手段と、この第2の書込み手段によるデータの書込み時に書込みエラーが発生した場合、前記第1の識別子を「両方向で書込み不能」に切換え設定する第2の制御手段とを具備している。   The portable electronic device of the present invention has a memory for storing data and a control element for reading and writing data to the memory, and executes processing corresponding to an externally input command. In the portable electronic device in which the result is output to the outside and at least one data area in which writing of data is permitted only once is set in the memory, the arrangement of data in the data area Indicates whether the direction is "from the first address to the last address", "from the last address to the first address", or "unwritable in both directions", and the initial state is set to "from the first address to the last address" Data writing to the first identifier and the data area in which data writing is permitted only once in the memory When performing the first identifier, the first identifier for checking the state of the first identifier, and as a result of the check by the first identifier, the first identifier has a data arrangement direction “from the first address to the last address. , The first writing means for writing data to the data area in the arrangement direction from the head address, and when a writing error occurs when writing data by the first writing means, As a result of the check by the first control means for switching the first identifier from “last address to head address” as the data arrangement direction and the first check means, the first identifier is the data arrangement direction. Is “From the last address to the top address”, the data is written to the data area in the arrangement direction from the last address. And a second control unit that switches the first identifier to “unwritable in both directions” when a write error occurs when data is written by the second writing unit. .

また、本発明のICカードは、データを記憶するためのメモリと、このメモリに対してデータの読出しおよびまたは書込みを行なう制御素子を有し、外部から入力されるコマンドに対応した処理を実行してその結果を外部へ出力し、かつ、前記メモリには、1回だけデータの書込みが許可されたデータ領域が少なくとも1つ以上設定されているICカードにおいて、前記データ領域におけるデータの並び方向が「先頭アドレスから最終アドレスに向う」あるいは「最終アドレスから先頭レスに向う」あるいは「両方向で書込み不能」であるかを表すもので、初期状態は「先頭アドレスから最終アドレスに向う」に設定されている第1の識別子と、前記メモリの1回だけデータの書込みが許可されたデータ領域に対してデータの書込みを行なう際、前記第1の識別子の状態をチェックする第1のチェック手段と、この第1のチェック手段によるチェックの結果、第1の識別子がデータの並び方向が「先頭アドレスから最終アドレスに向う」となっていた場合、先頭アドレスからの並び方向で当該データ領域に対してデータを書込む第1の書込み手段と、この第1の書込み手段によるデータの書込み時に書込みエラーが発生した場合、前記第1の識別子をデータの並び方向は「最終アドレスから先頭アドレスに向う」に切換え設定する第1の制御手段と、前記第1のチェック手段によるチェックの結果、第1の識別子がデータの並び方向は「最終アドレスから先頭アドレスに向う」となっていた場合、最終アドレスからの並び方向で当該データ領域に対してデータを書込む第2の書込み手段と、この第2の書込み手段によるデータの書込み時に書込みエラーが発生した場合、前記第1の識別子を「両方向で書込み不能」に切換え設定する第2の制御手段とを有したICモジュールと、このICモジュールを収納したICカード本体とを具備している。   The IC card of the present invention has a memory for storing data and a control element for reading and writing data to the memory, and executes processing corresponding to a command input from the outside. In the IC card in which at least one data area in which data writing is permitted only once is set in the memory, the data alignment direction in the data area is It indicates whether it is “from the top address to the last address”, “from the last address to the headless” or “unwritable in both directions”, and the initial state is set to “from the head address to the last address” Data is written to the first identifier and the data area in which data is allowed to be written only once in the memory. As a result of checking by the first checking means for checking the state of the first identifier and the first checking means, the first identifier has the data arrangement direction “from the first address to the last address”. The first write means for writing data to the data area in the arrangement direction from the head address, and when a write error occurs when data is written by the first write means, the first write means As a result of the check by the first control means for switching the identifier from “last address to head address” as the data arrangement direction, and the first check means, the first identifier indicates that the data arrangement direction is “final 2nd write that writes data to the data area in the arrangement direction from the last address. And an IC module having a second control means for switching and setting the first identifier to “unwritable in both directions” when a write error occurs when data is written by the second writing means, And an IC card main body containing the IC module.

本発明によれば、たとえば、1回だけデータの書込みが許可されたデータ領域に対して大量のデータを書込む際に、データ書込みの途中で通信異常等により全てのデータが書込めなかった場合、同じ領域内で逆方向からデータを書込むことにより、データ領域を再利用できる携帯可能電子装置およびICカードを提供できる。   According to the present invention, for example, when a large amount of data is written to a data area in which data writing is permitted only once, all data cannot be written due to a communication error or the like during the data writing. By writing data from the opposite direction in the same area, a portable electronic device and an IC card that can reuse the data area can be provided.

以下、本発明の実施の形態について図面を参照して説明する。
まず、第1の実施の形態について説明する。
図1は、本実施の形態に係る携帯可能電子装置としてのICカードを取扱うICカードシステムの構成例を示すものである。このICカードシステムは、ICカード11をカードリーダ・ライタ12を介してパーソナルコンピュータなどの端末装置13と接続可能にするとともに、端末装置13にキーボード14、CRT表示部15、プリンタ16を接続して構成される。
Hereinafter, embodiments of the present invention will be described with reference to the drawings.
First, the first embodiment will be described.
FIG. 1 shows a configuration example of an IC card system that handles an IC card as a portable electronic device according to the present embodiment. In this IC card system, the IC card 11 can be connected to a terminal device 13 such as a personal computer via a card reader / writer 12, and a keyboard 14, a CRT display unit 15, and a printer 16 are connected to the terminal device 13. Composed.

図2は、ICカード11の構成を示すもので、制御素子としてのCPU101、記憶内容が書換え可能な記憶手段(メモリ)としてのデータメモリ102、ワーキングメモリ103、プログラムメモリ104、および、カードリーダ・ライタ12との電気的接触を得るためのコンタクト部105によって構成されている。そして、これらのうち、破線内の部分(CPU101、データメモリ102、ワーキングメモリ103、プログラムメモリ104)は1つ(あるいは複数)のICチップ106で構成され、さらに、このICチップ106とコンタクト部105とが一体的にICモジュール化されて、ICカード本体11a内に埋設されている。   FIG. 2 shows the configuration of the IC card 11, and includes a CPU 101 as a control element, a data memory 102 as a storage means (memory) whose contents can be rewritten, a working memory 103, a program memory 104, a card reader, The contact portion 105 is used to obtain electrical contact with the writer 12. Of these, the portion within the broken line (CPU 101, data memory 102, working memory 103, program memory 104) is composed of one (or a plurality) of IC chips 106, and further this IC chip 106 and contact portion 105. Are integrated into an IC module and embedded in the IC card main body 11a.

データメモリ102は、たとえば、EEPROMなどの記憶内容が書換え可能な不揮発性メモリで構成されていて、各種アプリケーションデータなどがファイル構造で記憶される。   The data memory 102 is configured by a nonvolatile memory such as an EEPROM, which can rewrite stored contents, and stores various application data in a file structure.

たとえば、データメモリ102には、メモリ容量が大容量で、バイナリデータを1回だけ書込めて書換えができないデータ領域(バイナリ・エレメンタリ・ファイル)EFが少なくとも1つ設定されていて、このデータ領域EFには画像データ等(たとえば、10Kバイトあるいは20Kバイト以上の顔画像等)の長いデータが格納されるものとする。   For example, the data memory 102 has at least one data area (binary elementary file) EF that has a large memory capacity and cannot be rewritten by writing binary data only once. This data area EF Assume that long data such as image data (for example, a face image of 10 Kbytes or 20 Kbytes or more) is stored in.

また、データ領域EFには、当該データ領域EFにおけるデータの並び方向が「先頭アドレスから最終アドレスに向う」あるいは「最終アドレスから先頭アドレスに向う」あるいは「両方向で書込み不能」であるかを表すもので、初期状態は「先頭アドレスから最終アドレスに向う」に設定されている第1の識別子としてのフラグF1、および、当該データ領域EFに対するデータの書込み時にセットされ、当該データの書込み終了時にクリアされる第2の識別子としてのフラグF2がそれぞれ格納されている。なお、フラグF1は、データの書込み処理および読出し処理の双方に適用される。   The data area EF indicates whether the data arrangement direction in the data area EF is “from the start address to the end address”, “from the end address to the start address”, or “writable in both directions”. Thus, the initial state is set at the time of writing data to the data area EF and the flag F1 as the first identifier set to “from the first address to the last address” and cleared at the end of the data writing. Each flag F2 as a second identifier is stored. The flag F1 is applied to both data write processing and data read processing.

ワーキングメモリ103は、CPU101が処理を行なう際の処理データなどを一時的に保持するための作業用メモリであり、たとえば、RAMなどで構成される。
プログラムメモリ104は、たとえば、マスクROMなどの記憶内容が書換え不可能な不揮発性メモリで構成されており、CPU101の制御プログラムなどを記憶するものである。
The working memory 103 is a working memory for temporarily storing processing data when the CPU 101 performs processing, and is configured by, for example, a RAM.
The program memory 104 is composed of, for example, a non-volatile memory that cannot be rewritten, such as a mask ROM, and stores a control program of the CPU 101 and the like.

図3は、データメモリ102の1回だけデータの書込みが許可されたデータ領域に対してバイナリデータを書込む際のライトバイナリ(WRITE BINARY)コマンドのフォーマットを示すものである。ライトバイナリコマンドは、カードリーダ・ライタ12から入力されるもので、コマンドを識別する機能などを持つ分類部(CLA:class)、命令部(INS:instruction)、パラメータデータ(P1、P2)、書込むデータの長さを表すデータ長(Lc)、および、書込みデータ(DATA)から構成されている。   FIG. 3 shows a write binary (WRITE BINARY) command format for writing binary data to a data area in the data memory 102 in which data writing is permitted only once. The write binary command is input from the card reader / writer 12, and includes a classification unit (CLA: class) having a function for identifying the command, an instruction unit (INS: instruction), parameter data (P1, P2), a writing It consists of a data length (Lc) representing the length of data to be inserted and write data (DATA).

次に、このような構成において、第1の実施の形態に係るライトバイナリコマンドに対するデータ書込み処理について、図4、図5に示すフローチャートおよび図6、図7に示すデータ領域にデータを書込む際のイメージ図を参照して説明する。   Next, in such a configuration, when data is written to the data areas shown in the flowcharts shown in FIGS. 4 and 5 and the data areas shown in FIGS. 6 and 7 in the data writing process for the write binary command according to the first embodiment. This will be described with reference to the image diagram.

CPU101は、カードリーダ・ライタ12からのリセット解除により活性化されると、カードリーダ・ライタ12に対し初期応答データを送信する(ステップS1)。初期応答データを正常に送信すると、CPU101は、カードリーダ・ライタ12から入力されるコマンドの受信を待機し、コマンドを正常に受信すると(ステップS2)、当該コマンドのCLA部およびINS部によりコマンドの種類を確認する(ステップS3)。確認の結果、受信したコマンドがライトバイナリコマンド以外の場合、CPU101は、対応するコマンド処理を実行するが、ここでは説明を省略する。   When activated by reset cancellation from the card reader / writer 12, the CPU 101 transmits initial response data to the card reader / writer 12 (step S1). When the initial response data is normally transmitted, the CPU 101 waits for reception of a command input from the card reader / writer 12, and when the command is normally received (step S2), the CLA portion and INS portion of the command receive a command. The type is confirmed (step S3). As a result of the confirmation, if the received command is other than the write binary command, the CPU 101 executes the corresponding command processing, but the description is omitted here.

ステップS3における確認の結果、受信したコマンドがライトバイナリコマンドの場合、CPU101は、当該コマンドのP1部およびP2部によって指定されたデータ領域(バイナリファイル)EFがデータメモリ102内に存在するか否かをチェックし(ステップS4)、指定されたデータ領域EFが存在しない場合は当該処理を終了し、ステップS2のコマンド受信待ち状態に戻る。   If the received command is a write binary command as a result of the confirmation in step S3, the CPU 101 determines whether or not the data area (binary file) EF designated by the P1 part and P2 part of the command exists in the data memory 102. Is checked (step S4), and if the designated data area EF does not exist, the process ends, and the process returns to the command reception waiting state in step S2.

ステップS4におけるチェックの結果、指定されたデータ領域EFが存在する場合、CPU101は、当該データ領域EF内のフラグF2の状態をチェックする(ステップS5、図6(a)参照)。今回は、最初の書込み処理のため、フラグF2はクリア状態である。   As a result of the check in step S4, when the designated data area EF exists, the CPU 101 checks the state of the flag F2 in the data area EF (see step S5, FIG. 6A). This time, the flag F2 is in a clear state for the first writing process.

ステップS5におけるチェックの結果、フラグF2がクリア状態の場合、CPU101は、当該データ領域EF内のフラグF1の状態をチェックする(ステップS6)。今回は、最初の書込みのため、フラグF1は初期状態であり、データの並び方向は「先頭アドレスから最終アドレスに向う」となっている。   As a result of the check in step S5, if the flag F2 is in the clear state, the CPU 101 checks the state of the flag F1 in the data area EF (step S6). This time, for the first writing, the flag F1 is in an initial state, and the data arrangement direction is “from the first address to the last address”.

ステップS6におけるチェックの結果、フラグF1がデータの並び方向は「先頭アドレスから最終アドレスに向う」となっていた場合、CPU101は、受信したライトバイナリコマンドのP1部およびP2部の値とLc部の値(書込みサイズ)とフラグF1の状態に基づき、当該データ領域EFの先頭アドレスから見た書込み先範囲が当該データ領域EFのサイズ未満(先頭アドレスから見た書込み先範囲が領域オーバ)であるか否かをチェックし(ステップS7、図6(b)参照)、先頭アドレスから見た書込み先範囲が領域オーバである場合は当該処理を終了し、ステップS2のコマンド受信待ち状態に戻る。   As a result of the check in step S6, when the flag F1 indicates that the data arrangement direction is “from the first address to the last address”, the CPU 101 determines the values of the P1 part and P2 part of the received write binary command and the Lc part. Based on the value (write size) and the state of the flag F1, whether the write destination range seen from the start address of the data area EF is less than the size of the data area EF (the write destination range seen from the start address is area over) (Step S7, see FIG. 6B), and if the write destination range seen from the head address is over the area, the process is terminated and the process returns to the command reception waiting state in step S2.

ステップS7におけるチェックの結果、先頭アドレスから見た書込み先範囲が領域オーバでない場合、CPU101は、当該データ領域EFの先頭アドレスから見た書込み先範囲が全て初期値であるか否かをチェックし(ステップS8)、先頭アドレスから見た書込み先範囲が全て初期値でない場合は当該処理を終了し、ステップS2のコマンド受信待ち状態に戻る。   As a result of the check in step S7, if the write destination range seen from the top address is not over the area, the CPU 101 checks whether all the write destination ranges seen from the top address of the data area EF are initial values ( In step S8), if all the write destination ranges viewed from the top address are not initial values, the process is terminated and the process returns to the command reception waiting state in step S2.

ステップS8におけるチェックの結果、先頭アドレスから見た書込み先範囲が全て初期値である場合、CPU101は、データの書込み処理を開始する。すなわち、まず、当該データ領域EF内のフラグF2をセットする(ステップS9、図6(c)参照)。次に、CPU101は、フラグF1の示すデータの並び方向(先頭アドレスから)で、当該データ領域EFに対してデータを書込む(ステップS10、図6(c)参照)。   As a result of the check in step S8, when all the write destination ranges viewed from the top address are initial values, the CPU 101 starts data write processing. That is, first, the flag F2 in the data area EF is set (step S9, see FIG. 6C). Next, the CPU 101 writes data in the data area EF in the data arrangement direction (from the top address) indicated by the flag F1 (see step S10, FIG. 6C).

次に、CPU101は、全てのデータを正常に書込んだか否かをチェックし(ステップS11)、通信不良等で途中で書き終わってしまった場合は、当該データ領域EF内のフラグF1をデータの並び方向は「最終アドレスから先頭アドレスに向う」に切換え設定し、その後、フラグF2をクリアし、ステップS2のコマンド受信待ち状態に戻る(ステップS12,S13、図6(d),(e)参照)。   Next, the CPU 101 checks whether or not all data has been normally written (step S11). If the data has been written halfway due to a communication failure or the like, the CPU 101 sets the flag F1 in the data area EF for the data. The arrangement direction is switched to “from the last address to the head address”, and then the flag F2 is cleared and the process returns to the command reception waiting state in step S2 (see steps S12 and S13, FIGS. 6D and 6E). ).

ステップS11におけるチェックの結果、全てのデータを正常に書込んだ場合、CPU101は、フラグF1はそのままで、フラグF2をクリアし(ステップS13)、ステップS2のコマンド受信待ち状態に戻る。以上で書込み処理を終了する。   As a result of the check in step S11, when all data has been written normally, the CPU 101 clears the flag F2 while keeping the flag F1 (step S13), and returns to the command reception waiting state in step S2. This completes the writing process.

なお、上記データ書込み処理の時、当該ICカード11が処理を行なえないような強制終了(たとえば、書込み中に電源をオフされる等)があった場合、フラグF2はセットされたままの状態となる。   If the IC card 11 cannot be processed during the data writing process (for example, the power is turned off during writing), the flag F2 remains set. Become.

次に、前回、書込み失敗(ただし、当該ICカード11は終了処理実施)した場合に同じデータ領域EFに対してデータ書込み処理を行なう場合について説明する。   Next, a case will be described in which data writing processing is performed on the same data area EF when writing has failed last time (however, the IC card 11 performs termination processing).

前述同様、ステップS1〜S4と進み、指定されたデータ領域EFが存在する場合、CPU101は、当該データ領域EF内のフラグF2の状態をチェックする(ステップS5、図7(a)参照)。今回は、2回目の書込み処理で、前回の書込み失敗により終了処理が行なわれているため、フラグF2はクリア状態である。   As described above, the process proceeds to steps S1 to S4. When the designated data area EF exists, the CPU 101 checks the state of the flag F2 in the data area EF (see step S5, FIG. 7A). This time, the flag F2 is in the clear state because the end processing is performed due to the previous writing failure in the second writing processing.

したがって、CPU101は、続けて当該データ領域EF内のフラグF1の状態をチェックする(ステップS6)。今回は、2回目の書込み処理で、前回の書込み失敗により終了処理が行なわれていて、フラグF1がデータの並び方向は「先頭アドレスから最終アドレスに向う」となっていないため、CPU101は、フラグF1がデータの並び方向は「最終アドレスから先頭アドレスに向う」となっているか否かをチェック(ステップS14)。   Therefore, the CPU 101 continues to check the state of the flag F1 in the data area EF (step S6). In this case, in the second writing process, the end process is performed due to the previous writing failure, and the data alignment direction of the flag F1 is not “from the first address to the last address”. It is checked whether or not the data arrangement direction of F1 is “from the last address to the head address” (step S14).

ステップS14におけるチェックの結果、フラグF1がデータの並び方向は「最終アドレスから先頭アドレスに向う」となっていない場合、CPU101は当該処理を終了し、ステップS2のコマンド受信待ち状態に戻る。   As a result of the check in step S14, if the flag F1 does not indicate that the data arrangement direction is “from the last address to the head address”, the CPU 101 ends the process and returns to the command reception waiting state in step S2.

ステップS14におけるチェックの結果、フラグF1がデータの並び方向は「最終アドレスから先頭アドレスに向う」となっている場合、CPU101は、受信したライトバイナリコマンドのオフセット値と書込みサイズとフラグF1の状態に基づき、当該データ領域EFの最終アドレスから見た書込み先範囲が当該データ領域EFのサイズ未満(最終アドレスから見た書込み先範囲が領域オーバ)であるか否かをチェックし(ステップS15、図7(b)参照)、最終アドレスから見た書込み先範囲が領域オーバである場合は当該処理を終了し、ステップS2のコマンド受信待ち状態に戻る。   As a result of the check in step S14, when the flag F1 indicates that the data arrangement direction is “from the last address to the head address”, the CPU 101 sets the offset value, write size, and flag F1 state of the received write binary command. Based on this, it is checked whether the write destination range seen from the final address of the data area EF is less than the size of the data area EF (the write destination range seen from the final address is area over) (step S15, FIG. 7). (Refer to (b)), when the write destination range seen from the final address is over the area, the process is terminated and the process returns to the command reception waiting state in step S2.

ステップS15におけるチェックの結果、最終アドレスから見た書込み先範囲が領域オーバでない場合、CPU101は、当該データ領域EFの最終アドレスから見た書込み先範囲が全て初期値であるか否かをチェックし(ステップS16)、最終アドレスから見た書込み先範囲が全て初期値でない場合は当該処理を終了し、ステップS2のコマンド受信待ち状態に戻る。   As a result of the check in step S15, if the write destination range seen from the final address is not over the area, the CPU 101 checks whether all the write destination ranges seen from the final address of the data area EF are initial values ( In step S16), if all the write destination ranges viewed from the final address are not initial values, the process is terminated, and the process returns to the command reception waiting state in step S2.

ステップS16におけるチェックの結果、最終アドレスから見た書込み先範囲が全て初期値である場合、CPU101は、データの書込み処理を開始する。すなわち、まず、当該データ領域EF内のフラグF2をセットする(ステップS17、図7(c)参照)。次に、CPU101は、フラグF1の示すデータの並び方向(最終アドレスから)で、当該データ領域EFに対してデータを書込む(ステップS18、図7(c)参照)。   As a result of the check in step S16, if all the write destination ranges viewed from the final address are initial values, the CPU 101 starts data write processing. That is, first, the flag F2 in the data area EF is set (step S17, see FIG. 7C). Next, the CPU 101 writes data in the data area EF in the data arrangement direction (from the last address) indicated by the flag F1 (see step S18, FIG. 7C).

次に、CPU101は、全てのデータを正常に書込んだか否かをチェックし(ステップS19)、通信不良等で途中で書き終わってしまった場合は、当該データ領域EF内のフラグF1を「両方向で書込み不能」に切換え設定し、その後、フラグF2をクリアし、ステップS2のコマンド受信待ち状態に戻る(ステップS20,S21、図7(d)参照)。   Next, the CPU 101 checks whether or not all the data has been normally written (step S19). If the data has been written halfway due to communication failure or the like, the CPU 101 sets the flag F1 in the data area EF to “bidirectional”. Then, the flag F2 is cleared and the process returns to the command reception waiting state in step S2 (see steps S20 and S21, FIG. 7 (d)).

ステップS19におけるチェックの結果、全てのデータを正常に書込んだ場合、CPU101は、フラグF1はそのままで、フラグF2をクリアし(ステップS21、図7(e)参照)、ステップS2のコマンド受信待ち状態に戻る。以上で書込み処理を終了する。   As a result of the check in step S19, when all data has been written normally, the CPU 101 clears the flag F2 while keeping the flag F1 (see step S21, FIG. 7E), and waits for command reception in step S2. Return to state. This completes the writing process.

次に、前回、書込み失敗(ただし、当該ICカード11は強制終了)した場合に同じデータ領域EFに対してデータ書込み処理を行なう場合について説明する。   Next, a description will be given of a case where data writing processing is performed on the same data area EF when writing failed last time (however, the IC card 11 is forcibly terminated).

前述同様、ステップS1〜S4と進み、指定されたデータ領域EFが存在する場合、CPU101は、当該データ領域EF内のフラグF2の状態をチェックする(ステップS5、図7(a)参照)。今回は、2回目の書込み処理であるが、前回の書込み失敗(強制終了)により終了処理が行なわれていないため、フラグF2はセット状態である。   As described above, the process proceeds to steps S1 to S4. When the designated data area EF exists, the CPU 101 checks the state of the flag F2 in the data area EF (see step S5, FIG. 7A). Although this time is the second writing process, the flag F2 is in the set state because the termination process is not performed due to the previous writing failure (forced termination).

したがって、CPU101は、続けて当該データ領域EF内のフラグF1の状態をチェックする(ステップS22)。このチェックの結果、フラグF1がデータの並び方向は「先頭アドレスから最終アドレスに向う」となっている場合、CPU101は、フラグF1をデータの並び方向は「最終アドレスから先頭アドレスに向う」に切換え設定し(ステップS23)、その後、フラグF2をクリアし(ステップS24)、ステップS14に進む。   Therefore, the CPU 101 continues to check the state of the flag F1 in the data area EF (step S22). As a result of this check, if the flag F1 indicates that the data arrangement direction is “from the first address to the last address”, the CPU 101 switches the flag F1 from “last address to the first address”. After setting (step S23), the flag F2 is cleared (step S24), and the process proceeds to step S14.

ステップS22におけるチェックの結果、フラグF1がデータの並び方向は「先頭アドレスから最終アドレスに向う」となっていない場合、CPU101は、フラグF1を「両方向で書込み不能」に切換え設定し(ステップS25)、その後、フラグF2をクリアし(ステップS26)、ステップS2のコマンド受信待ち状態に戻る。   As a result of the check in step S22, if the flag F1 does not indicate that the data arrangement direction is “from the first address to the last address”, the CPU 101 switches and sets the flag F1 to “unwritable in both directions” (step S25). Thereafter, the flag F2 is cleared (step S26), and the process returns to the command reception waiting state in step S2.

ステップS14では、フラグF1がデータの並び方向は「最終アドレスから先頭アドレスに向う」となっているか否かをチェックし、フラグF1がデータの並び方向は「最終アドレスから先頭アドレスに向う」となっていない場合、CPU101は当該処理を終了し、ステップS2のコマンド受信待ち状態に戻る。   In step S14, it is checked whether or not the data arrangement direction of the flag F1 is “from the last address to the head address”, and the flag F1 is “data heading from the last address to the head address”. If not, the CPU 101 ends the process and returns to the command reception waiting state in step S2.

ステップS14におけるチェックの結果、フラグF1がデータの並び方向は「最終アドレスから先頭アドレスに向う」となっている場合、CPU101は、受信したライトバイナリコマンドのP1部およびP2部の値とLc部の値(書込みサイズ)とフラグF1の状態に基づき、当該データ領域EFの最終アドレスから見た書込み先範囲が当該データ領域EFのサイズ未満(最終アドレスから見た書込み先範囲が領域オーバ)であるか否かをチェックし(ステップS15、図7(b)参照)、最終アドレスから見た書込み先範囲が領域オーバである場合は当該処理を終了し、ステップS2のコマンド受信待ち状態に戻る。   As a result of the check in step S14, when the flag F1 indicates that the data arrangement direction is “from the last address to the head address”, the CPU 101 determines the values of the P1 part and P2 part of the received write binary command and the Lc part. Based on the value (write size) and the state of the flag F1, whether the write destination range seen from the final address of the data area EF is less than the size of the data area EF (write destination range seen from the final address is area over) (Step S15, see FIG. 7B), and if the write destination range seen from the final address is over the area, the process is terminated and the process returns to the command reception waiting state in step S2.

ステップS15におけるチェックの結果、最終アドレスから見た書込み先範囲が領域オーバでない場合、CPU101は、当該データ領域EFの最終アドレスから見た書込み先範囲が全て初期値であるか否かをチェックし(ステップS16)、最終アドレスから見た書込み先範囲が全て初期値でない場合は当該処理を終了し、ステップS2のコマンド受信待ち状態に戻る。   As a result of the check in step S15, if the write destination range seen from the final address is not over the area, the CPU 101 checks whether all the write destination ranges seen from the final address of the data area EF are initial values ( In step S16), if all the write destination ranges viewed from the final address are not initial values, the process is terminated, and the process returns to the command reception waiting state in step S2.

ステップS16におけるチェックの結果、最終アドレスから見た書込み先範囲が全て初期値である場合、CPU101は、データの書込み処理を開始する。すなわち、まず、当該データ領域EF内のフラグF2をセットする(ステップS17、図7(c)参照)。次に、CPU101は、フラグF1の示すデータの並び方向(最終アドレスから)で、当該データ領域EFに対してデータを書込む(ステップS18、図7(c)参照)。   As a result of the check in step S16, if all the write destination ranges viewed from the final address are initial values, the CPU 101 starts data write processing. That is, first, the flag F2 in the data area EF is set (step S17, see FIG. 7C). Next, the CPU 101 writes data in the data area EF in the data arrangement direction (from the last address) indicated by the flag F1 (see step S18, FIG. 7C).

次に、CPU101は、全てのデータを正常に書込んだか否かをチェックし(ステップS19)、通信不良等で途中で書き終わってしまった場合は、当該データ領域EF内のフラグF1を「両方向で書込み不能」に切換え設定し、その後、フラグF2をクリアし、ステップS2のコマンド受信待ち状態に戻る(ステップS20,S21、図7(d)参照)。   Next, the CPU 101 checks whether or not all the data has been normally written (step S19). If the data has been written halfway due to communication failure or the like, the CPU 101 sets the flag F1 in the data area EF to “bidirectional”. Then, the flag F2 is cleared and the process returns to the command reception waiting state in step S2 (see steps S20 and S21, FIG. 7 (d)).

ステップS19におけるチェックの結果、全てのデータを正常に書込んだ場合、CPU101は、フラグF1はそのままで、フラグF2をクリアし(ステップS21、図7(e)参照)、ステップS2のコマンド受信待ち状態に戻る。以上で書込み処理を終了する。   As a result of the check in step S19, when all data has been written normally, the CPU 101 clears the flag F2 while keeping the flag F1 (see step S21, FIG. 7E), and waits for command reception in step S2. Return to state. This completes the writing process.

なお、2度、書込み失敗した場合に同じデータ領域EFに対してデータ書込みを行なう場合、フラグF1の状態が「両方向で不能」と判断した時点でコマンド処理を終了する。   When data writing is performed to the same data area EF when the writing has failed twice, the command processing is terminated when it is determined that the state of the flag F1 is “impossible in both directions”.

次に、第2の実施の形態について説明する。
第2の実施の形態では、さらに、データ領域EFには、初期状態が「データ領域は初期化状態」に設定され、データの書込みが終了した際に「データ領域は書込み済」に切換え設定される第3の識別子としてのフラグF3が格納されている。
Next, a second embodiment will be described.
In the second embodiment, the initial state of the data area EF is set to “data area is initialized”, and when data writing is completed, the data area EF is switched to “data area is already written”. A flag F3 as a third identifier is stored.

以下、第2の実施の形態に係るライトバイナリコマンドに対するデータ書込み処理について説明するが、前述した第1の実施の形態(図4、図5)と同一部分は説明を省略し、異なる部分について図8に示すフローチャートおよび図9に示すデータ領域にデータを書込む際のイメージ図を参照して説明する。   Hereinafter, the data write processing for the write binary command according to the second embodiment will be described. However, the description of the same parts as those of the first embodiment (FIGS. 4 and 5) is omitted, and different parts are illustrated. 8 and an image diagram when data is written in the data area shown in FIG. 9 will be described.

前述した第1の実施の形態と異なる部分は、図8に示すように、ステップS15とステップS16との間にステップS27の処理が追加され、ステップS18とステップS19との間にステップS28の処理が追加された点が異なり、その他は同一である。   As shown in FIG. 8, the difference from the first embodiment described above is that step S27 is added between step S15 and step S16, and step S28 is executed between step S18 and step S19. Is different, and the others are the same.

すなわち、前述した第1の実施の形態と同様、ステップS1〜S14と進み、フラグF1がデータの並び方向は「最終アドレスから先頭アドレスに向う」となっている場合、CPU101は、受信したライトバイナリコマンドのP1部およびP2部の値とLc部の値(書込みサイズ)とフラグF1の状態に基づき、当該データ領域EFの最終アドレスから見た書込み先範囲が当該データ領域EFのサイズ未満(最終アドレスから見た書込み先範囲が領域オーバ)であるか否かをチェックし(ステップS15、図9(b)参照)、最終アドレスから見た書込み先範囲が領域オーバである場合は当該処理を終了し、ステップS2のコマンド受信待ち状態に戻る。   That is, as in the first embodiment described above, the process proceeds to steps S1 to S14, and when the flag F1 indicates that the data arrangement direction is “from the last address to the head address”, the CPU 101 receives the received write binary. Based on the values of the P1 and P2 parts of the command, the value of the Lc part (write size), and the state of the flag F1, the write destination range viewed from the final address of the data area EF is less than the size of the data area EF (final address (See step S15, FIG. 9 (b)), and if the write destination range seen from the final address is over the area, the process is terminated. Return to the command reception waiting state in step S2.

ステップS15におけるチェックの結果、最終アドレスから見た書込み先範囲が領域オーバでない場合、CPU101は、当該データ領域EF内のフラグF3の状態をチェックし(ステップS27)、フラグF3が「データ領域は初期化状態」に設定されている場合、データの書込み処理を開始する。ステップS27におけるチェックの結果、フラグF3が「データ領域は書込み済」に設定されている場合、CPU101は、ステップS16の処理を行なった後、データの書込み処理を開始する。   As a result of the check in step S15, if the write destination range viewed from the final address is not over the area, the CPU 101 checks the state of the flag F3 in the data area EF (step S27). If it is set to “enable state”, the data writing process is started. If the flag F3 is set to “data area has been written” as a result of the check in step S27, the CPU 101 starts the data writing process after performing the process in step S16.

すなわち、まず、当該データ領域EF内のフラグF2をセットする(ステップS17、図9(c)参照)。次に、CPU101は、フラグF1の示すデータの並び方向(最終アドレスから)で、当該データ領域EFに対してデータを書込む(ステップS18、図9(c)参照)。このとき、CPU101は、フラグF3を「データ領域は書込み済」に切換え設定する(ステップS28)。   That is, first, the flag F2 in the data area EF is set (step S17, see FIG. 9C). Next, the CPU 101 writes data to the data area EF in the data arrangement direction (from the last address) indicated by the flag F1 (see step S18, FIG. 9C). At this time, the CPU 101 switches and sets the flag F3 to “data area has been written” (step S28).

次に、CPU101は、全てのデータを正常に書込んだか否かをチェックし(ステップS19)、通信不良等で途中で書き終わってしまった場合は、当該データ領域EF内のフラグF1を「両方向で書込み不能」に切換え設定し、その後、フラグF2をクリアし、ステップS2のコマンド受信待ち状態に戻る(ステップS20,S21)。   Next, the CPU 101 checks whether or not all the data has been normally written (step S19). If the data has been written halfway due to communication failure or the like, the CPU 101 sets the flag F1 in the data area EF to “bidirectional”. Then, the flag F2 is cleared and the process returns to the command reception waiting state in step S2 (steps S20 and S21).

ステップS19におけるチェックの結果、全てのデータを正常に書込んだ場合、CPU101は、フラグF1はそのままで、フラグF2をクリアし(ステップS21、図9(d)参照)、ステップS2のコマンド受信待ち状態に戻る。以上で書込み処理を終了する。   As a result of the check in step S19, if all data has been written normally, the CPU 101 clears the flag F2 while keeping the flag F1 (see step S21, FIG. 9D), and waits for command reception in step S2. Return to state. This completes the writing process.

なお、フラグF3は、ステップS6におけるチェックの結果、フラグF1がデータの並び方向は「先頭アドレスから最終アドレスに向う」となっていた場合には、状態チェックは行なわない。   The flag F3 is not checked when the flag F1 indicates that the data alignment direction is “from the first address to the last address” as a result of the check in step S6.

このように、ステップS27によるチェックの結果、フラグF3が「データ領域は初期化状態」となっていた場合、当該データ領域EFにデータが書込まれていてもそれを無視して最終アドレスからの並び方向でデータを書込み、フラグF3が「データ領域は書込み済」となっていた場合、当該データ領域EFの最終アドレスから見た書込み先範囲が全て初期値であることを確認して、最終アドレスからの並び方向でデータを書込むものである。   As described above, when the flag F3 is "initialized state" as a result of the check in step S27, even if data is written in the data area EF, it is ignored and the data from the last address is ignored. When data is written in the arrangement direction and the flag F3 is “data area has been written”, it is confirmed that all the write destination ranges viewed from the final address of the data area EF are initial values, and the final address Data is written in the arrangement direction from.

以上説明したように、上記実施の形態によれば、1回だけデータの書込みが許可されたデータ領域に対してデータ(特に画像データ等の大量のデータ)を書込む際に、データ書込みの途中で通信異常等により全てのデータが書込めなかった場合、同じ領域内で逆方向からデータを書込むことにより、データ領域を再利用でき、非常に効率的である。   As described above, according to the above-described embodiment, when data (especially a large amount of data such as image data) is written to a data area in which data writing is permitted only once, the data is being written. If all data cannot be written due to a communication error or the like, the data area can be reused by writing data from the opposite direction in the same area, which is very efficient.

なお、前記実施の形態では、携帯可能電子装置として接触式のICカードに適用した場合について説明したが、本発明はこれに限定されるものではなく、非接触式のICカードなどへの応用も可能であり、また、PDAと称される携帯端末装置や携帯電話機などであっても適用でき、さらに、携帯可能電子装置の形状もカード型に限らず、冊子型、ブロック型あるいはタグ型など、他の形状であってもよい。   In the above embodiment, the case where the present invention is applied to a contact type IC card as a portable electronic device has been described. However, the present invention is not limited to this and can be applied to a non-contact type IC card. It can also be applied to a portable terminal device or a mobile phone called PDA, and the shape of the portable electronic device is not limited to a card type, but a booklet type, a block type, a tag type, Other shapes may be used.

本発明に係る携帯可能電子装置としてのICカードを取扱うICカードシステムの構成例を示すブロック図。The block diagram which shows the structural example of the IC card system which handles the IC card as a portable electronic device concerning the present invention. ICカードの構成を概略的に示すブロック図。1 is a block diagram schematically showing the configuration of an IC card. ライトバイナリコマンドのフォーマットを示す模式図。The schematic diagram which shows the format of a write binary command. 第1の実施の形態に係るライトバイナリコマンドに対するデータ書込み処理について説明するフローチャート。6 is a flowchart for explaining data write processing for a write binary command according to the first embodiment. 第1の実施の形態に係るライトバイナリコマンドに対するデータ書込み処理について説明するフローチャート。6 is a flowchart for explaining data write processing for a write binary command according to the first embodiment. 第1の実施の形態に係るライトバイナリコマンドに対するデータ書込み処理においてデータ領域にデータを書込む際のイメージ図。The image figure at the time of writing data in a data area in the data write-in process with respect to the write binary command which concerns on 1st Embodiment. 第1の実施の形態に係るライトバイナリコマンドに対するデータ書込み処理においてデータ領域にデータを書込む際のイメージ図。The image figure at the time of writing data in a data area in the data write-in process with respect to the write binary command which concerns on 1st Embodiment. 第2の実施の形態に係るライトバイナリコマンドに対するデータ書込み処理について説明する要部のフローチャート。The main part flowchart explaining the data write-in process with respect to the write binary command which concerns on 2nd Embodiment. 第2の実施の形態に係るライトバイナリコマンドに対するデータ書込み処理においてデータ領域にデータを書込む際のイメージ図。The image figure at the time of writing data in a data area in the data write-in process with respect to the write binary command which concerns on 2nd Embodiment.

符号の説明Explanation of symbols

11…ICカード(携帯可能電子装置)、11a…ICカード本体、12…カードリーダ・ライタ、13…端末装置、14…キーボード、15…CRT表示部、16…プリンタ、101…CPU(制御素子)、102…データメモリ(記憶手段)、103…ワーキングメモリ、104…プログラムメモリ、105…コンタクト部、106…ICチップ、EF…データ領域(バイナリ・エレメンタリ・ファイル)、F1…フラグ(第1の識別子)、F2…フラグ(第2の識別子)、F3…フラグ(第3の識別子)。   DESCRIPTION OF SYMBOLS 11 ... IC card (portable electronic device), 11a ... IC card main body, 12 ... Card reader / writer, 13 ... Terminal device, 14 ... Keyboard, 15 ... CRT display part, 16 ... Printer, 101 ... CPU (control element) , 102 ... Data memory (storage means), 103 ... Working memory, 104 ... Program memory, 105 ... Contact part, 106 ... IC chip, EF ... Data area (binary elementary file), F1 ... Flag (first identifier) ), F2... Flag (second identifier), F3... Flag (third identifier).

Claims (6)

データを記憶するためのメモリと、このメモリに対してデータの読出しおよびまたは書込みを行なう制御素子を有し、外部から入力されるコマンドに対応した処理を実行してその結果を外部へ出力し、かつ、前記メモリには、1回だけデータの書込みが許可されたデータ領域が少なくとも1つ以上設定されている携帯可能電子装置において、
前記データ領域におけるデータの並び方向が「先頭アドレスから最終アドレスに向う」あるいは「最終アドレスから先頭アドレスに向う」あるいは「両方向で書込み不能」であるかを表すもので、初期状態は「先頭アドレスから最終アドレスに向う」に設定されている第1の識別子と、
前記メモリの1回だけデータの書込みが許可されたデータ領域に対してデータの書込みを行なう際、前記第1の識別子の状態をチェックする第1のチェック手段と、
この第1のチェック手段によるチェックの結果、第1の識別子がデータの並び方向が「先頭アドレスから最終アドレスに向う」となっていた場合、先頭アドレスからの並び方向で当該データ領域に対してデータを書込む第1の書込み手段と、
この第1の書込み手段によるデータの書込み時に書込みエラーが発生した場合、前記第1の識別子をデータの並び方向は「最終アドレスから先頭アドレスに向う」に切換え設定する第1の制御手段と、
前記第1のチェック手段によるチェックの結果、第1の識別子がデータの並び方向は「最終アドレスから先頭アドレスに向う」となっていた場合、最終アドレスからの並び方向で当該データ領域に対してデータを書込む第2の書込み手段と、
この第2の書込み手段によるデータの書込み時に書込みエラーが発生した場合、前記第1の識別子を「両方向で書込み不能」に切換え設定する第2の制御手段と、
を具備したことを特徴とする携帯可能電子装置。
It has a memory for storing data and a control element for reading and writing data to this memory, executes processing corresponding to a command input from the outside, and outputs the result to the outside. And in the portable electronic device in which at least one data area in which data writing is permitted only once is set in the memory,
This indicates whether the data alignment direction in the data area is “from the start address to the end address”, “from the end address to the start address”, or “unwritable in both directions”. A first identifier set to `` to the final address '',
First check means for checking a state of the first identifier when data is written to a data area in which writing of data is permitted only once in the memory;
As a result of the check by the first checking means, if the first identifier indicates that the data alignment direction is “from the first address to the last address”, the data is stored in the data area in the alignment direction from the first address. First writing means for writing
A first control unit that switches and sets the first identifier to “from the last address to the first address” when a write error occurs when data is written by the first writing unit;
As a result of the check by the first checking means, if the first identifier indicates that the data arrangement direction is “from the last address to the head address”, the data for the data area is arranged in the arrangement direction from the last address. Second writing means for writing
A second control unit that switches and sets the first identifier to “unwritable in both directions” when a write error occurs when data is written by the second writing unit;
A portable electronic device comprising:
前記第1の書込み手段あるいは第2の書込み手段によるデータの書込み時にセットされ、当該データの書込み終了時にクリアされる第2の識別子と、
前記1回だけデータの書込みが許可されたデータ領域に対してデータの書込みを行なう際、前記第2の識別子の状態をチェックする第2のチェック手段と、
この第2のチェック手段によるチェックの結果、第2の識別子がセットされている場合、前記第1の識別子をデータの並び方向は「最終アドレスから先頭アドレスに向う」に切換え設定する第3の制御手段とをさらに具備し、
前記第1のチェック手段は、前記第2のチェック手段によるチェックの結果、第2の識別子がクリアされている場合、前記第1の識別子の状態をチェックすることを特徴とする請求項1記載の携帯可能電子装置。
A second identifier that is set when data is written by the first writing means or the second writing means, and is cleared when the writing of the data is completed;
A second check means for checking a state of the second identifier when data is written to the data area in which data writing is permitted only once;
If the second identifier is set as a result of the check by the second checking means, a third control for switching and setting the first identifier from “last address to head address” in the data arrangement direction And further comprising means,
The said 1st check means checks the state of the said 1st identifier, when the 2nd identifier is cleared as a result of the check by the said 2nd check means, The said 1st identifier is characterized by the above-mentioned. Portable electronic device.
初期状態が「1回だけデータの書込みが許可されたデータ領域は初期化状態」に設定され、前記第2の書込み手段によるデータの書込みが終了した際に「1回だけデータの書込みが許可されたデータ領域は書込み済」に切換え設定される第3の識別子と、
前記第1のチェック手段によるチェックの結果、第1の識別子がデータの並び方向は「最終アドレスから先頭アドレスに向う」となっていた場合、前記第3の識別子の状態をチェックする第3のチェック手段とをさらに具備し、
前記第2の書込み手段は、前記第3のチェック手段によるチェックの結果、第3の識別子が「1回だけデータの書込みが許可されたデータ領域は初期化状態」となっていた場合、当該データ領域にデータが書込まれていてもそれを無視して最終アドレスからの並び方向でデータを書込み、第3の識別子が「1回だけデータの書込みが許可されたデータ領域は書込み済」となっていた場合、当該データ領域の最終アドレスから見た書込み先範囲が全て初期値であることを確認して、最終アドレスからの並び方向でデータを書込むことを特徴とする請求項1記載の携帯可能電子装置。
The initial state is set to “initialized state for a data area in which data writing is permitted only once”. When data writing by the second writing unit is completed, “data writing is permitted only once” A third identifier that is set to be switched to “data area is already written”;
As a result of the check by the first check means, if the first identifier has a data arrangement direction “from the last address to the head address”, a third check for checking the state of the third identifier And further comprising means,
When the third identifier is "a data area in which data writing is permitted only once is initialized" as a result of the check by the third checking means, the second writing means Even if data is written in the area, it is ignored and the data is written in the arrangement direction from the last address, and the third identifier is “data area in which data writing is permitted only once has been written”. 2. The mobile phone according to claim 1, wherein the data is written in the arrangement direction from the final address after confirming that all the write destination ranges viewed from the final address of the data area are initial values. Possible electronic device.
データを記憶するためのメモリと、このメモリに対してデータの読出しおよびまたは書込みを行なう制御素子を有し、外部から入力されるコマンドに対応した処理を実行してその結果を外部へ出力し、かつ、前記メモリには、1回だけデータの書込みが許可されたデータ領域が少なくとも1つ以上設定されているICカードにおいて、
前記データ領域におけるデータの並び方向が「先頭アドレスから最終アドレスに向う」あるいは「最終アドレスから先頭アドレスに向う」あるいは「両方向で書込み不能」であるかを表すもので、初期状態は「先頭アドレスから最終アドレスに向う」に設定されている第1の識別子と、前記メモリの1回だけデータの書込みが許可されたデータ領域に対してデータの書込みを行なう際、前記第1の識別子の状態をチェックする第1のチェック手段と、この第1のチェック手段によるチェックの結果、第1の識別子がデータの並び方向が「先頭アドレスから最終アドレスに向う」となっていた場合、先頭アドレスからの並び方向で当該データ領域に対してデータを書込む第1の書込み手段と、この第1の書込み手段によるデータの書込み時に書込みエラーが発生した場合、前記第1の識別子をデータの並び方向は「最終アドレスから先頭アドレスに向う」に切換え設定する第1の制御手段と、前記第1のチェック手段によるチェックの結果、第1の識別子がデータの並び方向は「最終アドレスから先頭アドレスに向う」となっていた場合、最終アドレスからの並び方向で当該データ領域に対してデータを書込む第2の書込み手段と、この第2の書込み手段によるデータの書込み時に書込みエラーが発生した場合、前記第1の識別子を「両方向で書込み不能」に切換え設定する第2の制御手段とを有したICモジュールと、
このICモジュールを収納したICカード本体と、
を具備したことを特徴とするICカード。
It has a memory for storing data and a control element for reading and writing data to this memory, executes processing corresponding to a command input from the outside, and outputs the result to the outside. In the IC card in which at least one data area in which data writing is permitted only once is set in the memory,
This indicates whether the data alignment direction in the data area is “from the start address to the end address”, “from the end address to the start address”, or “unwritable in both directions”. Checks the status of the first identifier when writing data to the first identifier set to “to the last address” and the data area in which data writing is permitted only once in the memory. The first checking means that performs the check, and if the first identifier indicates that the data alignment direction is “from the first address to the last address”, the first identifier is the alignment direction from the first address. The first writing means for writing data to the data area and the data writing at the time of data writing by the first writing means When an error occurs, the first control means for switching the first identifier from “the last address to the head address” and setting the data arrangement direction, and the result of the check by the first check means, In the case where the identifier of 1 indicates that the data arrangement direction is “from the last address to the head address”, the second writing means for writing data to the data area in the arrangement direction from the last address; An IC module having a second control means for switching and setting the first identifier to "unwritable in both directions" when a write error occurs when data is written by the second write means;
An IC card body containing the IC module;
An IC card comprising:
前記ICモジュールは、さらに、
前記第1の書込み手段あるいは第2の書込み手段によるデータの書込み時にセットされ、当該データの書込み終了時にクリアされる第2の識別子と、前記1回だけデータの書込みが許可されたデータ領域に対してデータの書込みを行なう際、前記第2の識別子の状態をチェックする第2のチェック手段と、この第2のチェック手段によるチェックの結果、第2の識別子がセットされている場合、前記第1の識別子をデータの並び方向は「最終アドレスから先頭アドレスに向う」に切換え設定する第3の制御手段とを具備し、
前記第1のチェック手段は、前記第2のチェック手段によるチェックの結果、第2の識別子がクリアされている場合、前記第1の識別子の状態をチェックすることを特徴とする請求項4記載のICカード。
The IC module further includes:
A second identifier that is set when data is written by the first writing means or the second writing means, and is cleared when the writing of the data is completed, and the data area in which data writing is permitted only once When the data is written, the second check means for checking the state of the second identifier, and if the second identifier is set as a result of the check by the second check means, the first identifier And a third control means for switching and setting the identifier of the data from “last address to head address” in the data alignment direction,
The said 1st check means checks the state of the said 1st identifier, when the 2nd identifier is cleared as a result of the check by the said 2nd check means, The said 1st identifier is characterized by the above-mentioned. IC card.
前記ICモジュールは、さらに、
初期状態が「1回だけデータの書込みが許可されたデータ領域は初期化状態」に設定され、前記第2の書込み手段によるデータの書込みが終了した際に「1回だけデータの書込みが許可されたデータ領域は書込み済」に切換え設定される第3の識別子と、前記第1のチェック手段によるチェックの結果、第1の識別子がデータの並び方向は「最終アドレスから先頭アドレスに向う」となっていた場合、前記第3の識別子の状態をチェックする第3のチェック手段とをさらに具備し、
前記第2の書込み手段は、前記第3のチェック手段によるチェックの結果、第3の識別子が「1回だけデータの書込みが許可されたデータ領域は初期化状態」となっていた場合、当該データ領域にデータが書込まれていてもそれを無視して最終アドレスからの並び方向でデータを書込み、第3の識別子が「1回だけデータの書込みが許可されたデータ領域は書込み済」となっていた場合、当該データ領域の最終アドレスから見た書込み先範囲が全て初期値であることを確認して、最終アドレスからの並び方向でデータを書込むことを特徴とする請求項4記載のICカード。
The IC module further includes:
The initial state is set to “initialized state for a data area in which data writing is permitted only once”. When data writing by the second writing unit is completed, “data writing is permitted only once” As a result of the check by the first checking means and the first identifier, the data arrangement direction of the first identifier is “from the last address to the head address”. And a third check means for checking the state of the third identifier,
When the third identifier is "a data area in which data writing is permitted only once is initialized" as a result of the check by the third checking means, the second writing means Even if data is written in the area, it is ignored and the data is written in the arrangement direction from the last address, and the third identifier is “data area in which data writing is permitted only once has been written”. 5. The IC according to claim 4, wherein if the data is written, data is written in the arrangement direction from the final address after confirming that all the write destination ranges viewed from the final address of the data area are initial values. card.
JP2005313458A 2005-10-27 2005-10-27 Portable electronic device, and ic card Pending JP2007122394A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2005313458A JP2007122394A (en) 2005-10-27 2005-10-27 Portable electronic device, and ic card

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2005313458A JP2007122394A (en) 2005-10-27 2005-10-27 Portable electronic device, and ic card

Publications (1)

Publication Number Publication Date
JP2007122394A true JP2007122394A (en) 2007-05-17

Family

ID=38146183

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2005313458A Pending JP2007122394A (en) 2005-10-27 2005-10-27 Portable electronic device, and ic card

Country Status (1)

Country Link
JP (1) JP2007122394A (en)

Similar Documents

Publication Publication Date Title
JP4817836B2 (en) Card and host equipment
CN101187912A (en) Memory card system and method transmitting host identification information thereof
JP2009080673A (en) Portable electronic apparatus and command processing method thereof
JP4868979B2 (en) Portable electronic device and IC card
JP2007122394A (en) Portable electronic device, and ic card
JP2008310596A (en) Portable electronic equipment and control method for potable electronic equipment
JP2006252284A (en) Portable electronic device and ic card
JP2007087120A (en) Ic card mounted with multiple os (operating system) and issue consignment method
JP2007115187A (en) Portable electronic device and ic card
JP2006293706A (en) Multi-application ic card with application updating function
JP4784138B2 (en) IC card and IC card program
US7346730B2 (en) Mobile electronic device
JP4713878B2 (en) Portable electronic device
JP2008047040A (en) Portable electronic device and ic card
JP2007114961A (en) Portable electronic device and ic card
JP4738249B2 (en) Portable electronic device, IC card and IC module
JP7420179B1 (en) Electronic information storage medium, IC card, issuance processing method, and program
JP2006172271A (en) Multi-application ic card, and program for ic card
JP6823289B2 (en) IC card and computer program
JP5492172B2 (en) Portable electronic device, IC card and IC module
JP2008047041A (en) Portable electronic device and ic card
JP4549731B2 (en) Multi-application IC card with command code that is commonly used by applications
JP2008152452A (en) Portable electronic device, control method for portable electronic device, and ic card
JP2007172301A (en) Ic card having function of protecting data during transaction execution, and ic card program
JP5038918B2 (en) Portable electronic device and method for controlling portable electronic device