JP4245959B2 - Memory management method for IC card and IC card - Google Patents

Memory management method for IC card and IC card Download PDF

Info

Publication number
JP4245959B2
JP4245959B2 JP2003104978A JP2003104978A JP4245959B2 JP 4245959 B2 JP4245959 B2 JP 4245959B2 JP 2003104978 A JP2003104978 A JP 2003104978A JP 2003104978 A JP2003104978 A JP 2003104978A JP 4245959 B2 JP4245959 B2 JP 4245959B2
Authority
JP
Japan
Prior art keywords
record
data file
shared
file
data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Lifetime
Application number
JP2003104978A
Other languages
Japanese (ja)
Other versions
JP2004310573A (en
Inventor
喜之 大熊
浩二 ▲つる▼
滋 伊達
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Nippon Telegraph and Telephone Corp
Original Assignee
Nippon Telegraph and Telephone 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 Nippon Telegraph and Telephone Corp filed Critical Nippon Telegraph and Telephone Corp
Priority to JP2003104978A priority Critical patent/JP4245959B2/en
Publication of JP2004310573A publication Critical patent/JP2004310573A/en
Application granted granted Critical
Publication of JP4245959B2 publication Critical patent/JP4245959B2/en
Anticipated expiration legal-status Critical
Expired - Lifetime legal-status Critical Current

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Description

【0001】
【発明の属する技術分野】
本発明は、ICカードにおけるメモリ管理方法、及びICカードに関し(IC:Integrated Circuit)、詳しくは、不揮発性メモリを内蔵するICカードにおいてISO規格(ISO:International Organization for Standardization)のファイル構造及びコマンドを保ちつつ、複数ファイルにより共有されたデータ領域に書き込みを行うためのICカードにおけるメモリ管理方法、及びその実施に直接使用するICカードに係わる。
【0002】
【従来の技術】
ICカードは、主にEEPROM(Electronically Erasable and Programmable Read Only Memory )やフラッシュメモリなどの不揮発性メモリが搭載され、この不揮発性メモリの書き換え単位(以下、ブロックという)は数十バイト以上であり、その書き換えに要する処理時間は数十ミリ秒程度である。
【0003】
また、ICカードは、複数のファイルを保持可能なファイル構造が国際規格であるISO/IEC 7816-4 (ISO:International Organization for Standardization/IEC:International Electrotechnical Commission )で規定されており、従来、このデータファイルに含まれるデータや管理するための情報は、前記ブロックの境界とは関係なく配置されていた。
【0004】
【非特許文献】
ISO/IEC 7816-4:1995, “Identification cards - Integrated circuit(s) cards with contacts - Part 4: Interindustry commands for interchange”
【0005】
さらに、ICカードは搭載可能なメモリの制限や、互換性の観点から、同国際規格で規定されている命令は、多くの場合、少数のファイル、あるいは、少数の管理情報のみを対象に処理を行っていた。
【0006】
このような性質を持つICカードを用いたアプリケーションでは、データの性質やセキュリティの観点から、保持すべきデータを複数のファイルに分けてICカードに保持させ、ICカードを利用する際には、複数の命令を実行することで、複数のファイルの読み出し、書き出し又は追記や照合を行って、アプリケーションに必要なデータの読み出し、書き換え又は追記や、認証・照合処理を可能としていた。
【0007】
ICカードの利用の形態として、交通機関の切符や、コンサートなどのチケット、コンビニエンスストアなどで買い物の決済に使用されることが多くなっている。その際、ICカード利用者を待たせないためには、できる限り短時間でICカードのメモリの読み書きの処理を行って迅速にこの処理を終了することが望まれる。
【0008】
そこで、従来、データを書き込んだ部分を極力書き換えないようにしたり、複数のブロックに分散しないようなファイル管理方法を用いたり、複数のファイルの書き換えをまとめて行う特殊な命令を用いたり、素子の特性を調整することによりデータの消去時間を短縮するなどして、処理時間を短くする方法があった。
【0009】
【発明が解決しようとする課題】
しかしながら、従来のICカードにおいてメモリの読み書きの処理を行うには、複数の命令を実行し、複数ファイルの操作が必要であるために、分散配置されたブロックを複数書き換えることとなり、長い処理時間が必要であった。
【0010】
また、特に非接触ICカードにおいては、書き込み途中に電力供給を絶たれる場合が想定され、このようなときに、安全にICカード内のデータを書き込み前の状態に復帰させる処理(以下、書き込み保証という)が必要であるが、この書き込み保証の機能を実現するためには、データの二重化等、さらに多くの書き換え処理が必要となり、処理時間増加の要因の一つとなっていた。
【0011】
さらに、命令やファイル構造の特殊化は、従来のICカードや他のICカードとの互換性がなくなり、また、特別なハードウェアを必要とするものであるために、システムの導入や維持に必要なコストが高額になるという欠点があった。
【0012】
ここにおいて、本発明が解決すべき主要な目的は、次のとおりである。
【0013】
即ち、本発明の第1の目的は、国際規格や業界標準と互換性のある命令を使用しながらも、ICカードの書き込み及び読み込みに必要な処理時間を短縮して高速化された処理を可能とするICカードにおけるメモリ管理方法、及びICカードを提供せんとするものである。
【0014】
本発明の第2の目的は、非接触ICカードにおいて、処理時間の増加を最小限に抑えたまま、ファイルの書き込み保証を実現したICカードにおけるメモリ管理方法、及びICカードを提供せんとするものである。
【0015】
本発明の第3の目的は、既に利用者に配布された従来のICカードにおいて、ICカード上の不揮発性メモリにプログラムを追加するだけで、ICカードの処理時間を高速化することが可能なICカードにおけるメモリ管理方法及びICカードを提供せんとするものである。
【0016】
本発明の他の目的は、明細書、図面、特に特許請求の範囲の各請求項の記載から、自ずと明らかとなろう。
【0017】
【課題を解決するための手段】
まず、本発明方法においては、課題の解決にあたり、ファイル識別子と、レコード番号と、を引数とした読み出し、書き換え又は追記の実行命令を受信し、データファイルが保持する当該レコード番号により識別された1以上のレコードと、同一のレコード長を持つ共有データファイルの共有レコードを参照して、参照された当該レコードに記録されたデータに対して、当該実行命令に対応した読み出し、書き換え又は追記の実行可能に当該データファイルの管理を行う、という特徴的構成手法を講じる。
【0018】
一方、本発明装置においては、課題の解決にあたり、複数同一の長さで配置されそれぞれレコード番号により識別可能なレコードを有して、それぞれ識別可能なファイル識別子が付与されたデータファイルを格納保持するメモリと、当該データファイル内の前記レコードと同一のレコード長を有する前記他のデータファイルである共有データファイル内の前記共有レコードを当該データファイルの実データとして参照するファイル参照手段と、前記ファイル識別子と前記レコード番号とから特定されるデータ領域に対して読み出し、書き換え又は追記の実行命令を受信して、当該実行命令に従い対応する読み出し、書き換え又は追記の前記実行命令を行う実行命令処理手段と、を具備させる、という特徴的構成手段を講じる。
【0019】
さらに、具体的詳細に述べると、当該課題の解決では、本発明が次に列挙する上位概念から下位概念に亙る新規な特徴的構成手法及び手段を採用することにより、前記目的を達成するよう為される。
【0020】
即ち、本発明方法の第1の特徴は、複数バイトを書き換え単位とする不揮発性を有したメモリを内蔵するICカードに適用されて、それぞれ識別可能なファイル識別子が付与されたデータファイルが保持しかつ、前記メモリに複数同一の長さで配置されそれぞれレコード番号により識別可能なレコードを参照する場合に、前記データファイルの保持する前記レコードから共有データファイルが備える共有レコードを参照するメモリ管理方法であって、前記ICカードにおいて、前記ファイル識別子と、前記レコード番号と、を引数とした読み出し、書き換え又は追記の実行命令を受信し、前記データファイルが保持する前記レコード番号により識別された1以上の前記レコードと、同一のレコード長を持つ前記共有データファイルの共有レコードを参照して、参照された当該共有レコードに記録されたデータに対して、前記実行命令に対応した読み出し、書き換え又は追記の実行を可能に当該データファイルの管理を行ってなる、ICカードにおけるメモリ管理方法の構成採用にある。
【0021】
本発明方法の第2の特徴は、上記本発明方法の第1の特徴における前記共有データファイルの共有レコードの参照を、前記データファイルにおいて、保持する前記レコード毎に、前記共有レコードを参照先として設定されたレコード共有状態を示すレコード識別子を随時更新可能に格納する参照管理情報を保持しておき、当該レコード識別子から、当該レコードが当該共有レコードを参照先とするレコード共有状態に設定された場合に、当該レコードのデータとして、該当する当該共有レコードを参照してなる、ICカードにおけるメモリ管理方法の構成採用にある。
【0022】
本発明方法の第3の特徴は、上記本発明方法の第2の特徴における前記読み出し、書き換え又は追記の実行を、前記参照管理情報中に、合わせて前記レコードの当該参照先として設定された前記共有データファイルの前記ファイル識別子と、当該参照先の前記共有レコードの前記レコード番号とを格納しておき、前記共有レコード状態を示した前記レコードの当該参照管理情報が読み出されたときに、当該ファイル識別子と、当該レコード番号から特定される当該共有データファイルの当該共有レコードに対して前記実行命令に対応した読み出し、書き換え又は追記を実行してなる、ICカードにおけるメモリ管理方法の構成採用にある。
【0023】
本発明方法の第4の特徴は、上記本発明方法の第2又は第3の特徴における前記読み出し、書き換え又は追記の実行を、前記参照管理情報中に、合わせて前記レコードへのアクセス権を管理するアクセス権情報を保持しておき、前記共有レコード状態を示した前記レコードの当該参照管理情報が読み出されたときに、先に受信した前記実行命令に対して、前記アクセス権情報を基に、当該レコードへのアクセス権を確認して、当該アクセス権を満たす場合にのみ、当該レコードに対する当該実行命令に対応した読み出し、書き換え又は追記を実行してなる、ICカードにおけるメモリ管理方法の構成採用にある。
【0024】
本発明方法の第5の特徴は、上記本発明方法の第1、第2、第3又は第4の特徴における前記レコードの参照を、予め、前記複数のデータファイルを、前記ICカード内において唯一のディレクトリ識別子が付与されたディレクトリに属するツリー構造として格納しておくとともに、前記実行命令の対象として選択指定された当該データファイルの属する当該ディレクトリの当該ディレクトリ識別子を、チャネル番号により識別可能なチャネル管理情報として随時更新可能に保持しておき、前記チャネル番号と前記ファイル識別子と前記レコード番号を受信したときに、当該チャネル番号により特定される当該チャネル管理情報から、前記ディレクトリ識別子を読み出し、当該ディレクトリ識別子から特定される前記ディレクトリに属する前記データファイルを、前記ファイル識別子から特定し、当該データファイルから、前記レコード番号により特定される前記レコードを参照してなる、ICカードにおけるメモリ管理方法の構成採用にある。
【0025】
本発明方法の第6の特徴は、上記本発明方法の第5の特徴における前記読み出し、書き換え又は追記の実行を、前記チャネル管理情報中に、合わせて受信した前記実行命令の実行可否を管理するセキュリティステータス情報を当該チャネル管理情報が更新されるまで保持可能に格納しておき、当該チャネル管理情報が読み出されたときに、前記実行命令の対象となる前記レコードの前記アクセス権情報と前記セキュリティステータス情報とから、当該レコードへのアクセス権を確認して、当該アクセス権を満たす場合にのみ、前記実行命令を実行してなる、ICカードにおけるメモリ管理方法の構成作用にある。
【0026】
本発明方法の第7の特徴は、上記本発明方法の第1、第2、第3、第4、第5又は第6の特徴における前記データファイルの管理を、ブロック群番号で識別可能な2以上のブロック群からなる当該データファイルに、当該ブロック群番号を新規に更新された当該ブロック群から順次昇順に付番して、最新の前記ブロック群番号と当該ブロック群番号により特定されるブロック群数とブロック群長とを前記データファイル毎のデータファイル管理情報として保持して、前記実行命令を受信したときには、当該実行命令対象となる前記データファイルの前記データファイル管理情報を読み出して、当該実行命令が前記読み出し命令であったときには、
(最新のブロック群番号−1)×ブロック群長
により求められる最新のブロック群の格納位置を算出し、当該格納位置に記録された前記最新のブロック群の読み出しを実行する一方、当該実行命令が前記書き換え命令であったときには、
{(最新のブロック群番号+ブロック群数−2)mod ブロック群数}×ブロック群長
により求められる最旧のブロック群の格納位置を算出し、当該格納位置に記録された当該最旧のブロック群の書き換えを実行するとともに、前記データファイル管理情報の前記最新ブロック群番号を、
{(最新のブロック群番号+ブロック群数−2)mod ブロック群数}+1
により算出された値に更新してなる、ICカードにおけるメモリ管理方法の構成採用にある。
【0027】
本発明方法の第8の特徴は、上記本発明方法の第7の特徴における前記データファイルの管理を、世代番号を有する前記データファイル管理情報を前記データファイル毎に二つ保持して、同一の前記データファイルに基づく当該二つのデータファイル管理情報がそれぞれ有する世代番号の初期値として異なる値を設定しておき、一方、当該データファイル管理情報を読み出すときには、前記世代番号が大きい当該データファイル管理情報を読み出して、他方、当該データファイル管理情報を更新するときには、前記世代番号が小さい当該データファイル管理情報を当該更新の対象として検出して、前記世代番号が大きい前記データファイル管理情報の有する当該世代番号より大きい値を更新後の当該世代番号として設定してなる、ICカードにおけるメモリ管理方法の構成採用にある。
【0028】
本発明方法の第9の特徴は、上記本発明方法の第7又は第8の特徴における前記データファイルの管理を、当該データファイルについて、当該データファイルの作成のときに固定的に先頭の前記レコードから昇順に付番された順編成レコード構造を持つ一般データファイルと、新規に更新された前記レコード番号から昇順に付番され前記レコード長がファイル毎に一定である循環レコード構造を持つ循環データファイルと、で当該データファイルを分別管理して、一つの当該循環データファイル及び所要の前記一般データファイルの前記参照先として設定された前記共有レコードを保持する前記共有データファイルを参照するにあたり、当該共有データファイルは、当該一般データファイルのレコード共有状態に設定された複数レコードと、前記循環データファイルのレコード共有状態に設定された一つのレコードと、を特定の順番で並べた前記共有レコードを有する前記ブロック群を当該循環データファイルの前記総レコード数分保持しておき、前記チャネル番号と追記データと前記レコード番号と前記共有データファイルの前記ファイル識別子とともに前記追記の実行命令を受信したときには、当該レコード番号に基づく前記データファイルが前記一般データファイルの場合には、前記最新のブロック群の格納位置を算出して、当該格納位置の前記ブロック群に対して前記追記レコードを用いた追記を実行し、一方、前記チャネル番号に基づく前記データファイルが前記循環データファイルの場合には、前記最旧のブロック群の格納位置を算出して、当該格納位置の前記ブロック群に対して前記追記データによる追記を実行するとともに、前記ブロック群番号の更新処理を行ってなる、ICカードにおけるメモリ管理方法の構成採用にある。
【0029】
本発明方法の第10の特徴は、上記本発明方法の第9の特徴における前記データファイルの管理を、前記読み出しの実行命令による当該読み込みが失敗したときには、前記最旧のブロック群の読み出しを実行して、前記実行命令により前記データ領域が更新される際には、予め、前記最旧のブロック群を読み取り、
{(最新のブロック群番号+ブロック群数−2)mod ブロック群数}×ブロック群長+1
により求められる格納位置で特定される領域に当該読み取ったブロック群の複製を行ってなる、ICカードにおけるメモリ管理方法の構成採用にある。
【0030】
一方、本発明装置の第1の特徴は、複数バイトを書き換え単位とする不揮発性を有したメモリを内蔵するICカードであって、複数同一の長さで配置されそれぞれレコード番号により識別可能なレコードからなり、それぞれ識別可能なファイル識別子が付与されたデータファイルを格納保持する前記メモリと、当該データファイル内の前記レコードと同一のレコード長を有する共有データファイル内の共有レコードを当該データファイルのデータとして参照するデータファイル参照手段と、前記ファイル識別子と前記レコード番号とから、当該データファイル参照手段により特定された前記データに対して読み出し、書き換え又は追記の実行命令を受信して、当該実行命令に従い対応する読み出し、書き換え又は追記の当該実行命令を行う実行命令処理手段と、を具備してなる、ICカードの構成採用にある。
【0031】
本発明装置の第2の特徴は、上記本発明装置の第1の特徴における前記データファイルが、保持する前記レコード毎に、前記データファイル参照手段により前記共有レコードを参照先として設定されたレコード共有状態を示すとともに、随時更新可能なレコード識別子を格納する参照管理情報を具備してなる、ICカードの構成採用にある。
【0032】
本発明装置の第3の特徴は、上記本発明装置の第2の特徴における前記参照管理情報が、前記参照先の前記共有データファイルの前記ファイル識別子と、当該参照先の前記共有レコードのレコード番号とを含んでなる、ICカードの構成採用にある。
【0033】
本発明装置の第4の特徴は、上記本発明装置の第2又は第3の特徴における前記参照管理情報が、前記レコードに対するアクセスの許否を確認可能に格納されたアクセス権情報を含んでなる、ICカードの構成採用にある。
【0034】
本発明装置の第5の特徴は、上記本発明装置の第1、第2、第3又は第4の特徴における前記メモリが、前記データファイルを、前記ICカード内において唯一のディレクトリ識別子が付与されたディレクトリに属するツリー構造として保持管理して、前記ディレクトリ識別子と識別可能に付与されたチャネル番号とを、新規に同一の当該チャネル番号とともに他の前記ディレクトリ識別子を受信して更新されるまで継続保持して、前記データファイルが属する前記ディレクトリの選択状況を示すチャネル管理情報を保有する、メモリ管理手段を具備してなる、ICカードの構成採用にある。
【0035】
本発明装置の第6の特徴は、上記本発明装置の第5の特徴における前記チャネル管理情報が、前記実行命令の実行可否を管理するセキュリティステータス情報を当該チャネル管理情報が更新されるまで継続保持してなる、ICカードの構成採用にある。
【0036】
本発明装置の第7の特徴は、上記本発明装置の第1、第2、第3、第4、第5又は第6の特徴における前記実行命令処理手段が、前記メモリ管理手段に、ブロック群番号で識別可能な2以上のブロック群からなる前記データファイルの、新規に更新された当該ブロック群から順次昇順に付番される最新の当該ブロック群番号と、当該ブロック番号により特定されるブロック群数とブロック群長とを前記ファイル毎に保持するデータファイル管理情報を保有するとともに、前記実行命令を受信したときに、当該実行命令対象となる前記データファイルの前記データファイル管理情報を用いて、
(最新のブロック群番号−1)×ブロック群長
により最新のブロック群の格納位置を算出する処理手段と、
{(最新のブロック群番号+ブロック群数−2)mod ブロック群数}×ブロック群長
により最旧のブロック群の格納位置を算出する処理手段と、前記ファイルのデータ領域に更新があった場合に、
{(最新のブロック群番号+ブロック群数−2)mod ブロック群数}+1
により算出された値に当該最新のブロック群番号を更新する処理手段と、を具備してなる、ICカードの構成採用にある。
【0037】
本発明装置の第8の特徴は、上記本発明装置の第7の特徴における前記データファイル管理情報が、世代番号を有して前記データファイル毎に二つ保持され、同一の前記データファイルに基づく当該二つのファイル管理情報がそれぞれ有する世代番号の初期値として異なる値が設定されて、当該世代番号が小さい当該データファイル管理情報に対して、他方の当該データファイル管理情報の有する前記世代番号より大きい値を新規の前記世代番号として設定されて順次更新されてなる、ICカードの構成採用にある。
【0038】
本発明装置の第9の特徴は、上記本発明装置の第7又は第8の特徴における前記メモリ管理手段が、前記データファイルとして、データファイル作成時に固定的に先頭の前記レコードから昇順に付番された順編成レコード構成を持つ一般データファイルと、新規に更新された前記レコード番号から昇順に付番され前記レコード長がデータファイル毎に一定である循環レコード構造を持つ循環データファイルと、所要の前記一般データファイルの前記参照先として設定されて、当該一般データファイルのレコード共有状態に設定された複数レコードと、前記循環データファイルのレコード共有状態に設定された一つのレコードと、からなる前記共有レコードを有する前記ブロック群を当該循環データファイルの前記総レコード数分保持する、共有データファイルと、を保持して、当該共有データファイルの前記データファイル管理情報として、前記循環データファイルの前記レコード番号付与順番と等しく新規に書き込まれた前記ブロック群から昇順に付与された最新の前記ブロック群番号と、当該ブロック群数と、当該ブロック長と、前記データファイル参照手段による参照先として対応する前記循環レコード番号とを具備してなる、ICカードの構成採用にある。
【0039】
本発明装置の第10の特徴は、上記本発明装置の第9の特徴における前記メモリ管理手段が、前記ブロック群数を、前記循環データファイルのレコード数+1として保持し、前記実行命令処理手段により前記ブロック群が更新される際には、前記最旧のブロック群の格納位置を算出する処理手段により当該更新前に読み取られた当該ブロック群を、
{(最新のブロック群番号+ブロック群数−2)mod ブロック群数}×ブロック群長+1
により算出される格納位置に当該ブロック群を複製するよう機能構築されてなる、ICカードの構成採用にある。
【0040】
【発明の実施の形態】
以下、本発明の実施の形態につき、添付図面を参照しつつ、装置例を説明し、次いで、同装置例に基づき具現化される方法例を順に挙げて説明する。
【0041】
(装置例)
まず、図1は、本発明の装置例に係るICカードの機能構成図及び、それを動作させるためのリーダライタと情報処理端末の機能構成図である。
【0042】
同図に示すように本装置例に係るICカードαは、その内部に当該ICカードαの機能構成を得るためのICチップ1と、同ICカードαが非接触型として機能する場合に、外部のリーダライタβとの間で無線による通信を行うためのアンテナ2とを具備する。また、リーダライタβは情報通信端末γに接続され、ICカードαとの各種データの入出力可能に構成される。
【0043】
ここで、リーダライタβは、ICカードαや情報処理端末γと通信を行う機能と、実際にICカードαと無線で通信するためにデータを送受する機能を具備する。
【0044】
また、情報処理端末γにおいては、パーソナルコンピュータやワークステーションなどで構成され、ICカードα及びリーダライタβの機能を得るための各種プログラムの実行、それらプログラムの実行に伴って各種データの入出力、またそれらプログラムや書き換え不要なデータ並びにプログラムの実行に伴って生成されるデータの記憶、及び、外部入力手段、外部出力手段のそれぞれ機能を具備して構成される。
【0045】
さらに、ICカードαのICチップ1は、ICカードαの機能を実現するため、各種通信処理、後述するメモリ内のデータファイル参照手段として、また、データファイルの読み出し、書き換え又は追記の実行命令を受信してこの実行命令に則した入出力を行う実行命令処理手段としてCPU11(CPU:Central Processing Unit )を備える。
【0046】
さらに、ICチップ1には、データファイルを格納保持するメモリとして、上記プログラムや書き換え不要なデータを保持するためのROM12(ROM:Read Only Memory)と、プログラムの実行に伴って生成されるデータを一時的に記憶するRAM13(RAM:Random Access Memory)と、プログラムの実行に伴って生成されるデータを追記可能に記憶するEEPROM14(EEPROM:Electronically Erasable and Programmable Read Only Memory )とを搭載して、加えて、リーダライタβから電波信号を使って通信するためのRF部15から構成される。
【0047】
本装置例で示すEEPROM14は、例えば64バイトの書き換え単位(以下ブロックと言う)を持ち、1バイトだけを書き換えるときにも、64バイト全てを書き換える必要があるものとする。
【0048】
なお、本装置例において採用するICカードαは、非接触方式によりリーダライタβと通信を行うものとして示したが、ICカードαとリーダライタβとの接続形態を電気的な接続として有線(オンライン)の方式をとる接触方式により通信を行うものとしても構わない。
【0049】
次に、図2は、本装置例に係るEEPROMにおいて採用されるデータファイル構造を示す図である。
同図に示すように、ICカードαでは、例えば、ディレクトリd0,d1,d2,d3(ルートディレクトリd0)を用いて、このディレクトリd1,d2,d3にそれぞれ属するデータファイルf1,f2,f3a,f3b及び鍵ファイルk1,k2,k3等にツリー構造が設定されて管理される。例えば、ディレクトリd1にはデータファイルf1及び鍵ファイルk1が存在する。
【0050】
ここで、データファイルf1,f2,f3a,f3bは、レコード構造を持ち、アプリケーションを管理するためのデータが保存される。鍵ファイルk1,k2,k3には、データファイルf1,f2,f3a,f3bのアクセス権を制御するための鍵情報が保存される。さらに、データファイルf1,f2は一般データファイル形式、f3aは循環データファイル形式及びf3bは共有データファイル形式の各ファイル形式により構成される。
【0051】
一般データファイル形式(以下一般データファイルf1,f2という)は、レコード位置が固定されたデータファイル形式であり、循環データファイル形式(以下循環データファイルf3aという)は、レコード位置を、レコードの追記をするたびに新しいものから順に並べ替えるファイル形式、共有データファイル形式(以下共有データファイルf3bという)は、複数の一般データファイルf1,f2のレコードと一つの循環データファイルf3aをまとめて仮想的に一つのファイルとしたものである。
【0052】
また、共有データファイルf3bの各レコード(以下共有レコードという)は、例えば共有レコード1,2が一般データファイルf1のレコード1,2と、共有レコード3が一般データファイルf2のレコード3と、共有レコード4が循環データファイルのレコード3の最新レコードと共有している。
【0053】
次に、図3は、本装置例に係るEEPROMにおけるディレクトリ及びデータファイルの管理情報の論理構成を示す図である。なお、本装置例に係るICカードαにおいて適用されるデータファイルは、実データが格納されるデータ領域データとファイル管理領域からなり、まずデータファイル管理領域にて管理されるデータファイル管理情報について詳細に説明する。
【0054】
まず、同図(a)に示すように、本装置例において、ディレクトリd0,d1(ID=0101h),d2(ID=0102h),d3(ID=0103h)は、それぞれ各ディレクトリ毎にディレクトリ管理情報として不揮発性メモリであるEEPROM14に保持され、例えば、1バイトの種別である「01h」(「h」は16進表記を表す。以下同じ)、2バイトのディレクトリID「0101h」、2バイトの所属ファイルアドレス「XXXXh」、2バイトの次ディレクトリアドレス「XXXXh」からなる。なお、「XXXXh」については、任意のアドレスが設定されるものであり、以下の記載についても同様である。
【0055】
ここで、種別は、管理情報の種類を示し、例えばディレクトリ管理情報を一意に示す種別として「01h」とする。ディレクトリIDはICカード内において個別に識別可能なディレクトリの識別子を示す。所属ファイルアドレスは、本ディレクトリに所属するファイル群の一つの先頭アドレスである。次ディレクトリアドレスは、次に位置するディレクトリを示す管理情報の先頭のアドレスである。
【0056】
次に、同図(b)は、一般データファイルf1,f2をそれぞれ管理するためにEEPROM14に保持される一般データファイル管理情報を示す。一般データファイルf1,f2は、アプリケーションで用いるデータを保持、管理するものであるが、例えば一般データファイル管理情報として、同一ディレクトリd1内で他のデータファイルと重複しない2バイトの識別子であるファイルID「0001h」を割り振られる。
【0057】
また、一般データファイルf1,f2は、そのデータファイル毎に固定長、固定総レコード数のレコードの集合からなり、各レコードは参照管理情報として、「00h」を除く1バイトのレコード識別子(以下タグという)、1バイトのデータ長、データの内容を有して、先頭から順番に1バイトで、1から始まるレコード番号が固定的に割り振られる。
【0058】
さらに、一般データファイルf1,f2はそれぞれ各データファイル毎に、一般データファイル管理情報として、1バイトの種別「02h」、2バイトのファイルID「0001h」、2バイトのデータアドレス「0000h」、1バイトのレコード数「05h」、1バイトのレコード長「10h」、2バイトのセキュリティ属性「00000001b」(「b」は2進表記を表す。以下同じ)、2バイトの次ファイルアドレスからなる。
【0059】
種別「02h」は、管理情報の種類を示し、ここでは一般データファイル管理情報であることを示す。また、ファイルID「0001h」は、例えばディレクトリ内で重複がなくデータファイルを個別に識別可能に付与されるデータファイルの識別子を示す。データアドレス「0000h」は、当該一般データファイルf1のデータが保存されるデータブロック群の先頭アドレスとする。
【0060】
また、レコード数「05h」は、一般データファイルf1で保持できるレコード数の総数であり、レコード長「10h」は、保持するレコードの長さである。セキュリティ属性「00000001b」は、後に述べるセキュリティステータスと対にしてアクセス判定を可能するためのファイルアクセス権管理用のデータである。次ファイルアドレス「XXXXh」は、同一の例えばディレクトリd1に属する次のファイル管理情報の先頭アドレスである。ここで、自データファイル例えば一般データファイルf2が最後であるならば、「FFFFh」が格納される。
【0061】
続いて、同図(b)は、本装置例における循環データファイルf3aの管理情報を示す。循環データファイルf3aは、アプリケーションで用いるデータを保持管理して、同一の例えばディレクトリd3内で、他のデータファイルと重複のない2バイトの識別子のファイルID例えば「0004」を付与される。
【0062】
ここで、循環データファイルf3aは、各データファイル毎に設定された固定長、固定総レコード数のレコードの集合から構成される。各レコードは参照管理情報として「00h」を除く1バイトのタグ、1バイトのデータ長、データの内容からなるものであるが、循環データファイルf3aのレコードは、新しいものから順番に1バイトで1から始まるレコード番号が、動的に割り振られる。
【0063】
循環データファイルf3aの管理情報は、一般データファイルf1,f2の管理情報「02h」の他に2バイトの循環開始レコード例えば「FFh」が付加される。循環データファイルの種別は「03h」とした。循環開始レコード番号「FFh」は、確保されたデータブロック群内の複数レコードの何番目が最も新しいレコードかを示す。本循環データファイルf3aを他のデータファイルと共有する場合の循環開始レコード番号は「FFh」とする。
【0064】
一方、図3(d)は、共有データファイルf3bの管理情報である。共有データファイルf3bは、複数のデータファイルに一括してアクセスする場合に用いられる。また、例えば同一ディレクトリd3内で、他のデータファイルf3a,・・・と重複のない2バイトの識別子であるファイルIDを例えば「0004h」として割り振られる。
【0065】
また、各レコードは、それぞれ特定の一般データファイルf1,f2又は循環データファイルf3aのレコードから参照される共有レコードからなる。ただし、参照されるレコードの長さは全て等しいものとし、1つの共有データファイルf3bを参照する循環データファイルf3aは一つに限定される。各レコードは参照管理情報としての「00h」を除く1バイトのタグ、1バイトのデータ長、データの内容からなり、レコード番号は先頭から順番に1バイトで表され、1から順に始まり、固定的に割り振られる。
【0066】
さらに、一般データファイルf1,f2の特定のレコードは、特定のレコード番号が割り当てられて、循環データファイルf3aのレコードは、特定の一つのレコード番号に割り当てられる。
【0067】
ここで、共有データファイル管理情報は、連続したメモリ領域に二つ保持されるものであり、その内容は、一般データファイルf1,f2の管理情報で用いられたものの他に、1バイトの循環レコード番号「04h」、1バイトの循環開始ブロック群番号「01h」、1バイトの循環レコード数「03h」、2バイトのブロック群長「0040h」、2バイトの世代番号「0002h」、そして、レコード毎に、2バイトの参照しているディレクトリID「0101h」,「0101h」,「0102h」,「0103h」、と組になる2バイトのセキュリティ属性「00000001b」,「00000001b」,「00000010b」,「00000100b」からなる。
【0068】
共有データファイルの種別は、例えば「04h」と「05h」とする。循環レコード番号「04h」は循環データファイルf3bに対応する共有データファイルのレコード番号を示し、循環開始ブロック群番号「01h」は、循環データファイルf1bの最も新しいレコードを含むブロック群の番号を示し、循環レコード数「03h」は、循環するレコードの数を示す。
【0069】
さらに、二つ保持した循環データファイル管理情報で、世代番号が大きい方が新しい管理情報であることを示して、参照しているディレクトリID「0101h」,「0101h」,「0102h」,「0103h」は、各レコードにおいて共有するデータファイルが属するディレクトリd1,d2,d3のディレクトリIDを示し、同じく、セキュリティ属性「00000001b」,「00000001b」,「00000010b」,「00000100b」は、各レコードにおいて共有するデータファイルのセキュリティ属性を示す。
【0070】
また、同図(e)は、鍵ファイルk1,k2,k3の管理情報を示すものである。鍵ファイルk1,k2,k3は、それぞれアクセス権を制御するために用いるものであり、例えば鍵ファイルk1には同一ディレクトリd1において重複のない2バイトの識別子である「0011h」をファイルIDとして付与される。鍵ファイルk1,k2,k3は、16種類の異なる鍵を作成可能な鍵区分を有する。
【0071】
鍵ファイルk1の管理情報は、1バイトの種別「06h」、2バイトのファイルID「0011h」、2バイトのデータアドレス「0050h」、1バイトの鍵の長さ「10h」、1バイトの鍵区分「01h」、2バイトの次ファイルアドレス「XXXXh」からなる。
【0072】
ここで、種別は、データファイル管理情報の種類を示し、鍵ファイルk1,k2,k3の種別は06hである。データアドレス「0050h」は、鍵の内容が保持されるデータブロック群のアドレスを示し、鍵の長さ「10h」は、保持する鍵の長さのバイト数を示す。また、鍵区分は、「01h」〜「10h」の16種類からなり、次ファイルアドレス「XXXXh」は同一ディレクトリd1に属する次のデータファイルの管理情報の先頭アドレスである。
【0073】
次に、図4は、本装置例に係るEEPROMの物理構成図である。
まず、同図に示すように、ディレクトリd1,d2,d3及び各データファイルf1,f2,f3a,f3b及び鍵ファイルk1,k2,k3は、EEPROM14において実データが保持されるデータ領域と、それぞれの各管理情報を保持する管理情報領域とで構成される。
【0074】
同図に示すように、例えば、各ディレクトリ内のファイルのデータファイルのデータは、最下位から順にディレクトリd1が、「0000h」〜「005Fh」、ディレクトリd2が「0060h」〜「00CFh」、ディレクトリd3が「00D0h」〜「023Fh」に配置されて、各管理情報は、最上位から順に配置される。
【0075】
ここで、一般データファイルf1,f2及び循環データファイルf3aのレコードは、それぞれディレクトリd1,d2のデータ領域と管理情報領域とに保持されて、そのレコードは下位アドレスから順に保存されて、各レコードの保存形式は、タグ、長さ、データで構成される。
【0076】
ここで、一般データファイルf1,f2の参照管理情報を含むレコードは、共有データファイルf3bに格納された共有レコードを参照先としてレコード共有状態に設定された場合、タグは、「00h」となり、各データは1,2バイト目が参照先ファイルのあるディレクトリID「0103h」、3,4バイト目が参照先ファイルID「0004h」、5バイト目が参照先レコード番号「0001h」、「0002h」又は「0003h」を格納している。
【0077】
また、循環データファイルf3aのレコードが共有データファイルf3bに格納された共有レコードを参照している場合、物理的に先頭に位置するレコードのタグは「00h」となり、データは1,2バイト目が参照先ファイルのあるディレクトリID「0103h」、3,4バイト目が参照先ファイルID「0004h」となり、その他のレコードは無視される。
【0078】
さらに、共有データファイルf3bについては、そのレコード長を16バイト(10h)として、ブロック長は64バイト(40h)としている。したがって、共有データファイルf3bのデータ領域には、4つのブロック群を含む。ここで、共有データファイルf3bの各ブロックの先頭から順にレコード1,2,3,4として、一般データファイルf1,f2及び循環データファイルf3aについても同様に構成するレコードを先頭から順次、レコード1,2,・・・と呼ぶ。
【0079】
それにより、共有データファイルf3bのデータ領域の共有レコード1及び共有レコード2は、一般データファイルf1(ファイルID=0001h)のレコード1及びレコード2であり、共有レコード3は、一般データファイルf2(ファイルID=0002h)のレコード3、共有レコード4は循環データファイルf3a(ファイルID=0003h)のそれぞれから参照されたものである。
【0080】
続いて、共有データファイルf3bのデータ領域は、連続する複数のブロック群を構成することにより管理されている。ここで説明するブロック群とは、参照されているレコードそれぞれの内容を保持するメモリ領域であり、例えば、ブロックの境界を先頭に下位から上位アドレスに向かって割り当てられる領域のことである。
【0081】
ここで、ブロック長を「BlockSize」、レコード長を「RecLen」、レコード数(レコードの総数)を「RecNum」とすると、ブロック群の長さ「BlockLen」は、
BlockLen=BlockSize×{(RecLen×RecNum)%BlockSize}
である。ただし、X%YはXをYで割った値を切り上げたものである。
【0082】
共有データファイルf3bは、このブロック群を参照している循環データファイルf3aのレコード数+1個の複数ブロック群用いて管理されてなる。一般データファイルf1,f2の各レコードは、各ブロック群に、レコード番号に従って下位から順に割り当てられている。
【0083】
また、循環データファイルf3aのレコードが保持される位置は、循環開始ブロック群番号から始まるブロック群を第1レコードに対応するブロック群として、参照される循環データファイルf3aのレコード番号に従って、1レコードずつ各ブロック群に割り当てられ、個別のブロック群内では、参照されるレコード番号に従って割り当てられる。
【0084】
さらに、共有データファイルf3bのデータ領域は、循環データファイルf3aのレコード数3に1を加えた4つのブロック群からなっており、循環データファイルf3aの開始レコード番号が1であるため、共有データファイルf3bの先頭のブロック群から順に循環データファイルf3aの各レコードが割り当てられ、残りの1つのブロック群(ここでは4つ目の最後尾のブロック群)はバックアップ用となる。
【0085】
次に、図5は、本装置例に係るRAMにおけるチャネル、一時共有データファイルの管理情報、及び一時ファイルデータの論理構成を示す図である。本装置例に適用されるICカードαは、同図に示すように、メモリ管理手段として、チャネルと呼ぶアクセス権を保持する環境を複数保持し、RAM13上に保持されるチャネルごとにディレクトリ、セキュリティ状態を管理するよう機能構成される。
【0086】
まず、同図(a)に示すように、チャネル管理情報は、2バイトのディレクトリID、2バイトのディレクトリアドレス、2バイトのセキュリティステータスから構成される。ディレクトリID「0101h」は、現在当該チャネルとして格納保持しているディレクトリd1のIDであり、更新可能に保持されるものである。また、ディレクトリアドレス「XXXXh」は、同じくこのチャネルに格納されるディレクトリd1の管理情報の先頭アドレスを示す。セキュリティステータス「00000000b」は、このチャネルにおけるセキュリティ状態を示している。
【0087】
さらに、RAM13には、処理途中の状態を保持するために、同図(b)に示した一時共有データファイル管理情報及び同図(c)に示した一時ファイルデータを保持している。一時共有データファイル管理情報は、管理情報内のデータを書き換える際にバッファとして用いるものであり、一時ファイルデータは、ブロック群を書き換える際にバッファとして用いることが可能に構成される。
【0088】
(方法例)
続いて、以上のように構成されたICカードαにおいて、データファイルf1,f2,f3a,f3b毎に設定されたアクセス権の制御方法、ディレクトリd1,d2,d3を選択するディレクトリ選択の選択手順、鍵ファイルk1,k2,k3を用いた鍵照合の手順及びデータファイルf1,f2,f3a,f3bの読み出し手順を順に追って説明する。
【0089】
まず、本実施形態例におけるICカードαは、データファイルf1,f2,f3a,f3b毎に保持するセキュリティ属性と、チャネル毎に保持するセキュリティステータス、そして鍵ファイル毎に保持する鍵区分を使ってデータファイルf1,f2,f3a,f3bへのアクセス制御を行う。
【0090】
データファイルf1,f2,f3a,f3b毎に保持したセキュリティ属性は、どの鍵で照合したらアクセス可能であるのかを示すものであり、一方チャネル毎に設定されたセキュリティステータスは、現在どの鍵で照合したかどうかを示している。例えば、鍵区分「01h」の鍵を照合したとすると、セキュリティステータスの該当ビットを「1」として、「00000001b」となる。
【0091】
この状態でセキュリティ属性が「00000001b」のデータファイルf1をアクセスする場合、このセキュリティステータス「00000001b」とセキュリティ属性「00000001b」の論理積を計算して、その結果が「00000001b」となることから、アクセス可能と判断する。
【0092】
また、この状態で、セキュリティ属性が「00000010b」のデータファイルf2をアクセスする場合は、論理積の結果が「00000000b」となるため、アクセス不可と判断することが可能となり、予め設定されたセキュリティ属性、セキュリティステータス及び鍵ファイルにしたがって、データファイルf1,f2,f3a,f3bへのアクセス制御が可能となる。
【0093】
次に、図6は、本発明の方法例に係るディレクトリの選択手順を示すフローチャートである。同図を用いて各種データファイルを格納するディレクトリd1,d2,d3を選択する手順を説明する。
【0094】
本方法例によるICカードαは、上位装置である、例えば情報処理端末γから引数として、1バイトのチャネル番号(以下Chという)、2バイトのディレクトリID(以下DirIDという)を持つディレクトリ選択命令を受信する。
【0095】
ICカードαはディレクトリ選択命令を受信すると、最初のディレクトリであるディレクトリd1の管理情報内の次ディレクトリアドレス「XXXXh」からディレクトリd2,・・・と順次たどることにより、ディレクトリ管理情報内のディレクトリIDが受信した引数「DirID」と等しいディレクトリ管理情報を検索する(ST1)。
【0096】
ST1の後、「DirID」と合致するディレクトリIDの検出を確認して(ST2)、所望のディレクトリIDが検出されなかった場合には、ディレクトリ指定誤りの異常終了を情報処理端末γにリーダライタβを介して送信して(ST3)終了する。ST2にて、引数「DirID」と合致するディレクトリIDが検出された場合には、そのディレクトリ管理情報の先頭アドレスを「DirAddr」に代入する(ST4)。
【0097】
引数「Ch」で特定されるチャネル管理情報内のディレクトリアドレスに「DirAddr」を(ST5)、ディレクトリIDに「DirID」を(ST6)それぞれ書き込み、全ての処理が正常に終了した場合には、正常終了応答を情報処理端末γに送信して(ST7)ディレクトリの選択処理を終了する。
【0098】
続いて、図7は、本方法例に係る鍵の照合手順を示すフローチャートである。本方法例において適用するICカードαは、引数として1バイトのチャネル番号「Ch」、2バイトの鍵ファイルのID(以下KeyIDという)、複数バイトの鍵内容(以下KeyValueという)、1バイトの鍵の長さ(以下KeyLenという)を持つ鍵照合命令を上位装置である情報処理端末γからリーダライタβを介して受け取る。
【0099】
そこで、まず、同図に示すように、「Ch」にて特定されるチャネル管理情報内にあるディレクトリIDを「DirID」に、ディレクトリアドレスを「DirAddr」に、セキュリティステータスを「SS」として代入する(ST11)。代入された「DirAddr」のアドレスから始まるディレクトリ管理情報を読み込み、さらにこのディレクトリ管理情報中の所属ファイルアドレスをたどり、ファイルIDが「KeyID」と等しく、かつ種別が「06h」である鍵ファイル管理情報を探す(ST12)。
【0100】
ST12の後、鍵ファイルが検出されたかどうか確認して(ST13)、検出されなかった場合は、鍵ファイルIDの指定誤りの異常応答を上位装置に送信して(ST14)鍵の照合手順の処理を終了する。一方、所望の鍵ファイルが検出された場合には、その鍵ファイル管理情報の先頭アドレスを「KeyAddr」に代入する(ST15)。
【0101】
「KeyAddr」で特定されるアドレスから始まる鍵ファイル管理情報内のデータアドレスをKeyValue´に代入して(ST16)、先に情報通信端末γから受け取った「KeyValue」とこの「KeyValue´」が等しいどうか例えば「KeyLen」の長さから確認する(ST17)。
【0102】
「KeyValue」と「KeyValue´」が等しくない場合、鍵照合不一致として鍵内容不一致異常終了応答を情報通信端末γに送信し(ST18)、鍵照合の処理を終了する。一方、「KeyValue」と「KeyValue´」が等しい場合には、「KeyAddr」のアドレスから始まる鍵ファイル管理情報内の鍵区分を「KeyKind」とおく(ST19)。
【0103】
さらに、引数として先に受け取った「SS」の「KeyKind」ビット目を「1」に置き換える(ST20)。ST20まで、全て正常に終了したときには、正常終了応答を上位装置である情報通信端末γにリーダライタβを介して送信して(ST21)、鍵の照合処理を終了する。
【0104】
次に、図8は、本方法例に係るデータファイルの読み出し手順を示すフローチャートである。同図を用いて各データファイルf1,f2,f3a,f3bを読み出す手順を説明する。
まず、本方法例にて適用するICカードαは、引数として、1バイトのチャネル番号「Ch」、2バイトのデータファイルのファイルID(以下FileIDという)、1バイトのレコード番号(以下RecNo)を持つ読み出し命令を上位装置情報通信端末γから受け取る。
【0105】
受け取った「Ch」により特定されるチャネル管理情報内にあるディレクトリIDを「DirID」、ディレクトリアドレスを「DirAddr」、セキュリティステータスを「SS」にそれぞれ代入して(ST31)、「DirAddr」で特定されるアドレスから始まるディレクトリ管理情報内に格納された所属ファイルアドレスからデータファイル管理情報を順次たどっていき、種別が「02h」、「03h」、「04h」又は「05h」でファイルIDがFileIDと等しいデータファイル管理情報を探す(ST32)。
【0106】
ST32の後に、データファイル管理情報が検出されたかどうかを確認して(ST33)、検出されなかった場合には、ファイルID指定誤りの異常終了応答を情報通信端末γに送信して、データファイル読み出しの処理を終了する。一方、所望のデータファイル管理情報が検出されたときには、このデータファイル管理情報の先頭アドレスを「FileAddr」とおく(ST35)。
【0107】
さらに、「FileAddr」で特定されるデータファイル管理情報内の種別を「FileKind」として(ST36)、先ず、この「FileKind」に代入された値が、一般データファイルf1,f2を示す「02h」であるかどうかを確認する(ST37)。ここで、「FileKind」が「02h」であった場合には、該当する一般データファイルf1又はf2の読み出しを行う(ST38)。
【0108】
「FileKind」の値が、「02h」でない場合には、さらに、循環データファイルf3aを示す「03h」であるかどうか確認して(ST39)、「03h」であれば、循環データファイルf3aの読み出し処理を行い(ST40)、循環データファイルf3aを示す「03h」でなければ、引続き、「FileKind」が「04h」又は「05h」であるかどうか確認する(ST41)。
【0109】
この「FileKind」が、共有データファイルf3bの種別として設定された「04h」又は「05h」であれば、共有データファイルf3bの読み出し処理を行い(ST42)、「FileKind」が以上の「02h」〜「05h」のいずれにも該当しないときには、データファイル種別の指定誤りとして異常終了を情報処理端末γに送信して(ST43)読み出し処理を終了する。
【0110】
さらに、ST38、ST40及びST42にて行う一般データファイルf1,f2、循環データファイルf3a及び共有データファイルf3bの読み出し処理について順に説明する。
【0111】
図9は、本方法例に係る一般データファイルの読み出し手順を示すフローチャートである。同図に示すように、ST38にて一般データファイルf1,f2を読み出す処理を実行するにあたり、まず、「FileAddr」で始まる一般データファイル管理情報を特定して、この一般データファイル管理情報内に格納されたセキュリティ属性と、先に「Ch」にて特定されるチャネル管理情報内のセキュリティステータスを代入された「SS」との論理積を算出して結果を「Ans」に代入する(ST51)。
【0112】
ST51の後、この論理積の結果「Ans」が「00000000b」であるかどうかを確認して(ST52)、「Ans」が「00000000b」の場合には、アクセス権不足としてアクセス権誤り異常終了を情報処理端末γに送信して(ST53)一般データファイルの読み出し処理を終了する。
【0113】
一方、ST52で論理積の結果「Ans」が「00000000b」でない場合には、「FileAddr」のアドレスにより特定される一般データファイル管理情報内のデータアドレスを「DataAddr」、レコード長を「RecLen」としてそれぞれ代入する(ST54)。
【0114】
続いて、読み出すべきレコードのアドレス「RecAddr」を、
RecAddr=DataAddr+RecLen×(RecNo−1)
の式から算出して(ST55)、この「RecAddr」から始まるデータの1バイト目を「タグ」(以下、「Tag」という)として(ST56)、この「Tag」が「00h」かどうか確認する(ST57)。
【0115】
ここで、「Tag」が「00h」ではない場合、通常のレコードとして「RecAddr」から「RecLen」分のデータと、一般データファイルの読み出しの正常終了の通知を合わせて情報処理端末γに送信して(ST58)、一般データファイルの読み出しを正常に終了する。
【0116】
一方、「Tag」が「00h」であった場合には、共有データファイルf3bからのレコードの参照であると判断して、「RecAddr」で特定されるアドレスから始まるレコードの、例えば第3バイトから第4バイトを共有データファイルf3bの属するディレクトリd3のディレクトリID(以下LDirID)とし、第5バイトと第6バイトを共有データファイルf3bのファイルID(以下LFileID)とし、第7バイトを共有データファイルf3bの参照先レコード番号(以下LRecNo)とする(ST59)。
【0117】
ST59の後、一般データファイルから共有レコードの読み出し処理を行う(ST60)ものであるが、一般データファイルから共有レコードの読み出し処理を行うにあたっては、以下にさらに詳細に説明する。
図10は、本方法例に係る一般データファイルからの共有レコード読み出し手順を示すフローチャートである。ST60について同図を参照して説明する。
【0118】
まず、「LDirID」をディレクトリIDとするディレクトリ管理情報を、「DirAddr」を先頭アドレスとするディレクトリ管理情報内の次ディレクトリアドレスから順位たどって探し、検出したディレクトリ管理情報の先頭アドレスを「LDirAddr」とする(ST61)。
【0119】
次いで、この「LDirAddr」で始まるディレクトリ管理情報内の所属ファイルアドレスをたどり、種別が「04h」又は「05h」であり、かつ、ファイルIDが「LFileID」で特定される共有データファイル管理情報を検索し(ST62)、その結果、二つの共有データファイルの管理情報が検出された確認する(ST63)。
【0120】
ST63にて共有データファイル管理情報が一つしか検出されなかった場合には、検出した共有データファイル管理情報の先頭アドレスを「LFileAddr」とする(ST64)ものであるが、二つの共有データファイル管理情報が検出されたときには、種別が「04h」である共有データファイル管理情報の先頭アドレスを「LFileAddr1」とし、種別が「05h」の共有データファイル管理情報の先頭アドレスを「LFileAddr2」とする(ST65)。
【0121】
次いで、「LFileAddr1」と「LFileAddr2」とで始まる二つの共有データファイル管理情報内の世代番号を比較して、大きいほうの管理情報の先頭アドレスを「LFileAddr」とする(ST66)ことで、「LFileAddr」を決定する。
【0122】
ST64又はST66により「LFileAddr」が決定された後に、この「LFileAddr」のアドレスを先頭アドレスとする共有データファイル管理情報内のデータアドレスを「LDataAddr」、循環開始ブロック群番号を「LStartBlock」、レコード長を「LRecLen」、レコード数を「LRecNum」、ブロック群長を「LBlockLen」、循環レコード数を「LRRecNum」とする(ST67)。
【0123】
ST67にて代入した値を用いて、まず、最新ブロック群の先頭アドレス「LBlockAddr」を、
LBlockAddr=LDataAddr+LBlockLen×(LStartBlock−1)
の式より算出する(ST68)。
【0124】
引続き、レコード番号「LRecNo」で示されるレコードの先頭アドレス「LRecAddr」を、
LRecAddr=LBlockAddr+LRecLen×(LRecNo−1)
の式により算出する(ST69)
【0125】
ここで、ST69より求めた「LRecAddr」のアドレスを先頭アドレスとするレコードが実際に読み出せるかどうか確認して(ST70)、実際にデータとして読み出せた場合には、この「LRecAddr」から「LRecLen」長さ分のデータを読み出し、正常終了の通知ともに情報処理端末γに応答する(ST71)。
【0126】
一方、実データとしてメモリ上から、算出することで得た「LRecAddr」から始まるレコードを読み出せなかった場合には、バックアップブロック群の先頭アドレス「LBBlockAddr」を、
LBBlockAddr=LDataAddr+BlockLen×{(LSartBlock+LRRecNum−1)mod(LRRecNum+1)}の式より算出して求める(ST72)。
【0127】
さらに、レコード番号「LRecNo」で示されるレコードの先頭アドレス「LRecAddr」を、
LRecAddr=LBBlockAddr+LRecLen×(LRecNo−1)
の式を用いて算出する(ST73)。
【0128】
「LRecAddr」のアドレスを先頭アドレスとするレコードから、「LRecLen」長さ分のデータを読み出して、正常終了の通知とともに情報処理端末γに送信して応答し(ST74)、一般データファイル内の共有レコード読み出し処理を終了する。
【0129】
次に、図11は、本方法例に係る循環データファイルの読み出し手順を示すフローチャートである。同図に示すように、前述のST40にて循環データファイルf3aを読み出す処理を実行するにあたり、まず、「FileAddr」で始まるデータファイル管理情報内のセキュリティ属性と、先に「Ch」にて特定されるチャネル管理情報内のセキュリティステータスである「SS」との論理積を算出してその結果を「Ans」とする(ST81)。
【0130】
次に、この「Ans」が「00000000b」であるかどうかを確認して(ST82)、「00000000b」であった場合には、アクセス権不足としてアクセス権誤りの異常終了を情報通信端末γに応答として送信して(ST83)、循環データファイルの読み出し処理を終了する。
【0131】
一方、「Ans」が「00000000b」でない場合には、「FileAddr」で始まる循環データファイル管理情報内の循環開始レコード番号を「RecStart」、データアドレスを「DataAddr」とおき(ST84)、この「RecStart」が「FFh」であるかどうかを確認して(ST85)、「FFh」でない場合、「FileAddr」で始まる循環データファイル管理情報内のレコード長を「RecLen」、レコード数を「RecNum」とおく(ST86)。
【0132】
引続き、所望の読み出す対象レコードの先頭アドレス「RecAddr」を、RecAddr=DataAddr+RecLen×(RecStart−1)
の式を用いて算出して(ST87)、この算出した「RecAddr」から始まるレコードの「RecLen」で示される長さ分を読み出し、これを正常終了の応答とともに情報処理端末γに送信して読み出し処理を終了する(ST88)。
【0133】
一方、ST85において「RecStart」が「FFh」であった場合には、「DataAddr」を先頭アドレスとするレコードの第3バイトから第4バイトを共有データファイルの属するディレクトリID(以下LDirIDという)とし、第5バイトと第6バイトを共有データファイルのファイルID(以下LFileIDという)とする(ST89)。
【0134】
その後、循環データファイルから共有レコードの読み出し処理を行う(ST90)ものであるが、循環データファイルからの共有レコード読み出し手順の詳細については、以下のような手順を順次実行するものである。
図12は、本方法例に係る循環データファイルからの共有レコード読み出し手順を示すフローチャートである。ST90について同図を参照して説明する。
【0135】
まず、同図に示したST91〜ST96の過程により共有データファイル管理情報の先頭アドレス「LFileAddr」を決定するものであるが、この手順については、図10に示した一般データファイル内共有レコードの読み出し手順のST61〜ST66と同一のものであり、説明の繰り返しを避けるため、ここでの説明を省略する。
【0136】
ST94又はST96までの過程を経て「LFileAddr」が決定された後、「LFileAddr」で示されたアドレスから始まる共有データファイル管理情報内のデータアドレスを「LDataAddr」、循環開始ブロック群番号を「LStartBlock」、レコード長を「LRecLen」、レコード数を「LRecNum」、循環レコード数を「LRRecNum」、ブロック群長を「LBlockLen」、循環レコード番号を「LRRecNo」とおく(ST97)。
【0137】
以上の代入された値を用いて、最新のブロック群の先頭アドレス「LBlockAddr」は、
LBlockAddr=LDataAddr+LBlockLen×(LStartBlock−1)
により算出する(ST98)。
【0138】
さらに、レコード番号「LRRecNo」で示されるレコードの先頭アドレス「LRecAddr」を、
LRecAddr=LBlockAddr+LRecLen×(LRRecNo−1)
により算出して(ST99)、算出された「LRecAddr」を先頭アドレスとして始まるデータが実際のメモリ上にて読み出せるか確認する(ST100)。
【0139】
ここで、「LRecAddr」から始まるデータが実際に読み出せた場合には、この「LRecAddr」から始まるデータを「LRecLen」分読み出して、情報処理装置γに正常終了の通知とともに送信して読み出し処理を終了する(ST101)。
【0140】
一方、「LRecAddr」から始まるデータが読み出せなかったときには、バックアップブロック群の先頭アドレス「LBBlockAddr」を、
LBBlockAddr=LDataAddr+LBlockLen×{(LStartBlock+LRRecNum−1)mod(LRRecNum+1)}
から算出する(ST102)。
【0141】
続いて、レコード番号「LRRecNo」で示されるレコードの先頭アドレス「LRecAddr」を、
LRecAddr=LBBlockAddr+LRecLen×(LRRecNo−1)
から算出して(ST103)、「LRecAddr」の先頭アドレスから始まるデータを「LRecLen」分だけ読み出し、正常終了の通知とともに情報処理端末γに応答として送信して(ST104)、読み出し処理を終了する。
【0142】
続いて、図13は、本方法例に係る共有データファイルの読み出し手順を示すフローチャートである。同図に示すように、前述のST42にて共有データファイルf3bを読み出す処理を実行するにあたり、まず、「DirAddr」を先頭アドレスとするディレクトリ管理情報内の所属ファイルアドレスから、データファイル管理情報をたどり、「FileAddr」を先頭アドレスとして、かつ、種別が「04h」又は「05h」であり、「FileID」をファイルIDとする共有データファイル管理情報を検索する(ST111)。
【0143】
ここで、共有データファイル管理情報が検出されたか確認して(ST112)、共有データファイル管理情報が検出された場合、この検出された共有データファイル管理情報の先頭アドレスを「FileAddr´」とする(ST113)。
【0144】
「FileAddr」を先頭アドレスとする共有データファイル管理情報と、「FileAddr´」を先頭アドレスとする共有データファイル管理情報とで保持する世代番号を比較して、世代番号の大きい方の共有データファイル管理情報の先頭アドレスを改めて「FileAddr」とする(ST114)。
【0145】
次に、ST112にて共有データファイル管理情報が検出されなかった場合、又は、ST114を経て一意に「FileAddr」が決定された後に、この「FileAddr」を先頭アドレスとする共有データファイル管理情報内のレコード番号「RecNo」のディレクトリIDを「LDirID」に、セキュリティ属性を「SA」に代入する(ST115)。
【0146】
続いて、チャネル管理情報内でディレクトリIDが「LDirID」と等しいものを検索して、その検索されたチャネル管理情報内のセキュリティステータスと「SA」との論理積を算出して、「Ans」とし(ST116)、この「Ans」が「00000000b」であるかどうか確認する(ST117)。
【0147】
ここで、「Ans」が「00000000b」であった場合、この共有データファイルについてのアクセス権不足としてアクセス権誤りの異常終了を情報処理端末γに応答して(ST118)処理を終了する。
【0148】
一方、「Ans」が「00000000b」でなかった場合には、「FileAddr」を先頭アドレスとする共有データファイル管理情報内の循環開始ブロック群番号を「StartBlock」、データアドレスを「DataAddr」、レコード数を「RecNum」、レコード長を「RecLen」、ブロック群長を「BlockLen」、循環レコード数を「RecNum」とする(ST119)。
【0149】
以上、代入された値を用いて、読み出すブロック群の先頭アドレス「BlockAddr」は、
BlockAddr=DataAddr+BlockLen×(StartBlock−1)
の式により算出して(ST120)、この算出した「BlockAddr」のアドレスを先頭アドレスとしたブロック群が読み出せるかを確認する(ST121)。
【0150】
「BlockAddr」を先頭アドレスとするブロック群が読み出せた場合には、先に受け渡されたレコード番号「RecNo」で示されるレコードの先頭アドレス「RecAddr」を、
RecAddr=BlockAddr+RecLen×(RecNo−1)
の式を用いて算出する(ST122)。
【0151】
この算出した「RecAddr」を先頭アドレスとして長さ「RecLen」分のデータを読み出し、読み出したデータを情報処理端末γに送信するとともに、正常終了の応答をして(ST123)、共有データファイルf3bの読み出し処理を終了する。
【0152】
一方、ST121にて「BlockAddr」から始まるデータが読み出せない場合には、バックアップブロック群の先頭アドレス「BBlockAddr」を、
BBlockAdr=DataAddr+BlockLen×{(StartBlock+RRecNum−1)mod(RRecNum+1)}
の式を用いて算出する(ST124)。
【0153】
引続き、先に受け渡されたレコード番号「RecNo」で示されるレコードの先頭アドレス「RecAddr」を、
RecAddr=BBlockAddr+RecRen×(RecNo−1)の式を用いて算出し(ST125)、この「RecAddr」を先頭アドレスとして「RecLen」長さ分のデータを読み出し、正常終了の通知とともに情報処理端末γに応答として送信して(ST126)、読み出し処理を終了する。
【0154】
続いて、図14は、本方法例に係るデータファイルの追記・書き換え手順を示すフローチャートである。同図を用いて各データファイルf1,f2,f3a,f3bを追記又は書き換える手順を説明する。
まず、本方法例におけるICカードαは、引数として1バイトのチャネル番号(以下Chという)、2バイトのデータファイルのID(以下FileIDという)、1バイトのレコード番号(以下RecNoという)、複数バイトの書き換えデータ(以下WriteDataという)を持つ追記又は書き換え命令を情報処理端末γから受け取る。
【0155】
以下、同図に示した過程を経るものであるが、ST131〜ST143の過程は、図8に示したST31〜ST43の各過程と対応しており、読み出し命令を追記又は書き換え命令と置き換えるものであり、繰り返しを避けるため説明は省略する。また、ST138、ST140及びST142の各処理過程については、以下に順を追って説明する。
【0156】
図15は、本方法例に係る一般データファイルの追記・書き換え手順を示すフローチャートである。同図に示すように、ST138にて一般データファイルf1,f2を追記又は書き換え処理を実行するにあたり、図9にて示したST51〜ST57に対応するST151〜ST157の過程を順次行う。
【0157】
その後、ST157において「Tag」が「01h」と等しくない場合に、「RecAddr」を先頭アドレスとして「RecLen」分の長さに「WriteData」を書き込み、情報処理端末γに応答として正常終了の通知を送信して(ST158)、一般データファイルf1,f2の追記又は書き込み手順を終了する。
【0158】
一方、ST157において「Tag」が「01h」であった場合には、ST59と同様に、「RecAddr」から始まるレコードの第3バイトから第4バイトを共有データファイルf3bの属するディレクトリd3のディレクトリID、ファイルID、レコード番号を取り出して、それぞれ「LDirID」、「LFileID」、「LRecNo」とする(ST159)。
【0159】
続いて、一般データファイルからの共有レコードの追記又は書き換え処理(ST160)について説明する。
図16は、本方法例に係る一般データファイルからの共有レコードの追記・書き換え手順を示すフローチャートである。ST160について同図を参照して説明するが、同図ST161〜ST167は図10のST61〜ST67に対応するものであり、説明を省略する。
【0160】
ST167の後に、最新のブロック群の先頭アドレス「LBlockAddr」を、
LBlockAddr=LDataAddr+LBlockLen×(LStartBlock−1)
の式により算出して、さらに、バックアップブロック群の先頭アドレス「LBBlockAddr」を、
LBBlockAddr=LDataAddr+LBlockLen×{(LStartBlock+LRRecNum−1)mod(LRRecNum+1)}
の式より代入して算出する(ST168)。
【0161】
その後、一時ファイルデータ内のレコード番号「LRecNo」で示されるレコードの先頭アドレス「LTRecData」を、
LTRecData=LRecLen×(LRecNo−1)
の式より算出して(ST169)、ST168にて算出した「LBlockAddr」を先頭アドレスとするブロック群が読み出せるかどうか確認する(ST170)。
【0162】
ここで、「LBlockAddr」から始まるブロック群が読み出せない場合には、「LBBlockAddr」から始まるブロック群を一時ファイルデータに複製して(ST171)、一方、読み出せる場合には、読み出したブロック群を一時ファイルデータとともに、「LBBlockAddr」から始まるブロック群とに複製する(ST172)。
【0163】
ST171又はST172を経て一時ファイルデータに複製が完了した後に、この一時ファイルデータの「LTRecData」からレコード長「LRecLen」分だけ「WriteData」を書き込み(ST173)、一時ファイルデータの内容を「LBlockAddr」に複製して(ST174)、情報処理端末γに正常終了の応答を送信して(ST175)、追記又は書き換えの処理を終了する。
【0164】
次に、図17は、本方法例に係る循環データファイルの書き換え手順を示すフローチャートである。同図に示すように、前述のST140にて循環データファイルf3aの書き換え処理を実行するにあたり、まず、ST181〜ST185までは、図11に示したST81〜ST85と同一のものであり、説明を省略する。
【0165】
ST185にて、「RecStart」が「FFh」でない場合には、「FileAddr」を先頭アドレスとする循環データファイル管理情報内のレコード長を「RecLen」、レコード数を「RecNum」とおき(ST186)、書き換える所望のレコードの先頭アドレスを「RecAddr」を、
RecAddr=DataAddr+RecLen×{(RecStart+RecNum+RecNo−1)mod RecNum}
の式より算出する(ST188)。
【0166】
この算出した「RecAddr」を先頭アドレスとするレコードに対して、長さ「RecLen」分の領域に「WriteData」を書き込み、以上の処理が正常に終了した後に書き換えの正常終了通知を情報処理端末γに応答として送信する(ST189)。
【0167】
一方、ST185にて「RecStart」が「FFh」であった場合には、循環レコード内の共有レコードの書き換え処理を実行するものであるが、まず、「DirAddr」から始まるレコードの第3バイトから第4バイトを共有データファイルの属するディレクトリd3のディレクトリID(以下LDirIDという)とし、第5バイトと第6バイトを共有データファイルのファイルID(以下LFileIDという)とする(ST190)。
【0168】
ここで、先に受け渡されたレコード番号「RecNo」が「01h」であるかどうか確認して(ST191)、「RecNo」が「01h」でなければレコード番号指定誤りとして異常応答を送信して(ST192)、循環ファイルの書き換え処理を終了する。一方、ST191にて「RecNo」が「01h」であった場合には、循環データファイルから共有レコードの書き換え処理を行う(ST193)。
【0169】
図18は、本方法例に係る循環データファイルからの共有レコード書き換え手順を示すフローチャートである。
引続き、ST193の循環データファイルの書き換え手順について詳細に説明するものであるが、同図に示したST201〜ST206については、図12に示したST91〜ST96の処理手順と同様のものであり、説明を省略する。
【0170】
ST204又はST206にて「LFileAddr」が一意に決定された後に、この「LFileAddr」を先頭アドレスとする共有データファイル管理情報内のデータアドレスを「LDataAddr」、循環開始ブロック群番号を「LStartBlock」、レコード長を「LRecLen」、ブロック長を「LBlockLen」、循環レコード数を「LRRecNum」とおく(ST207)。
【0171】
続いて、例えばレコード番号1で示される最新のブロック群の先頭アドレス「LBlockAddr」を、
LBlockAddr=LDataAddr+LBlockLen×(LStartBlock−1)
の式より算出する。
【0172】
加えて、バックアップブロック群の先頭アドレス「LBBlockAddr」を、
LBBlockAddr=LDataAddr+LBlockLen×{(LStartBlock+LRRecNum−1)mod(LRRecNum+1)}
の式に先に代入した値を用いて算出する(ST208)。
【0173】
ここで、算出して求めた「LBlockAddr」を先頭アドレスとするデータの領域が実際に読めるものであるか確認して(ST209)、読み出せない場合には、「LBBlockAddr」を先頭アドレスとするブロック群の内容を一時ファイルデータに複製する(ST210)。一方、「LBBlockAddr」から始まるブロック群が読み出せた場合には、このブロック群の内容を一時ファイルデータと、「LBBlockAddr」から始まるブロック群とに複製する(ST211)。
【0174】
ST210又はST211を経て、一時ファイルデータに新規なデータを複製した後に、一時ファイルデータ内のレコード番号「LRecNo」で示されるレコードの先頭アドレス「LTRecData」を、
LTRecData=LRecLen×(LRecNo−1)
の式より算出する(ST212)。
【0175】
その後、一時ファイルデータ内の「LTRecData」からレコード長「LRecLen」分に「WriteData」を書き込み(ST213)、引続き、一時ファイルデータの内容を「LBlockAddr」を先頭アドレスとするブロック群に複製し(ST214)、情報処理端末γに正常終了の応答を送信して(ST215)、書き換え処理を終了する。
【0176】
続いて、図19は、本方法例に係る共有データファイルの書き換え手順を示すフローチャートである。同図に示すように、前述のST142にて共有データファイルf3bを書き換える処理を実行するにあたっては、まず、ST221〜ST229までは、図13に示したST111〜ST119と同様の手順であり、その説明を省略する。
【0177】
ST229にて代入された値を用いて、最新ブロック群の先頭アドレス「BlockAddr」を、
BlockAddr=DataAddr+BlockLen×{(StartBlock+RRecNum−1)mod(RRecNum+1)}
の式より算出する。
【0178】
さらに、バックアップブロック群の先頭アドレス「BBlockAddr」を、
BBlockAddr=DataAddr+BlockLen×{(StartBlock+RRecNum−1)mod(RRecNum+1)}
の式を用いて算出する(ST230)。ここで、算出して求めた「BlockAddr」を先頭アドレスとするブロック群がよみだせるものであるか確認する(ST231)。
【0179】
ST231にて「BlockAddr」から始まるブロック群が読み出せない場合には、「BBlockAddr」から始まるブロック群を一時ファイルデータに複製して(ST232)、一方、読み出せるものであれば、このブロック群の内容を一時ファイルデータと、「BBlockAddr」を先頭アドレスとする領域とに複製する(ST233)。
【0180】
ST232又はST233を経て一時ファイルデータに複製がされた後に、一時データファイル内のレコード番号「RecNo」で示されるレコードの先頭アドレス「TRecData」を、
TRecData=RecLen×(RecNo−1)
の式により算出する(ST234)。
【0181】
引続き、一時ファイルデータ内の「TRecData」からレコード長「RecLen」分に「WriteData」を書き込み(ST235)、一時ファイルデータの内容を「BlockAddr」に複製し(ST236)、ST236の処理が終了した後に、情報処理端末γに正常終了の応答を送信して(ST237)、書き換え処理を終了する。
【0182】
次に、本方法例に係るデータファイルf1,f2,f3a,f3bの追記手順について説明するものの、追記命令を受信した後に所定のデータファイル指定の手順については図14に示した手順と同様のフローを用いるものであり、その説明は省略する。また、特に一般データファイルf1,f2の追記手順については合わせて図15及び図16の手順に従うものとする。ここでは、循環データファイルf3a及び共有データファイルf3bの追記について順に説明する。
【0183】
図20は、本方法例に係る循環データファイルの追記手順を示すフローチャートである。同図に示すように、前述のST140にて循環データファイルf3bの追記処理を実行するにあたり、まず、引数として受け渡されたレコード番号「RecNo」が「01h」であるかどうか確認して(ST241)、「01h」でない場合には、レコード番号誤りとして異常応答を送信して(ST242)、追記の処理を終了する。
【0184】
一方、ST241にて「RecNo」が「01h」であった場合には、以下ST243〜ST247の過程、即ち、図11に示したST81〜ST85又は図17のST181〜ST185と同様の手順を踏むものであり、ここでの説明は省略する。
【0185】
引続き、ST247にて「RecStart」が「FFh」ではなかった場合には、まず、「FileAddr」を先頭アドレスとする循環データファイル管理情報内のレコード長を「RecLen」、レコード数を「RecNum」とおく(ST248)。
【0186】
次いで、追記の対象となるレコードのアドレス「RecAddr」を、
RecAddr=DataAddr+RecLen×{(RecStart+RecNum−2)mod RecNum}
の式により算出して(ST249)、「RecAddr」から長さ「RecLen」分の領域に「WriteData」を書き込む(ST250)。
【0187】
その後、新規に更新するための新しい循環開始レコード番号「RecNum´」を、
RecNum´=(RecStart+RecNum−2)mod RecNum−1
の式を用いて算出する(ST251)。
【0188】
続いて、「FileAddr」から始まる循環データファイル管理情報内の循環開始レコード番号を「RecNum´」に更新書き換えて(ST252)、ST252の完了後に正常終了の通知として、情報処理端末γに応答を送信して(ST253)、追記処理を終了する。
【0189】
一方、ST247にて「RecStart」が「FFh」であった場合には、まず、「DataAddr」から始まるレコードの第3バイトから第4バイトを共有データファイルの属するディレクトリのディレクトリIDを「LDirID」、第5バイトと第6バイトを共有データファイルのファイルIDを「LFileID」とおき(ST254)、循環データファイルから共有レコードの追記処理を実行する(ST255)。
【0190】
図21は、本方法例に係る循環データファイルからの共有レコード追記手順を示すフローチャートである。
引続き、ST255の循環データファイルの追記手順について詳細に説明するが、同図に示したST261〜ST269については、図18に示したST201〜ST209と同様の処理であり、その説明を省略するものであるが、ST266において世代番号を比較した際、世代番号が小さい共有データファイル管理情報の先頭アドレスを「LFileAddr´」とする。
【0191】
ST269の後、「LBBlockAddr」を先頭アドレスとするブロック群が読み出せない場合には、「LBBlockAddr」から始まるブロック群の内容を「LBlockAddr」を先頭アドレスとするブロック群と、一時ファイルデータとに複製し(ST270)、一方、読み出せる場合には、この「LBlockAddr」から始まるブロック群の内容を一時ファイルデータに複製する(ST271)。
【0192】
ST270又はST271を経て、一時データファイルに複製がされた後に、この一時ファイルデータ内のレコード番号「LRRecNo」で示されるレコードの先頭アドレス「LTRecAddr」を、
LTRecAddr=LRecLen×(LRRecNo−1)
の式より算出する(ST272)。
【0193】
その後、一時ファイルデータ内においてST272にて算出した「LTRecAddr」を先頭アドレスとしてレコード長「LRecLen」分の領域に「WriteData」を書き込み(ST273)、また、この一時データファイルの内容を「LBBlockAddr」から始まるブロック群に複製する(ST274)とともに、「LFileAddr」から始まる共有データファイル管理情報を一時共有データファイル管理情報に複製する(ST275)。
【0194】
続いて、新規に更新するための新しい循環開始ブロック番号「LStartBlock´」を、
(LStartBlock+LRRecNum−1)mod(LRRecNum+1)
の式を用いて算出する。
【0195】
加えて、この共有データファイル管理情報内の既存の世代番号「LHNum」に対して新しい世代番号「LHNum´」を、
LHNum´=LHNum+1
の式より算出して(ST276)、一時共有データファイル管理情報内の循環開始ブロック群番号を「LStartBlock´に、世代番号を「LHNum´」に変更する(ST277)。
【0196】
その後、一時共有データファイル管理情報を、ST266にて決定した「LFileAddr´」を先頭アドレスとするブロック群に複製して(ST278)、以上、ST278までの処理が完了した後に、情報処理端末γに正常終了の通知として応答を送信し(ST279)、循環データファイル内の共有レコード追記処理を終了する。
【0197】
続いて、図22は、本方法例に係る共有データファイルの追記手順を示すフローチャートである。同図に示すように、前述のST142にて共有データファイルf3bを追記する処理を実行するにあたっては、まず、ST281〜ST287までの手順は図19に示したST221〜ST227までの手順と同様のものであり、その説明は省略するものであるが、ST284において世代番号を比較した際に、世代番号が小さい共有データファイル管理情報の先頭アドレスを「LFileAddr´」とする。
【0198】
ST287において論理積の解「Ans」が「00000000b」であった場合には、ST228同様に、情報処理端末γに対して、アクセス権不足による異常終了である旨通知する応答を為す(ST288)。一方、「00000000b」ではない場合には、「FileAddr」を先頭アドレスとする共有データファイル管理情報内の循環開始ブロック群番号を「StartBlock」、データアドレスを「DataAddr」、レコード数を「RecNum」、レコード長を「RecLen」、ブロック群長を「BlockLen」、循環レコード数を「RRecNum」、循環レコード番号を「RRecNo」とおく(ST289)。
【0199】
続いて、先に引数として受け渡された追記対象を示す「RecNo」が、循環レコード番号「RRecNo」と等しいものであるかどうか確認して(ST290)、等しくない場合は、一般レコードの追記手順を実行して(ST291)、等しい場合には、循環レコードの追記を行う(ST292)。ここで、ST291の手順は図19に示したST230〜ST237の手順に従い実行可能なものである。
【0200】
図23は、共有データファイルの循環レコードの追記手順を示すフローチャートである。図22に示したST292については、図23を参照して説明する。同図に示すとおり、まず、最新ブロック群の先頭アドレス「BlockAddr」を、
BlockAddr=DataAddr+BlockLen×(StartBlock−1)
の式より算出する。
【0201】
さらに、バックアップブロック群の先頭アドレス「BBlockAddr」を、
BBlockAddr=DataAddr+BlockLen×{(StartBlock+RRecNum−1)mod(RRecNum+1)}
の式を用いて算出する(ST301)。
【0202】
次いで、算出した「BlockAddr」を先頭アドレスとするブロック群が読み出せるかどうかを確認して(ST302)、読み出せない場合には、「BBlockAddr」を先頭アドレスとするブロック群の内容を、「BlockAddr」から始まるブロック群と一時ファイルデータとに複製する(ST303)。一方、読み出せる場合には、この「BlockAddr」から始まるブロック群の内容を一時ファイルデータに複製する(ST304)。
【0203】
ST303又はST304にて複製された一時ファイルデータ内のレコード番号「RRecNo」で示されるレコードの先頭アドレス「TRecAddr」を、
TRecAddr=RecLen×(RRecNo−1)
の式より算出して(ST305)、「TRecAddr」からレコード長「RecLen」分の領域に「WriteData」を書き込む(ST306)。
【0204】
さらに、一時共有データファイル管理情報の内容を「BBlockAddr」から始まるブロック群に複製した(ST307)後に、「FileAddr」から始まる共有データファイル管理情報の内容を一時共有データファイル管理情報に複製する(ST308)。
【0205】
続いて、新規に更新する新しい循環開始ブロック群番号「StartBlock´」を、
StartBlock´=(StartBlock+RRecNum−1)mod(RRecNum+1)
の式を用いて算出する。
【0206】
さらに合わせて、既存の世代番号「LHNum」に対して新しい世代番号「LHNum´」を、
LHNum´=LHNum+1
の式より算出して(ST309)、一時共有データファイル管理情報内の循環開始ブロック群番号を「StartBlock´」に、世代番号を「LHNum´」にそれぞれ更新する(ST310)。
【0207】
その後、一時共有データファイル管理情報をST284にて決定した「LFileAddr´」を先頭アドレスとするブロック群に複製して(ST311)、ST311まで完了した後に、正常終了の通知として応答を情報処理端末γに送信して(ST312)、追記処理を終了する。
【0208】
以上、本発明の実施の形態につき、装置例及び方法例を挙げて説明したが、本発明は、必ずしも上述した手段及び手法にのみ限定されるものではなく、後述の効果を有する範囲内において、適宜、変更実施可能なものである。
【0209】
【発明の効果】
以上、詳細に説明したように、本発明によれば、EEPROMなど一般的な不揮発性メモリを搭載したICカードにおいて、複数のファイルに分散したデータを一つの共有データファイルとして一度読み書きすることにより、その処理時間を大幅に短縮することが可能となり、処理時間を延ばすことなくカードに蓄積するデータの読み書き頻度やデータの長さに応じて、複数のファイルにデータを分散させて管理することができる。
【0210】
また、ICカードに複数の事業者が相乗りしている交通機関の切符や、公共機関が発行するIDカードに民間が相乗りするなどのように、一枚のICカードに複数の事業者のサービスを載せる場合にも、共通するデータを共有データファイルとして利用することで、処理時間を短縮することができる。
【0211】
さらに、非接触方式のICカードにデータを書き込む途中に、電力が無くなる場合に、必要な書き込み保証の機能を共有データファイルに対して実現することにより、交通機関の切符として利用される場合等、リーダライタにICカードをかざして通るときなど、電力供給が不安定な利用場面でも、安心してデータの書き換えが可能となる。
【0212】
しかも、共有データファイル以外のデータファイルは、国際規格ISO/IEC7816に準拠したICカードと互換性を保つことが可能であり、ICカードの不揮発性メモリに、例えば本発明に基づくプログラムを追加することにより、従来機能を拡張することが可能となる。
【図面の簡単な説明】
【図1】本発明の装置例に係るICカードの機能構成図及び、それを動作させるためのリーダライタと情報処理端末の機能構成図である。
【図2】図1に示したEEPROMにおいて採用されるデータファイル構造を示す図である。
【図3】同上、EEPROMにおけるディレクトリ及びデータファイルの管理情報の論理構成を示す図である。
【図4】同上、EEPROMの物理構成図である。
【図5】同上、RAMにおけるチャネル、一時共有データファイルの管理情報、及び一時ファイルデータの論理構成を示す図である。
【図6】本発明の方法例に係るディレクトリの選択手順を示すフローチャートである。
【図7】同上、鍵の照合手順を示すフローチャートである。
【図8】同上、データファイルの読み出し手順を示すフローチャートである。
【図9】同上、一般データファイルの読み出し手順を示すフローチャートである。
【図10】同上、一般データファイルからの共有レコード読み出し手順を示すフローチャートである。
【図11】同上、循環データファイルの読み出し手順を示すフローチャートである。
【図12】同上、循環データファイルからの共有レコード読み出し手順を示すフローチャートである。
【図13】同上、共有データファイルの読み出し手順を示すフローチャートである。
【図14】同上、データファイルの追記・書き換え手順を示すフローチャートである。
【図15】同上、一般データファイルの追記・書き換え手順を示すフローチャートである。
【図16】同上、一般データファイルからの共有レコードの追記・書き換え手順を示すフローチャートである。
【図17】同上、循環データファイルの書き換え手順を示すフローチャートである。
【図18】同上、循環データファイルからの共有レコード書き換え手順を示すフローチャートである。
【図19】同上、共有データファイルの書き換え手順を示すフローチャートである。
【図20】同上、循環データファイルの追記手順を示すフローチャートである。
【図21】同上、循環データファイルからの共有レコード追記手順を示すフローチャートである。
【図22】同上、共有データファイルの追記手順を示すフローチャートである。
【図23】同上、共有データファイルの循環レコードの追記手順を示すフローチャートである。
【符号の説明】
α…ICカード
β…リーダライタ
γ…情報処理端末
1…ICチップ
2…アンテナ
11…CPU
12…ROM
13…RAM
14…EEPROM
15…RF部
d0…ディレクトリ(ルートディレクトリ)
d1,d2,d3…ディレクトリ
f1,f2…一般データファイル
f3a…循環データファイル
f3b…共有データファイル
k1,k2,k3…鍵ファイル
[0001]
BACKGROUND OF THE INVENTION
The present invention relates to a memory management method in an IC card and an IC card (IC: Integrated Circuit), and more particularly, to an ISO standard (ISO: International Organization for Standardization) file structure and command in an IC card incorporating a nonvolatile memory. The present invention relates to a memory management method in an IC card for writing to a data area shared by a plurality of files while maintaining the same, and an IC card used directly for the implementation.
[0002]
[Prior art]
The IC card is mainly equipped with a nonvolatile memory such as an EEPROM (Electronically Erasable and Programmable Read Only Memory) and a flash memory, and a rewrite unit (hereinafter referred to as a block) of the nonvolatile memory is several tens of bytes or more. The processing time required for rewriting is about several tens of milliseconds.
[0003]
The IC card has a file structure capable of holding a plurality of files defined by ISO / IEC 7816-4 (ISO: International Organization for Standardization / IEC: International Electrotechnical Commission). Data included in the file and information for management are arranged regardless of the block boundary.
[0004]
[Non-patent literature]
ISO / IEC 7816-4: 1995, “Identification cards-Integrated circuit (s) cards with contacts-Part 4: Interindustry commands for interchange”
[0005]
Furthermore, from the viewpoint of compatibility with the IC card that can be mounted on the IC card and the compatibility, the instructions stipulated in the international standard are often processed only for a small number of files or a small number of management information. I was going.
[0006]
In an application using an IC card having such properties, from the viewpoint of data properties and security, the data to be held is divided into a plurality of files and held in the IC card. By executing this command, a plurality of files can be read, written, appended, or verified, and data required for the application can be read, rewritten, appended, or authenticated / verified.
[0007]
As a form of use of an IC card, it is increasingly used for settlement of shopping at tickets for transportation, tickets for concerts, convenience stores, and the like. At that time, in order not to make the IC card user wait, it is desired to perform reading / writing processing of the memory of the IC card in as short a time as possible and to finish this processing promptly.
[0008]
Therefore, in the past, the part where the data was written was not rewritten as much as possible, the file management method not to be distributed to multiple blocks, the special command to rewrite multiple files at once, There has been a method of shortening the processing time by adjusting the characteristics to shorten the data erasing time.
[0009]
[Problems to be solved by the invention]
However, in order to perform memory read / write processing in a conventional IC card, it is necessary to execute a plurality of instructions and operate a plurality of files. Therefore, a plurality of blocks arranged in a distributed manner are rewritten, and a long processing time is required. It was necessary.
[0010]
In particular, in the case of a non-contact IC card, it is assumed that the power supply is cut off during writing. In such a case, a process for safely returning the data in the IC card to the state before writing (hereinafter referred to as writing guarantee). However, in order to realize this write guarantee function, more rewrite processing such as duplication of data is required, which is one of the causes of an increase in processing time.
[0011]
Furthermore, specialization of commands and file structure is necessary for the introduction and maintenance of the system because it is not compatible with conventional IC cards and other IC cards and requires special hardware. There is a disadvantage that the cost is high.
[0012]
Here, the main objects to be solved by the present invention are as follows.
[0013]
In other words, the first object of the present invention is to enable high-speed processing by shortening the processing time required for writing to and reading from an IC card while using instructions compatible with international standards and industry standards. A memory management method for an IC card and an IC card are provided.
[0014]
A second object of the present invention is to provide a memory management method for an IC card and an IC card that realizes a file writing guarantee while minimizing an increase in processing time in a non-contact IC card. It is.
[0015]
A third object of the present invention is to increase the processing time of an IC card in a conventional IC card that has already been distributed to users by simply adding a program to a nonvolatile memory on the IC card. A memory management method for an IC card and an IC card are provided.
[0016]
Other objects of the present invention will become apparent from the specification, drawings, and particularly the description of each claim.
[0017]
[Means for Solving the Problems]
First, in the method of the present invention, in solving the problem, a read, rewrite or append execution command with a file identifier and a record number as arguments is received and identified by the record number held by the data file. Referring to the shared record of the shared data file having the same record length as the above records, the data recorded in the referenced record can be read, rewritten, or appended according to the execution instruction. The characteristic configuration method of managing the data file is taken.
[0018]
On the other hand, in the device of the present invention, in order to solve the problem, a plurality of records that are arranged with the same length and can be identified by the record numbers are stored and held with the respective identifiable file identifiers. A memory, file reference means for referring to the shared record in the shared data file, which is the other data file having the same record length as the record in the data file, as actual data of the data file, and the file identifier Execution instruction processing means for receiving a read, rewrite or append execution instruction for the data area identified from the record number and executing the corresponding read, rewrite or append execution instruction according to the execution instruction; The characteristic constituent means is provided.
[0019]
More specifically, in order to solve the problem, the present invention achieves the above-mentioned object by adopting a novel characteristic configuration method and means ranging from the superordinate concept to the subordinate concept listed below. Is done.
[0020]
In other words, the first feature of the method of the present invention is applied to an IC card incorporating a non-volatile memory having a plurality of bytes as a rewrite unit, and each data file with an identifiable file identifier is held. And a memory management method for referring to a shared record included in a shared data file from the record held by the data file when referring to a record that is arranged in the memory with the same length and can be identified by a record number. In the IC card, an execution command for reading, rewriting or appending with the file identifier and the record number as arguments is received, and the one or more identified by the record number held by the data file A shared record of the shared data file having the same record length as the record In the IC card, the data file is managed so that the data recorded in the shared record referred to can be read, rewritten or additionally written corresponding to the execution instruction. The configuration of the memory management method is adopted.
[0021]
The second feature of the method of the present invention is that the reference to the shared record of the shared data file in the first feature of the method of the present invention is used as the reference destination for each record held in the data file. When the reference management information for storing the record identifier indicating the set record sharing state is stored so that it can be updated as needed, and the record is set to the record sharing state with the shared record as the reference destination from the record identifier Furthermore, the configuration of the memory management method in the IC card, which refers to the corresponding shared record as the data of the record, is employed.
[0022]
According to a third feature of the method of the present invention, the execution of the reading, rewriting or appending in the second feature of the method of the present invention is set in the reference management information as the reference destination of the record. The file identifier of the shared data file and the record number of the shared record of the reference destination are stored, and when the reference management information of the record indicating the shared record state is read, A configuration of a memory management method in an IC card, in which reading, rewriting or appending corresponding to the execution instruction is executed on the shared record of the shared data file identified from the file identifier and the record number. .
[0023]
According to a fourth feature of the method of the present invention, the access right to the record is managed together with the execution of the reading, rewriting or appending in the second or third feature of the method of the present invention in the reference management information. Access right information is stored, and when the reference management information of the record indicating the shared record state is read, the execution instruction received earlier is read based on the access right information. A configuration of a memory management method in an IC card, in which the access right to the record is confirmed, and only when the access right is satisfied, reading, rewriting or appending corresponding to the execution instruction for the record is executed It is in.
[0024]
A fifth feature of the method of the present invention is that the record reference in the first, second, third, or fourth feature of the method of the present invention is referred to in advance, the plurality of data files are stored in the IC card. Channel management in which the directory identifier of the directory to which the data file selected and designated as the target of the execution instruction belongs can be identified by a channel number. When the channel number, the file identifier, and the record number are received, the directory identifier is read from the channel management information specified by the channel number, and is updated as needed. Before belonging to the directory specified by The data file, identified from the file identifier from the data file, comprising with reference to the record specified by the record number, in the configuration adopting the memory management method in the IC card.
[0025]
According to a sixth feature of the method of the present invention, the execution of the execution instruction received together with the execution of the reading, rewriting or appending in the fifth feature of the method of the present invention is managed in the channel management information. Security status information is stored so as to be retained until the channel management information is updated, and when the channel management information is read, the access right information and the security of the record that is the target of the execution instruction are stored. It is in the configuration action of the memory management method in the IC card, in which the access right to the record is confirmed from the status information and the execution instruction is executed only when the access right is satisfied.
[0026]
A seventh feature of the method of the present invention is that the management of the data file in the first, second, third, fourth, fifth or sixth feature of the method of the present invention can be identified by a block group number 2 The block group specified by the latest block group number and the block group number is assigned to the data file composed of the above block groups in ascending order from the newly updated block group. When the execution command is received by holding the number and the block group length as data file management information for each data file, the data file management information of the data file to be executed is read and the execution is executed When the instruction is the read instruction,
(Latest block group number -1) x block group length
Calculating the storage position of the latest block group obtained by the above and executing reading of the latest block group recorded in the storage position, while the execution instruction is the rewrite instruction,
{(Latest block group number + number of block groups−2) mod number of block groups} × block group length
To calculate the storage position of the oldest block group obtained by the above, execute rewriting of the oldest block group recorded in the storage position, and the latest block group number of the data file management information,
{(Latest block group number + number of block groups−2) mod number of block groups} +1
The configuration of the memory management method in the IC card, which is updated to the value calculated by the above.
[0027]
The eighth feature of the method of the present invention is that the management of the data file in the seventh feature of the method of the present invention is the same as the data file management information having two generation numbers is retained for each data file. A different value is set as an initial value of the generation number of each of the two data file management information based on the data file. On the other hand, when reading out the data file management information, the data file management information having a large generation number On the other hand, when the data file management information is updated, the data file management information with the lower generation number is detected as the update target, and the generation of the data file management information with the higher generation number is included. An IC card that has a value greater than the number set as the updated generation number In the configuration adoption of the definitive memory management method.
[0028]
The ninth feature of the method of the present invention is that the management of the data file in the seventh or eighth feature of the method of the present invention is the same as that of the record at the top of the data file when the data file is created. General data file with sequential record structure numbered in ascending order from the beginning, and circular data file with circular record structure numbered in ascending order from the newly updated record number and the record length is constant for each file When the data file is managed separately and the shared data file that holds the shared record set as the reference destination of the one cyclic data file and the required general data file is referred to, The data file has multiple records set in the record sharing state of the general data file, The block group having the shared records in which one record set in the record sharing state of the circular data file is arranged in a specific order is retained for the total number of records of the circular data file, and the channel When the execution command for the additional recording is received together with the number, the additional recording data, the record number, and the file identifier of the shared data file, if the data file based on the recording number is the general data file, the latest block Calculating the storage position of the group, and performing the additional recording using the additional recording record for the block group of the storage position, while the data file based on the channel number is the circular data file, The storage position of the oldest block group is calculated, and the block at the storage position is calculated. And executes the write once by the additional data with respect to the group, consisting performs update processing of the block group number, in the configuration adopting the memory management method in the IC card.
[0029]
According to a tenth feature of the method of the present invention, the management of the data file in the ninth feature of the method of the present invention is executed. When the read by the read execution instruction fails, the oldest block group is read. Then, when the data area is updated by the execution instruction, the oldest block group is read in advance,
{(Latest block group number + number of block groups−2) mod number of block groups} × block group length + 1
The memory management method in the IC card adopts the configuration in which the read block group is duplicated in the area specified by the storage position obtained by the above.
[0030]
On the other hand, the first feature of the device of the present invention is an IC card incorporating a non-volatile memory having a plurality of bytes as a rewrite unit, and a plurality of records arranged with the same length and identifiable by record numbers. The memory for storing and holding data files each having an identifiable file identifier, and the shared record in the shared data file having the same record length as the record in the data file. From the data file reference means to be referred to as, the file identifier and the record number, read, rewrite or append execution instructions for the data specified by the data file reference means, and according to the execution instructions Executing the corresponding read, rewrite or append execution instructions Formed by including an instruction processing unit, and in the configuration adopting IC cards.
[0031]
The second feature of the device of the present invention is that the data file in the first feature of the present device is a record sharing set by the data file reference means as the reference destination for each record held The IC card configuration employs reference management information that indicates the status and stores record identifiers that can be updated as needed.
[0032]
According to a third feature of the device of the present invention, the reference management information in the second feature of the device of the present invention includes the file identifier of the shared data file at the reference destination and the record number of the shared record at the reference destination. And adopting a configuration of an IC card.
[0033]
According to a fourth feature of the device of the present invention, the reference management information in the second or third feature of the device of the present invention includes access right information stored so as to be able to confirm whether or not to permit access to the record. IC card configuration adopted.
[0034]
A fifth feature of the device of the present invention is that the memory in the first, second, third or fourth features of the device of the present invention is assigned the data file and a unique directory identifier in the IC card. The directory identifier and the channel number assigned to be identifiable are maintained and maintained until the other directory identifier is received together with the same channel number and updated. Thus, the IC card is configured to have memory management means for holding channel management information indicating the selection status of the directory to which the data file belongs.
[0035]
The sixth feature of the device of the present invention is that the channel management information in the fifth feature of the device of the present invention continues to hold security status information for managing whether or not the execution instruction can be executed until the channel management information is updated. Thus, the configuration of the IC card is adopted.
[0036]
A seventh feature of the device of the present invention is that the execution instruction processing means in the first, second, third, fourth, fifth, or sixth feature of the device of the present invention is connected to the memory management means in a block group. The latest block group number assigned in ascending order from the newly updated block group of the data file consisting of two or more block groups that can be identified by numbers, and the block group specified by the block number While holding the data file management information that holds the number and the block group length for each file, and when receiving the execution command, using the data file management information of the data file that is the target of the execution command,
(Latest block group number -1) x block group length
Processing means for calculating the storage position of the latest block group by
{(Latest block group number + number of block groups−2) mod number of block groups} × block group length
When the processing means for calculating the storage position of the oldest block group according to the above and the data area of the file are updated,
{(Latest block group number + number of block groups−2) mod number of block groups} +1
And a processing unit that updates the latest block group number to the value calculated by the above-described method.
[0037]
The eighth feature of the device of the present invention is that the data file management information in the seventh feature of the device of the present invention has two generation numbers and is retained for each data file, and is based on the same data file. A different value is set as the initial value of the generation number of each of the two file management information, and the data file management information having a smaller generation number is larger than the generation number of the other data file management information. The IC card configuration is adopted in which values are set as new generation numbers and sequentially updated.
[0038]
The ninth feature of the device of the present invention is that the memory management means in the seventh or eighth feature of the device of the present invention is assigned as the data file in ascending order from the first record fixed at the time of data file creation. A general data file having a sequential record structure, a circular data file having a circular record structure in which the record length is fixed for each data file and is assigned in ascending order from the newly updated record number; The sharing comprising: a plurality of records set as the reference destination of the general data file and set in the record sharing state of the general data file; and one record set in the record sharing state of the circular data file The block group having records is retained for the total number of records of the circular data file. A data file, and as the data file management information of the shared data file, the latest data assigned in ascending order from the newly written block group equal to the record number assignment order of the circular data file The IC card has a configuration in which a block group number, the number of block groups, the block length, and the circular record number corresponding as a reference destination by the data file reference means are provided.
[0039]
According to a tenth feature of the device of the present invention, the memory management means in the ninth feature of the device of the present invention holds the number of block groups as the number of records in the circular data file + 1, and the execution command processing means When the block group is updated, the block group read before the update by the processing means for calculating the storage position of the oldest block group,
{(Latest block group number + number of block groups−2) mod number of block groups} × block group length + 1
The IC card configuration is constructed such that the function is constructed so that the block group is copied to the storage position calculated by.
[0040]
DETAILED DESCRIPTION OF THE INVENTION
DESCRIPTION OF EMBODIMENTS Hereinafter, embodiments of the present invention will be described with reference to the accompanying drawings, and an example of a method embodied based on the apparatus will be described in order.
[0041]
(Example of equipment)
First, FIG. 1 is a functional configuration diagram of an IC card according to an example of an apparatus of the present invention, and a functional configuration diagram of a reader / writer and an information processing terminal for operating the IC card.
[0042]
As shown in the figure, the IC card α according to the present apparatus example includes an IC chip 1 for obtaining a functional configuration of the IC card α and an external IC card α when the IC card α functions as a non-contact type. And an antenna 2 for performing wireless communication with the reader / writer β. Further, the reader / writer β is connected to the information communication terminal γ and configured to be able to input and output various data with the IC card α.
[0043]
Here, the reader / writer β has a function of communicating with the IC card α and the information processing terminal γ, and a function of transmitting and receiving data for actually communicating with the IC card α wirelessly.
[0044]
The information processing terminal γ is composed of a personal computer, a workstation, and the like, executes various programs for obtaining the functions of the IC card α and the reader / writer β, and inputs and outputs various data along with the execution of these programs. In addition, the program, data that does not need to be rewritten, data stored when the program is executed, and functions of an external input unit and an external output unit are provided.
[0045]
Further, the IC chip 1 of the IC card α implements various communication processes, data file reference means in the memory to be described later, and execution instructions for reading, rewriting or appending data files in order to realize the functions of the IC card α. A CPU 11 (CPU: Central Processing Unit) is provided as execution command processing means for receiving and inputting / outputting in accordance with the execution command.
[0046]
Further, in the IC chip 1, a ROM 12 (ROM: Read Only Memory) for holding the above program and data that does not need to be rewritten as a memory for storing and holding the data file, and data generated upon execution of the program are stored. Equipped with RAM 13 (RAM: Random Access Memory) for temporary storage and EEPROM 14 (EEPROM: Electronically Erasable and Programmable Read Only Memory) for additionally storing data generated during program execution The reader / writer β includes an RF unit 15 for communication using radio signals.
[0047]
The EEPROM 14 shown in this apparatus example has, for example, a 64-byte rewrite unit (hereinafter referred to as a block), and even when only 1 byte is rewritten, it is necessary to rewrite all 64 bytes.
[0048]
The IC card α employed in this apparatus example is shown as communicating with the reader / writer β by a non-contact method. However, the connection form of the IC card α and the reader / writer β is wired (online) as an electrical connection. Communication may be performed by a contact method using the method of
[0049]
Next, FIG. 2 is a diagram showing a data file structure adopted in the EEPROM according to this apparatus example.
As shown in the figure, in the IC card α, for example, directories d0, d1, d2, and d3 (root directory d0) are used, and data files f1, f2, f3a, and f3b belonging to the directories d1, d2, and d3, respectively. In addition, tree structures are set and managed in the key files k1, k2, k3, and the like. For example, a data file f1 and a key file k1 exist in the directory d1.
[0050]
Here, the data files f1, f2, f3a, and f3b have a record structure and store data for managing applications. The key files k1, k2, and k3 store key information for controlling the access rights of the data files f1, f2, f3a, and f3b. Further, the data files f1 and f2 are constituted by a general data file format, f3a is constituted by a circular data file format, and f3b is constituted by a shared data file format.
[0051]
The general data file format (hereinafter referred to as general data files f1 and f2) is a data file format in which the record position is fixed, and the circular data file format (hereinafter referred to as circular data file f3a) is a record position and an additional record. A file format and a shared data file format (hereinafter referred to as a shared data file f3b) that are rearranged in order from the newest one are virtually combined with records of a plurality of general data files f1 and f2 and one circular data file f3a. One file.
[0052]
Each record of the shared data file f3b (hereinafter referred to as a shared record) includes, for example, the shared records 1 and 2 are the records 1 and 2 of the general data file f1, the shared record 3 is the record 3 of the general data file f2, and the shared record 4 is shared with the latest record of record 3 of the circular data file.
[0053]
Next, FIG. 3 is a diagram showing a logical configuration of directory and data file management information in the EEPROM according to this apparatus example. The data file applied in the IC card α according to the present apparatus example includes data area data in which actual data is stored and a file management area. First, the data file management information managed in the data file management area is described in detail. Explained.
[0054]
First, as shown in FIG. 5A, in this apparatus example, directories d0, d1 (ID = 0101h), d2 (ID = 0102h), and d3 (ID = 0103h) are directory management information for each directory. Is stored in the EEPROM 14 which is a non-volatile memory, for example, “01h” which is a 1-byte type (“h” represents hexadecimal notation, the same applies hereinafter), a 2-byte directory ID “0101h”, and a 2-byte affiliation It consists of a file address “XXXXh” and a 2-byte next directory address “XXXXh”. An arbitrary address is set for “XXXXh”, and the same applies to the following description.
[0055]
Here, the type indicates the type of management information. For example, “01h” is set as a type that uniquely indicates directory management information. The directory ID indicates an identifier of a directory that can be individually identified in the IC card. The belonging file address is one head address of a group of files belonging to this directory. The next directory address is the head address of management information indicating the next directory.
[0056]
Next, FIG. 4B shows general data file management information held in the EEPROM 14 for managing the general data files f1 and f2. The general data files f1 and f2 hold and manage data used in the application. For example, as general data file management information, a file ID that is a 2-byte identifier that does not overlap with other data files in the same directory d1. “0001h” is assigned.
[0057]
The general data files f1 and f2 are composed of a set of records having a fixed length and a fixed total number of records for each data file. Each record is a 1-byte record identifier (hereinafter referred to as a tag) excluding “00h” as reference management information. A record number having a data length of 1 byte and data contents, and a record number starting from 1 is fixedly allocated with 1 byte in order from the top.
[0058]
Further, the general data files f1 and f2 are, as general data file management information for each data file, 1-byte type “02h”, 2-byte file ID “0001h”, 2-byte data address “0000h”, 1 Byte record number “05h”, 1 byte record length “10h”, 2 byte security attribute “00000001b” (“b” represents binary notation, the same applies hereinafter), and 2 byte next file address.
[0059]
The type “02h” indicates the type of management information, and here indicates general data file management information. The file ID “0001h” indicates, for example, an identifier of a data file that is given so that there is no duplication in the directory and the data file can be individually identified. The data address “0000h” is the head address of the data block group in which the data of the general data file f1 is stored.
[0060]
The record number “05h” is the total number of records that can be held in the general data file f1, and the record length “10h” is the length of the record to be held. The security attribute “00000001b” is file access right management data for enabling access determination in combination with a security status described later. The next file address “XXXXh” is the head address of the next file management information belonging to the same directory d1, for example. Here, if the own data file, for example, the general data file f2 is the last, “FFFFh” is stored.
[0061]
Next, FIG. 5B shows management information of the circulating data file f3a in this apparatus example. The circular data file f3a retains and manages data used by the application, and is given a file ID, for example, “0004”, which is a 2-byte identifier that does not overlap with other data files in the same directory d3, for example.
[0062]
Here, the circular data file f3a is composed of a set of records having a fixed length and a fixed total number of records set for each data file. Each record consists of a 1-byte tag excluding “00h”, 1-byte data length, and data contents as reference management information, but the record of the circular data file f3a is 1 byte in order from the newest one. Record numbers starting with are dynamically allocated.
[0063]
In addition to the management information “02h” of the general data files f1 and f2, a 2-byte circulation start record such as “FFh” is added to the management information of the circulating data file f3a. The type of the circulating data file is “03h”. The circulation start record number “FFh” indicates what number among the plurality of records in the secured data block group is the newest record. The circulation start record number when this circulation data file f3a is shared with other data files is set to “FFh”.
[0064]
On the other hand, FIG. 3D shows management information of the shared data file f3b. The shared data file f3b is used when accessing a plurality of data files at once. For example, in the same directory d3, a file ID that is a 2-byte identifier that does not overlap with other data files f3a,... Is assigned as “0004h”, for example.
[0065]
Each record is composed of a shared record that is referred to by a record of a specific general data file f1, f2 or circular data file f3a. However, the lengths of the records to be referred to are all equal, and the number of circular data files f3a that refer to one shared data file f3b is limited to one. Each record consists of a 1-byte tag excluding “00h” as reference management information, a 1-byte data length, and data contents, and the record number is expressed in 1 byte from the beginning, starting from 1 and fixed. Allocated to
[0066]
Furthermore, specific record numbers are assigned to specific records in the general data files f1 and f2, and records in the cyclic data file f3a are assigned to one specific record number.
[0067]
Here, two pieces of shared data file management information are held in a continuous memory area, and the contents are one-byte circular records in addition to those used in the management information of the general data files f1 and f2. Number “04h”, 1-byte circular start block group number “01h”, 1-byte circular record number “03h”, 2-byte block group length “0040h”, 2-byte generation number “0002h”, and each record In addition, 2-byte security attributes “00000001b”, “00000001b”, “00000010b”, “00000100b”, which are paired with 2-byte directory IDs “0101h”, “0101h”, “0102h”, “0103h”. It consists of.
[0068]
The shared data file type is, for example, “04h” and “05h”. The circular record number “04h” indicates the record number of the shared data file corresponding to the circular data file f3b, the circular start block group number “01h” indicates the number of the block group including the newest record of the circular data file f1b, The number of circulating records “03h” indicates the number of circulating records.
[0069]
Further, two of the stored circular data file management information indicates that the larger generation number is the new management information, and the directory IDs “0101h”, “0101h”, “0102h”, “0103h” being referred to Indicates the directory IDs of the directories d1, d2, and d3 to which the data files shared in each record belong. Similarly, the security attributes “00000001b”, “00000001b”, “00000010b”, and “00000100b” are data shared in each record. Indicates the security attribute of the file.
[0070]
FIG. 4E shows the management information of the key files k1, k2, and k3. The key files k1, k2, and k3 are used to control access rights. For example, the key file k1 is assigned “0011h”, which is a 2-byte identifier that is not duplicated in the same directory d1, as a file ID. The The key files k1, k2, and k3 have key classifications that can create 16 different keys.
[0071]
The management information of the key file k1 includes 1-byte type “06h”, 2-byte file ID “0011h”, 2-byte data address “0050h”, 1-byte key length “10h”, and 1-byte key classification. It consists of “01h” and a 2-byte next file address “XXXXh”.
[0072]
Here, the type indicates the type of the data file management information, and the type of the key files k1, k2, and k3 is 06h. The data address “0050h” indicates the address of the data block group in which the key content is held, and the key length “10h” indicates the number of bytes of the key length to be held. The key classification includes 16 types of “01h” to “10h”, and the next file address “XXXXh” is the head address of the management information of the next data file belonging to the same directory d1.
[0073]
Next, FIG. 4 is a physical configuration diagram of the EEPROM according to this apparatus example.
First, as shown in the figure, the directories d1, d2, and d3, the data files f1, f2, f3a, and f3b and the key files k1, k2, and k3 are divided into data areas in which real data is held in the EEPROM 14, It consists of a management information area for holding each management information.
[0074]
As shown in the figure, for example, the data of the data files of the files in each directory are, from the lowest order, the directory d1 is “0000h” to “005Fh”, the directory d2 is “0060h” to “00CFh”, and the directory d3. Are arranged in “00D0h” to “023Fh”, and the pieces of management information are arranged in order from the top.
[0075]
Here, the records of the general data files f1 and f2 and the circular data file f3a are held in the data area and the management information area of the directories d1 and d2, respectively, and the records are stored in order from the lower address. The storage format consists of a tag, length, and data.
[0076]
Here, when the record including the reference management information of the general data files f1 and f2 is set in the record sharing state with the shared record stored in the shared data file f3b as a reference destination, the tag becomes “00h”. In the data, the first and second bytes are the directory ID “0103h” where the reference destination file is located, the third and fourth bytes are the reference destination file ID “0004h”, and the fifth byte is the reference destination record number “0001h”, “0002h” or “ 0003h "is stored.
[0077]
In addition, when the record of the circular data file f3a refers to the shared record stored in the shared data file f3b, the tag of the record physically located at the top is “00h”, and the data has the first and second bytes. The directory ID “0103h” in which the reference destination file exists, the third and fourth bytes become the reference destination file ID “0004h”, and other records are ignored.
[0078]
Further, the shared data file f3b has a record length of 16 bytes (10h) and a block length of 64 bytes (40h). Therefore, the data area of the shared data file f3b includes four block groups. Here, as the records 1, 2, 3, and 4 in order from the top of each block of the shared data file f3b, the records that are similarly configured for the general data file f1, f2 and the circular data file f3a are sequentially recorded from the top to the record 1, Called 2, ...
[0079]
Thereby, the shared record 1 and the shared record 2 in the data area of the shared data file f3b are the record 1 and the record 2 of the general data file f1 (file ID = 0001h), and the shared record 3 is the general data file f2 (file Record 3 and shared record 4 with ID = 0002h are referenced from each of the circular data file f3a (file ID = 0003h).
[0080]
Subsequently, the data area of the shared data file f3b is managed by configuring a plurality of continuous block groups. The block group described here is a memory area that holds the contents of each referenced record. For example, the block group is an area that is allocated from the lower boundary to the higher address starting from the block boundary.
[0081]
Here, assuming that the block length is “BlockSize”, the record length is “RecLen”, and the number of records (total number of records) is “RecNum”, the length “BlockLen” of the block group is
BlockLen = BlockSize × {(RecLen × RecNum)% BlockSize}
It is. However, X% Y is a value obtained by rounding up a value obtained by dividing X by Y.
[0082]
The shared data file f3b is managed using a plurality of block groups of the number of records of the circular data file f3a + 1 referring to this block group plus one. Each record of the general data files f1 and f2 is assigned to each block group in order from the lower order according to the record number.
[0083]
Further, the position where the record of the cyclic data file f3a is held is one record at a time according to the record number of the cyclic data file f3a referred to, with the block group starting from the circulation start block group number as the block group corresponding to the first record. It is assigned to each block group, and in the individual block group, it is assigned according to the record number referred to.
[0084]
Further, the data area of the shared data file f3b is composed of four block groups obtained by adding 1 to the number of records 3 of the circular data file f3a, and the starting record number of the circular data file f3a is 1. Each record of the circular data file f3a is assigned in order from the first block group of f3b, and the remaining one block group (here, the fourth last block group) is used for backup.
[0085]
Next, FIG. 5 is a diagram illustrating a logical configuration of a channel, management information of the temporary shared data file, and temporary file data in the RAM according to the present apparatus example. As shown in the figure, the IC card α applied to this apparatus example has a plurality of environments for holding access rights called channels as memory management means, and a directory, security for each channel held on the RAM 13. Functionally configured to manage state.
[0086]
First, as shown in FIG. 2A, the channel management information is composed of a 2-byte directory ID, a 2-byte directory address, and a 2-byte security status. The directory ID “0101h” is the ID of the directory d1 that is currently stored and held as the channel, and is held updatable. The directory address “XXXXh” indicates the head address of the management information of the directory d1 that is also stored in this channel. The security status “00000000b” indicates the security state in this channel.
[0087]
Further, the RAM 13 holds the temporary shared data file management information shown in FIG. 7B and the temporary file data shown in FIG. The temporary shared data file management information is used as a buffer when rewriting data in the management information, and the temporary file data is configured to be used as a buffer when rewriting a block group.
[0088]
(Example method)
Subsequently, in the IC card α configured as described above, the access right control method set for each of the data files f1, f2, f3a, f3b, the directory selection selection procedure for selecting the directories d1, d2, d3, A key collation procedure using the key files k1, k2, and k3 and a reading procedure of the data files f1, f2, f3a, and f3b will be described in order.
[0089]
First, the IC card α according to the present embodiment uses the security attribute held for each data file f1, f2, f3a, f3b, the security status held for each channel, and the key classification held for each key file. Access control to the files f1, f2, f3a, and f3b is performed.
[0090]
The security attributes held for each of the data files f1, f2, f3a, and f3b indicate which key is used for access, while the security status set for each channel is used for checking which key is currently used. Indicates whether or not. For example, if the key of the key classification “01h” is collated, the corresponding bit of the security status is set to “1” and becomes “00000001b”.
[0091]
In this state, when accessing the data file f1 having the security attribute “00000001b”, the logical product of the security status “00000001b” and the security attribute “00000001b” is calculated, and the result becomes “00000001b”. Judge that it is possible.
[0092]
In this state, when the data file f2 having the security attribute “00000010b” is accessed, the result of the logical product is “00000000b”. According to the security status and the key file, access control to the data files f1, f2, f3a, and f3b becomes possible.
[0093]
Next, FIG. 6 is a flowchart showing a directory selection procedure according to the method example of the present invention. A procedure for selecting directories d1, d2, and d3 for storing various data files will be described with reference to FIG.
[0094]
The IC card α according to this method example is a host device, for example, a directory selection command having a 1-byte channel number (hereinafter referred to as Ch) and a 2-byte directory ID (hereinafter referred to as DirID) as an argument from the information processing terminal γ. Receive.
[0095]
Upon receiving the directory selection command, the IC card α sequentially follows the directory d2,... From the next directory address “XXXXh” in the management information of the directory d1, which is the first directory, so that the directory ID in the directory management information is changed. Directory management information equal to the received argument “DirID” is searched (ST1).
[0096]
After ST1, the detection of the directory ID matching “DirID” is confirmed (ST2). If the desired directory ID is not detected, the information processing terminal γ is notified of the abnormal termination of the directory designation error by the reader / writer β. (ST3) to finish. If a directory ID matching the argument “DirID” is detected in ST2, the head address of the directory management information is substituted into “DirAddr” (ST4).
[0097]
When “DirAddr” is written in the directory address in the channel management information specified by the argument “Ch” (ST5) and “DirID” is written in the directory ID (ST6), and all the processes are normally completed, it is normal. An end response is transmitted to the information processing terminal γ (ST7), and the directory selection process ends.
[0098]
Next, FIG. 7 is a flowchart showing a key verification procedure according to the present method example. The IC card α applied in this method example has a 1-byte channel number “Ch” as an argument, a 2-byte key file ID (hereinafter referred to as KeyID), a multi-byte key content (hereinafter referred to as KeyValue), and a 1-byte key. Is received from the information processing terminal γ, which is the host device, via the reader / writer β.
[0099]
Therefore, first, as shown in the figure, the directory ID in the channel management information specified by “Ch” is assigned to “DirID”, the directory address is assigned to “DirAddr”, and the security status is assigned to “SS”. (ST11). Reads the directory management information starting from the assigned “DirAddr” address, traces the file address in the directory management information, and has the file ID equal to “KeyID” and the type is “06h”. (ST12).
[0100]
After ST12, it is confirmed whether or not a key file has been detected (ST13). If not detected, an abnormal response of a key file ID specification error is transmitted to the host device (ST14). Exit. On the other hand, when a desired key file is detected, the head address of the key file management information is substituted into “KeyAddr” (ST15).
[0101]
The data address in the key file management information starting from the address specified by “KeyAddr” is substituted for KeyValue ′ (ST16), and “KeyValue” received from information communication terminal γ and “KeyValue ′” are equal to each other. For example, it is confirmed from the length of “KeyLen” (ST17).
[0102]
When “KeyValue” and “KeyValue ′” are not equal, a key content mismatch abnormal end response is transmitted to the information communication terminal γ as a key verification mismatch (ST18), and the key verification processing is terminated. On the other hand, when “KeyValue” and “KeyValue ′” are equal, the key classification in the key file management information starting from the address of “KeyAddr” is set as “KeyKind” (ST19).
[0103]
Further, the “KeyKind” bit of “SS” received earlier as an argument is replaced with “1” (ST20). When all of the processing ends normally until ST20, a normal end response is transmitted to the information communication terminal γ, which is a higher-level device, via the reader / writer β (ST21), and the key verification processing ends.
[0104]
Next, FIG. 8 is a flowchart showing a data file reading procedure according to the present method example. A procedure for reading each data file f1, f2, f3a, f3b will be described with reference to FIG.
First, the IC card α applied in this method example has a 1-byte channel number “Ch”, a 2-byte data file ID (hereinafter referred to as FileID), and a 1-byte record number (hereinafter RecNo) as arguments. The read command is received from the host device information communication terminal γ.
[0105]
The directory ID in the channel management information specified by the received “Ch” is assigned to “DirID”, the directory address is set to “DirAddr”, and the security status is assigned to “SS” (ST31), and specified by “DirAddr”. The data file management information is sequentially traced from the affiliation file address stored in the directory management information starting from the address, and the type is “02h”, “03h”, “04h” or “05h” and the file ID is equal to the FileID. Search for data file management information (ST32).
[0106]
After ST32, it is confirmed whether or not data file management information has been detected (ST33). If not detected, a file ID designation error abnormal termination response is transmitted to the information communication terminal γ to read the data file. Terminate the process. On the other hand, when the desired data file management information is detected, the head address of this data file management information is set to “FileAddr” (ST35).
[0107]
Furthermore, the type in the data file management information specified by “FileAddr” is set to “FileKind” (ST36). First, the value assigned to “FileKind” is “02h” indicating the general data files f1 and f2. It is confirmed whether or not there is (ST37). If “FileKind” is “02h”, the corresponding general data file f1 or f2 is read (ST38).
[0108]
If the value of “FileKind” is not “02h”, it is further checked whether it is “03h” indicating the circulating data file f3a (ST39). If it is “03h”, reading of the circulating data file f3a is performed. Processing is performed (ST40), and if it is not “03h” indicating the circulating data file f3a, it is continuously checked whether “FileKind” is “04h” or “05h” (ST41).
[0109]
If this “FileKind” is “04h” or “05h” set as the type of the shared data file f3b, the shared data file f3b is read (ST42), and “FileKind” is more than “02h” to If none of “05h” is applicable, an abnormal termination is transmitted to the information processing terminal γ as a data file type designation error (ST43), and the reading process is terminated.
[0110]
Furthermore, the reading process of the general data files f1, f2, the circulation data file f3a, and the shared data file f3b performed in ST38, ST40, and ST42 will be described in order.
[0111]
FIG. 9 is a flowchart showing a general data file read procedure according to this method example. As shown in the figure, in executing the process of reading the general data files f1 and f2 in ST38, first, general data file management information starting with “FileAddr” is specified and stored in the general data file management information. The logical product of the assigned security attribute and “SS” into which the security status in the channel management information previously specified by “Ch” is assigned is calculated, and the result is assigned to “Ans” (ST51).
[0112]
After ST51, it is checked whether or not the result “Ans” of this logical product is “00000000b” (ST52). If “Ans” is “00000000b”, an access right error abnormal end is detected as an insufficient access right. The data is transmitted to the information processing terminal γ (ST53), and the general data file reading process is terminated.
[0113]
On the other hand, if the result of logical product “Ans” is not “00000000b” in ST52, the data address in the general data file management information specified by the address of “FileAddr” is “DataAddr”, and the record length is “RecLen”. Each is substituted (ST54).
[0114]
Subsequently, the address “RecAddr” of the record to be read is
RecAddr = DataAddr + RecLen × (RecNo−1)
(ST55), the first byte of the data starting from “RecAddr” is set as a “tag” (hereinafter referred to as “Tag”) (ST56), and it is confirmed whether or not this “Tag” is “00h”. (ST57).
[0115]
Here, when “Tag” is not “00h”, the data from “RecAddr” to “RecLen” as a normal record and the notification of normal completion of reading of the general data file are sent together to the information processing terminal γ. (ST58), the reading of the general data file is normally terminated.
[0116]
On the other hand, if “Tag” is “00h”, it is determined that the record is a reference from the shared data file f3b, and the record starting from the address specified by “RecAddr”, for example, from the third byte The fourth byte is a directory ID (hereinafter, LDirID) of the directory d3 to which the shared data file f3b belongs, the fifth byte and the sixth byte are the file ID (hereinafter, LFileID) of the shared data file f3b, and the seventh byte is the shared data file f3b. The reference destination record number (hereinafter referred to as LRecNo) (ST59).
[0117]
After ST59, the shared record is read from the general data file (ST60). The read process of the shared record from the general data file will be described in more detail below.
FIG. 10 is a flowchart showing a procedure for reading a shared record from a general data file according to this method example. ST60 will be described with reference to FIG.
[0118]
First, the directory management information having “LDirID” as the directory ID is searched in order from the next directory address in the directory management information having “DirAddr” as the head address, and the head address of the detected directory management information is “LDirAddr”. (ST61).
[0119]
Next, the affiliated file address in the directory management information starting with “LDirAddr” is traced, and the shared data file management information identified by the type “04h” or “05h” and the file ID “LFFileID” is searched. As a result, it is confirmed that the management information of the two shared data files has been detected (ST63).
[0120]
When only one shared data file management information is detected in ST63, the head address of the detected shared data file management information is set to “LFileAddr” (ST64). When the information is detected, the head address of the shared data file management information whose type is “04h” is “LFileAddr1”, and the head address of the shared data file management information whose type is “05h” is “LFileAddr2” (ST65). ).
[0121]
Next, the generation numbers in the two shared data file management information starting with “LFFileAddr1” and “LFFileAddr2” are compared, and the leading address of the larger management information is set to “LFFileAddr” (ST66), thereby “LFFileAddr”. Is determined.
[0122]
After “LFileAddr” is determined in ST64 or ST66, the data address in the shared data file management information having the address of “LFileAddr” as the head address is “LDataAddr”, the circulation start block group number is “LStartBlock”, and the record length Is “LRecLen”, the number of records is “LRecNum”, the block group length is “LBlockLen”, and the number of circular records is “LRRecNum” (ST67).
[0123]
Using the value substituted in ST67, first, the head address “LBlockAddr” of the latest block group is
LBlockAddr = LDataAddr + LBlockLen × (LStartBlock-1)
(ST68).
[0124]
Subsequently, the start address “LRecAddr” of the record indicated by the record number “LRecNo”
LRecAddr = LBlockAddr + LRecLen × (LRecNo−1)
(ST69)
[0125]
Here, it is confirmed whether or not a record having the address of “LRecAddr” obtained from ST69 can be actually read (ST70). If the record can be actually read, data from “LRecAddr” to “LRecLen” is checked. The data for the length is read, and the normal end notification is returned to the information processing terminal γ (ST71).
[0126]
On the other hand, when the record starting from “LRecAddr” obtained by calculation from the memory as real data cannot be read, the head address “LBBlockAddr” of the backup block group is set to
LBBlockAddr = LDataAddr + BlockLen × {(LSStartBlock + LRRecNum−1) mod (LRRecNum + 1)} is calculated and obtained (ST72).
[0127]
Furthermore, the start address “LRecAddr” of the record indicated by the record number “LRecNo”
LRecAddr = LBBlockAddr + LRecLen × (LRecNo−1)
(ST73).
[0128]
Read the data for the length of “LRecLen” from the record having the address of “LRecAddr” as the top address, send it to the information processing terminal γ together with the normal end notification, and respond (ST74). The record reading process ends.
[0129]
Next, FIG. 11 is a flowchart showing a procedure for reading a circular data file according to this method example. As shown in the figure, in executing the process of reading the circular data file f3a in the above-mentioned ST40, first, the security attribute in the data file management information starting with “FileAddr” and the first identified by “Ch” are shown. The logical product with the security status “SS” in the channel management information is calculated and the result is set to “Ans” (ST81).
[0130]
Next, it is confirmed whether or not “Ans” is “00000000b” (ST82). If it is “00000000b”, the information communication terminal γ responds with an abnormal termination of an access right error as an insufficient access right. (ST83), and the reading process of the circular data file is completed.
[0131]
On the other hand, if “Ans” is not “00000000b”, the circulation start record number in the circulation data file management information starting with “FileAddr” is set to “RecStart”, the data address is set to “DataAddr” (ST84), and this “RecStart” is set. Is not “FFh”, and if it is not “FFh”, the record length in the cyclic data file management information starting with “FileAddr” is set to “RecLen” and the number of records is set to “RecNum”. (ST86).
[0132]
Subsequently, the start address “RecAddr” of the desired record to be read is set to RecAddr = DataAddr + RecLen × (RecStart−1)
(ST87), and reads the length indicated by “RecLen” of the record starting from the calculated “RecAddr”, and transmits this to the information processing terminal γ together with the normal end response to read The process ends (ST88).
[0133]
On the other hand, if “RecStart” is “FFh” in ST85, the third byte to the fourth byte of the record having “DataAddr” as the head address are set as the directory ID (hereinafter referred to as LDirID) to which the shared data file belongs. The fifth byte and the sixth byte are used as the file ID (hereinafter referred to as LFileID) of the shared data file (ST89).
[0134]
Thereafter, the shared record is read from the circular data file (ST90). The details of the shared record read procedure from the circular data file are sequentially executed as follows.
FIG. 12 is a flowchart showing a procedure for reading a shared record from a circular data file according to this method example. ST90 will be described with reference to FIG.
[0135]
First, the head address “FileAddr” of the shared data file management information is determined by the process of ST91 to ST96 shown in the figure. For this procedure, the shared record in the general data file shown in FIG. 10 is read. The procedure is the same as ST61 to ST66, and a description thereof is omitted here to avoid repeated description.
[0136]
After “LFileAddr” is determined through the process up to ST94 or ST96, the data address in the shared data file management information starting from the address indicated by “LFileAddr” is “LDataAddr”, and the circulation start block group number is “LStartBlock”. The record length is “LRecLen”, the number of records is “LRecNum”, the number of circular records is “LRRecNum”, the block group length is “LBlockLen”, and the circular record number is “LRRecNo” (ST97).
[0137]
Using the above substituted values, the head address “LBlockAddr” of the latest block group is
LBlockAddr = LDataAddr + LBlockLen × (LStartBlock-1)
(ST98).
[0138]
Furthermore, the head address “LRecAddr” of the record indicated by the record number “LRRecNo”
LRecAddr = LBlockAddr + LRecLen × (LRRecNo−1)
(ST99), and it is confirmed whether the data starting with the calculated “LRecAddr” can be read on the actual memory (ST100).
[0139]
Here, when the data starting from “LRecAddr” can be actually read, the data starting from “LRecAddr” is read for “LRecLen” and transmitted to the information processing apparatus γ together with the normal end notification to perform the reading process. The process ends (ST101).
[0140]
On the other hand, when the data starting from “LRecAddr” cannot be read, the head address “LBBlockAddr” of the backup block group is set to
LBBlockAddr = LDataAddr + LBlockLen × {(LSStartBlock + LRRecNum−1) mod (LRRecNum + 1)}
(ST102).
[0141]
Subsequently, the start address “LRecAddr” of the record indicated by the record number “LRRecNo”
LRecAddr = LBBlockAddr + LRecLen × (LRRecNo−1)
(ST103), the data starting from the head address of “LRecAddr” is read for “LRecLen”, is transmitted as a response to the information processing terminal γ together with a normal end notification (ST104), and the reading process is terminated.
[0142]
Next, FIG. 13 is a flowchart showing a procedure for reading a shared data file according to this method example. As shown in the figure, in executing the process of reading the shared data file f3b in the above-described ST42, first, the data file management information is traced from the belonging file address in the directory management information having “DirAddr” as the head address. The shared data file management information having “FileAddr” as the head address, the type “04h” or “05h”, and “FileID” as the file ID is searched (ST111).
[0143]
Here, it is confirmed whether or not the shared data file management information is detected (ST112), and when the shared data file management information is detected, the head address of the detected shared data file management information is set to “FileAddr ′” ( ST113).
[0144]
The generation number held in the shared data file management information having “FileAddr” as the top address and the shared data file management information having “FileAddr ′” as the top address are compared, and the shared data file management with the larger generation number is compared. The head address of the information is changed to “FileAddr” (ST114).
[0145]
Next, when the shared data file management information is not detected in ST112, or after “FileAddr” is uniquely determined through ST114, the “FileAddr” is included in the shared data file management information having the head address. The directory ID of the record number “RecNo” is assigned to “LDirID”, and the security attribute is assigned to “SA” (ST115).
[0146]
Subsequently, the channel management information is searched for a directory ID equal to “LDirID”, and the logical product of the security status in the searched channel management information and “SA” is calculated to be “Ans”. (ST116), it is confirmed whether this "Ans" is "00000000b" (ST117).
[0147]
Here, if “Ans” is “00000000b”, an access right error abnormal termination is returned to the information processing terminal γ as a lack of access right for this shared data file (ST118), and the process is terminated.
[0148]
On the other hand, when “Ans” is not “00000000b”, the circulation start block group number in the shared data file management information having “FileAddr” as the head address is “StartBlock”, the data address is “DataAddr”, and the number of records Is “RecNum”, the record length is “RecLen”, the block group length is “BlockLen”, and the number of circular records is “RecNum” (ST119).
[0149]
As described above, using the assigned value, the start address “BlockAddr” of the block group to be read is
BlockAddr = DataAddr + BlockLen × (StartBlock-1)
(ST120), and it is confirmed whether or not a block group having the calculated “BlockAddr” address as the head address can be read (ST121).
[0150]
When a block group having “BlockAddr” as the head address can be read, the head address “RecAddr” of the record indicated by the record number “RecNo” delivered earlier is
RecAddr = BlockAddr + RecLen × (RecNo−1)
(ST122).
[0151]
Using this calculated “RecAddr” as the head address, data for the length “RecLen” is read, the read data is transmitted to the information processing terminal γ, and a normal end response is sent (ST123), and the shared data file f3b is read. The reading process ends.
[0152]
On the other hand, when the data starting from “BlockAddr” cannot be read in ST121, the head address “BBlockAddr” of the backup block group is set to
BBlockAddr = DataAddr + BlockLen × {(StartBlock + RRecNum−1) mod (RRecNum + 1)}
(ST124).
[0153]
Subsequently, the head address “RecAddr” of the record indicated by the record number “RecNo” delivered earlier is
RecAddr = BBlockAddr + RecRen × (RecNo−1) is calculated using the formula (ST125), “RecAddr” is used as a head address, data of “RecLen” length is read, and a normal end notification and response to the information processing terminal γ (ST126) and the reading process is terminated.
[0154]
Next, FIG. 14 is a flowchart showing a procedure for adding / rewriting a data file according to this example method. A procedure for adding or rewriting the data files f1, f2, f3a, and f3b will be described with reference to FIG.
First, the IC card α in this method example has a 1-byte channel number (hereinafter referred to as Ch) as an argument, a 2-byte data file ID (hereinafter referred to as FileID), a 1-byte record number (hereinafter referred to as RecNo), and a plurality of bytes. Of the rewriting data (hereinafter referred to as “WriteData”) is received from the information processing terminal γ.
[0155]
In the following, the process shown in the figure is performed, but the process of ST131 to ST143 corresponds to each process of ST31 to ST43 shown in FIG. 8, and the read command is replaced with an append or rewrite command. There is no explanation to avoid repetition. In addition, each process of ST138, ST140, and ST142 will be described in order below.
[0156]
FIG. 15 is a flowchart showing a procedure for adding and rewriting a general data file according to this method example. As shown in the figure, when the general data files f1 and f2 are added or rewritten in ST138, the processes of ST151 to ST157 corresponding to ST51 to ST57 shown in FIG. 9 are sequentially performed.
[0157]
After that, when “Tag” is not equal to “01h” in ST157, “WriteData” is written in the length of “RecLen” with “RecAddr” as the head address, and a normal end notification is sent to information processing terminal γ as a response. (ST158), and the procedure for appending or writing the general data files f1 and f2 is completed.
[0158]
On the other hand, if “Tag” is “01h” in ST157, the third to fourth bytes of the record starting with “RecAddr” are replaced with the directory ID of the directory d3 to which the shared data file f3b belongs, as in ST59. The file ID and the record number are extracted and set as “LDirID”, “LFileID”, and “LRecNo”, respectively (ST159).
[0159]
Next, the process of adding or rewriting the shared record from the general data file (ST160) will be described.
FIG. 16 is a flowchart showing a procedure for adding / rewriting a shared record from a general data file according to this method example. ST160 will be described with reference to the same figure, but ST161 to ST167 in FIG. 10 correspond to ST61 to ST67 in FIG.
[0160]
After ST167, the head address “LBlockAddr” of the latest block group is
LBlockAddr = LDataAddr + LBlockLen × (LStartBlock-1)
In addition, the top address “LBBlockAddr” of the backup block group is calculated by
LBBlockAddr = LDataAddr + LBlockLen × {(LSStartBlock + LRRecNum−1) mod (LRRecNum + 1)}
(ST168).
[0161]
Thereafter, the start address “LTRecData” of the record indicated by the record number “LRecNo” in the temporary file data is
LTRecData = LRecLen × (LRecNo-1)
(ST169), it is confirmed whether or not the block group having “LBlockAddr” calculated in ST168 as a start address can be read (ST170).
[0162]
Here, when the block group starting from “LBBlockAddr” cannot be read, the block group starting from “LBBlockAddr” is copied to the temporary file data (ST171). Along with the temporary file data, the data is copied to a block group starting from “LBBlockAddr” (ST172).
[0163]
After copying to the temporary file data through ST171 or ST172, “WriteData” is written for the record length “LRecLen” from “LTRecData” of this temporary file data (ST173), and the contents of the temporary file data are stored in “LBlockAddr”. It duplicates (ST174), transmits a normal end response to the information processing terminal γ (ST175), and ends the appending or rewriting process.
[0164]
Next, FIG. 17 is a flowchart showing a procedure for rewriting a circulating data file according to this method example. As shown in the figure, when executing the rewriting process of the circular data file f3a in the above-described ST140, first, ST181 to ST185 are the same as ST81 to ST85 shown in FIG. To do.
[0165]
If “RecStart” is not “FFh” in ST185, the record length in the circular data file management information having “FileAddr” as the head address is set to “RecLen”, and the number of records is set to “RecNum” (ST186). Set the start address of the desired record to be rewritten to “RecAddr”
RecAddr = DataAddr + RecLen × {(RecStart + RecNum + RecNo−1) mod RecNum}
(ST188).
[0166]
For the record having the calculated “RecAddr” as the head address, “WriteData” is written in the area of the length “RecLen”, and after the above process is normally completed, a rewrite normal end notification is sent to the information processing terminal γ. As a response (ST189).
[0167]
On the other hand, when “RecStart” is “FFh” in ST185, the rewrite processing of the shared record in the circular record is executed. First, from the third byte of the record starting with “DirAddr” The 4 bytes are set as the directory ID (hereinafter referred to as LirID) of the directory d3 to which the shared data file belongs, and the 5th and 6th bytes are set as the file ID of the shared data file (hereinafter referred to as LFileID) (ST190).
[0168]
Here, it is confirmed whether or not the record number “RecNo” delivered first is “01h” (ST191). If “RecNo” is not “01h”, an abnormal response is transmitted as a record number designation error. (ST192), the circular file rewriting process is terminated. On the other hand, if “RecNo” is “01h” in ST191, the shared record is rewritten from the circular data file (ST193).
[0169]
FIG. 18 is a flowchart showing the shared record rewriting procedure from the circular data file according to this method example.
Subsequently, the rewriting procedure of the circular data file in ST193 will be described in detail, but ST201 to ST206 shown in the figure are the same as the processing procedure of ST91 to ST96 shown in FIG. Is omitted.
[0170]
After “LFileAddr” is uniquely determined in ST204 or ST206, the data address in the shared data file management information having “LFFileAddr” as the head address is “LDataAddr”, the circulation start block group number is “LStartBlock”, and the record The length is set to “LRecLen”, the block length is set to “LBlockLen”, and the number of circular records is set to “LRRecNum” (ST207).
[0171]
Subsequently, for example, the head address “LBlockAddr” of the latest block group indicated by the record number 1 is
LBlockAddr = LDataAddr + LBlockLen × (LStartBlock-1)
It is calculated from the following formula.
[0172]
In addition, the head address “LBBlockAddr” of the backup block group is
LBBlockAddr = LDataAddr + LBlockLen × {(LSStartBlock + LRRecNum−1) mod (LRRecNum + 1)}
It calculates using the value previously substituted in the equation (ST208).
[0173]
Here, it is confirmed whether the data area having the calculated “LBBlockAddr” as the head address is actually readable (ST209). If the data area cannot be read, the block having “LBBlockAddr” as the head address is checked. The contents of the group are copied to temporary file data (ST210). On the other hand, when the block group starting from “LBBlockAddr” can be read, the contents of this block group are copied to the temporary file data and the block group starting from “LBBlockAddr” (ST211).
[0174]
After replicating new data to the temporary file data through ST210 or ST211, the start address “LTRecData” of the record indicated by the record number “LRecNo” in the temporary file data is
LTRecData = LRecLen × (LRecNo-1)
(ST212).
[0175]
After that, “WriteData” is written from the “LTRecData” in the temporary file data to the record length “LRecLen” (ST213), and then the contents of the temporary file data are copied to a block group having “LBlockAddr” as the head address (ST214). ) A normal end response is transmitted to the information processing terminal γ (ST215), and the rewriting process is ended.
[0176]
Subsequently, FIG. 19 is a flowchart showing a rewrite procedure of the shared data file according to the present method example. As shown in the figure, in executing the process of rewriting the shared data file f3b in the above-described ST142, first, the steps from ST221 to ST229 are the same as the steps ST111 to ST119 shown in FIG. Is omitted.
[0177]
Using the value substituted in ST229, the head address “BlockAddr” of the latest block group is
BlockAddr = DataAddr + BlockLen × {(StartBlock + RRecNum−1) mod (RRecNum + 1)}
It is calculated from the following formula.
[0178]
Furthermore, the head address “BBlockAddr” of the backup block group is set to
BBlockAddr = DataAddr + BlockLen × {(StartBlock + RRecNum−1) mod (RRecNum + 1)}
(ST230). Here, it is confirmed whether or not a block group having “BlockAddr” obtained by calculation as a leading address can be read (ST231).
[0179]
If the block group starting from “BlockAddr” cannot be read in ST231, the block group starting from “BBlockAddr” is copied to temporary file data (ST232). The contents are copied to the temporary file data and the area having “BBlockAddr” as the head address (ST233).
[0180]
After copying to the temporary file data via ST232 or ST233, the start address “TRecData” of the record indicated by the record number “RecNo” in the temporary data file is
TRecData = RecLen × (RecNo−1)
(ST234).
[0181]
Subsequently, “WriteData” is written from the “TRecData” in the temporary file data to the record length “RecLen” (ST235), the contents of the temporary file data are copied to “BlockAddr” (ST236), and after the processing of ST236 is completed Then, a normal termination response is transmitted to the information processing terminal γ (ST237), and the rewriting process is terminated.
[0182]
Next, the procedure for appending data files f1, f2, f3a, and f3b according to the present method example will be described. The procedure for specifying a predetermined data file after receiving the append command is the same as the procedure shown in FIG. The description is omitted. In particular, the additional recording procedure for the general data files f1 and f2 is to follow the procedures shown in FIGS. Here, additional writing of the circulating data file f3a and the shared data file f3b will be described in order.
[0183]
FIG. 20 is a flowchart showing a procedure for adding a circular data file according to this method example. As shown in the figure, when executing the additional recording process of the circular data file f3b in the above-described ST140, first, it is confirmed whether or not the record number “RecNo” delivered as an argument is “01h” (ST241). ), If not “01h”, an abnormal response is transmitted as a record number error (ST242), and the additional writing process is terminated.
[0184]
On the other hand, if “RecNo” is “01h” in ST241, the following steps ST243 to ST247, that is, steps similar to ST81 to ST85 shown in FIG. 11 or ST181 to ST185 shown in FIG. Therefore, the description here is omitted.
[0185]
Subsequently, if “RecStart” is not “FFh” in ST247, first, the record length in the circular data file management information having “FileAddr” as the head address is “RecLen”, and the number of records is “RecNum”. (ST248).
[0186]
Next, the address “RecAddr” of the record to be added is
RecAddr = DataAddr + RecLen × {(RecStart + RecNum−2) mod RecNum}
(ST249), “WriteData” is written in an area from “RecAddr” to the length “RecLen” (ST250).
[0187]
After that, a new circulation start record number “RecNum ′” for newly updating
RecNum ′ = (RecStart + RecNum−2) mod RecNum−1
(ST251).
[0188]
Subsequently, the circulation start record number in the circulation data file management information starting from “FileAddr” is updated and rewritten to “RecNum ′” (ST252), and a response is sent to the information processing terminal γ as a normal end notification after completion of ST252. Then, the additional recording process is terminated.
[0189]
On the other hand, if “RecStart” is “FFh” in ST247, first, the 3rd to 4th bytes of the record starting with “DataAddr” are set to the directory ID of the directory to which the shared data file belongs, “LDirID”, The file ID of the shared data file is set as “LFileID” in the fifth byte and the sixth byte (ST254), and the process of adding the shared record from the circular data file is executed (ST255).
[0190]
FIG. 21 is a flowchart showing a procedure for adding a shared record from a circular data file according to this method example.
Subsequently, the procedure for adding a circular data file in ST255 will be described in detail. However, ST261 to ST269 shown in the figure are the same processing as ST201 to ST209 shown in FIG. 18, and the description thereof is omitted. However, when the generation numbers are compared in ST266, the head address of the shared data file management information with the smaller generation number is set to “LFileAddr ′”.
[0191]
After ST269, if the block group starting with “LBBlockAddr” cannot be read, the contents of the block group starting with “LBBlockAddr” are copied to the block group starting with “LBBlockAddr” and the temporary file data. On the other hand, if it can be read, the contents of the block group starting from “LBlockAddr” are copied to the temporary file data (ST271).
[0192]
After being copied to the temporary data file through ST270 or ST271, the head address “LTRecAddr” of the record indicated by the record number “LRRecNo” in the temporary file data is
LTRecAddr = LRecLen × (LRRecNo−1)
(ST272).
[0193]
Thereafter, “WriteData” is written in an area corresponding to the record length “LRecLen” with “LTRecAddr” calculated in ST272 in the temporary file data as the start address (ST273), and the contents of this temporary data file are changed from “LBBlockAddr”. In addition to copying to the starting block group (ST274), the shared data file management information starting from “LFFileAddr” is copied to the temporary shared data file management information (ST275).
[0194]
Subsequently, a new circulation start block number “LStartBlock ′” for newly updating
(LStartBlock + LRRecNum-1) mod (LRRecNum + 1)
This is calculated using the following formula.
[0195]
In addition, a new generation number “LHNum ′” is assigned to the existing generation number “LHNum” in the shared data file management information.
LHNum '= LHNum + 1
The cycle start block group number in the temporary shared data file management information is changed to “LStartBlock ′” and the generation number is changed to “LHNum ′” (ST277).
[0196]
Thereafter, the temporary shared data file management information is copied to a block group having “LFFileAddr ′” determined in ST266 as the head address (ST278), and after the processing up to ST278 is completed, the information processing terminal γ A response is transmitted as a notification of normal termination (ST279), and the shared record appending process in the circular data file is terminated.
[0197]
Next, FIG. 22 is a flowchart showing a procedure for appending a shared data file according to this method example. As shown in the figure, in executing the process of additionally writing the shared data file f3b in the above-described ST142, the procedure from ST281 to ST287 is the same as the procedure from ST221 to ST227 shown in FIG. Although the description thereof is omitted, when the generation numbers are compared in ST284, the head address of the shared data file management information with the smaller generation number is set to “LFileAddr ′”.
[0198]
When the logical product solution “Ans” is “00000000b” in ST287, a response is made to notify the information processing terminal γ of abnormal termination due to insufficient access right as in ST228 (ST288). On the other hand, if it is not “00000000b”, the circulation start block group number in the shared data file management information having “FileAddr” as the head address is “StartBlock”, the data address is “DataAddr”, the number of records is “RecNum”, The record length is “RecLen”, the block group length is “BlockLen”, the number of circular records is “RRecNum”, and the circular record number is “RRecNo” (ST289).
[0199]
Subsequently, it is checked whether or not “RecNo” indicating the target of additional recording previously passed as an argument is equal to the circular record number “RRecNo” (ST290). Is executed (ST291), and if they are equal, a circular record is additionally written (ST292). Here, the procedure of ST291 can be executed according to the procedure of ST230 to ST237 shown in FIG.
[0200]
FIG. 23 is a flowchart showing a procedure for adding a circular record of a shared data file. ST292 shown in FIG. 22 will be described with reference to FIG. As shown in the figure, first, the head address “BlockAddr” of the latest block group is set to
BlockAddr = DataAddr + BlockLen × (StartBlock-1)
It is calculated from the following formula.
[0201]
Furthermore, the head address “BBlockAddr” of the backup block group is set to
BBlockAddr = DataAddr + BlockLen × {(StartBlock + RRecNum−1) mod (RRecNum + 1)}
(ST301).
[0202]
Next, it is confirmed whether or not the block group having the calculated “BlockAddr” as the head address can be read (ST302). If the block group cannot be read, the contents of the block group having the “BBlockAddr” as the head address are changed to “BlockAddr”. Are copied to the block group starting with "and temporary file data" (ST303). On the other hand, if it can be read, the contents of the block group starting from “BlockAddr” are copied to the temporary file data (ST304).
[0203]
The head address “TRecAddr” of the record indicated by the record number “RRecNo” in the temporary file data duplicated in ST303 or ST304,
TRecAddr = RecLen × (RRecNo−1)
(ST305), “WriteData” is written in an area corresponding to the record length “RecLen” from “TRecAddr” (ST306).
[0204]
Further, after copying the contents of the temporary shared data file management information to a block group starting from “BBlockAddr” (ST307), the contents of the shared data file management information starting from “FileAddr” are copied to the temporary shared data file management information (ST308). ).
[0205]
Subsequently, a new circulation start block group number “StartBlock ′” to be newly updated is
StartBlock ′ = (StartBlock + RRecNum−1) mod (RRecNum + 1)
This is calculated using the following formula.
[0206]
In addition, a new generation number “LHNum ′” is added to the existing generation number “LHNum”.
LHNum '= LHNum + 1
(ST309), the circulation start block group number in the temporary shared data file management information is updated to “StartBlock ′”, and the generation number is updated to “LHNum ′” (ST310).
[0207]
Thereafter, the temporary shared data file management information is duplicated in a block group having “LFFileAddr ′” determined in ST284 as the top address (ST311), and after completing up to ST311, a response is sent as a normal end notification to the information processing terminal γ. (ST312), and the appending process is terminated.
[0208]
As described above, the embodiments of the present invention have been described with reference to apparatus examples and method examples, but the present invention is not necessarily limited only to the above-described means and methods, and within the scope of the effects described below. Changes can be made as appropriate.
[0209]
【The invention's effect】
As described above in detail, according to the present invention, in an IC card equipped with a general non-volatile memory such as EEPROM, by reading and writing data dispersed in a plurality of files as one shared data file, The processing time can be greatly shortened, and data can be distributed and managed in multiple files according to the read / write frequency of data stored in the card and the data length without extending the processing time. .
[0210]
In addition, services of multiple operators can be provided on a single IC card, such as a ticket for a transportation system in which multiple operators are sharing on an IC card, or a private sector sharing an ID card issued by a public institution. Even in the case of loading, the processing time can be shortened by using the common data as a shared data file.
[0211]
In addition, when power is lost while writing data to a non-contact IC card, when the required write guarantee function is realized for the shared data file, it can be used as a ticket for transportation, etc. Even when the power supply is unstable, such as when an IC card is passed over a reader / writer, data can be rewritten with peace of mind.
[0212]
In addition, data files other than the shared data file can be compatible with an IC card conforming to the international standard ISO / IEC7816. For example, a program based on the present invention is added to the nonvolatile memory of the IC card. Thus, it becomes possible to expand the conventional function.
[Brief description of the drawings]
FIG. 1 is a functional configuration diagram of an IC card according to an apparatus example of the present invention, and a functional configuration diagram of a reader / writer and an information processing terminal for operating the IC card.
FIG. 2 is a diagram showing a data file structure adopted in the EEPROM shown in FIG. 1;
FIG. 3 is a diagram showing a logical configuration of directory and data file management information in the EEPROM.
FIG. 4 is a diagram showing the physical configuration of the EEPROM.
FIG. 5 is a diagram showing a logical configuration of a channel, temporary shared data file management information, and temporary file data in the RAM.
FIG. 6 is a flowchart showing a directory selection procedure according to an example method of the present invention.
FIG. 7 is a flowchart showing a key collating procedure.
FIG. 8 is a flowchart showing a procedure for reading a data file.
FIG. 9 is a flowchart showing a procedure for reading a general data file.
FIG. 10 is a flowchart showing a procedure for reading a shared record from a general data file.
FIG. 11 is a flowchart showing a procedure for reading a circular data file.
FIG. 12 is a flowchart showing a procedure for reading a shared record from a circular data file.
FIG. 13 is a flowchart showing a shared data file read procedure;
FIG. 14 is a flowchart showing a procedure for adding / rewriting a data file.
FIG. 15 is a flowchart showing a general data file additional recording / rewriting procedure.
FIG. 16 is a flowchart showing a procedure for appending and rewriting a shared record from a general data file.
FIG. 17 is a flowchart showing the rewrite procedure of the circulating data file.
FIG. 18 is a flowchart showing a shared record rewrite procedure from a circular data file.
FIG. 19 is a flowchart showing a shared data file rewrite procedure.
FIG. 20 is a flowchart showing a procedure for adding a circular data file to the above.
FIG. 21 is a flowchart showing a procedure for adding a shared record from a circular data file.
FIG. 22 is a flowchart showing a procedure for appending a shared data file to the above.
FIG. 23 is a flowchart showing a procedure for adding a circular record of a shared data file to the above.
[Explanation of symbols]
α ... IC card
β… Reader / Writer
γ ... Information processing terminal
1 ... IC chip
2 ... Antenna
11 ... CPU
12 ... ROM
13 ... RAM
14… EEPROM
15 ... RF section
d0 ... directory (root directory)
d1, d2, d3 ... directory
f1, f2 ... General data file
f3a ... Circular data file
f3b ... Shared data file
k1, k2, k3 ... key file

