JP3607229B2 - Portable electronic device and method for checking the same - Google Patents

Portable electronic device and method for checking the same Download PDF

Info

Publication number
JP3607229B2
JP3607229B2 JP2001299146A JP2001299146A JP3607229B2 JP 3607229 B2 JP3607229 B2 JP 3607229B2 JP 2001299146 A JP2001299146 A JP 2001299146A JP 2001299146 A JP2001299146 A JP 2001299146A JP 3607229 B2 JP3607229 B2 JP 3607229B2
Authority
JP
Japan
Prior art keywords
validity
data
information
confirmation
card
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 - Fee Related
Application number
JP2001299146A
Other languages
Japanese (ja)
Other versions
JP2003108445A (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.)
Toshiba Corp
Original Assignee
Toshiba Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Toshiba Corp filed Critical Toshiba Corp
Priority to JP2001299146A priority Critical patent/JP3607229B2/en
Publication of JP2003108445A publication Critical patent/JP2003108445A/en
Application granted granted Critical
Publication of JP3607229B2 publication Critical patent/JP3607229B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Description

【0001】
【発明の属する技術分野】
本発明は、たとえば書込み/書換え可能な不揮発性メモリおよびCPUなどの制御素子を有するIC(集積回路)チップを内蔵し、外部から供給される命令データに基づいて各種処理を実行するICカード等の携帯可能電子装置及びそのチェック方法に関する。
【0002】
【従来の技術】
近年、携帯可能な電子装置として、書換え可能な不揮発性のデータメモリとそれを制御するためのCPU(セントラル・プロセッシング・ユニット)を有し、外部からのデータの入出力を行う手段を備えたICチップを内蔵した、いわゆるICカードが産業各方面で開発されている。
【0003】
産業各方面へのICカードの進出に伴って、ICカードの出荷形態も種々多様化してきている。例えば、発行前のICカードを提供する場合には提供先で発行するケースや、発行済みICカードを提供する場合には提供先にて個人情報等を書き込むケースが発生してきている。上述するケースの場合、提供先にて提供されたICカードが正常であるか(不良品はないか)をチェックする必要がある。
【0004】
このようなチェック方法として、例えば、特開平4−15778号公報には、カードに書きこむ前のカードデータに基づいて算出したチェックコードと、カードから読取ったカードデータに基づいて算出したチェックコードとを比較することで、書き込みデータ自体が誤っていることによる誤記録をチェックすることが記載されている。
【0005】
【発明が解決しようとする課題】
しかしながら、上述したような従来技術の場合では、外部装置(カードデータチェック装置)においてカードに記録されているデータをチェックするため、チェックコードの比較結果が不一致であった場合に、外部装置への読出し時に生じたエラーが原因となる恐れもある。更には、誤記録以前に、カードの記録部自体に不良がある可能性もあった。従って、チェックコードが不一致だった真の理由がわからず、カードが出荷され種々の処理が行われていく工程のどの段階で不良となったのか見極める事が困難であった。
【0006】
本発明は、以上の点に鑑みなされたもので、不良品を確実に検出することができる携帯可能電子装置及びそのチェック方法を提供することを目的とする。
【0007】
【課題を解決するための手段】
上記目的を達成するために、本発明の携帯可能電子装置は、外部から受信した命令データに基づいて動作する携帯可能電子装置において、
複数のデータを格納し、この各データの全体あるいは一部に基づいて算出された前記データの正当性を確認するための第1の情報を前記各データに対応させて格納する書換え可能な不揮発性メモリと、
外部から前記不揮発性メモリの正当性の確認を指示する命令データを受信した時、
前記不揮発性メモリに格納されている各データの全体あるいは一部に基づいて前記データの正当性を確認するための第2の情報をデータ毎に算出する算出手段と、
この算出手段によって算出された第2の情報と、前記不揮発性メモリに格納された第1の情報とを比較し、全てのデータにて第1の情報と第2の情報とが一致している場合に、前記データは正当であると確認する正当性確認手段と、
この正当性確認手段にて正当性確認が行われたことを示す確認情報を前記不揮発性メモリに書込む書込み手段と、
外部から前記不揮発性メモリの正当性の確認を指示する命令データ以外の命令データを受信した時、
前記正当性確認が行われたことを示す確認情報に基づいて、正当性の確認が行われたか否かを判定する判定手段と、
この判定手段によって正当性の確認が行われたと判定された場合に、以後の正当性確認を禁止する禁止手段と、を具備することを特徴とする。
また、上記目的を達成するために、本発明の携帯可能電子装置のチェック方法は、複数のデータを格納する書き換え可能な不揮発性メモリを有し、外部から受信した命令データに基づいて動作する携帯可能電子装置のチェック方法において、
外部から前記不揮発性メモリの正当性の確認を指示する命令データを受信し、
前記不揮発性メモリに格納されている各データの少なくとも一部に基づいて前記データの正当性を確認するための確認情報をデータ毎に算出し、
この確認情報と、前記不揮発性メモリに予め格納された各データの正当性を示す正当性管理情報とを対応するデータ毎に比較し、
比較した結果、前記確認情報と、前記正当性管理情報とが一致している場合に、前記データは正当であると確認し、
正当性確認が行われたことを示すチェック情報を前記不揮発性メモリに書込みし、
外部から前記不揮発性メモリの正当性の確認を指示する命令データ以外の命令データを受信し、
正当性確認が行われたことを示すチェック情報に基づいて、正当性の確認が行われたか否かを判定し、
正当性の確認が行われたと判定された場合に、以後の正当性確認を禁止する。
【0008】
【発明の実施の形態】
以下、本発明に係る実施の形態について図面を参照して詳細に説明する。図2は、本発明に係る携帯可能電子装置としてのICカード1(接触式あるいは無線式ともに含む)及びリーダライタ4(接触式あるいは無線式ともに含む)を用いたシステム構成を説明するための図である。
【0009】
図2に示すように、ICカード1を用いたシステムは、図示せぬ内部メモリを有する上位装置としてのホストコンピュータ3と、このホストコンピュータ3と接続している端末装置としてのリーダライタ4と、ディスプレイ装置5と、キーボード6と、プリンタ7とを有している。
【0010】
リーダライタ4は内部メモリを有し、ICカード1に対する電文の読み取り、書き込み(送受信)を接触あるいは非接触で行うものである。ディスプレイ装置5は、操作手順や作動状態をオペレータに知らせるものである。キーボード6は、オペレータによって操作入力されるものである。プリンタ7は、オペレータの操作指示に従って、指示された情報を印刷するものである。
【0011】
また、接触式ICカードを用いる場合には、リーダライタ4に接触式ICカードを挿入するためのICカード挿入部(図示せず)が設けられ、無線式ICカードを用いる場合には、リーダライタ4と無線式ICカードとの間を通信するための通信部(図示せず)が設けられる。
【0012】
図3は、図2のシステムを構成するICカード1の機能ブロックを概略的に示す図である。図3に示すように、ICカード1は、リード/ライト部(R/W部)11と、暗証設定/暗証照合部12と、暗号化/復号化部13などの基本機能を実行する部分と、これらの基本機能を管理するスーパーバイザ14とで構成されている。
【0013】
R/W部11は、データメモリ等に対してデータの読み出し、書き込み、あるいは消去を行う機能を有する。暗証設定/暗証照合部12は、ユーザが設定した暗証番号の記憶及び読み出し禁止処理を行うと共に、暗証番号の設定後にその暗証番号と外部装置から入力した暗証番号との照合を行い、以後の処理の許可を与える機能を有する。
【0014】
暗号化/復号化部13は、例えば、通信回線を介してあるいは無線通信によりリーダライタ4とICカード1との間でデータの送受信を行う場合の通信データの漏洩、偽造を防止するための暗号化や、復号化行う機能を有する。
【0015】
また、暗号化/復号化部13は、送信データに対して暗号化を施し、また暗号化されたデータを復号化する機能も有する。スーパーバイザ14は、リーダライタ4から入力された命令コード、もしくはデータの付加された命令コードを解読し、この命令を実行する機能を有する。この暗号化/復号化部13により、本発明の復号手段を構成している。
【0016】
図4は、ICカード1の概略的な制御ブロック図を示している。図4に示すように、無線式及び接触式ICカードともに、少なくとも1つ以上のアプリケーションが登録可能であり、図4に示すような諸機能を実行するために、制御手段としてのCPU等の制御素子15と、各種記憶部としてのデータメモリ16、プログラムメモリ18、ワーキングメモリ17、リーダライタ4と信号の授受を行なう受信手段、出力手段としての通信部19とから構成されている。登録されているアプリケーションとしては、例えばクレジットやポイントシステム等が挙げられる。
【0017】
通信部19は、無線式ICカード1の場合にはアンテナ部として構成され、リーダライタ4から送信された変調波を非接触で受信したり外部へ変調波を発信するようになっている。また、このアンテナ部19で受信した変調波から内部回路に供給するための電源やクロックを生成するようになっている。
【0018】
また、接触式ICカード1の場合にはコンタクト部として構成され、リーダライタ4に設けられた図示せぬICカード端子部と接触することにより電源やクロックを得るようになっている。
【0019】
これらの構成のうち、制御素子15、データメモリ16、プログラムメモリ18、及びワーキングメモリ17は1つのICチップ(あるいは複数のICチップ)20で構成されてICカード本体内に埋設されている。制御素子15は、各種の判定処理/判断処理及びメモリへの書込みや読出し等のデータ処理を行う制御部である。
【0020】
プログラムメモリ18は、例えばマスクROM(Read Only Memory)等の書き換え不可能な固定メモリで構成されており、上述するような各基本機能を実現するサブルーチンを備えた制御素子15の制御プログラム等を記憶している。
【0021】
データメモリ16は、アプリケーションデータ等の各種データの記憶に使用され、例えばEEPROM(Electrically Erasable and Programable ROM)や強誘電体不揮発性メモリ(FeRAM)などの消去(書き換え)可能な不揮発性メモリで構成されている。
【0022】
ワーキングメモリ17は、制御素子15が処理を行なう際の処理データを一時的に保持するための作業用のメモリであり、例えばSRAM(Static Random Access Memory)等の揮発性メモリで構成されている。
【0023】
図5は、データメモリ16の構成を示す概念図である。データメモリ16は、図5に示すように、システム領域110とユーザ領域120とに大きく分割定義されている。特にシステム領域110は、例えばICカード1内の内部制御を行うために直接関連するデータを格納する領域である。
【0024】
従って、システム領域110には、データメモリ16全体の管理等に使用するデータを含むカード管理情報111と、複数のデータファイル(以下DFと称する。)を管理するためのDF定義情報112、とEF(エレメンタリファイル)のアドレスを管理するためのEFアドレステーブル113とから構成されており、データメモリ16の先頭から順次格納されている。
【0025】
ユーザ領域120には、DF定義情報112、EFアドレステーブル113に関連付けられ、実際に各種データを格納する複数のEFデータ列122が、データメモリ16の最後尾から順次配置されて、設定されている。従って、システム領域110の各種格納情報111、112、113と、EFデータ列122に挟まれた部分は、データメモリ16の空き領域121として存在する。
【0026】
この空き領域120は、システム領域110の各種格納情報111、112、113及びEFデータ列122のいずれにも属していない領域で、EFデータ列122の追加が発生した場合に使用される領域である。
【0027】
また、ICカードの製造元(あるいは発行元)がICカード1を出荷する際に、ユーザ領域120における全体あるいはその使用している部分(EFデータ列122部分)のメモリが正常な状態であることを示す正当性管理情報を、ICカード1に対して(実施例毎に後述する)予め決められた箇所に格納するようになっている。
【0028】
その結果、ICカードが提供された提供先においては、ユーザ領域120における全体あるいはその使用している部分(EFデータ列122部分)を用いて正当性管理情報を算出し、ICカード1に予め格納されている正当性管理情報と比較する事によって、提供されたICカード1が不良品でないことを確認できるようになっている。
【0029】
また、図6に示すように、本実施の形態では、システム領域110のカード管理情報111には、チェック完了フラグ140と、正当性チェック禁止フラグ150が設けられている。
【0030】
チェック完了フラグ140は、ユーザ領域120における全体あるいはその使用している部分(EFデータ列122部分)のメモリが正常であるか(不良品がないか)を判定すべく、後述する正当性チェックを実施したか否かを示すフラグである。
【0031】
このチェック完了フラグ140は、後述するように正当性管理情報がセットされた場合には、正当性チェックが未完了であることを示す「0」が格納されており、ICカード1における正当性チェックが正常に終了すると、正当性チェックが正常に完了したことを示す「1」が格納されるようになっている。
【0032】
また、正当性チェック禁止フラグ150は、ICカード1における正当性チェックの機能を実行できるか否かを示すフラグであり、「0」が格納されている場合には正当性チェックの機能を実施可能な状態を示し、「1」が格納されている場合には正当性チェックの機能の実施が禁止されている状態を示す。
【0033】
尚、この正当性チェック禁止フラグ150は、ICカード1が複数のアプリケーションを有し、複数のアプリケーションに対応する複数のDFを保持している場合には、アプリケーション毎に設けられるものである。その結果、ICカード1においては、アプリケーション(DF)毎に正当性チェックの機能の実施を禁止することが可能となる。
【0034】
本実施の形態では、正当性管理情報が設定されたICカード1への最初のアクセス時に、まず正当性チェックを指示するコマンドを実行しないと(即ち、ICカード1に対して他の処理を先に指示してしまうと)、正当性チェック機能の実行を禁止するようになっている。
【0035】
従って、正当性管理情報がセットされた際には、正当性チェック機能が実行可能であるため、正当性チェック禁止フラグ150、チェック完了フラグ140は共に「0」を格納している。
【0036】
図1のフローチャートに示すように、まず、ICカードの製造あるいは発行元において、ICカード1のユーザ領域120の全体あるいはその使用している部分(EFデータ列122部分)のメモリについて、後述する種々の方法により、正当性管理情報を計算により算出し、予め決められたメモリ部分に格納する(ST100)。そして、提供先に対して正当性管理情報がセットされたICカード1を提供する。
【0037】
次に、ICカード1の提供先において、ST100で正当性管理情報がセットされたICカード1に対して、電源、クロック信号、及びリセット信号を供給する。そして、ICカード1の制御素子15がリセット信号を検出すると(ST101)、リセットに対応した初期応答信号(Answer to Reset:ATR)を外部へ出力する(ST102)。
【0038】
次に、外部よりコマンドを受信すると(ST103)、受信したコマンドの内容を解析し、正当性チェックコマンドであるか判定する(ST104)。ST104の判定の結果、正当性チェックコマンドを受信したと判定された場合、正当性チェック禁止フラグ150及びチェック完了フラグ140を参照し、共に「0」を格納しているか確認する(ST105)。
【0039】
ST105の確認の結果、正当性チェック禁止フラグ150が「1」を格納し、正当性チェック機能の実行が禁止されている場合には、実行不可能であることを示すステータスコードを設定したエラーレスポンスを出力し、一連の処理を中断する(ST110)。
【0040】
ST105の確認の結果、チェック完了フラグ140が「1」を格納し、正当性チェックが既に正常に終了している場合には、既にチェック完了していることを示すステータスコードを設定したエラーレスポンスを出力し、一連の処理を中断する(ST110)。
【0041】
ST105の確認の結果、正当性チェック禁止フラグ105、チェック完了フラグ140が共に「0」を格納し、正当性チェック未完了でかつチェック機能が実行可能である場合には、制御素子15は、ユーザ領域120における全体あるいはその使用している部分(EFデータ列122部分)を用いて正当性管理情報を算出し、ICカード1に予め格納されている正当性管理情報と比較する(ST106)。
【0042】
ST106の比較の結果、正当性管理情報が一致しなかった場合には、制御素子15は、不一致を示すステータスコードを設定したエラーレスポンスを外部へ出力する(ST110)。また、ST106の比較の結果、正当性管理情報が一致した場合には、チェック完了フラグ140を「0」から「1」に変更し、正常終了を示すステータスコード「9000」を設定した正常レスポンスを外部へ出力する(ST109)。
【0043】
次に、ST104の判定の結果、正当性チェックコマンドではないコマンドを受信した場合には、図7のフローチャートへと進み、制御素子15は、チェック完了フラグ140を参照し、正当性チェックが既に正常終了しているかを判定する(ST111)。
【0044】
ST111の判定の結果、チェック完了フラグ140が「1」を格納し、正当性チェックが正常に終了していると判定された場合には、受信したコマンドの指示に従って処理を実行し、処理結果をレスポンス出力する(ST112)。
【0045】
ST111の判定の結果、チェック完了フラグ140が「0」を格納し、正当性チェックが未だ実行されていない状態であると判定された場合には、正当性チェック禁止フラグ150を「0」から「1」に変更する(ST113)。そして、受信したコマンドの指示に従って処理を実行し、処理結果をレスポンス出力するようになっている(ST114)。
【0046】
従って、実施の形態では、提供先における正当性管理情報が設定されたICカード1への最初のアクセス時に、正当性チェック機能を実行し、提供されたICカードが不良品でないかを確認するようになっている。逆に、正当性チェック以外のコマンド処理を指示した場合に、正当性チェック機能の実行を禁止するようになっている。
【0047】
このため、提供されたICカードが正常でなかったのか、提供先にて異なる処理が施されたため不良が生じたのかを認識することができるようになる。
【0048】
(正当性チェック機能に関する第1の実施例)
次に、図8乃至図10を用いて、上述するICカード1におけるメモリの正当性チェック機能に関する第1の実施例について説明する。この第1の実施例においては、上述したユーザ領域120の正当性管理情報を、ユーザ領域に生成されたEFデータ毎に計算し、付与するようになっている。
【0049】
図8は、データメモリ16のEFデータ列122の構成を示す図である。夫々のEFデータ列122は、図8に示すように、EFデータ列長さ管理情報126、EF定義情報127、EFデータ128、及び後述するEF正当性管理情報129とから少なくとも構成されている。
【0050】
EFデータ列長さ管理情報126は、1バイトで構成され、EFデータ列長さ管理情報126の先頭から、EF定義情報127、EFデータ128、EF正当性管理情報129の終わり迄の長さ情報を格納している。EF定義情報127は、ファイル構成を識別する識別情報やアクセスに必要な認証キー等が格納されている。EFデータ128は、実際にデータを格納する部分である。
【0051】
EF正当性管理情報129は、当該EFのデータが正当であることを確認するためのフラグで、例えば、EFデータ列長さ管理情報126、EF定義情報127、EFデータ128全ての値(バイト)の加算を取り、桁上がりした値は無視した1バイトの値からなる。
【0052】
即ち、「FEh」と「02h」(hは16進数を示す)とからなる2つのバイトを加算した場合、「101h」となるが、桁上がりは無視するため、「01h」を加算結果として、更に次のバイトを加算していくこととなる。
【0053】
そして、EF正当性管理情報129は、データメモリ16のユーザ領域120にEFデータ列122が作成される際に、EFデータ列長さ管理情報126、EF定義情報127、EFデータ128の値に基づいて算出され、EFデータ列122の最後尾に続けて格納されるようになっている。
【0054】
図9(a)は、リーダライタ4からICカード1に対して供給される命令データの構成について説明する図である。本実施の形態で用いるコマンドとして、後述する正当性チェックコマンドが存在する。正当性チェックコマンドは、ICカードの製造元(あるいは発行元)からICカード1の提供を受けた後に、ICカード1が正常であるか(不良品でないか)をチェックするよう指示するコマンドである。
【0055】
この正当性チェックコマンドは、図9(a)に示すように、コマンドの分類(CLA:class)や命令(INS:instruction)からなるコマンドコード部と、パラメータデータP1、P2を有する。
【0056】
また、図9(b)は、図9(a)に示すコマンドを実行後、ICカード1がリーダライタ4へ出力するレスポンスデータの構成を示しており、ステータスコード部(SW1、SW2)からなる。そして、ICカード1では、正当性設定コマンド、あるいは正当性チェックコマンドの実行を正常に終了した場合には、ステータスコード部をSW1=90、SW2=00と設定して、外部出力するようになっている。
【0057】
図10は、このように構成されたICカード1における正当性チェックコマンド処理に関する第1の実施例のフローチャート図である。これは、ICカードの製造元(あるいは発行元)からICカード1の提供を受けると、まず不良品でないか確認するために実行する機能である。
【0058】
尚、図10は、図1におけるST106〜ST107の正当性チェックコマンド処理をST121〜ST124にて詳述したフローチャート図であり、その他同一部分については同じステップ番号を付与している。
【0059】
図10に示すように、提供されたICカード1に対して、電源が供給され、リセット信号が検出されると(ST101)、制御素子15は、リセットに対応したATRを外部へ出力する(ST102)。
【0060】
次に、外部よりコマンドを受信すると(ST103)、受信したコマンドの内容を解析し、正当性チェックコマンドであるか判定する(ST104)。ST104の判定の結果、正当性チェックコマンドでない場合には、図7に示すST111以降の処理へ進む。
【0061】
ST104の判定の結果、正当性チェックコマンドを受信したと判定された場合、正当性チェック禁止フラグ150及びチェック完了フラグ140を参照し、正当性チェック機能が実施可能であるか(共に「0」を格納しているか)を確認する(ST105)。
【0062】
ST105の確認の結果、正当性チェック禁止フラグ150あるいはチェック完了フラグ140のいずれかが「1」を格納している場合には、図1で説明した通り、正当性チェック機能の実行が禁止されているか、あるいは正当性チェックが既に正常に終了しているため、エラーレスポンスを出力し、一連の処理を中断する(ST110)。
【0063】
ST105の確認の結果、正当性チェック禁止フラグ105、チェック完了フラグ140が共に「0」を格納し、正当性チェック未完了でかつチェック機能が実行可能である場合には、制御素子15は、データメモリ16の最後尾にあるEFデータ列122aから、EFデータ列長さ管理情報126、EF定義情報127、EFデータ128全ての値の加算を取り、桁上がりした値は無視した1バイトの値を算出する(ST121)。
【0064】
そして、ST121の算出値と、算出対象となったEFデータ列122aのEFデータ正当性管理情報129の格納値とを比較する(ST122)。この比較の結果、一致した場合には、次のEFデータ列122b以降の加算算出処理とその比較処理(ST121−ST124)を繰返し実行する。ST123の比較の結果、一致しなかった場合には、制御素子15は、エラーを示すステータスコードを設定し、外部へ出力する(ST110)。
【0065】
また、ST124にてデータメモリ16内に存在する全てのEFデータ列122にて加算算出処理とその比較処理を実行し、全て一致すると(ST121−ST124)、制御素子15は、チェック完了フラグ140を「0」から「1」に変更し(ST108)、正常終了を示すステータスコード「9000」を設定し、外部へ出力する(ST109)。
【0066】
この第1の実施例では、ユーザ領域の正当性管理情報を、ユーザ領域に生成された全てのEFデータに対して、個々に付与している。従って、正当性チェック時に正常でないと判定された場合には、ユーザ領域内のどこ部分が正常でなかったのかを認識することができるという効果を奏する。
【0067】
尚、第1の実施例で示すように、EFデータ列毎に正当性管理情報を有する場合においては、EFデータ列を作成する際にEFデータ列毎に正当性管理情報が算出され、ともに格納されていることから、図6に示すチェック完了フラグ140は保持していなくても、同様の効果を奏することは言うまでもない。
【0068】
(正当性チェック機能に関する第2の実施例)
次に、図11乃至図14を用いて、上述したICカード1におけるメモリの正当性チェック機能に関する第2の実施例について説明する。
【0069】
この第2の実施例では、第1の実施例と比較すると、ユーザ領域120の正当性管理情報を、ユーザ領域120全体(生成されたEFデータ列122及び空き領域121)に基づいて算出し、システム領域110に格納するようになっている点が特に異なっている。尚、第1の実施例と同様な部分については同じ符号を用いて説明し、重複する説明については省略する。
【0070】
また第2の実施例においては、使用するコマンドとして、正当性チェックコマンドに加え、後述する正当性設定コマンドが新たに存在する。この正当性設定コマンドは、ICカード1を第三者に提供する前に実行するコマンドで、データメモリ16内のユーザ領域120部分の正当性を算出し、この算出結果をシステム領域に記憶するよう指示するコマンドである。図1におけるST100の段階で使用するコマンドである。
【0071】
この正当性設定コマンド及びそれに対応するレスポンスデータは、第1の実施例における正当性チェックコマンドと同様に、図9に示すようなフォーマットで、リーダライタ4とICカード1との間で送受信される。
【0072】
第2の実施例においては、図11(a)に示すように、更にシステム領域110のカード管理情報111にユーザ領域120の正当性を管理するユーザ領域正当性管理情報130と、ユーザ領域の正当性管理情報が設定された旨を示す管理情報フラグ131が格納されている。
【0073】
ユーザ領域正当性管理情報130は、ユーザ領域120全体(生成されたEFデータ列122及び空き領域121)の値から算出される。また、管理情報フラグ131は、ユーザ領域正当性管理情報130が設定された際に、「1」が格納されるようになっている。
【0074】
また、図11(b)に示すように、データメモリ16のユーザ領域120以外の部分、即ちシステム領域110の正当性を管理するためのシステム領域正当性管理情報132が、システム領域(EFアドレステーブル113)に格納されている。
【0075】
そして、ICカード1の起動時に実施される自己診断処理において、システム領域110(詳しくは、ユーザ領域正当性管理情報130、管理情報フラグ131、及びシステム領域正当性管理情報132を除くシステム領域)の正当性チェックが実行される。尚、正当性チェックの方法については、同様にシステム領域110の値(バイト)に基づいて算出され、システム領域の管理情報131と比較されるようになっている。
【0076】
図12は、このユーザ領域正当性管理情報130と管理情報フラグ131の設定方法について説明するフローチャート図である。図12に示すように、第2の実施例では、リーダライタ4は、システム領域の管理情報フラグ131の状態が、管理情報を設定していないことを示しているICカード1に対して正当性設定コマンドを実行するようになっている。
【0077】
ICカード1の制御素子15は、外部から正当性設定コマンドを受信すると(ST131)、カード管理情報111に格納されている管理情報フラグ131を参照し、管理情報が既に設定されているかを判定する(ST132)。
【0078】
ST132の判定の結果、管理情報フラグ131に「1」が格納されており、管理情報が既に設定されていると判定された場合には、制御素子15は既に管理情報が設定されている事を示すステータスコードを設定したエラーレスポンスを出力し、一連の処理を中断する(ST133)。
【0079】
ST132の判定の結果、管理情報フラグ131に「0」が格納されており、管理情報が設定されていない状態であると判定されると、制御素子15は、データメモリ16のユーザ領域の値に基づいてユーザ領域正当性管理情報130を算出する(ST134)。
【0080】
この算出方法は、例えば、ユーザ領域120の全ての値(バイト)の加算を取り、桁上がりした値は無視した1バイトの値を算出するという方法も考えられる。
【0081】
本第2の実施例の場合、ユーザ領域120の全ての値とは、存在するEFデータ列122a、122b、122c、…だけでなく、空き領域121の値も含んで計算することができる。従って、EFデータ列122が存在するユーザ領域だけでなく、空き領域121においても正当性を確認することができるようになっている。
【0082】
次に、制御素子15は、システム領域110のカード管理情報111の所定の箇所に、ST134で算出されたユーザ領域正当性管理情報130を格納すると共に、管理情報フラグ130を正当性管理情報が設定された旨を示す情報「1」に変更する(ST135)。そして、正常に終了した旨を示すレスポンスデータを外部へ出力することによって、正当性設定コマンドの一連の処理を終了する(ST136)。
【0083】
図13は、第2の実施例におけるデータメモリ16のEFデータ列122の構成を示す図である。夫々のEFデータ列122は、EFデータ列長さ管理情報126、EF定義情報127、及びEFデータ128とから少なくとも構成されている。また、図13(a)に示すように、第1の実施例と同様に、EF正当性管理情報129を含む構成でも良い。
【0084】
図14は、図11乃至図13に示す構成のICカード1における正当性チェックコマンド処理に関する第2の実施例のフローチャート図である。第1の実施例同様に、ICカードの製造元(あるいは発行元)からICカード1の提供を受けると、まず不良品でないか確認するために実行する機能である。
【0085】
図14に示すように、提供されたICカード1に対して、電源が供給され、リセット信号が検出されると(ST141)、制御素子15は、ICカード1内部の諸回路の自己診断処理を実行する。この自己診断処理において、システム領域110のチェックが実施され、システム領域の管理情報132と比較し、一致することを確認している。
【0086】
ST42における自己診断処理が正常に終了すると、その自己診断の結果を含んだATRを外部へ出力する(ST142)。尚、自己診断処理を実施するタイミングは、本実施例のタイミングに限定されるものではない。
【0087】
次に、外部よりコマンドを受信すると(ST143)、受信したコマンドの内容を解析し、正当性チェックコマンドであるか判定する(ST144)。ST104の判定の結果、正当性チェックコマンドでない場合には、図7に示すST111以降の処理へ進む。
【0088】
ST144の判定の結果、正当性チェックコマンドを受信したと判定された場合、管理情報フラグ131を参照し、正当性管理情報が設定されているか否かを判定すると共に(ST145)、正当性チェック禁止フラグ150及びチェック完了フラグ140を参照し、正当性チェック機能が実施可能であるか(共に「0」を格納しているか)を確認する(ST146)。
【0089】
ST145で管理情報フラグ131に「0」が格納され正当性管理情報が設定されていないと判定された場合、あるいはST146で正当性チェック禁止フラグ150あるいはチェック完了フラグ140のいずれかに「1」が格納され、図1で説明した通り、正当性チェック機能の実行が禁止されているか、あるいは正当性チェックが既に正常に終了していると判定された場合には、エラーレスポンスを出力し、一連の処理を中断する(ST147)。
【0090】
ST145で管理情報フラグ131に「0」が格納され正当性管理情報が設定されており、ST146で正当性チェック禁止フラグ105、チェック完了フラグ140が共に「0」を格納し、正当性チェック未完了でかつチェック機能が実行可能であると判定された場合には、制御素子15は、例えば、データメモリ16のユーザ領域120全ての値(バイト単位)の加算を取り、桁上がりした値は無視した1バイトの値を算出する(ST148)。
【0091】
そして、ST148の算出値と、カード管理情報111に格納されているユーザ領域正当性管理情報130とを比較する(ST149)。この比較の結果、一致しなかった場合には(ST151)、制御素子15は、エラーを示すステータスコードを設定し、外部へ出力する(ST147)。
【0092】
ST150で一致したと判定された場合には、制御素子15は、チェック完了フラグ140を「0」から「1」に変更し(ST151)、正常終了を示すステータスコード「9000」を設定し、外部へ出力する(ST152)。
【0093】
以上、説明した通り、第2の実施例では、EFデータが格納されている部分のみならず空き領域121をも含めたユーザ領域全体の値に基づいて正当性管理情報を算出している。従って、空き領域における正当性についても確認することができ、より確実に正常なICカード1を提供先に渡すことが可能となるという効果を奏する。
【0094】
また、第2の実施例においては、データメモリ16のユーザ領域120については正当性チェック処理によってその正当性を確認し、システム領域110については自己診断にて正当性チェックを行うようになっている。従って、データメモリ16全体において、正当性をチェックすることが可能となるという効果を奏する。
【0095】
また、第2の実施例では、ユーザ領域の正当性を確認する処理が1つのコマンドで指示可能となる。従って、提供者にとっては簡単に提供されたICカードの正当性を確認することが可能となるという効果を奏する。
【0096】
【発明の効果】
以上説明したように、本発明によれば、不良品を確実に検出することができる。
【図面の簡単な説明】
【図1】本発明の携帯可能電子装置に係るICカード1における正当性管理情報の設定処理及び正当性チェック処理に関して説明するためのフローチャート図。
【図2】ICカード1及びリーダライタ4を用いたシステム構成を概略的に説明するための図。
【図3】ICカード1の基本的な機能ブロックを示す図。
【図4】ICカード1の制御ブロックを示す図。
【図5】ICカード1のデータメモリ16の構成を説明するための図。
【図6】ICカード1における正当性管理情報の設定処理及び正当性チェック処理に関して説明するためのフローチャート図。
【図7】正当性チェック処理に関連する格納情報を説明する図。
【図8】第1の実施例におけるユーザ領域120のEFデータ列122の構成を説明するための図。
【図9】命令データ(特に正当性チェックコマンド、正当性設定コマンド)及びそれに対するレスポンスデータの構成を示す図。
【図10】ICカード1における正当性のチェック処理に関する第1の実施例を説明するためのフローチャート図。
【図11】第2の実施例におけるICカード1の正当性チェック処理に関連する情報を示図。
【図12】ICカード1における正当性の設定処理に関して説明するためのフローチャート図。
【図13】第2の実施例におけるユーザ領域120のEFデータ列122の構成を説明するための図。
【図14】ICカード1における正当性のチェック処理に関する第2の実施例を説明するためのフローチャート図。
【符号の説明】
1 ICカード
4 リーダライタ
16 データメモリ
17 ワーキングメモリ
18 プログラムメモリ
110 システム領域
120 ユーザ領域
121 空き領域
122 EFデータ列
129 EF正当性管理情報
130 ユーザ領域正当性管理情報
131 管理情報フラグ
132 システム領域正当性管理情報
140 チェック完了フラグ
150 正当性チェック禁止フラグ
[0001]
BACKGROUND OF THE INVENTION
The present invention incorporates an IC (integrated circuit) chip having a control element such as a writable / rewritable non-volatile memory and a CPU, and performs various processes based on command data supplied from the outside. The present invention relates to a portable electronic device and a check method thereof.
[0002]
[Prior art]
In recent years, as a portable electronic device, an IC having a rewritable nonvolatile data memory and a CPU (Central Processing Unit) for controlling it, and means for inputting / outputting data from the outside So-called IC cards with built-in chips have been developed in various industries.
[0003]
With the advancement of IC cards in various industries, IC card shipment forms have been diversified. For example, when providing an IC card before issuance, there are cases where the card is issued by the provider, and when an issued IC card is provided, there is a case where personal information is written at the provider. In the case described above, it is necessary to check whether the IC card provided by the provider is normal (there is no defective product).
[0004]
As such a check method, for example, Japanese Patent Laid-Open No. 4-15778 discloses a check code calculated based on card data before writing on a card, and a check code calculated based on card data read from the card. It is described that the erroneous recording due to the fact that the write data itself is incorrect is checked by comparing the above.
[0005]
[Problems to be solved by the invention]
However, in the case of the prior art as described above, since the data recorded on the card is checked in the external device (card data check device), if the comparison result of the check code does not match, There is also a possibility that an error occurring during reading may be a cause. Furthermore, there is a possibility that the recording part of the card itself is defective before erroneous recording. Therefore, the true reason for the mismatch of the check codes is not known, and it is difficult to determine at which stage of the process the card is shipped and various processes are performed.
[0006]
The present invention has been made in view of the above points, and an object thereof is to provide a portable electronic device that can reliably detect defective products and a method for checking the portable electronic device.
[0007]
[Means for Solving the Problems]
To achieve the above object, the portable electronic device of the present invention is a portable electronic device that operates based on command data received from the outside.
A rewritable nonvolatile memory that stores a plurality of data and stores first information for confirming the validity of the data calculated based on all or a part of each data in correspondence with each data. Memory,
When receiving command data for instructing the validity of the nonvolatile memory from the outside,
Calculating means for calculating, for each data, second information for confirming the validity of the data based on the whole or a part of each data stored in the nonvolatile memory;
The second information calculated by the calculating means is compared with the first information stored in the non-volatile memory, and the first information and the second information match in all data. A legitimacy confirmation means for confirming that the data is legitimate,
Writing means for writing confirmation information into the nonvolatile memory indicating that the validity confirmation has been performed by the validity confirmation means;
When command data other than command data for instructing the validity confirmation of the nonvolatile memory is received from the outside,
Determination means for determining whether or not the validity has been confirmed based on the confirmation information indicating that the validity has been confirmed;
And a prohibiting means for prohibiting subsequent legitimacy confirmation when it is judged by the judging means that the legitimacy has been confirmed.
In order to achieve the above object, a portable electronic device checking method according to the present invention includes a rewritable nonvolatile memory for storing a plurality of data, and operates based on command data received from the outside. In a method for checking possible electronic devices,
Receiving instruction data instructing the validity of the non-volatile memory from the outside,
Calculate confirmation information for each data to confirm the validity of the data based on at least a part of each data stored in the nonvolatile memory,
Compare this confirmation information with the validity management information indicating the validity of each data stored in advance in the nonvolatile memory for each corresponding data,
As a result of comparison, when the confirmation information and the validity management information match, the data is confirmed to be valid,
Write check information indicating that the validity has been confirmed to the nonvolatile memory,
Receiving instruction data other than instruction data for instructing confirmation of the validity of the nonvolatile memory from the outside;
Based on the check information indicating that the validity has been confirmed, it is determined whether or not the validity has been confirmed,
If it is determined that the validity has been confirmed, subsequent validity confirmation is prohibited.
[0008]
DETAILED DESCRIPTION OF THE INVENTION
Hereinafter, embodiments according to the present invention will be described in detail with reference to the drawings. FIG. 2 is a diagram for explaining a system configuration using an IC card 1 (including both contact type and wireless type) and a reader / writer 4 (including both contact type and wireless type) as portable electronic devices according to the present invention. It is.
[0009]
As shown in FIG. 2, the system using the IC card 1 includes a host computer 3 as a host device having an internal memory (not shown), a reader / writer 4 as a terminal device connected to the host computer 3, A display device 5, a keyboard 6, and a printer 7 are included.
[0010]
The reader / writer 4 has an internal memory, and performs reading and writing (transmission / reception) of messages to and from the IC card 1 in contact or non-contact. The display device 5 notifies an operator of an operation procedure and an operating state. The keyboard 6 is input by an operator. The printer 7 prints the instructed information in accordance with an operator operation instruction.
[0011]
When using a contact IC card, the reader / writer 4 is provided with an IC card insertion section (not shown) for inserting the contact IC card. When using a wireless IC card, the reader / writer A communication unit (not shown) for communicating between the wireless IC card 4 and the wireless IC card is provided.
[0012]
FIG. 3 is a diagram schematically showing functional blocks of the IC card 1 constituting the system of FIG. As shown in FIG. 3, the IC card 1 includes a read / write unit (R / W unit) 11, a password setting / password verification unit 12, and a part that executes basic functions such as an encryption / decryption unit 13. And a supervisor 14 for managing these basic functions.
[0013]
The R / W unit 11 has a function of reading, writing, or erasing data with respect to a data memory or the like. The password setting / password collating unit 12 performs processing for prohibiting the storage and reading of the password set by the user, collates the password with the password entered from the external device after setting the password, and performs subsequent processing. It has a function to give permission.
[0014]
The encryption / decryption unit 13 is an encryption for preventing leakage or forgery of communication data when data is transmitted / received between the reader / writer 4 and the IC card 1 via a communication line or by wireless communication, for example. And a function of performing decryption.
[0015]
The encryption / decryption unit 13 also has a function of encrypting transmission data and decrypting the encrypted data. The supervisor 14 has a function of decoding an instruction code input from the reader / writer 4 or an instruction code to which data is added and executing the instruction. The encryption / decryption unit 13 constitutes the decryption means of the present invention.
[0016]
FIG. 4 shows a schematic control block diagram of the IC card 1. As shown in FIG. 4, at least one or more applications can be registered in both the wireless and contact IC cards, and control of a CPU or the like as a control means in order to execute various functions as shown in FIG. The device 15 includes a data memory 16 as various storage units, a program memory 18, a working memory 17, a reader / writer 4 for receiving and transmitting signals, and a communication unit 19 as an output unit. Examples of registered applications include credits and point systems.
[0017]
In the case of the wireless IC card 1, the communication unit 19 is configured as an antenna unit, and receives a modulated wave transmitted from the reader / writer 4 in a non-contact manner or transmits a modulated wave to the outside. Further, a power supply and a clock for supplying to the internal circuit are generated from the modulated wave received by the antenna unit 19.
[0018]
In the case of the contact type IC card 1, it is configured as a contact portion, and a power source and a clock are obtained by contacting an IC card terminal portion (not shown) provided in the reader / writer 4.
[0019]
Among these components, the control element 15, the data memory 16, the program memory 18, and the working memory 17 are constituted by one IC chip (or a plurality of IC chips) 20 and are embedded in the IC card body. The control element 15 is a control unit that performs various determination processes / determination processes and data processes such as writing to and reading from the memory.
[0020]
The program memory 18 is composed of a non-rewritable fixed memory such as a mask ROM (Read Only Memory), for example, and stores a control program of the control element 15 having a subroutine for realizing each basic function as described above. doing.
[0021]
The data memory 16 is used for storing various data such as application data, and is composed of an erasable (rewritable) nonvolatile memory such as an EEPROM (Electrically Erasable and Programmable ROM) and a ferroelectric nonvolatile memory (FeRAM). ing.
[0022]
The working memory 17 is a working memory for temporarily storing processing data when the control element 15 performs processing, and is configured by a volatile memory such as SRAM (Static Random Access Memory).
[0023]
FIG. 5 is a conceptual diagram showing the configuration of the data memory 16. As shown in FIG. 5, the data memory 16 is largely divided and defined into a system area 110 and a user area 120. In particular, the system area 110 is an area for storing data directly related to, for example, internal control in the IC card 1.
[0024]
Therefore, in the system area 110, card management information 111 including data used for managing the entire data memory 16, etc., DF definition information 112 for managing a plurality of data files (hereinafter referred to as DF), and EF An EF address table 113 for managing addresses of (elementary files) is stored sequentially from the top of the data memory 16.
[0025]
In the user area 120, a plurality of EF data strings 122 that are associated with the DF definition information 112 and the EF address table 113 and actually store various data are sequentially arranged from the end of the data memory 16 and set. . Therefore, the portion sandwiched between the various storage information 111, 112, 113 in the system area 110 and the EF data string 122 exists as a free area 121 in the data memory 16.
[0026]
The free area 120 is an area that does not belong to any of the various storage information 111, 112, 113 and the EF data string 122 in the system area 110, and is an area that is used when the addition of the EF data string 122 occurs. .
[0027]
Further, when the IC card manufacturer (or issuer) ships the IC card 1, it is confirmed that the memory in the entire user area 120 or in the used area (the EF data string 122) is in a normal state. The legitimacy management information shown is stored in a predetermined location (described later in each embodiment) with respect to the IC card 1.
[0028]
As a result, the provision destination provided with the IC card calculates the validity management information using the entire user area 120 or the portion used by the user area 120 (the EF data string 122 portion) and stores it in the IC card 1 in advance. By comparing with the legitimacy management information that has been provided, it is possible to confirm that the provided IC card 1 is not defective.
[0029]
Further, as shown in FIG. 6, in the present embodiment, the card management information 111 in the system area 110 is provided with a check completion flag 140 and a validity check prohibition flag 150.
[0030]
The check completion flag 140 performs a validity check (to be described later) in order to determine whether or not the memory of the entire user area 120 or the portion used (the EF data string 122 portion) is normal (no defective product). It is a flag indicating whether or not it has been implemented.
[0031]
The check completion flag 140 stores “0” indicating that the validity check has not been completed when the validity management information is set as will be described later. When the process ends normally, “1” indicating that the validity check has been completed normally is stored.
[0032]
The validity check prohibition flag 150 is a flag indicating whether or not the validity check function in the IC card 1 can be executed. When “0” is stored, the validity check function can be implemented. When “1” is stored, it indicates a state in which the execution of the validity check function is prohibited.
[0033]
The validity check prohibition flag 150 is provided for each application when the IC card 1 has a plurality of applications and holds a plurality of DFs corresponding to the plurality of applications. As a result, in the IC card 1, it is possible to prohibit the execution of the validity check function for each application (DF).
[0034]
In the present embodiment, at the first access to the IC card 1 in which the validity management information is set, a command for instructing the validity check is not executed first (that is, other processing is first performed on the IC card 1). If it is instructed, the execution of the validity check function is prohibited.
[0035]
Accordingly, since the validity check function can be executed when the validity management information is set, both the validity check prohibition flag 150 and the check completion flag 140 store “0”.
[0036]
As shown in the flowchart of FIG. 1, first, in the IC card manufacturer or issuer, the memory of the entire user area 120 of the IC card 1 or the portion used (EF data string 122) is described below. By this method, the validity management information is calculated and stored in a predetermined memory portion (ST100). Then, the IC card 1 in which the validity management information is set is provided to the providing destination.
[0037]
Next, the supply destination of the IC card 1 supplies power, a clock signal, and a reset signal to the IC card 1 in which the validity management information is set in ST100. When the control element 15 of the IC card 1 detects a reset signal (ST101), an initial response signal (Answer to Reset: ATR) corresponding to the reset is output to the outside (ST102).
[0038]
Next, when a command is received from the outside (ST103), the content of the received command is analyzed to determine whether it is a validity check command (ST104). If it is determined that the validity check command has been received as a result of the determination in ST104, the validity check prohibition flag 150 and the check completion flag 140 are referred to and it is confirmed whether or not “0” is stored (ST105).
[0039]
As a result of the confirmation in ST105, when the validity check prohibition flag 150 stores “1” and execution of the validity check function is prohibited, an error response in which a status code indicating that execution is impossible is set. Is output and the series of processing is interrupted (ST110).
[0040]
As a result of the confirmation in ST105, if the check completion flag 140 stores “1” and the validity check has already been completed normally, an error response in which a status code indicating that the check has already been completed is set. Output, and a series of processing is interrupted (ST110).
[0041]
As a result of the confirmation in ST105, when both the validity check prohibition flag 105 and the check completion flag 140 store “0”, and the validity check is not completed and the check function can be executed, the control element 15 Legitimacy management information is calculated using the entire area 120 or a portion used in the area 120 (EF data string 122 portion), and is compared with the legitimacy management information stored in advance in the IC card 1 (ST106).
[0042]
If the validity management information does not match as a result of the comparison in ST106, the control element 15 outputs an error response in which a status code indicating a mismatch is set to the outside (ST110). If the validity management information matches as a result of the comparison in ST106, the check completion flag 140 is changed from “0” to “1”, and a normal response in which the status code “9000” indicating normal termination is set is displayed. Output to the outside (ST109).
[0043]
Next, when a command that is not a validity check command is received as a result of the determination in ST104, the process proceeds to the flowchart of FIG. 7, and the control element 15 refers to the check completion flag 140 and the validity check is already normal. It is determined whether the process has been completed (ST111).
[0044]
As a result of the determination in ST111, if the check completion flag 140 stores “1” and it is determined that the validity check has been completed normally, the process is executed according to the instruction of the received command, and the process result is displayed. A response is output (ST112).
[0045]
As a result of the determination in ST111, if the check completion flag 140 stores “0” and it is determined that the validity check has not yet been executed, the validity check prohibition flag 150 is changed from “0” to “ 1 "(ST113). Then, processing is executed in accordance with the received command instruction, and the processing result is output as a response (ST114).
[0046]
Therefore, in the embodiment, the validity check function is executed at the first access to the IC card 1 in which the validity management information is set at the providing destination, and it is confirmed whether the provided IC card is a defective product. It has become. Conversely, when command processing other than the validity check is instructed, execution of the validity check function is prohibited.
[0047]
For this reason, it is possible to recognize whether the provided IC card is not normal or whether a defect has occurred because different processing is performed at the providing destination.
[0048]
(First embodiment regarding validity check function)
Next, a first embodiment relating to the memory validity checking function in the IC card 1 will be described with reference to FIGS. In the first embodiment, the above-described validity management information of the user area 120 is calculated and assigned for each EF data generated in the user area.
[0049]
FIG. 8 is a diagram showing a configuration of the EF data string 122 of the data memory 16. Each EF data string 122 includes at least EF data string length management information 126, EF definition information 127, EF data 128, and EF validity management information 129 described later, as shown in FIG.
[0050]
The EF data string length management information 126 is composed of 1 byte, and is length information from the head of the EF data string length management information 126 to the end of the EF definition information 127, EF data 128, and EF validity management information 129. Is stored. The EF definition information 127 stores identification information for identifying a file configuration, an authentication key necessary for access, and the like. The EF data 128 is a part that actually stores data.
[0051]
The EF validity management information 129 is a flag for confirming that the data of the EF is valid. For example, all values (bytes) of the EF data string length management information 126, the EF definition information 127, and the EF data 128 are stored. The carry value is a 1-byte value that is ignored.
[0052]
That is, when two bytes consisting of “FEh” and “02h” (h indicates a hexadecimal number) are added, “101h” is obtained, but the carry is ignored, so that “01h” is added as the addition result. Further, the next byte is added.
[0053]
The EF validity management information 129 is based on the values of the EF data string length management information 126, the EF definition information 127, and the EF data 128 when the EF data string 122 is created in the user area 120 of the data memory 16. And is stored following the end of the EF data string 122.
[0054]
FIG. 9A is a diagram for explaining the configuration of command data supplied from the reader / writer 4 to the IC card 1. As a command used in the present embodiment, there is a validity check command to be described later. The validity check command is a command for instructing whether the IC card 1 is normal (not defective) after receiving the provision of the IC card 1 from the manufacturer (or issuer) of the IC card.
[0055]
As shown in FIG. 9A, the validity check command has a command code portion including a command classification (CLA: class) and an instruction (INS: instruction), and parameter data P1 and P2.
[0056]
FIG. 9B shows a structure of response data output from the IC card 1 to the reader / writer 4 after executing the command shown in FIG. 9A, and includes a status code part (SW1, SW2). . Then, in the IC card 1, when the execution of the validity setting command or the validity check command is normally completed, the status code portion is set as SW1 = 90 and SW2 = 00 and is output externally. ing.
[0057]
FIG. 10 is a flowchart of the first embodiment regarding the validity check command processing in the IC card 1 configured as described above. This is a function that is executed in order to confirm whether the IC card 1 is received from the manufacturer (or issuer) of the IC card.
[0058]
FIG. 10 is a flowchart illustrating the validity check command processing of ST106 to ST107 in FIG. 1 in detail in ST121 to ST124, and the same step numbers are assigned to other identical parts.
[0059]
As shown in FIG. 10, when power is supplied to the provided IC card 1 and a reset signal is detected (ST101), the control element 15 outputs an ATR corresponding to the reset to the outside (ST102). ).
[0060]
Next, when a command is received from the outside (ST103), the content of the received command is analyzed to determine whether it is a validity check command (ST104). If the result of the determination in ST104 is not a validity check command, the process proceeds to ST111 and subsequent steps shown in FIG.
[0061]
If it is determined that the validity check command has been received as a result of the determination in ST104, the validity check prohibition flag 150 and the check completion flag 140 are referred to and whether the validity check function can be implemented (both “0” is set). Whether it is stored) is confirmed (ST105).
[0062]
As a result of the confirmation in ST105, if either the validity check prohibition flag 150 or the check completion flag 140 stores “1”, the execution of the validity check function is prohibited as described with reference to FIG. Since the validity check has already ended normally, an error response is output and the series of processing is interrupted (ST110).
[0063]
As a result of the confirmation in ST105, when both the validity check prohibition flag 105 and the check completion flag 140 store “0”, the validity check is not completed and the check function can be executed, the control element 15 All values of the EF data string length management information 126, the EF definition information 127, and the EF data 128 are added from the EF data string 122a at the tail of the memory 16, and the carry value is a 1-byte value ignored. Calculate (ST121).
[0064]
Then, the calculated value of ST121 is compared with the stored value of the EF data validity management information 129 of the EF data string 122a to be calculated (ST122). As a result of the comparison, if they match, the addition calculation process after the next EF data string 122b and the comparison process (ST121-ST124) are repeatedly executed. If the result of the comparison in ST123 is that they do not match, the control element 15 sets a status code indicating an error and outputs it to the outside (ST110).
[0065]
Further, the addition calculation process and the comparison process are executed for all the EF data strings 122 existing in the data memory 16 in ST124, and when all match (ST121-ST124), the control element 15 sets the check completion flag 140. “0” is changed to “1” (ST108), status code “9000” indicating normal termination is set, and output to the outside (ST109).
[0066]
In the first embodiment, the validity management information of the user area is individually assigned to all EF data generated in the user area. Therefore, when it is determined that the normality is not normal during the validity check, it is possible to recognize which part in the user area is not normal.
[0067]
As shown in the first embodiment, in the case where the validity management information is provided for each EF data string, the validity management information is calculated for each EF data string and stored together when the EF data string is created. Therefore, it goes without saying that the same effect can be obtained even if the check completion flag 140 shown in FIG. 6 is not held.
[0068]
(Second embodiment regarding validity check function)
Next, a second embodiment relating to the memory validity checking function in the IC card 1 will be described with reference to FIGS.
[0069]
In the second embodiment, as compared with the first embodiment, the validity management information of the user area 120 is calculated based on the entire user area 120 (the generated EF data string 122 and the free area 121), The difference is that the data is stored in the system area 110. The same parts as those in the first embodiment will be described using the same reference numerals, and overlapping descriptions will be omitted.
[0070]
In the second embodiment, as a command to be used, in addition to a validity check command, there is a new validity setting command described later. This validity setting command is a command that is executed before the IC card 1 is provided to a third party. The validity of the user area 120 in the data memory 16 is calculated, and the calculation result is stored in the system area. It is a command to instruct. This is a command used in the stage of ST100 in FIG.
[0071]
The validity setting command and the response data corresponding thereto are transmitted and received between the reader / writer 4 and the IC card 1 in the format shown in FIG. 9 in the same manner as the validity check command in the first embodiment. .
[0072]
In the second embodiment, as shown in FIG. 11A, the card area management information 111 in the system area 110 further includes user area validity management information 130 for managing the validity of the user area 120, and the validity of the user area. A management information flag 131 indicating that the management information is set is stored.
[0073]
The user area validity management information 130 is calculated from the values of the entire user area 120 (the generated EF data string 122 and the free area 121). The management information flag 131 stores “1” when the user area validity management information 130 is set.
[0074]
As shown in FIG. 11B, system area validity management information 132 for managing the validity of the part other than the user area 120 of the data memory 16, that is, the system area 110, is stored in the system area (EF address table). 113).
[0075]
In the self-diagnosis process performed when the IC card 1 is started, the system area 110 (specifically, the system area excluding the user area validity management information 130, the management information flag 131, and the system area validity management information 132). A validity check is performed. The validity check method is similarly calculated based on the value (byte) of the system area 110 and compared with the management information 131 of the system area.
[0076]
FIG. 12 is a flowchart for explaining a method for setting the user area validity management information 130 and the management information flag 131. As shown in FIG. 12, in the second embodiment, the reader / writer 4 is valid for the IC card 1 in which the state of the management information flag 131 in the system area indicates that the management information is not set. The setting command is executed.
[0077]
When receiving the validity setting command from the outside (ST131), the control element 15 of the IC card 1 refers to the management information flag 131 stored in the card management information 111 and determines whether the management information has already been set. (ST132).
[0078]
As a result of the determination in ST132, when “1” is stored in the management information flag 131 and it is determined that the management information has already been set, the control element 15 indicates that the management information has already been set. An error response in which the status code shown is set is output, and a series of processing is interrupted (ST133).
[0079]
As a result of the determination in ST132, if “0” is stored in the management information flag 131 and it is determined that the management information is not set, the control element 15 sets the value in the user area of the data memory 16 to the value. Based on this, the user area validity management information 130 is calculated (ST134).
[0080]
As this calculation method, for example, a method in which all values (bytes) in the user area 120 are added and a value of 1 byte is calculated by ignoring the carry value.
[0081]
In the case of the second embodiment, all values in the user area 120 can be calculated including not only the existing EF data strings 122a, 122b, 122c,. Therefore, the validity can be confirmed not only in the user area where the EF data string 122 exists but also in the empty area 121.
[0082]
Next, the control element 15 stores the user area validity management information 130 calculated in ST134 at a predetermined location of the card management information 111 in the system area 110, and sets the management information flag 130 in the validity management information. It is changed to the information “1” indicating that it has been made (ST135). Then, the response data indicating the normal end is output to the outside, and the series of processes of the validity setting command is ended (ST136).
[0083]
FIG. 13 is a diagram showing the configuration of the EF data string 122 of the data memory 16 in the second embodiment. Each EF data string 122 includes at least EF data string length management information 126, EF definition information 127, and EF data 128. Further, as shown in FIG. 13A, a configuration including EF validity management information 129 may be used as in the first embodiment.
[0084]
FIG. 14 is a flowchart of the second embodiment regarding the validity check command processing in the IC card 1 having the configuration shown in FIGS. As in the first embodiment, when the IC card 1 is provided from the IC card manufacturer (or issuer), it is a function that is executed first to confirm whether the product is defective.
[0085]
As shown in FIG. 14, when power is supplied to the provided IC card 1 and a reset signal is detected (ST141), the control element 15 performs self-diagnosis processing of various circuits inside the IC card 1. Execute. In this self-diagnosis process, the system area 110 is checked and compared with the management information 132 of the system area to confirm that they match.
[0086]
When the self-diagnosis process in ST42 ends normally, the ATR including the result of the self-diagnosis is output to the outside (ST142). Note that the timing for performing the self-diagnosis process is not limited to the timing of the present embodiment.
[0087]
Next, when a command is received from the outside (ST143), the content of the received command is analyzed to determine whether it is a validity check command (ST144). If the result of the determination in ST104 is not a validity check command, the process proceeds to ST111 and subsequent steps shown in FIG.
[0088]
If it is determined that the validity check command has been received as a result of the determination in ST144, the management information flag 131 is referred to determine whether the validity management information is set (ST145), and the validity check is prohibited. Referring to flag 150 and check completion flag 140, it is confirmed whether the validity check function can be implemented (both store “0”) (ST146).
[0089]
When it is determined in ST145 that “0” is stored in the management information flag 131 and the validity management information is not set, or in ST146, “1” is set in either the validity check prohibition flag 150 or the check completion flag 140. When it is determined that the execution of the validity check function is prohibited or the validity check has already been completed normally as described in FIG. 1, an error response is output and a series of Processing is interrupted (ST147).
[0090]
In ST145, “0” is stored in the management information flag 131 and the validity management information is set. In ST146, the validity check prohibition flag 105 and the check completion flag 140 both store “0”, and the validity check is not completed. If it is determined that the check function can be executed, the control element 15 adds, for example, all the values (in bytes) of the user area 120 of the data memory 16 and ignores the carry value. A 1-byte value is calculated (ST148).
[0091]
Then, the calculated value of ST148 is compared with the user area validity management information 130 stored in the card management information 111 (ST149). As a result of this comparison, if they do not match (ST151), the control element 15 sets a status code indicating an error and outputs it to the outside (ST147).
[0092]
If it is determined in ST150 that they match, the control element 15 changes the check completion flag 140 from “0” to “1” (ST151), sets the status code “9000” indicating normal termination, and external (ST152).
[0093]
As described above, in the second embodiment, the validity management information is calculated based on the value of the entire user area including the empty area 121 as well as the part storing the EF data. Therefore, it is possible to confirm the validity in the empty area, and it is possible to deliver the normal IC card 1 to the provider more reliably.
[0094]
In the second embodiment, the validity of the user area 120 of the data memory 16 is confirmed by a validity check process, and the validity of the system area 110 is checked by self-diagnosis. . Therefore, it is possible to check the validity of the entire data memory 16.
[0095]
In the second embodiment, the process for confirming the validity of the user area can be instructed with one command. Therefore, it is possible for the provider to easily confirm the validity of the provided IC card.
[0096]
【The invention's effect】
As described above, according to the present invention, defective products can be reliably detected.
[Brief description of the drawings]
FIG. 1 is a flowchart for explaining validity management information setting processing and validity check processing in an IC card 1 according to a portable electronic device of the present invention.
FIG. 2 is a diagram for schematically explaining a system configuration using an IC card 1 and a reader / writer 4;
3 is a view showing basic functional blocks of the IC card 1. FIG.
FIG. 4 is a diagram showing a control block of the IC card 1;
FIG. 5 is a diagram for explaining a configuration of a data memory 16 of the IC card 1;
FIG. 6 is a flowchart for explaining the validity management information setting process and the validity check process in the IC card 1;
FIG. 7 is a diagram for explaining storage information related to validity check processing;
FIG. 8 is a diagram for explaining the configuration of an EF data string 122 in a user area 120 in the first embodiment.
FIG. 9 is a diagram showing a configuration of command data (in particular, a validity check command and a validity setting command) and response data corresponding thereto.
FIG. 10 is a flowchart for explaining a first embodiment relating to a validity check process in the IC card 1;
FIG. 11 is a diagram showing information related to the validity check process of the IC card 1 in the second embodiment.
FIG. 12 is a flowchart for explaining legitimacy setting processing in the IC card 1;
FIG. 13 is a diagram for explaining the configuration of an EF data string 122 in a user area 120 in the second embodiment.
FIG. 14 is a flowchart for explaining a second embodiment relating to a validity check process in the IC card 1;
[Explanation of symbols]
1 IC card
4 Reader / Writer
16 data memory
17 Working memory
18 Program memory
110 System area
120 User area
121 Free space
122 EF data string
129 EF legitimacy management information
130 User area validity management information
131 Management information flag
132 System area correctness management information
140 Check complete flag
150 Validity check prohibition flag