Claims (10)

複数バイトを書き換え単位とする不揮発性を有したメモリを内蔵するICカードに適用されて、それぞれ識別可能なファイル識別子が付与されたデータファイルが保持しかつ、前記メモリに複数同一の長さで配置されそれぞれレコード番号により識別可能なレコードを参照する場合に、前記データファイルの保持する前記レコードから共有データファイルが備える共有レコードを参照するメモリ管理方法であって、
前記ICカードにおいて、
前記ファイル識別子と、前記レコード番号と、を引数とした読み出し、書き換え又は追記の実行命令を受信し、
前記データファイルが保持する前記レコード番号により識別された1以上の前記レコードと、同一のレコード長を持つ前記共有データファイルの共有レコードを参照して、
参照された当該共有レコードに記録されたデータに対して、前記実行命令に対応した読み出し、書き換え又は追記の実行を可能に当該データファイルの管理を行う、
ことを特徴とするICカードにおけるメモリ管理方法。
Applied to an IC card containing a non-volatile memory with multiple bytes as a rewrite unit, each of which holds a data file with an identifiable file identifier and is arranged in the memory with the same length And a memory management method for referring to a shared record included in a shared data file from the record held by the data file when referring to a record that can be identified by a record number,
In the IC card,
Receiving a read, rewrite or append execution command with the file identifier and the record number as arguments,
With reference to the shared record of the shared data file having the same record length as the one or more records identified by the record number held by the data file,
The data file is managed so that the data recorded in the referenced shared record can be read, rewritten or additionally written corresponding to the execution instruction.
A memory management method in an IC card.
前記共有データファイルの共有レコードの参照は、
前記データファイルにおいて、保持する前記レコード毎に、前記共有レコードを参照先として設定されたレコード共有状態を示すレコード識別子を随時更新可能に格納する参照管理情報を保持しておき、
当該レコード識別子から、当該レコードが当該共有レコードを参照先とするレコード共有状態に設定された場合に、
当該レコードのデータとして、該当する当該共有レコードを参照する、
ことを特徴とする請求項1に記載のICカードにおけるメモリ管理方法。
The reference to the shared record of the shared data file is
In the data file, for each record to be held, reference management information for storing a record identifier indicating a record sharing state set with the shared record as a reference destination is updated as needed,
From the record identifier, when the record is set to a record sharing state with the shared record as a reference destination,
Refer to the corresponding shared record as the data of the record,
The memory management method for an IC card according to claim 1.
前記読み出し、書き換え又は追記の実行は、
前記参照管理情報中に、合わせて前記レコードの当該参照先として設定された前記共有データファイルの前記ファイル識別子と、当該参照先の前記共有レコードの前記レコード番号とを格納しておき、
前記共有レコード状態を示した前記レコードの当該参照管理情報が読み出されたときに、当該ファイル識別子と、当該レコード番号から特定される当該共有データファイルの当該共有レコードに対して前記実行命令に対応した読み出し、書き換え又は追記を実行する、ことを特徴とする請求項2に記載のICカードにおけるメモリ管理方法。
The execution of the reading, rewriting or appending is as follows:
In the reference management information, the file identifier of the shared data file set as the reference destination of the record and the record number of the shared record of the reference destination are stored in advance.
When the reference management information of the record indicating the shared record state is read, the execution instruction is supported for the shared record of the shared data file identified from the file identifier and the record number The memory management method for an IC card according to claim 2, wherein the read, rewrite, or additional writing is performed.
前記読み出し、書き換え又は追記の実行は、
前記参照管理情報中に、合わせて前記レコードへアクセス権を管理するアクセス権情報を保持しておき、
前記共有レコード状態を示した前記レコードへの当該参照管理情報が読み出されたときに、
先に受信した前記実行命令に対して、前記アクセス権情報を基に、当該レコードへのアクセス権を確認して、
当該アクセス権を満たす場合にのみ、当該レコードに対する当該実行命令に対応した読み出し、書き換え又は追記を実行する、
ことを特徴とする請求項2又は3に記載のICカードにおけるメモリ管理方法。
The execution of the reading, rewriting or appending is as follows:
In the reference management information, holding access right information for managing the access right to the record together,
When the reference management information to the record indicating the shared record state is read,
For the execution instruction received earlier, based on the access right information, confirm the access right to the record,
Only when the access right is satisfied, read, rewrite or append corresponding to the execution instruction for the record is executed.
4. The memory management method for an IC card according to claim 2, wherein the memory management method is used.
前記レコードの参照は、
予め、前記複数のデータファイルを、前記ICカード内において唯一のディレクトリ識別子が付与されたディレクトリに属するツリー構造として格納しておくとともに、前記実行命令の対象として選択指定された当該データファイルの属する当該ディレクトリの当該ディレクトリ識別子を、チャネル番号により識別可能なチャネル管理情報として随時更新可能に保持しておき、
前記チャネル番号と前記ファイル識別子と前記レコード番号を受信したときに、当該チャネル番号により特定される当該チャネル管理情報から、前記ディレクトリ識別子を読み出し、
当該ディレクトリ識別子から特定される前記ディレクトリに属する前記データファイルを、前記ファイル識別子から特定し、
当該データファイルから、前記レコード番号により特定される前記レコードを参照する、ことを特徴とする請求項1、2、3又は4に記載のICカードにおけるメモリ管理方法。
The record reference is
The plurality of data files are stored in advance as a tree structure belonging to a directory to which a unique directory identifier is assigned in the IC card, and the data file to which the data file selected and designated as the target of the execution instruction belongs The directory identifier of the directory is held so that it can be updated at any time as channel management information that can be identified by the channel number,
When the channel number, the file identifier, and the record number are received, the directory identifier is read from the channel management information specified by the channel number,
Identifying the data file belonging to the directory identified from the directory identifier from the file identifier;
5. The memory management method for an IC card according to claim 1, wherein the record specified by the record number is referred to from the data file.
複数バイトを書き換え単位とする不揮発性を有したメモリを内蔵するICカードであって、
複数同一の長さで配置されそれぞれレコード番号により識別可能なレコードからなり、それぞれ識別可能なファイル識別子が付与されたデータファイルを格納保持する前記メモリと、
当該データファイル内の前記レコードと同一のレコード長を有する共有データファイル内の共有レコードを当該データファイルのデータとして参照するデータファイル参照手段と、
前記ファイル識別子と前記レコード番号とから、当該データファイル参照手段により特定された前記データに対して読み出し、書き換え又は追記の実行命令を受信して、当該実行命令に従い対応する読み出し、書き換え又は追記の当該実行命令を行う実行命令処理手段と、を具備する、
ことを特徴とするICカード
An IC card containing a non-volatile memory having multiple bytes as a rewrite unit,
A plurality of memories arranged and stored in the same length, each of which includes a record that can be identified by a record number, each storing a data file with an identifiable file identifier;
Data file reference means for referencing a shared record in a shared data file having the same record length as the record in the data file as data of the data file;
From the file identifier and the record number, an execution instruction for reading, rewriting or appending to the data specified by the data file reference means is received, and the corresponding reading, rewriting or appending corresponding to the execution instruction is received An execution command processing means for executing an execution command;
IC card characterized by that .
前記データファイルは、
保持する前記レコード毎に、前記データファイル参照手段により前記共有レコードを参照先として設定されたレコード共有状態を示すとともに、随時更新可能なレコード識別子を格納する参照管理情報を具備する、
ことを特徴とする請求項に記載のICカード。
The data file is
For each of the records to be held, the data file reference means indicates a record sharing state set with the shared record as a reference destination, and includes reference management information for storing a record identifier that can be updated at any time.
The IC card according to claim 6 .
前記参照管理情報は、
前記参照先の前記共有データファイルの前記ファイル識別子と、当該参照先の前記共有レコードのレコード番号とを含む、
ことを特徴とする請求項に記載のICカード。
The reference management information is
Including the file identifier of the shared data file of the reference destination and the record number of the shared record of the reference destination;
The IC card according to claim 7 .
前記参照管理情報は、
前記レコードに対するアクセスの許否を確認可能に格納されたアクセス権情報を含む、
ことを特徴とする請求項7又は8に記載のICカード。
The reference management information is
Including access right information stored so as to be able to confirm whether or not to allow access to the record,
The IC card according to claim 7 or 8 , wherein
前記メモリは、
前記データファイルを、前記ICカード内において唯一のディレクトリ識別子が付与されたディレクトリに属するツリー構造として保持管理して、
前記ディレクトリ識別子と識別可能に付与されたチャネル番号とを、新規に同一の当該チャネル番号とともに他の前記ディレクトリ識別子を受信して更新されるまで継続保持して、前記データファイルが属する前記ディレクトリの選択状況を示すチャネル管理情報を保有する、
メモリ管理手段を具備する、
ことを特徴とする請求項6、7、8又は9に記載のICカード。
The memory is
Holding and managing the data file as a tree structure belonging to a directory with a unique directory identifier in the IC card;
Selection of the directory to which the data file belongs by continuously holding the directory identifier and an identifiable channel number until the other directory identifier is newly received and updated together with the same channel number. Holds channel management information indicating the situation,
Comprising memory management means;
The IC card according to claim 6, 7, 8, or 9 .
JP2003104978A 2003-04-09 2003-04-09 Memory management method for IC card and IC card Expired - Lifetime JP4245959B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2003104978A JP4245959B2 (en) 2003-04-09 2003-04-09 Memory management method for IC card and IC card

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2003104978A JP4245959B2 (en) 2003-04-09 2003-04-09 Memory management method for IC card and IC card

Publications (2)

Publication Number Publication Date
JP2004310573A JP2004310573A (en) 2004-11-04
JP4245959B2 true JP4245959B2 (en) 2009-04-02

Family

ID=33467618

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2003104978A Expired - Lifetime JP4245959B2 (en) 2003-04-09 2003-04-09 Memory management method for IC card and IC card

Country Status (1)

Country Link
JP (1) JP4245959B2 (en)

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101272642B1 (en) * 2005-08-03 2013-06-10 쌘디스크 코포레이션 Reclaiming data storage capacity in flash memory systems
US7949845B2 (en) 2005-08-03 2011-05-24 Sandisk Corporation Indexing of file data in reprogrammable non-volatile memories that directly store data files
US7669003B2 (en) 2005-08-03 2010-02-23 Sandisk Corporation Reprogrammable non-volatile memory systems with indexing of directly stored data files
US7984084B2 (en) * 2005-08-03 2011-07-19 SanDisk Technologies, Inc. Non-volatile memory with scheduled reclaim operations
US7480766B2 (en) * 2005-08-03 2009-01-20 Sandisk Corporation Interfacing systems operating through a logical address space and on a direct data file basis
ATE493707T1 (en) * 2005-08-03 2011-01-15 Sandisk Corp NON-VOLATILE MEMORY WITH BLOCK MANAGEMENT
US7814262B2 (en) 2005-10-13 2010-10-12 Sandisk Corporation Memory system storing transformed units of data in fixed sized storage blocks
JP5329884B2 (en) * 2008-09-18 2013-10-30 株式会社東芝 Portable electronic device and data processing method in portable electronic device
JP2011048437A (en) * 2009-08-25 2011-03-10 Alpine Electronics Inc Character string retrieval system, data structure of character string database and navigation device