Claims (2)

外部から受信した命令データに基づいて動作する携帯可能電子装置において、
複数のデータを格納し、この各データの全体あるいは一部に基づいて算出された前記データの正当性を確認するための第1の情報を前記各データに対応させて格納する書換え可能な不揮発性メモリと、
外部から前記不揮発性メモリの正当性の確認を指示する命令データを受信した時、
前記不揮発性メモリに格納されている各データの全体あるいは一部に基づいて前記データの正当性を確認するための第2の情報をデータ毎に算出する算出手段と、
この算出手段によって算出された第2の情報と、前記不揮発性メモリに格納された第1の情報とを比較し、全てのデータにて第1の情報と第2の情報とが一致している場合に、前記データは正当であると確認する正当性確認手段と、
この正当性確認手段にて正当性確認が行われたことを示す確認情報を前記不揮発性メモリに書込む書込み手段と、
外部から前記不揮発性メモリの正当性の確認を指示する命令データ以外の命令データを受信した時、
前記正当性確認が行われたことを示す確認情報に基づいて、正当性の確認が行われたか否かを判定する判定手段と、
この判定手段によって正当性の確認が行われたと判定された場合に、以後の正当性確認を禁止する禁止手段と、を具備することを特徴とする携帯可能電子装置。
In a portable electronic device that operates based on command data received from outside,
Storing a plurality of data, a rewritable nonvolatile storing the first information to confirm the validity of the data calculated on the basis of the whole or part of the respective data to correspond to the respective data Memory,
When receiving command data for instructing the validity of the nonvolatile memory from the outside,
Calculating means for calculating, for each data, second information for confirming the validity of the data based on all or part of each data stored in the nonvolatile memory;
The second information calculated by the calculation means is compared with the first information stored in the non-volatile memory, and the first information and the second information match in all data. A legitimacy confirmation means for confirming that the data is legitimate,
Writing means for writing confirmation information into the nonvolatile memory indicating that the validity confirmation is performed by the validity confirmation means;
When command data other than command data for instructing the validity confirmation of the nonvolatile memory is received from the outside,
Determination means for determining whether or not the validity has been confirmed based on the confirmation information indicating that the validity has been confirmed;
A portable electronic device comprising: prohibiting means for prohibiting subsequent validity checking when it is determined by the determining means that the validity has been confirmed.
複数のデータを格納する書き換え可能な不揮発性メモリを有し、外部から受信した命令データに基づいて動作する携帯可能電子装置のチェック方法において、
外部から前記不揮発性メモリの正当性の確認を指示する命令データを受信するステップと、
前記不揮発性メモリに格納されている各データの少なくとも一部に基づいて前記データの正当性を確認するための確認情報をデータ毎に算出するステップと、
この算出ステップで算出された確認情報と、前記不揮発性メモリに予め格納された各データの正当性を示す正当性管理情報とを対応するデータ毎に比較するステップと、
この比較ステップにて比較した結果、前記確認情報と、前記正当性管理情報とが一致している場合に、前記データは正当であると確認するステップと、
この確認ステップにて正当性確認が行われたことを示すチェック情報を前記不揮発性メモリに書込むステップと、
外部から前記不揮発性メモリの正当性の確認を指示する命令データ以外の命令データを受信するステップと、
前記確認ステップにて正当性確認が行われたことを示すチェック情報に基づいて、正当性の確認が行われたか否かを判定するステップと、
この判定ステップによって正当性の確認が行われたと判定された場合に、以後の正当性確認を禁止するステップと、を有することを特徴とする携帯可能電子装置のチェック方法。
In a check method of a portable electronic device having a rewritable nonvolatile memory for storing a plurality of data and operating based on command data received from outside,
Receiving instruction data for instructing confirmation of the validity of the non-volatile memory from the outside,
Calculating a check information to confirm the validity of the data based on at least a portion of each data stored in the nonvolatile memory for each data,
Comparing the confirmation information calculated in this calculation step with the validity management information indicating the validity of each data stored in advance in the nonvolatile memory for each corresponding data;
As a result of comparison in this comparison step, when the confirmation information matches the validity management information, the step of confirming that the data is valid;
Writing check information into the non-volatile memory indicating that the validity is confirmed in the confirmation step;
Receiving command data other than command data for instructing confirmation of the validity of the nonvolatile memory from the outside;
Determining whether or not validity has been confirmed based on check information indicating that validity has been confirmed in the confirmation step; and
A method for checking a portable electronic device, comprising: a step of prohibiting subsequent legitimacy confirmation when it is judged that the legitimacy has been confirmed in this judgment step.
JP2001299146A 2001-09-28 2001-09-28 Portable electronic device and method for checking the same Expired - Fee Related JP3607229B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2001299146A JP3607229B2 (en) 2001-09-28 2001-09-28 Portable electronic device and method for checking the same

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2001299146A JP3607229B2 (en) 2001-09-28 2001-09-28 Portable electronic device and method for checking the same

Publications (2)

Publication Number Publication Date
JP2003108445A JP2003108445A (en) 2003-04-11
JP3607229B2 true JP3607229B2 (en) 2005-01-05

Family

ID=19119945

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2001299146A Expired - Fee Related JP3607229B2 (en) 2001-09-28 2001-09-28 Portable electronic device and method for checking the same

Country Status (1)

Country Link
JP (1) JP3607229B2 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2278484A1 (en) 2009-07-16 2011-01-26 Kabushiki Kaisha Toshiba Processing system for portable electronic apparatus, portable electronic apparatus, and processing apparatus for portable electronic apparatus

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8161221B2 (en) * 2008-11-25 2012-04-17 Hitachi, Ltd. Storage system provided with function for detecting write completion
TWI483117B (en) 2010-09-29 2015-05-01 Toshiba Kk Device for executing a command, host controller and system for executing a command
JP2013222348A (en) * 2012-04-17 2013-10-28 Dainippon Printing Co Ltd Ic card and computer program

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2278484A1 (en) 2009-07-16 2011-01-26 Kabushiki Kaisha Toshiba Processing system for portable electronic apparatus, portable electronic apparatus, and processing apparatus for portable electronic apparatus
US8629757B2 (en) 2009-07-16 2014-01-14 Kabushiki Kaisha Toshiba Processing system for portable electronic apparatus, portable electronic apparatus, and processing apparatus for portable electronic apparatus