Also Published As

Publication number Publication date
JP2004310573A (en) 2004-11-04

Similar Documents

Publication Publication Date Title
JP2537199B2 (en) IC card
JP4322021B2 (en) Memory card
US7127570B2 (en) Proximity communication system, proximity communication method, data managing apparatus and data management method, storage medium, and computer program
US6480935B1 (en) Smart card memory management system and method
US7653796B2 (en) Information recording medium and region management method for a plurality of recording regions each managed by independent file system
KR970004106B1 (en) Ic card
KR100948120B1 (en) Portable information recording medium
US5608902A (en) File management system for memory card
US6687800B1 (en) Chip card comprising means and method for managing a virtual memory and associated communication method
JP4245959B2 (en) Memory management method for IC card and IC card
KR20140108666A (en) Writing data in a non-volatile memory of a smart card
JPH1125003A (en) Method and device for information processing
US5929428A (en) File managing method requiring a change in key data and IC card device using the method
CN101807262B (en) Apparatus and method for data processing
EP1450235B1 (en) Memory device
US20050216684A1 (en) Information recording medium, data processing apparatus, and recording region setting method of information recording medium
US20040076033A1 (en) Access apparatus, data processing system, computer program product and computer data signal
JPH1139450A (en) Ic card
JPH10105472A (en) Method for managing access of memory
KR100977640B1 (en) Method for modification of data on a memory card on a transaction
JP2004185242A (en) Ic card communication system switching method and ic card
JP7468765B1 (en) ELECTRONIC INFORMATION STORAGE MEDIUM, IC CHIP, IC CARD, ALL-IN-ONE DATA UPDATE METHOD, AND PROGRAM
JP7438432B1 (en) Electronic information storage medium, IC chip, IC card, record writing method, and program
EP0949594A2 (en) Access management method and apparatus, and portable electronic device used therefor
JP7043886B2 (en) Information processing method and OS using electronic information storage medium, IC card, electronic information storage medium

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20050719

RD01 Notification of change of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7426

Effective date: 20070626

RD02 Notification of acceptance of power of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7422

Effective date: 20070807

RD02 Notification of acceptance of power of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7422

Effective date: 20071109

RD05 Notification of revocation of power of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7425

Effective date: 20080418

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20081028

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20081209

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

A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20090107

R150 Certificate of patent or registration of utility model

Ref document number: 4245959

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

Free format text: JAPANESE INTERMEDIATE CODE: R150

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20120116

Year of fee payment: 3

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20130116

Year of fee payment: 4

S531 Written request for registration of change of domicile

Free format text: JAPANESE INTERMEDIATE CODE: R313531

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350

EXPY Cancellation because of completion of term