Also Published As

Publication number Publication date
JP2003108445A (en) 2003-04-11

Similar Documents

Publication Publication Date Title
EP0707270B1 (en) Method and apparatus for validating system operation
US4983816A (en) Portable electronic device
KR910007035B1 (en) A data processing method between the first electronic devie and the second electronic device and a portable device as the second electronic device for the data processing method
JPWO2002057904A1 (en) Control device with download function
US5039850A (en) IC card
KR940007351B1 (en) Portable electronic equipement
US20070124534A1 (en) Data storing apparatus, IC card, and data storing method
JP3590131B2 (en) Portable storage medium and portable storage medium issuing device
JP3607229B2 (en) Portable electronic device and method for checking the same
JP2003523025A (en) Bill validator with removable flash memory
US20060289656A1 (en) Portable electronic apparatus and data output method therefor
EP1220148B1 (en) Ic card, ic card issuing device, ic card issuing system, and ic card issuing method
US6173401B1 (en) Importing information onto a chip card
EP1079340A2 (en) Integrated circuit card protected from unauthorized access
JP3620834B2 (en) Portable electronic device and output method of initial response thereof
JPH11282991A (en) Ic card
JP2011060136A (en) Portable electronic apparatus, and data management method in the same
JP4661244B2 (en) Air conditioner
JP2007323133A (en) Method for issuing ic card, and ic card
JP2016139305A (en) Electronic control unit and software rewriting system
JP2005258968A (en) Validity verification method of data written in ic card, and program for ic card
JP4691355B2 (en) Non-volatile memory
JP2006293706A (en) Multi-application ic card with application updating function
CN115525933B (en) Data tamper-proof method and device, electronic equipment and storage medium
JP4899499B2 (en) IC card issuing method, IC card issuing system, and IC card

Legal Events

Date Code Title Description
A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20040120

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20040203

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20040405

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20041006

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

Free format text: PAYMENT UNTIL: 20081015

Year of fee payment: 4

LAPS Cancellation because of no payment of annual fees