JP3863011B2 - Combination type IC card, control method therefor, and system program therefor - Google Patents

Combination type IC card, control method therefor, and system program therefor Download PDF

Info

Publication number
JP3863011B2
JP3863011B2 JP2001365116A JP2001365116A JP3863011B2 JP 3863011 B2 JP3863011 B2 JP 3863011B2 JP 2001365116 A JP2001365116 A JP 2001365116A JP 2001365116 A JP2001365116 A JP 2001365116A JP 3863011 B2 JP3863011 B2 JP 3863011B2
Authority
JP
Japan
Prior art keywords
contact
command
information
application program
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
JP2001365116A
Other languages
Japanese (ja)
Other versions
JP2003168092A (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.)
Sharp Corp
Original Assignee
Sharp 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 Sharp Corp filed Critical Sharp Corp
Priority to JP2001365116A priority Critical patent/JP3863011B2/en
Publication of JP2003168092A publication Critical patent/JP2003168092A/en
Application granted granted Critical
Publication of JP3863011B2 publication Critical patent/JP3863011B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Description

【0001】
【発明の属する技術分野】
本発明は、接触式ICカードと非接触式ICカードの両機能を併せ持つコンビネーション型のICカード、及びその制御方法、並びにそのシステムプログラムに関する。
【0002】
【従来の技術】
ICカードは、外部機器との通信に接点を通じて行う接触式ICカードと、外部機器との通信に接点を介さずに非接触で行う非接触式ICカードに分類されてきた。近年その両方のインターフェース(以下、I/Fと略記する)機能を備えた、コンビネーション型ICカードが開発されている。
【0003】
接触式ICカードの国際規格としては、ISO/IEC7816がありISO/IEC7816−3に外部機器との伝送プロトコルや初期化手順、ISO/IEC7816−4に共通コマンド(コマンド構造)が規格化されている。
【0004】
また、非接触式ICカードの国際規格としては、ISO/IEC14443があり、ISO/IEC14443−3に初期化手順、ISO/IEC14443−4に外部機器との伝送プロトコルが規格化されている。
【0005】
コンビネーション型ICカード(以下コンビ型ICカードと略称する)では、接触式ICカードとして動作する場合は、上記ISO/IEC7816−3の伝送プロトコルを適用して、外部機器とのコマンド送受信を行う一方、非接触式ICカードとして動作する場合は、上記ISO/IEC14443−4の伝送プロトコルを適用して、外部機器とのコマンド送受信を行う。
【0006】
コンビ型ICカードとしては、例えば特開平11−272824号公報に示されるようなものがある。このコンビ型ICカードは、接触用I/Fおよび非接触用I/Fと、接触式で動作しているか非接触式で動作しているかを判別する手段と、判定結果に基づき外部機器と接触式で応答する場合と外部機器と非接触で応答する場合で、実行可能なコマンドを切り替える手段とを有している。
【0007】
このコンビ型ICカードは、外部機器と通信でコマンドを受信したとき、図16に示すように、まず接触式による起動か否かを判別し(ステップ1、以下、ステップをSと略記する)、接触式ならば、接触式のコマンドリストを参照する(S3)。接触式でないなら、非接触式による起動か否かを判別し(S2)、非接触式ならば、非接触式のコマンドリストを参照する(S4)。次に、上記コマンドリストにおいて、受信したコマンドと一致するものがあると判定した場合(S5)、ROMのサブルーチンプログラムが実行される(S6)。受信コマンドが一致しなければ実行不可能と判定され、エラー処理が実行される。
【0008】
これにより、接触式で駆動される場合および非接触式で駆動される場合の双方において同等の機能を実行でき、さまざまな用途において、誤動作の防止されたコンビ型ICカードを提供することができると記載されている。
【0009】
【発明が解決しようとする課題】
コンビ型ICカードの場合、接触用I/Fが選択された場合と非接触用I/Fが選択された場合とで、外部機器と通信を行うための伝送プロトコルが異なる。このため、コンビ型ICカード上のアプリケーションプログラムでどちらのI/Fが選択された場合でも同等の動作を行うためには、この伝送プロトコル上の違いを吸収してアプリケーションプログラムに確実にコマンドを受け渡す必要がある。
【0010】
また、コンビ型ICカードに搭載されているアプリケーションプログラムにおいて、外部機器から受信したコマンドを処理するのに時間がかかる場合、外部機器に対してタイムアウト(時間切れによる不通となる通信状態)が発生するのを防ぐため、ウエイト(Wait、待機) 要求コマンドを外部機器に送信し、外部機器からウエイト応答を受信することがある。
【0011】
しかしながら、接触用I/Fの伝送プロトコルと非接触用I/Fの伝送プロトコルとでは、このウエイト要求時間における、パラメータによって設定される時間が異なるため、接触用I/Fで十分なウエイト時間のウエイト要求を外部機器へ送信したとしても、非接触用I/Fでは外部機器でタイムアウトが発生してしまうという問題がある。
【0012】
また、上述したコンビ型ICカードは、接触用I/Fで接続されている場合は、接触用のコマンドリストを参照してコマンドの実行可否を決定し、非接触用I/Fで接続されている場合は、非接触用のコマンドリストを参照してコマンドの実行可否を決定し、あるいは共通のコマンドリストを設けて接触式または非接触式のみでのコマンドの実行可否、接触式/非接触式両方での実行可否を判定する方式である。
【0013】
このコンビ型ICカードの場合、一枚のコンビ型ICカードに単一のアプリケーションプログラムが搭載されている場合に有効な方式であるが、一枚のコンビ型ICカード上に、接触式/非接触式両方で動作可能なアプリケーションプログラム、接触式のみで動作可能なアプリケーションプログラム、非接触式のみで動作可能なアプリケーションなど複数のアプリケーションが搭載されるような多目的用途のコンビ型ICカードに適用するための考慮はなされておらず、もしこのような用途に適用したとしてもアプリケーション毎にコマンドリストを用意する必要があり、手順も複雑になるという問題点がある。
【0014】
また、このコンビ型ICカードにおいては、接触式と非接触式で同じ伝送プロトコルでコマンドの送信/受信を行う必要があり、異なる伝送プロトコルでの動作は考慮されていなかった。
【0015】
本発明の目的は、以下の3項目である。
【0016】
1)接触式および非接触式の伝送プロトコル上の違いを吸収して、アプリケーションプログラムに確実にコマンドを受け渡すことができ、確実にコマンド実行結果を外部機器に送信(出力)できるアプリケーション共通化方式を提供する。
【0017】
2)コンビ型ICカードに搭載しているアプリケーションプログラムから外部機器に対してウエイト要求を行った場合、接触用I/Fが選択されていても非接触用I/Fが選択されていても、外部機器でタイムアウトが発生することが回避されたアプリケーション共通化方式を提供する。
【0018】
3)一枚のコンビ型ICカードに、接触式/非接触式両方で動作可能なアプリケーションプログラム、接触式のみで動作可能なアプリケーションプログラム、非接触のみで動作可能なアプリケーションなどのような複数のアプリケーションプログラムが搭載された場合にも、アプリケーションプログラムに確実にコマンドを受け渡すことができ、確実にコマンド実行結果を外部機器に送信できるアプリケーション共通化方式を提供する。
【0019】
【課題を解決するための手段】
本発明のコンビ型ICカードは、上記課題を解決するために、外部機器との通信のための接触用I/F及び非接触用I/Fと、どちらのI/Fで起動されているか判別する判別部と、システムプログラム及び少なくとも1つのアプリケーションプログラムを格納した第一記憶部と、外部機器から受信した接触用I/Fまたは非接触用I/Fを介したコマンドから抽出されたコマンド情報を格納する第二記憶部と、外部機器から受信した前記コマンドの各フィールドに含まれる上記コマンド情報を前記アプリケーションプログラムによりアクセス可能に抽出する抽出部とを有し、前記第二記憶部には、応答送信コマンド情報として、前記外部機器に対してウエイト要求する処理待ち期間を示すウエイト要求値情報が格納されており、さらに、割り込み処理回路とタイマ回路と、前記入力したコマンドの実行中に所定時間に設定された上記タイマ回路のカウント終了により割り込みが発生した場合、前記ウエイト要求値を初期値とするカウント値が0でなければ前記カウント値を1減算し、0であれば、外部機器に対してウエイト要求コマンドを送信すると共に、前記カウント値を初期値に再設定する再設定手段とを有していることを特徴としている。
【0020】
上記構成によれば、外部機器から受信した前記コマンドの各フィールドに含まれる上記コマンド情報を前記アプリケーションプログラムによりアクセス可能に抽出する抽出部を有することにより、接触式および非接触式の伝送プロトコル上の違いを吸収して、アプリケーションプログラムに確実にコマンドを受け渡すことができ、確実にコマンド実行結果を外部機器に送信(出力)できる。
【0021】
さらに、上記構成によれば、搭載しているアプリケーションプログラムから外部機器に対してウエイト要求を行った場合、再設定手段を有しているので、接触用I/Fが選択されていても非接触用I/Fが選択されていても、外部機器でタイムアウトが発生することが回避できる。
【0022】
上記コンビ型ICカードでは、前記システムプログラム及び少なくとも1つのアプリケーションプログラムを格納した第一記憶部は書き換え可能な不揮発性記憶素子からなることが好ましい。
【0023】
上記コンビ型ICカードにおいては、前記コマンド情報を格納する第二記憶部は、揮発性記憶素子からなることが望ましい。
【0024】
上記コンビ型ICカードでは、前記第二記憶部には、受信コマンド情報として、受信したコマンドの種別あるいは動作を指定する情報、受信したデータの格納場所情報、受信したコマンドの属性を示すプロトコル情報、及び接触及び非接触のいずれで通信するかを示す接続モード情報からなる群から選択される少なくとも1つが格納されていることが好ましい。
【0025】
上記コンビ型ICカードにおいては、前記第二記憶部には、応答送信コマンド情報として、送信するデータの格納場所情報、コマンドの実行結果を示すステータス情報、送信するコマンドの属性を示すプロトコル情報、前記外部機器に対してウエイト要求する処理待ち期間を示すウエイト要求値情報からなる群から選択される少なくとも1つが格納されていることが望ましい
【0026】
本発明のコンビ型ICカードの制御方法は、前記の課題を解決するために、外部機器からのコマンドを接触式及び非接触式にてそれぞれ受信でき、接触式及び非接触式の何れで受信したか判別して、コマンドに対応するアプリケーションプログラムを実行し、その実行結果を外部機器に出力する接触式及び非接触式兼用のICカードであるコンビネーション型ICカードの制御方法において、外部機器から受信したコマンドの各フィールドに含まれるコマンド情報をアプリケーションプログラムからアクセス可能に抽出し、前記アプリケーションプログラムの実行が、前記外部機器に対してウエイト要求することを必要とする場合、前記外部機器から既にウエイト応答情報を受信しているか確認し、ウエイト応答情報を受信していなければ、ウエイト要求情報を出力し、ウエイト応答情報を受信しており、かつ所定の時間以内に前記アプリケーションプログラムの実行が完了しなかったとき、再度ウエイト要求情報を出力することを特徴としている。
【0027】
上記方法によれば、外部機器から受信したコマンドの各フィールドに含まれるコマンド情報をアプリケーションプログラムからアクセス可能にすることで、接触式および非接触式の伝送プロトコル上の違いを吸収して、アプリケーションプログラムに確実にコマンドを受け渡すことができ、確実にコマンド実行結果を外部機器に送信(出力)できる。
【0028】
さらに、上記方法によれば、搭載しているアプリケーションプログラムから外部機器に対してウエイト要求を行った場合、再度ウエイト要求情報を出力するので、接触式が選択されていても非接触式が選択されていても、外部機器でタイムアウトが発生することが回避できる。
【0029】
上記制御方法では、前記アプリケーションプログラムが、接触式及び非接触式のいずれの接続モードでも実行可能な場合、判別された接続モードでアプリケーションプログラムを実行することが好ましい。
【0030】
上記制御方法においては、前記アプリケーションプログラムが、接触モードでのみ実行可能な場合、判別された接続モードが接触モードでないとき、エラー応答情報を出力し、判別された接続モードが接触モードであるとき、接触モードで前記アプリケーションプログラムを実行することが望ましい。
【0031】
上記制御方法では、前記アプリケーションプログラムが、非接触モードでのみ実行可能な場合、判別された接続モードが非接触モードでないとき、エラー応答情報を出力し、判別された接続モードが非接触モードであるとき、非接触モードで前記アプリケーションプログラムを実行することが好ましい。
【0032】
上記方法によれば、一枚のコンビ型ICカードに、接触式/非接触式両方で動作可能なアプリケーションプログラム、接触式のみで動作可能なアプリケーションプログラム、非接触のみで動作可能なアプリケーションなどのような複数のアプリケーションプログラムが搭載された場合にも、アプリケーションプログラムに確実にコマンドを受け渡すことができ、確実にコマンド実行結果を外部機器に送信できる
【0033】
本発明のコンビ型ICカードのシステムプログラムは、前記の課題を解決するために、上記の何れかに記載の制御方法を実行処理することを特徴としている。
【0034】
【発明の実施の形態】
以下、図1ないし図15を参照しながら本発明に係るコンビ型ICカードの実施の形態について詳細に説明する。図1に示すように、本発明によるアプリケーション共通化方式が適用される一形態としてのコンビ型ICカード100では、非接触用I/F101と、接触/非接触判定手段102と、接触用I/F103と、CPU(Central Processing Unit) 104と、揮発性メモリ105と、不揮発性メモリ106と、タイマ回路107と、割り込み回路108とが、共通バスラインを介して互いにデータの送受信可能にそれぞれ設けられている。
【0035】
不揮発性メモリ106には、CPU104により制御されるシステムプログラムや、少なくとも1つのアプリケーションプログラムが予め格納されている。システムプログラムは、コンビ型ICカード100と外部とのデータの送受信や、コンビ型ICカード100内部間でのデータの送受信を制御するためのものである。
【0036】
このようなコンビ型ICカード100においては、非接触用外部機器109や接触用外部機器110からコマンド(命令)をシステムプログラムに沿って受信し、上記コマンドにしたがったアプリケーションプログラムを実行し、その結果を上記コマンドを送信した非接触用外部機器109や接触用外部機器110に返送(出力)するようになっている。
【0037】
非接触用I/F101は、常時、非接触である無線にて信号を送受信可能となっており、非接触用外部機器109と無線で互いに通信できるように構成されている。無線で通信している時、コンビ型ICカード100は非接触用ICカードとして動作する。
【0038】
また、接触用I/F103は、接触用外部機器110とコンビ型ICカード100の表面に露出して設けられた電極端子を介して(つまり有線で接触状態にて)互いに通信できるように構成されている。電極端子を介して通信している時、コンビ型ICカード100は、接触用ICカードとして動作する。
【0039】
これらの通信状態は同時に接続されて通信することはなく、例えば受信した開始信号の信号強度の大小や、接触用外部機器110と電極端子とが接触状態か否かによる電源電圧等といった検出電圧の有無によって、どちらか一方のICカードとして択一的に動作するように設定されている。
【0040】
接触/非接触判定手段102は、通信中のI/Fが接触式であるか非接触式であるかを判定するものである。判定方法としては、例えば接触モードで使用するクロック端子からクロックが供給されているのか、非接触モードで使用するRF回路からクロックが供給されているかのクロックの供給元をクロック周波数の違いにより判定する方法が挙げられる。判定結果は、例えば接触式であるとき0、非接触式であるとき1がCPU104によって参照可能であるレジスタ(メモリ)に格納されるように構成されている。
【0041】
判定結果情報は、EEPROM(Electrically Erasable Programmable Read Only Memory) 等の不揮発性メモリ106に格納したシステムプログラムに基づきCPU104により参照される。不揮発性メモリ106には、システムプログラムの他に、アプリケーションプログラム(後に詳述する)が格納されている。また、揮発性メモリ105は、一時記憶データを格納するための、例えばRAM(Random Access Memory)である。
【0042】
図1に示した不揮発性メモリ106に格納するプログラムの階層構造を示す構成例としては、図2に示すように、システムプログラム上に一つの接触/非接触共通アプリケーションプログラムが構成されている例が挙げられる。
【0043】
また、上記プログラムの階層構造を示す、他の構成例としては、図3に示すように、システムプログラム上に接触/非接触共通アプリケーションプログラム、接触専用アプリケーションプログラム、非接触専用アプリケーションプログラムなど複数のアプリケーションプログラムがそれぞれ構成されている例が挙げられる。
【0044】
接触/非接触共通アプリケーションプログラムとしては、例えばバスカードなどの交通系のアプリケーションにおいて、お金のチャージを窓口で接触モードによって行い、バスヘの乗車/降車を非接触モードで行う用途がある。接触専用アプリケーションとしては、接触式でのみ使用が認められている電子マネーなどの金融系の用途がある。また、非接触専用のアプリケーションプログラムには、テレホンカード、入退出システムなどの用途がある。
【0045】
本発明によるコンビ型ICカードにおいては図1ないし図3に示したいずれのアプリケーション構成においても、適切な処理を行うために次の一連の処理を行う。すなわち、
1.実行すべきアプリケーションプログラムを選択する。
【0046】
2.接触式または非接触式で外部機器と接続を開始したとき、どちらのI/Fで起動しているかを接触/非接触判定手段102により判定する。
【0047】
3.接触/非接触判定手段102による判定結果に応じたプロトコルで初期応答を行い、通信を確立する。
【0048】
4.接触/非接触判定手段102による判定結果に応じたプロトコルでコマンドを受信する。
【0049】
5.コマンドにより指定されたアプリケーションプログラムを実行する。
【0050】
6.アプリケーションプログラムの実行結果を応答として外部機器へ返信する。
【0051】
7.必要に応じて外部機器に対してウエイト要求送信/応答受信動作を行う。
【0052】
以下に、各処理の詳細を述べるが、まず接触式と非接触式で用いられる伝送プロトコルについて説明する。
【0053】
図4に伝送用プロトコルの構成を示す。ここで、図4(a)は接触式で用いられる接触用伝送プロトコルコマンドの1フレームの構成、図4(b)は非接触式で用いられる非接触用伝送プロトコルの1フレームの構成、図4(c)は図4(a)及び図4(b)に記載の情報フィールド部を示し、コマンド受信時のフィールドの構成、図4(d)は図4(a)及び図4(b)に記載の情報フィールド部を示し、コマンド応答送信時のフィールドの構成を各々示している。
【0054】
より詳しくは、接触用伝送プロトコルコマンドの1フレームは図4(a)に示すように先頭フィールド部と情報フィールド部と最終フィールド部の3つの大きなフィールドにより構成される。
【0055】
このうち先頭フィールド部のNADは、コマンドブロックの送信元と宛先を示すものである。ここでコマンドブロックとは、図4に示すそれぞれの伝送プロトコルコマンド1フレーム分を示す。先頭フィールド部のPCBは、プロトコル制御情報を示し、データ転送に必要な制御情報が格納されている。例えば、後に詳述するコマンド受信やウエイト応答受信などの情報が格納される。先頭フィールド部のLENには、後に続く情報フィールド部のデータの長さが格納される。
【0056】
情報フィールド部にコマンド本体が格納される。最終フィールド部には、伝送ブロックの誤り検出符号(EDC:Error Detection Code)が格納される。情報フィールド部の構成はコマンド受信時とコマンド応答送信時でフィールドが異なり、その構成は下記の図4(c)と図4(d)とに関する欄にて詳述する。
【0057】
また、非接触用伝送プロトコルコマンドの1フレームは、図4(b)に示すように、先頭フィールド部と情報フィールド部と最終フィールド部により構成される。
【0058】
このうち先頭フィールド部のPCBは、プロトコル制御情報を示しデータ転送に必要な制御情報が格納される。例えば、後に詳述するコマンド受信やウエイト応答受信などの情報が格納される。先頭フィールド部のCIDは、ICカードの番号が格納される。
【0059】
情報フィールド部にコマンド本体が格納される。最終フィールド部には、伝送ブロックの誤り検出符号(CRC:Cyclic Redundancy Check)が格納される。情報フィールド部の構成はコマンド受信時とコマンド応答送信時でフィールドが異なり、その構成は次の図4(c)と図4(d)に関する欄にて詳述する。
【0060】
図4(a)と図4(b)に示した情報フィールド部はコマンド受信時とコマンド応答送信時とでは構成が異なる。
【0061】
すなわち、コマンド受信時の情報フィールド部は図4(c)に示すデータが格納される。このうち、CLA、INS、P1、P2はコマンドの種別/動作などを指定するパラメータであり、LCは後に続く、DATA(コマンド本体)の長さを示す。LEは、コマンド応答時に期待するデータの最大長さを示す。
【0062】
次に、コマンド応答時の情報フィールド部は図4(d)に示すデータが格納される。ここで、DATAはデータフィールドを示し、SWl、SW2は応答に対するステータス情報を示す。以上説明したように、伝送プロトコルのフレーム構成は接触用と非接触用とでは互いに異なっている。
【0063】
そのため、本発明においては、接触用伝送時及び非接触用伝送時のいずれにおいても、また、本発明によるコンビ型ICカードに格納されるシステムプログラム及びアプリケーションプログラムのいずれもが参照可能な共有情報のテーブルを揮発性メモリ105に設けている。
【0064】
コマンド受信時に用いられる共有情報を図5に示し、コマンド応答送信時に用いられる共通情報を図7に示す。詳細は後述するが、図5のCLA、INS、P1、P2、LC、LEの各値は図4(c)に示したコマンド受信時の情報フィールド部における同名の各フィールドに対応し、格納アドレスR_DATA_AD、受信データ長R_DATA_LENはコマンド受信時の情報フィールド部におけるDATAの格納場所を示す。
【0065】
また、プロトコル情報R_PSTATには、図6に示すコマンド受信時のプロトコル情報が対応し、受信INF長R_INF_LENは、図4(a)に示した先頭フィールド部のLENに対応する。さらに非接触/接触識別フラグICC_FLAGは前述した接触/非接触判定手段102が判定した接続モードを示し、例えばこの値が0であれば接触モード、1であれば非接触モードであることを示す。
【0066】
同様に詳細は後述するが、図7における送信データ格納アドレスT_DATA_AD、送信データ長T_DATA_LEN、コマンド実行結果SWは、図4(d)に示すコマンド応答送信時情報フィールド部のDATA、SW1、SW2に対応する。また、プロトコル情報T_PSTATには、図8に示すコマンド応答送信時のプロトコル情報に示す、コマンド応答送信TRS_Iまたはウエイト要求送信TRS_WReqを格納する。
【0067】
以下に上述した共有情報を用いて本発明による多目的用途のコンビ型ICカードのアプリケーション実行方法を詳細に説明する。
【0068】
まず、コンビ型ICカードは、接触式または非接触式で外部機器と接続を開始したとき、どちらのI/Fで起動しているかを、接触/非接触判定手段102により判定して、CPU104がシステムプログラムの動作を開始し、システムプログラムに沿って、コンビ型ICカード100を制御する。このシステムプログラムに沿った制御動作を図9のフローチャートに従って説明する。
【0069】
システムプログラムスタート後(SP1)、システムプログラムに基づきCPU104によって図2または図3に示す最初に実行したいアプリケーションプログラムの情報を揮発性メモリ105にセット、例えば、不揮発性メモリ106から得た情報を揮発性メモリ105に格納して登録しておく(SP2)。
【0070】
なお、実行すべきアプリケーションプログラムを予め選択するのは、後述のSP12において、アプリケーション選択コマンドを外部機器から発行しなくとも直ちに最初に登録したアプリケーションに分岐できるようにするためである。このステップは、必須ではなく、また接触式/非接触式を判定する前でなくともよい。最初のコマンドを受信するまで、例えば後述のSP5の直後や、SP9直後に、上記SP2を実行するように設定してもよい。
【0071】
アプリケーションプログラムの情報として、例えばアプリケーションプログラム登録時、予め、不揮発性メモリ106の特定アドレスに対してアプリケーションのIDとアプリケーションの格納先(分岐先)情報が格納されている。
【0072】
接触式で接続しているか非接触式で接続しているかを接触/非接触判定手段102の判定結果を参照することにより判断する(SP3)。接触式であると判定した場合、SP4以後の処理を行う。
【0073】
続いて、揮発性メモリ105に接触モードであることを示す内部フラグを0にセットする(SP4)。その後、接触用I/F103を使用して初期応答情報(ATR:Answer to Reset)を接触用外部機器110に送信する(SP5)。ATRは、接触式ICカードと接触用外部機器110とが互いに接続されたとき、最初にICカードから接触用外部機器110に対して送信するICカード情報である。接触用外部機器110に通知される情報には、通信速度などの接続情報も含まれている。
【0074】
SP5にて示した送信が終了すると、接触用外部機器110とコンビ型ICカード100の接触用I/F103との間でコマンドの送信/受信が可能になる。コマンドは、接続された接触用外部機器110から図4(a)に示した接触用伝送プロトコルコマンドの形式によってコンビ型ICカード100に送信される。コマンド実行結果に対応する応答も同一形式によって、コンビ型ICカード100から接触用外部機器110に送信される。
【0075】
SP6では、図4(a)に示した接触式伝送プロトコルによるコマンド受信処理を行う。接続された接触用外部機器110からコマンドを送信し、接触用I/F103で受信した情報をコマンドブロック1フレーム分、揮発性メモリ105に格納する。ここでコマンドブロックとは、図4に示すそれぞれの伝送プロトコルコマンド1フレーム分を示す。
【0076】
続いて、受信したコマンド情報を上位のアプリケーションプログラムが参照できるようにするため、揮発性メモリ105に格納されたコマンドブロックから情報を切り出し、図5に示した共有情報として揮発性メモリ105に格納する(SP7)。
【0077】
すなわち、CLA、INS、P1、P2、LC、LEの各値は、揮発性メモリ105のアドレスR_a、R_b、R_c、R_d、R_e、R_fにそれぞれ格納される。DATAの格納アドレスR_DATA_AD、及び受信データ長R_DATA_LENは、揮発性メモリ105の各アドレスR_g、R_hにそれぞれ格納される。
【0078】
プロトコル情報R_PSTATは、先頭フィールド部のプロトコル制御情報を示すPCBを参照した図6のコマンド受信時のプロトコル情報として、揮発性メモリ105のアドレスR_iに格納される。コマンド受信の場合、RCV_Iを格納し、ウエイト要求に対する応答受信の場合、RCV_WResを、それぞれ格納する。
【0079】
受信INF長R_INF_LENは、先頭フィールド部における、情報フィールド部の長さを示すLENを参照して揮発性メモリ105のアドレスR_jに格納される。非接触/接触識別フラグICC_FLAGには、SP4のステップでセットされたフラグの値0が揮発性メモリ105のアドレスR_kに格納される。次に、後述するSP12の処理を行う。
【0080】
一方、SP3において、非接触式であると判定された場合、SP8以後の処理を行う。まず、揮発性メモリ105に非接触モードであることを示す内部フラグを1にセットする(SP8)。その後、非接触用外部機器109と非接触用I/F101を使用して初期応答コマンドの交換を行う(SP9)。
【0081】
SP9における初期応答コマンドの交換が終了すると、非接触用外部機器109とコンビ型ICカード100の非接触用I/F101との間でコマンドの送信/受信が可能になる。
【0082】
コマンドは、非接触用外部機器109から図4(b)に示す非接触用伝送プロトコルコマンドの形式によってコンビ型ICカード100に送信される(SP10)。コマンド実行結果に対する応答も同一形式によって、コンビ型ICカード100から非接触用外部機器109に送信される。
【0083】
SP10では、非接触式伝送プロトコルによるコマンド受信処理を行う。非接触用外部機器109からコマンドを送信し、非接触用I/F101で受信した情報を前述した接触式の場合と同様にコマンドブロック1フレーム分を揮発性メモリ105に格納する。なお、情報フィールド部に格納されるデータ構成は、前述した接触式の場合と同一である。
【0084】
続いて、受信したコマンド情報を上位のアプリケーションプログラムが参照できるようにするため、揮発性メモリ105に格納されたコマンドブロックから情報を切り出し、図5に示す共有情報として揮発性メモリ105にそれぞれ格納する(SP11)。
【0085】
共有情報として揮発性メモリ105に格納するデータのうち、受信INF長R_INF_LENは、非接触伝送プロトコルの場合、情報として存在しないため、コマンドブロック1フレーム受信時に、システムプログラム内で受信データ数をカウントして、情報フィールド部の長さを算出した値が揮発性メモリ105のアドレスR_jに格納される。非接触/接触識別フラグICC_FLAGには、SP8のステップでセットしたフラグの値1が揮発性メモリ105のアドレスR_kに格納される。
【0086】
その他の共有情報は、前述した接触式と同様に揮発性メモリ105のそれぞれのアドレスに格納される。次にSP12の処理を行う。
【0087】
SP12では、非接触用外部機器109あるいは接触用外部機器110から送信されたコマンドがシステムプログラム上に搭載した特定のアプリケーションを選択する選択コマンドかどうかを、アプリケーションプログラムが揮発性メモリ105をアクセスして判定する。
【0088】
アプリケーションの選択コマンドであるとアプリケーションプログラムが判定した場合、上記アプリケーションプログラムは、以降の処理を続行し、SP14へ進み選択したアプリケーションの分岐先の情報を揮発性メモリ105に格納する。アプリケーションプログラムの分岐先情報は、SP2のステップで格納した揮発性メモリ105の領域から分岐先情報を参照することにより得られる。
【0089】
また、アプリケーションの選択コマンドに対する応答を非接触用外部機器109及び接触用外部機器110へ送信するため、図7に示したコマンド応答送信時に、指定する情報を揮発性メモリ105に格納する。アプリケーションの選択コマンドでない場合、SP13に進み揮発性メモリ105から現在選択されているアプリケーションの分岐先情報を読み出した後、上記アプリケーションプログラムに分岐する。
【0090】
SP15では、コマンドの実行結果に対する応答を接触用I/F103か非接触用I/F101のどちらで非接触用外部機器109または接触用外部機器110へ送信するかを判定する。判定は、SP4、SP8の各ステップでセットした内部フラグの値によりなされる。内部フラグの値が0の時、接触式と判定し、SP16を実行する。内部フラグの値が1の時、非接触式と判定し、SP17を実行する。
【0091】
接触式の場合、SP16において、図7に示すコマンド応答送信時に指定する情報(送信データ格納アドレスT_DATA_AD及び送信データ長T_DATA_LEN)を参照し、図4(a)に示す接触用伝送プロトコルコマンド構成に変換して送信データとして揮発性メモリ105に格納する。そして、送信データを揮発性メモリ105から順番に読み出し、接触用I/F103を介して接触用外部機器110に送信する。データ送信後は、次のコマンドを受信するためにSP6へ戻る。
【0092】
図7に示すコマンド応答送信時に指定する情報は、SP13またはSP14において、次のように揮発性メモリ105に対して予め格納しておく。
【0093】
図7における揮発性メモリ105のアドレスT_aに送信データ格納アドレスT_DATA_AD、アドレスT_bに送信データ長T_DATA_LEN、アドレスT_cにコマンド実行結果SWを格納する。これらは、図4(b)のコマンド応答送信時情報フィールド部のDATA、SW1、SW2にデータを格納するための情報である。
【0094】
また、アドレスT_dにプロトコル情報T_PSTATを格納する。プロトコル情報T_PSTATには、図8のコマンド応答送信時のプロトコル情報に示す、コマンド応答送信TRS_Iまたはウエイト要求送信TRS_WReqが格納される。これは、図4(a)に示した接触用伝送プロトコルコマンドにおける先頭フィールド部のPCBにデータを格納するための情報である。また、ウエイト要求を送信する場合は、アドレスT_eにウエイト要求値T_WAITを格納する。
【0095】
これらの情報については、常にすべての情報を格納しておく必要はない。
【0096】
コマンドに対する応答を送信したい場合は、送信データ格納アドレスT_DATA_AD、送信データ長T_DATA_LEN、コマンド実行結果SWに情報を格納する。プロトコル情報T_PSTATには、図8に示したコマンド応答送信TRS_Iを格納する。
【0097】
ウエイト要求を送信するときは、プロトコル情報T_PSTAT、ウエイト要求値T_WAITのみ格納する。プロトコル情報T_PSTATには、ウエイト要求送信TRS_WReqを格納する。
【0098】
上述の格納情報を参照し、図4(a)の接触用伝送プロトコルコマンド構成への変換は、次のように行う。先頭フィールド部、情報フィールド部、最終フィールド部の順番に揮発性メモリ105に格納する。
【0099】
先頭フィールド部のNADには、コマンド受信時のNADの送信元と宛先を反対にしたデータを格納する。PCBには、プロトコル情報T_PSTATの制御情報を格納する。LENには、情報フィールド部の長さを格納する。情報フィールド部のDATAは、揮発性メモリ105に格納した送信データ格納アドレスT_DATA_ADから送信データ長T_DATA_LEN分読み出したデータを格納する。SW1、SW2には、コマンド実行結果SWのデータを格納する。最終フィールド部には、伝送ブロックの誤り検出符号を格納する。
【0100】
ウエイト要求を送信する場合は、先頭フィールド部のLENに1を格納し、情報フィールド部にウエイト要求値T_WAITの値を情報フィールドDATA部に1バイト格納する。
【0101】
一方、非接触式の場合、SP17において図7に示すコマンド応答送信時に指定する情報を参照し、図4に示す非接触用伝送プロトコルコマンド構成に変換し、送信データとして揮発性メモリ105に格納する。そして、送信データを揮発性メモリ105から順番に読み出し、非接触用I/F101を介して非接触用外部機器109に送信する。データ送信後は、次のコマンドを受信するためにSP10へ戻る。
【0102】
図7に示すコマンド応答送信時に指定する情報は、SP13またはSP14において、上述したように揮発性メモリ105にあらかじめ格納しておく。
【0103】
上述の格納情報を参照し、図4(b)の非接触用伝送プロトコルコマンド構成への変換は、次のように行う。先頭フィールド部、情報フィールド部、最終フィールド部に関する各情報を、それらの順番にて揮発性メモリ105にそれぞれ格納する。
【0104】
先頭フィールド部のPCBには、プロトコル情報T_PSTATの制御情報を格納する。CIDには、コマンド受信時に得られたCIDの値を格納する。情報フィールド部のDATAは、揮発性メモリ105に格納した送信データ格納アドレスT_DATA_ADから送信データ長T_DATA_LEN分読み出したデータを格納する。SW1、SW2には、コマンド実行結果SWのデータを格納する。最終フィールド部には、伝送ブロックの誤り検出符号を格納する。
【0105】
ウエイト要求を送信する場合は、情報フィールド部にT_WAITの値を情報フィールドDATA部に1バイト格納する。
【0106】
次に、図9に示したSP13のステップで実行するアプリケーションプログラムの動作手順について図10、図11、図12を用いて説明する。
【0107】
図10は、接触式/非接触式両方で実行可能な共有アプリケーションプログラムの動作フローチャートである。システムプログラムからこのアプリケーションプログラムに分岐し(SAP00)、続いて、図5に示したコマンド受信時に格納される共有情報の内、揮発性メモリ105のアドレスR_kから接触/非接触識別フラグICC_FLAGを読み出し、現在の接続モードを判定する(SAP01)。接触モードであると判定したとき、接触モードでのコマンド判定処理を行う(SAP02)。
【0108】
コマンドの判定処理は、図5に示した、揮発性メモリ105に格納された共通情報である、CLA、INS、P1、P2の値を揮発性メモリ105の各アドレスR_a、R_b、R_c、R_dから読み出して判定される。
【0109】
次に、非接触モードのコマンド処理を実行して(SAP03)、SAP06へ進む。
【0110】
SAP01において、非接触モードであると判定したとき、非接触モードでのコマンド判定処理を行う(SAP04)。コマンドの判定処理は、図5に示した、揮発性メモリ105に格納された共有情報である、CLA、INS、P1、P2の値を揮発性メモリ105の各アドレスR_a、R_b、R_c、R_dから読み出して判定される。
【0111】
次に、非接触モードのコマンド処理を実行して(SAP05)、SAP06へ進む。SAP06では、SAP03またはSAP05において実行したコマンドの応答情報を図7に示したコマンド応答送信時に指定する情報に従って、揮発性メモリ105に格納する。この後、システムプログラムヘ復帰する(SAP07)。
【0112】
図11は、接触式のみで実行可能なアプリケーションプログラムの動作フローチャートである。システムプログラムからこのアプリケーションプログラムに分岐し(SAP10)、図5に示したコマンド受信時に格納される共有情報の揮発性メモリ105のアドレスR_kから接触/非接触識別フラグICC_FLAGを読み出し、現在の接続モードを判定する(SAP11)。
【0113】
接触モードであると判定したとき、接触モードでのコマンド判定処理を行う(SAP12)。コマンドの判定処理は、図5に示した、揮発性メモリ105に格納された、共通情報であるCLA、INS、P1、P2の値を揮発性メモリ105の各アドレスR_a、R_b、R_c、R_dから読み出して判定される。
【0114】
次に、接触モードのコマンド処理を実行して(SAP13)、SAP15へ進む。
【0115】
SAP11において、非接触モードであると判定したとき、受信コマンドは非接触モードで実行不可と判定し、エラー応答情報を用意する(SAP14)。
【0116】
SAP15では、SAP13によって実行したコマンドの応答情報、またはSAP14のエラー応答情報を図7に示したコマンド応答送信時に指定する情報に従って、揮発性メモリ105に格納する。この後、システムプログラムヘ復帰する(SAP16)。
【0117】
図12は、非接触式のみで実行可能なアプリケーションプログラムの動作フローチャートである。システムプログラムから、このアプリケーションプログラムに分岐し(SAP20)、図5に示したコマンド受信時に格納される共有情報である、接触/非接触識別フラグICC_FLAGを揮発性メモリ105のアドレスR_kから読み出し、現在の接続モードを判定する(SAP21)。
【0118】
非接触モードであると判定したとき、非接触モードでのコマンド判定処理を行う(SAP22)。コマンドの判定処理は、図5に示した、揮発性メモリ105に格納された、共通情報であるCLA、INS、P1、P2の値を揮発性メモリ105の各アドレスR_a、R_b、R_c、R_dからそれぞれ読み出して判定される。
【0119】
次に、非接触モードのコマンド処理を実行して(SAP23)、SAP25へ進む。
【0120】
一方、SAP21において、接触モードであると判定されたとき、受信コマンドは接触モードで実行不可と判定して、エラー応答情報を用意する(SAP24)。
【0121】
SAP25では、SAP23において実行したコマンドの応答情報または、SAP14のエラー応答情報を図7に示したコマンド応答送信時に指定する情報に従って、揮発性メモリ105に格納する。この後、システムプログラムヘ復帰する(SAP26)。
【0122】
次に、図10のSAP03またはSAP05、図11のSAP13、図12のSAP23の各ステップで実行する、コマンド実行処理について図13、図14を用いて説明する。
【0123】
コマンド実行処理には、時間がかかるものがあり、非接触用外部機器109、接触用外部機器110から受信したコマンドをアプリケーションプログラムが実行している間に、時間超過のため、非接触用外部機器109、接触用外部機器110がコマンドに対する応答なしと判定する場合がある(いわゆる、タイムアウト)。
【0124】
このようにコマンド処理に時間がかかる場合、非接触用外部機器109、接触用外部機器110に対してウエイト要求を送信し、ウエイト応答を受信することで、非接触用外部機器109、接触用外部機器110は、送信したコマンドに対する応答を受信するまで待つことができる。
【0125】
また、ウエイト時間を延長したい場合は、再度、非接触用外部機器109、接触用外部機器110に対してウエイト要求を行う。このウエイト要求送信/応答受信の各動作は、図13、図14におけるコマンド処理で行うように設定されている。
【0126】
図13に示すように、まず、コマンド処理がスタートしたとき(SC00)、コマンド処理にウエイト要求が必要かどうかを判定する(SC01)。ウエイト要求が必要なコマンドとして、例えば認証など暗号処理を伴う演算処理に時間がかかるコマンドが挙げられる。ウエイト要求が必要ないコマンドとして、例えばアプリケーションプログラムが管理するファイルを読み出すような時間がかからないコマンドが挙げられる。
【0127】
コマンド処理にウエイト要求が必要かどうかを判定する方法としては、予め処理に長時間を要することが既知のコマンドをアプリケーションが判定したり、内蔵するフラッシュメモリの消去等処理に長時間を要する内部処理中に、受信したコマンドをシステムプログラムが判定したりする等がある。
【0128】
ウエイト要求が必要なコマンドでは、コマンド実行前にウエイト要求を非接触用外部機器109、接触用外部機器110に送信する必要がある。ウエイト要求が必要であると判定した場合、図5における共有情報の揮発性メモリに格納された、プロトコル情報R_PSTATをアドレスR_iから読み出して、受信ステータスがウエイト応答受信RCV_WResかどうかを判定する(SC02)。
【0129】
RCV_WResでない場合は、まだウエイト要求を行っていないのでSC04へ進み、ウエイト要求送信を行うための情報を用意する。図7の送信時に指定する情報のうち、プロトコル情報T_PSTATに格納する情報として図8のウエイト要求送信TRS_WReqとウエイト要求値T_WAITに格納する情報を用意する。
【0130】
また、コンビ型ICカード100のタイマ回路107と割り込み回路108を利用してウエイトの自動延長を行うために、自動延長の時間間隔をタイマカウント数として揮発性メモリ105にセットする(SC04)。続いて、タイマ回路107を起動する(SC05)。
【0131】
SC02における判定において、受信ステータスがRCV_WResすなわち、ウエイト要求に対する応答有りと判定されたとき、次に進みコマンドを実行する(SC06)。続いて、ウエイト要求の自動延長用タイマを停止する(SC07)。
【0132】
一方、SC01における判定において、ウエイトが必要ないコマンドと判定した場合、受信ステータスがコマンド受信RCV_Iであることを確認し(SC03)、SC06に進みコマンドを実行する。受信ステータスがコマンド受信RCV_Iでない場合は、エラー応答送信のための情報を用意するようになっている(SC08)。
【0133】
ウエイト要求が必要なコマンド実行において1度目のウエイト要求/応答後、SC06のステップでコマンド実行中に、SC04、SC05で起動したタイマ割り込みを利用して、ウエイト再延長要求を行うようになっている。コマンド実行中にタイマ割り込みが発生したとき、図14に示すフローでウエイト再延長要求送信/応答受信を行う。
【0134】
まず、タイマ−割り込みがスタートすると(ST00)、揮発性メモリ105からタイマカウント値を読み出し、0かどうか確認する(ST01)。0でなければ、まだ再延長時間経過していないと見なし、タイマカウント値を1減じて揮発性メモリ105に格納し(ST03)割り込み処理を終了する。
【0135】
タイマカウント値が0になっていれば、再延長時間経過したとみなし、接続されている外部機器109、110との間でウエイト要求を送信し(ST02)、続いて、応答受信を行う(ST04)。そして、ST04−1のステップによってタイマカウント数を再セットして割り込み処理を終了する(ST05)。図13に示したSC06のコマンド実行が終了するまで、ウエイト時間の再延長処理が行われる。
【0136】
図15は、図9、図10、図11、図12、図13、図14に記載の動作において、外部機器、システムプログラム、アプリケーション間のデータのやりとりを簡単に示したタイミングチャートである。
【0137】
図9のSP6からSP16の接触用I/Fによるコマンドの送受信およびSP10からSP17の非接触用I/Fによるコマンドの送受信ループにおいて、外部機器109、110からウエイトを必要としない第1のコマンドを送信したとき、コンビ型ICカード100のシステムプログラムでコマンドの受信を行い、図10、図11、図12のいずれかのアプリケーションプログラムヘコマンド情報が渡される。
【0138】
それぞれのアプリケーションプログラム内でコマンドを実行し、終了するとコマンドの応答情報をシステムプログラムヘ返却する。システムプログラムにおいて、接触式または非接触用I/Fを判定し、接続されている外部機器109、110にコマンド応答を送信する。
【0139】
上記外部機器109、110からウエイトを必要とする第2のコマンドを送信したとき、システムプログラムでコマンドの受信を行い、図10、図11、図12のいずれかのアプリケーションプログラムへコマンド情報が渡される。
【0140】
それぞれのアプリケーションプログラム内のコマンド実行ステップを示す、図13において、ウエイト要求が必要と判定されたとき、第1のウエイト要求情報をシステムプログラムヘ返却する(戻す)。
【0141】
システムプログラムにおいて、接続状態にあるのが、接触式I/F103または非接触用I/F101かを判定し、その判定結果に応じた接続されている外部機器109、110にウエイト要求を送信する。次に外部機器109、110がシステムプログラムヘ第1のウエイト要求に対するウエイト応答をシステムプログラムヘ送信する。
【0142】
ウエイト応答情報は、各アプリケーションプログラムヘ渡され図13において、コマンド実行を開始する。コマンド実行が第1のウエイト要求による時間内に終了しない場合、第2のウエイト要求を行うために、図14における割り込み処理によって、ウエイトの再延長要求/応答を行う。
【0143】
コマンド実行が終了したとき、コマンドの応答情報をシステムプログラムヘ返却する。システムプログラムにおいて、接続状態にあるのが、接触式I/F103または非接触用I/F101かを判定し、その判定結果に応じた接続されている、外部機器109、110にコマンド応答を送信する。
【0144】
以上のような実施の形態により、接触式および非接触式の伝送プロトコル上の違いを吸収して、アプリケーションプログラムに確実にコマンドを受け渡すことができ、確実にコマンド実行結果を外部機器に返却することができるアプリケーション共通化方式を提供することができる。
【0145】
また、コンビ型ICカードに搭載しているアプリケーションプログラムから外部機器に対してウエイト要求を行った場合、接触用I/F103が選択されていても、非接触用I/F101が選択されていても、外部機器109、110でタイムアウトが発生することがないアプリケーション共通化方式を提供することができる。
【0146】
一枚のコンビ型ICカードに、接触式/非接触式の両方で動作可能なアプリケーションプログラム、接触式のみで動作可能なアプリケーションプログラム、非接触式のみで動作可能なアプリケーションなどのような複数のアプリケーションプログラムが搭載された場合にも、アプリケーションプログラムに確実にコマンドを受け渡すことができ、確実にコマンド実行結果を外部機器に返却(出力)することができるアプリケーション共通化方式を提供することができる。
【0147】
本発明は、前記の課題を解決するために、以下の各手段1.〜6.をそれぞれ提供している。
【0148】
手段1.接触用I/Fと非接触用I/Fを有し、どちらのI/Fで起動されているか判別可能なシステムプログラムを搭載したコンビ型ICカードにおいて、前記システムプログラムは、外部機器から受信した接触用I/Fのコマンドと非接触用I/Fのコマンドとからコマンド情報を抽出して揮発性メモリに格納しICカードアプリケーションプログラムにコマンド情報を受け渡すように構成されているコンビ型ICカードのアプリケーション共通化方式が提供される。
【0149】
手段2.接触用I/Fと非接触用I/Fを有し、どちらのI/Fで起動されているか判別可能なシステムプログラムを搭載したコンビ型ICカードにおいて、前記システムプログラムは、ICカードアプリケーションプログラムからの送信情報を揮発性メモリに格納し、接触用I/Fのコマンドまたは非接触用I/Fのコマンドに変換して、外部機器へ送信するように構成されているコンビ型ICカードのアプリケーション共通化方式が提供される。
【0150】
手段3.接触用I/Fと非接触用I/Fを有し、どちらのI/Fで起動されているか判別可能なシステムプログラムを搭載したコンビ型ICカードにおいて、前記システムプログラムは、外部機器から受信した接触用I/Fのコマンドと非接触用I/Fのコマンドからコマンド情報を抽出して揮発性メモリに格納しICカードアプリケーションプログラムにコマンド情報を受け渡す。前記コマンド情報に、接触用I/Fまたは非接触用I/Fのプロトコル情報を含み、ICカードアプリケーションプログラムが参照できるように構成されているコンビ型ICカードのアプリケーション共通化方式が提供される。
【0151】
手段4.接触用I/Fと非接触用I/Fを有し、どちらのI/Fで起動されているか判別可能なシステムプログラムを搭載したコンビ型ICカードにおいて、前記システムプログラムは、外部機器から受信した接触用I/Fのコマンドと非接触用I/Fのコマンドからコマンド情報を抽出して揮発性メモリに格納しICカードアプリケーションプログラムにコマンド情報を受け渡す。前記コマンド情報に、接触用I/Fまたは非接触用I/Fの接触モード/非接触モードの識別フラグを含み、ICカードアプリケーションプログラムが参照できるように構成されているコンビ型ICカードのアプリケーション共通化方式が提供される。
【0152】
手段5.接触用I/Fと非接触用I/Fを有し、どちらのI/Fで起動されているか判別可能なシステムプログラムを搭載したコンビ型ICカードにおいて、前記システムプログラムは、ICカードアプリケーションプログラムから送信指定したウエイト要求コマンドに対し、ウエイト要求/応答を外部機器に対して送受信し、ウエイト時間延長が必要な場合はウエイト要求コマンドの送受信を自動で行うように構成されているコンビ型ICカードのアプリケーション共通化方式が提供される。
【0153】
手段6.接触用I/Fと非接触用I/Fを有し、どちらのI/Fで起動されているか判別可能なシステムプログラムを搭載したコンビ型ICカードにおいて、前記システムプログラムは、一枚のコンビ型ICカード上に、接触式/非接触式両方で動作可能なアプリケーションプログラム、接触式のみで動作可能なアプリケーションプログラム、非接触のみで動作可能なアプリケーションプログラムなど複数アプリケーションプログラムを搭載した場合に、アプリケーションプログラムを選択できるように構成されている、コンビ型ICカードのアプリケーション共通化方式が提供される。
【0154】
また、本発明のコンビ型ICカードの制御方法は、前記の課題を解決するために、以下の各制御方法1.〜5.をそれぞれ提供している。
【0155】
制御方法1.は、外部機器との接触用I/F及び非接触用I/Fを有し、どちらのI/Fで起動されているか判別可能なシステムプログラム及び少なくとも1つのアプリケーションプログラムを格納した記憶領域を備えた接触式及び非接触式兼用のICカードであるコンビ型ICカードの制御方法において、前記システムプログラムにより、現在の外部機器との接続モードが接触式か非接触式かを判別し、前記判別結果を記憶する第1のステップと、前記外部機器から受信したコマンドの各フィールドに含まれるコマンド情報を抽出して前記アプリケーションプログラムからアクセス可能な記憶領域に記憶する第2のステップと、前記受信したコマンドが実行すべきアプリケーションの選択コマンドであるか判別する第3のステップと、前記第3のステップでアプリケーションの選択コマンドであれば選択されたアプリケーション実行に必要な情報を記憶する第4のステップと、前記第3のステップでアプリケーションの選択コマンドでなければ既に選択されているアプリケーションプログラムを実行する第5のステップと、前記コマンドあるいはアプリケーションプログラムの実行結果情報を前記記憶領域へ記憶する第6のステップと、前記第6のステップで記憶した実行結果情報を前記外部機器へ応答として送信(出力)する第7のステップとを含むことを特徴としている。
【0156】
制御方法2.は、さらに、前記第5のステップで実行すべきアプリケーションプログラムが、接触式及び非接触式のいずれの接続モードでも実行可能な場合、前記5のステップはさらに、前記第1のステップで判別した接続モードを確認する第8のステップと、前記第8のステップで確認された接続モードでアプリケーションを実行する第9のステップと、前記第9のステップで実行した結果情報を前記記憶領域へ記憶する第10のステップを含んでいてもよい。
【0157】
制御方法3.は、前記第5のステップで実行すべきアプリケーションプログラムが、接触モードでのみ実行可能な場合、前記第5のステップはさらに、前記第1のステップで判別した接続モードを確認する第11のステップと、前記第11のステップで確認された接続モードが接触モードでない場合、エラー応答情報を前記記憶領域へ記憶する第12のステップと、前記第11のステップで確認された接続モードが接触モードである場合、接触モードで前記アプリケーションプログラムを実行する第13のステップと、前記第13のステップで実行した結果情報を前記記憶領域へ記憶する第14のステップを含んでいてもよい。
【0158】
制御方法4.は、前記第5のステップで実行すべきアプリケーションプログラムが、非接触モードでのみ実行可能な場合、前記第5のステップはさらに前記第1のステップで判別した接続モードを確認する第15のステップと、前記第15のステップで確認された接続モードが非接触モードでない場合、エラー応答情報を前記記憶領域へ記憶する第16のステップと、前記第15のステップで確認された接続モードが非接触モードである場合、非接触モードで前記アプリケーションプログラムを実行する第17のステップと、前記第17のステップで実行した結果情報を前記記憶領域へ記憶する第18のステップを含んでいてもよい。
【0159】
制御方法5.は、前記第5のステップで実行すべきアプリケーションプログラムが、前記外部機器に対してウエイト要求することを必要とする場合、前記5のステップはさらに、前記外部機器から既にウエイト応答情報を受信しているか確認する第19のステップと前記第19のステップでウエイト応答情報を受信していなければ、ウエイト要求情報を前記記憶領域へ記憶する第20のステップと、前記第19のステップでウエイト応答情報を受信しており、かつ所定の時間以内に前記アプリケーションの実行が完了しなかった場合、再度ウエイト要求情報を前記記憶領域へ記憶する第21のステップとを含んでいてもよい。
【0160】
上記のような、本発明に係るコンビ型ICカードの各制御方法は、それぞれ、コンピュータにて解読可能で実行可能な形態、例えばC言語にて記述されたシステムプログラムを、例えばCD−ROMの形態にて市場に流通させることができる。
【0161】
【発明の効果】
以上説明したように、この発明によれば、接触用および非接触用I/Fを有するコンビ型ICカードにおいて、共通に動作するアプリケーションプログラム、接触式でのみ動作するアプリケーションプログラム、非接触式でのみ動作するアプリケーションプログラムを搭載するシステムプログラムを有する、さまざまな用途に対応可能なコンビ型ICカードを実現するアプリケーション共通化方式が提供できるという効果を奏する。
【図面の簡単な説明】
【図1】 本発明のコンビ型ICカードを示すブロック図である
【図2】 上記コンビ型ICカードにおける、システムプログラム上に一つの接触/非接触共通アプリケーションプログラムが構成されている場合を示すブロック図である。
【図3】 上記コンビ型ICカードにおける、システムプログラム上に接触/非接触共通アプリケーションプログラム、接触専用アプリケーションプログラム、非接触専用アプリケーションプログラムなど複数のアプリケーションプログラムが構成されている場合を示すブロック図である。
【図4】 (a)〜(d)は、上記コンビ型ICカードにおける、接触式および非接触式のプロトコルの各フレーム構成図である。
【図5】 上記コンビ型ICカードにおける、コマンド受信時にシステムプログラムとアプリケーションプログラムとが共有する共有情報の表である。
【図6】 上記コンビ型ICカードにおける、コマンド受信時のプロトコル情報を示す表である。
【図7】 上記コンビ型ICカードにおける、コマンド応答送信時に指定する情報を示す表である。
【図8】 上記コンビ型ICカードにおける、コマンド応答送信時のプロトコル情報を示す表である。
【図9】 上記コンビ型ICカードにおける、システムプログラムの動作フローチャートである。
【図10】 上記コンビ型ICカードにおける、接触式/非接触式共有アプリケーションの動作フローチャートである。
【図11】 上記コンビ型ICカードにおける、接触式専用アプリケーションの動作フローチャートである。
【図12】 上記コンビ型ICカードにおける、非接触式専用アプリケーションの動作フローチャートである。
【図13】 上記コンビ型ICカードにおける、アプリケーションプログラムコマンド実行の動作フローチャートである。
【図14】 上記コンビ型ICカードにおける、割り込み処理を使用したウエイト要求交換の動作フローチャートである。
【図15】 上記コンビ型ICカードにおける、外部機器、システムプログラム、アプリケーション間のデータのやりとりを示したタイミングチャートである。
【図16】 従来のコンビ型ICカードの動作を示すフローチャートである。
【符号の説明】
101 非接触用I/F(インターフェース)
102 接触/非接触判定手段(判定部)
103 接触用I/F(インターフェース)
104 CPU(抽出部)
105 揮発性メモリ(第二記憶部)
106 不揮発性メモリ(第一記憶部)
109 非接触用外部機器(外部機器)
110 接触用外部機器(外部機器)
[0001]
BACKGROUND OF THE INVENTION
  The present invention relates to a combination-type IC card having both functions of a contact IC card and a non-contact IC card, a control method thereof, and a system program thereof.
[0002]
[Prior art]
  The IC card has been classified into a contact IC card that performs contact with an external device through a contact and a non-contact IC card that performs contact with an external device without using a contact. In recent years, a combination type IC card having functions of both interfaces (hereinafter abbreviated as I / F) has been developed.
[0003]
  International standards for contact IC cards include ISO / IEC7816. ISO / IEC7816-3 standardizes transmission protocols and initialization procedures with external devices, and ISO / IEC7816-4 standardizes common commands (command structure). .
[0004]
  As an international standard for non-contact type IC cards, there is ISO / IEC14443, and ISO / IEC14443-3 standardizes an initialization procedure, and ISO / IEC14443-4 standardizes a transmission protocol with an external device.
[0005]
  In a combination type IC card (hereinafter abbreviated as a combination type IC card), when operating as a contact type IC card, the transmission protocol of the ISO / IEC7816-3 is applied to perform command transmission / reception with an external device, When operating as a non-contact IC card, the transmission / reception of commands to / from an external device is performed by applying the transmission protocol of ISO / IEC 14443-4.
[0006]
  An example of a combination type IC card is disclosed in Japanese Patent Laid-Open No. 11-272824. This combination type IC card has contact I / F and non-contact I / F, means for discriminating whether it is operating in contact type or non-contact type, and contacts with external devices based on the determination result Means for switching executable commands when responding by a formula and when responding without contact with an external device.
[0007]
  When this combination type IC card receives a command by communication with an external device, as shown in FIG. 16, it first determines whether or not it is a contact type activation (step 1, hereinafter, step is abbreviated as S), If it is a contact type, the contact type command list is referred to (S3). If it is not a contact type, it is determined whether or not the activation is based on a non-contact type (S2), and if it is a non-contact type, a non-contact type command list is referenced (S4). Next, when it is determined that there is a command that matches the received command in the command list (S5), a ROM subroutine program is executed (S6). If the received commands do not match, it is determined that execution is impossible, and error processing is executed.
[0008]
  As a result, it is possible to provide a combination type IC card that can perform the same function both in the case of being driven by a contact type and in the case of being driven by a non-contact type, and that can prevent malfunction in various applications. Are listed.
[0009]
[Problems to be solved by the invention]
  In the case of a combination IC card, the transmission protocol for communicating with an external device differs depending on whether the contact I / F is selected or the non-contact I / F is selected. Therefore, in order to perform the same operation regardless of which I / F is selected in the application program on the combination IC card, the command is surely received by the application program by absorbing the difference in the transmission protocol. Need to pass.
[0010]
  In addition, in an application program installed in a combination type IC card, if it takes time to process a command received from an external device, a timeout (communication state that is interrupted due to time out) occurs for the external device. In order to prevent this, a wait (wait) request command may be transmitted to the external device and a wait response may be received from the external device.
[0011]
  However, the contact I / F transmission protocol and the non-contact I / F transmission protocol have different waiting times for the contact I / F. Even if the wait request is transmitted to the external device, the non-contact I / F has a problem that a timeout occurs in the external device.
[0012]
  In addition, when the above-described combination type IC card is connected with a contact I / F, it is determined whether or not the command can be executed with reference to a contact command list, and the combination IC card is connected with a non-contact I / F. If it is, determine whether the command can be executed by referring to the non-contact command list, or provide a common command list to determine whether the command can be executed by the contact type or non-contact type, contact type / non-contact type This is a method for determining whether or not both can be executed.
[0013]
  This combination type IC card is effective when a single application program is installed on a single combination type IC card, but it is a contact type / non-contact type on a single combination type IC card. For application to multi-purpose combination IC cards that have multiple applications such as application programs that can be operated by both types, application programs that can be operated only by contact types, and applications that can be operated only by non-contact types There is no consideration, and even if it is applied to such a use, it is necessary to prepare a command list for each application, and there is a problem that the procedure becomes complicated.
[0014]
  Further, in this combination type IC card, it is necessary to send / receive commands using the same transmission protocol for the contact type and the non-contact type, and operation with different transmission protocols is not considered.
[0015]
  The objects of the present invention are the following three items.
[0016]
  1) Application commonization system that absorbs the difference in contact and non-contact transmission protocols, can reliably send commands to application programs, and can reliably send (output) command execution results to external devices I will provide a.
[0017]
  2) When a weight request is made to an external device from an application program mounted on a combination type IC card, even if a contact I / F is selected or a non-contact I / F is selected, Provide a common application method that avoids timeouts in external devices.
[0018]
  3) Multiple applications such as an application program that can be operated by both contact type and non-contact type, an application program that can be operated only by contact type, an application that can be operated only by non-contact type, etc. Even when a program is installed, a common application method is provided that can reliably pass a command to an application program and reliably transmit a command execution result to an external device.
[0019]
[Means for Solving the Problems]
  In order to solve the above problems, the combination type IC card of the present invention determines which I / F is activated, ie, a contact I / F for communication with an external device or a non-contact I / F. Command information extracted from the command via the contact I / F or non-contact I / F received from the external device, the first storage unit storing the system program and at least one application program A second storage unit for storing;Included in each field of the command received from an external deviceAn extraction unit for extracting the command information so as to be accessible by the application program;The second storage unit stores, as response transmission command information, wait request value information indicating a processing wait period for requesting a wait for the external device, and further includes an interrupt processing circuit, a timer circuit, When an interrupt occurs due to the end of the count of the timer circuit set at a predetermined time during execution of the input command, the count value is decremented by 1 unless the count value having the wait request value as an initial value is 0, If it is 0, it has a resetting means for transmitting a wait request command to the external device and resetting the count value to the initial value.It is characterized by that.
[0020]
  According to the above configuration,Included in each field of the command received from an external deviceBy having an extraction unit that extracts the command information so that it can be accessed by the application program, it is possible to absorb the difference in the contact and non-contact transmission protocols and reliably pass the command to the application program. The command execution result can be reliably transmitted (output) to the external device.
[0021]
  Furthermore, according to the above configuration, when a wait request is issued from an installed application program to an external device, there is a resetting means, so even if the contact I / F is selected, no contact is made. Even when the use I / F is selected, it is possible to avoid a timeout from occurring in the external device.
[0022]
  In the combination IC card, the first storage unit storing the system program and at least one application program is preferably composed of a rewritable nonvolatile storage element.
[0023]
  In the combination IC card, it is preferable that the second storage unit for storing the command information is composed of a volatile storage element.
[0024]
  In the combination type IC card, the second storage unit includes, as received command information, information specifying the type or operation of the received command, storage location information of the received data, protocol information indicating attributes of the received command, Preferably, at least one selected from the group consisting of connection mode information indicating whether communication is performed by contact or non-contact is stored.
[0025]
  In the combination IC card, in the second storage unit, as response transmission command information, storage location information of data to be transmitted, status information indicating the execution result of the command, protocol information indicating the attribute of the command to be transmitted, It is desirable that at least one selected from the group consisting of wait request value information indicating a processing wait period for requesting a wait for an external device is stored..
[0026]
In order to solve the above-mentioned problem, the control method for a combination type IC card of the present invention can receive commands from an external device in a contact type and a non-contact type, respectively, and can receive either a contact type or a non-contact type. In the control method of a combination type IC card which is a contact type and non-contact type IC card that executes an application program corresponding to the command and outputs the execution result to the external device, the received result is received from the external device. Extracts command information contained in each field of the command so that it can be accessed from the application programIf the execution of the application program requires a wait request to the external device, it is confirmed whether wait response information has already been received from the external device, and if the wait response information has not been received. When the wait request information is output, the wait response information is received, and the execution of the application program is not completed within a predetermined time, the wait request information is output again.It is characterized by doing.
[0027]
  According to the above method, by making the command information included in each field of the command received from the external device accessible from the application program, the difference between the contact type and the non-contact type transmission protocol is absorbed, and the application program The command can be reliably delivered to and the command execution result can be reliably transmitted (output) to the external device.
[0028]
  Furthermore, according to the above method, when a wait request is made to the external device from the installed application program, the wait request information is output again, so even if the contact method is selected, the non-contact method is selected. Even if it is, it can be avoided that a timeout occurs in the external device.
[0029]
  In the above control method, it is preferable that the application program is executed in the determined connection mode when the application program can be executed in either the contact type or the non-contact type connection mode.
[0030]
  In the above control method, when the application program can be executed only in the contact mode, when the determined connection mode is not the contact mode, error response information is output, and when the determined connection mode is the contact mode, It is desirable to execute the application program in a contact mode.
[0031]
  In the control method, when the application program can be executed only in the non-contact mode, error response information is output when the determined connection mode is not the non-contact mode, and the determined connection mode is the non-contact mode. In some cases, it is preferable to execute the application program in a non-contact mode.
[0032]
  According to the above method, an application program that can be operated by both contact type and non-contact type, an application program that can be operated only by contact type, an application that can be operated only by non-contact, etc. Even when multiple application programs are installed, commands can be reliably passed to the application program, and command execution results can be reliably transmitted to external devices..
[0033]
In order to solve the above-described problems, a system program for a combination type IC card according to the present invention is characterized by executing and executing any one of the control methods described above.
[0034]
DETAILED DESCRIPTION OF THE INVENTION
  Hereinafter, embodiments of a combination type IC card according to the present invention will be described in detail with reference to FIGS. As shown in FIG. 1, in a combination type IC card 100 as an embodiment to which the application sharing method according to the present invention is applied, a non-contact I / F 101, a contact / non-contact determination means 102, a contact I / F F103, CPU (Central Processing Unit) 104, volatile memory 105, non-volatile memory 106, timer circuit 107, and interrupt circuit 108 are provided to transmit / receive data to / from each other via a common bus line. ing.
[0035]
  The nonvolatile memory 106 stores in advance a system program controlled by the CPU 104 and at least one application program. The system program is for controlling transmission / reception of data between the combination IC card 100 and the outside and data transmission / reception between the combination IC card 100.
[0036]
  In such a combination-type IC card 100, commands (commands) are received from the non-contact external device 109 and the contact external device 110 according to the system program, and an application program according to the command is executed. Is returned (output) to the non-contact external device 109 or the contact external device 110 that has transmitted the command.
[0037]
  The non-contact I / F 101 can always transmit and receive signals wirelessly without contact, and is configured to be able to communicate with the non-contact external device 109 wirelessly. When communicating wirelessly, the combination IC card 100 operates as a non-contact IC card.
[0038]
  Further, the contact I / F 103 is configured to be able to communicate with the external device for contact 110 and the electrode terminal provided on the surface of the combination IC card 100 (that is, in a wired contact state). ing. When communicating via the electrode terminals, the combination IC card 100 operates as a contact IC card.
[0039]
  These communication states are not connected at the same time and do not communicate. For example, the detected voltage such as the magnitude of the signal strength of the received start signal, the power supply voltage depending on whether the external device for contact 110 and the electrode terminal are in contact, or the like. Depending on the presence / absence, it is set to operate alternatively as one of the IC cards.
[0040]
  The contact / non-contact determination unit 102 determines whether the I / F during communication is a contact type or a non-contact type. As a determination method, for example, whether the clock is supplied from the clock terminal used in the contact mode or whether the clock is supplied from the RF circuit used in the non-contact mode is determined based on the difference in the clock frequency. A method is mentioned. The determination result is configured to be stored in a register (memory) that can be referred to by the CPU 104, for example, 0 for the contact type and 1 for the non-contact type.
[0041]
  The determination result information is referred to by the CPU 104 based on a system program stored in a nonvolatile memory 106 such as an EEPROM (Electrically Erasable Programmable Read Only Memory). The nonvolatile memory 106 stores an application program (described in detail later) in addition to the system program. The volatile memory 105 is, for example, a RAM (Random Access Memory) for storing temporarily stored data.
[0042]
  As a configuration example showing the hierarchical structure of the program stored in the nonvolatile memory 106 shown in FIG. 1, as shown in FIG. 2, an example in which one contact / non-contact common application program is configured on the system program. Can be mentioned.
[0043]
  As another configuration example showing the hierarchical structure of the program, as shown in FIG. 3, a plurality of applications such as a contact / non-contact common application program, a contact-only application program, and a non-contact-only application program on the system program An example where each program is configured is given.
[0044]
  As a contact / non-contact common application program, for example, in a traffic application such as a bus card, there is an application in which money is charged in a contact mode at a window and boarding / alighting on a bus is performed in a non-contact mode. Contact-only applications include financial applications such as electronic money, which is allowed to be used only in contact type. Non-contact application programs include applications such as telephone cards and entry / exit systems.
[0045]
  In the combination type IC card according to the present invention, the following series of processing is performed in order to perform appropriate processing in any of the application configurations shown in FIGS. That is,
  1.Select the application program to be executed.
[0046]
  2.When the connection with the external device is started in the contact type or the non-contact type, the contact / non-contact determination unit 102 determines which I / F is activated.
[0047]
  3.An initial response is made with a protocol corresponding to the determination result by the contact / non-contact determination means 102 to establish communication.
[0048]
  4).A command is received by a protocol according to the determination result by the contact / non-contact determination means 102.
[0049]
  5.The application program specified by the command is executed.
[0050]
  6).The execution result of the application program is returned to the external device as a response.
[0051]
  7).Wait request transmission / response reception operations are performed on external devices as necessary.
[0052]
  Details of each process will be described below. First, transmission protocols used in the contact type and the non-contact type will be described.
[0053]
  FIG. 4 shows the configuration of the transmission protocol. Here, FIG. 4A shows the configuration of one frame of the contact transmission protocol command used in the contact type, FIG. 4B shows the configuration of one frame of the non-contact transmission protocol used in the contactless type, and FIG. (C) shows the information field part shown in FIG. 4 (a) and FIG. 4 (b), the field structure at the time of command reception, and FIG. 4 (d) in FIG. 4 (a) and FIG. 4 (b). The information field part of description is shown and the structure of the field at the time of command response transmission is each shown.
[0054]
  More specifically, as shown in FIG. 4A, one frame of the contact transmission protocol command is composed of three large fields, ie, a head field portion, an information field portion, and a final field portion.
[0055]
  Among these, the NAD in the head field portion indicates the source and destination of the command block. Here, the command block indicates one frame of each transmission protocol command shown in FIG. The PCB in the first field portion indicates protocol control information, and stores control information necessary for data transfer. For example, information such as command reception and wait response reception, which will be described in detail later, is stored. The LEN of the first field part stores the data length of the information field part that follows.
[0056]
  The command body is stored in the information field portion. In the final field portion, an error detection code (EDC) of the transmission block is stored. The configuration of the information field portion is different when receiving a command and when transmitting a command response, and the configuration will be described in detail in the columns relating to FIG. 4 (c) and FIG. 4 (d) below.
[0057]
  One frame of the non-contact transmission protocol command is composed of a head field part, an information field part, and a last field part as shown in FIG. 4B.
[0058]
  Of these, the PCB in the first field portion indicates protocol control information and stores control information necessary for data transfer. For example, information such as command reception and wait response reception, which will be described in detail later, is stored. The IC card number is stored in the CID of the first field portion.
[0059]
  The command body is stored in the information field portion. The final field portion stores a transmission block error detection code (CRC: Cyclic Redundancy Check). The configuration of the information field portion is different when receiving a command and when sending a command response, and the configuration will be described in detail in the following sections related to FIG. 4C and FIG. 4D.
[0060]
  The configuration of the information field part shown in FIGS. 4A and 4B differs between when a command is received and when a command response is transmitted.
[0061]
  That is, the data shown in FIG. 4C is stored in the information field part at the time of command reception. Of these, CLA, INS, P1, and P2 are parameters that specify the type / operation of the command, and LC indicates the length of DATA (command body) that follows. LE indicates the maximum length of data expected at the time of command response.
[0062]
  Next, the data shown in FIG. 4D is stored in the information field portion at the time of command response. Here, DATA indicates a data field, and SW1 and SW2 indicate status information for the response. As described above, the frame structure of the transmission protocol is different for contact and non-contact.
[0063]
  Therefore, in the present invention, shared information that can be referred to by both the system program and the application program stored in the combination-type IC card according to the present invention, both in contact transmission and non-contact transmission. A table is provided in the volatile memory 105.
[0064]
  FIG. 5 shows shared information used when receiving a command, and FIG. 7 shows common information used when sending a command response. Although details will be described later, each value of CLA, INS, P1, P2, LC, and LE in FIG. 5 corresponds to each field of the same name in the information field portion at the time of command reception shown in FIG. R_DATA_AD and reception data length R_DATA_LEN indicate the storage location of DATA in the information field portion at the time of command reception.
[0065]
  Further, the protocol information R_PSTAT corresponds to the protocol information at the time of command reception shown in FIG. 6, and the reception INF length R_INF_LEN corresponds to the LEN of the first field portion shown in FIG. 4A. Further, the non-contact / contact identification flag ICC_FLAG indicates the connection mode determined by the above-described contact / non-contact determination means 102. For example, if this value is 0, it indicates the contact mode and 1 indicates the non-contact mode.
[0066]
  Similarly, although details will be described later, the transmission data storage address T_DATA_AD, the transmission data length T_DATA_LEN, and the command execution result SW in FIG. 7 correspond to DATA, SW1, and SW2 in the command response transmission information field part shown in FIG. To do. Further, the protocol information T_PSTAT stores the command response transmission TRS_I or the wait request transmission TRS_WReq shown in the protocol information at the time of command response transmission shown in FIG.
[0067]
  The application execution method of the multi-purpose combination type IC card according to the present invention will be described below in detail using the shared information described above.
[0068]
  First, when the combination type IC card starts connection with an external device in contact type or non-contact type, the contact / non-contact determination means 102 determines which I / F is activated, and the CPU 104 The operation of the system program is started, and the combination IC card 100 is controlled according to the system program. Control operations according to this system program will be described with reference to the flowchart of FIG.
[0069]
  After starting the system program (SP1), the CPU 104 sets the information of the application program to be executed first shown in FIG. 2 or FIG. 3 in the volatile memory 105 based on the system program, for example, the information obtained from the nonvolatile memory 106 is volatile. It is stored and registered in the memory 105 (SP2).
[0070]
  Note that the reason why the application program to be executed is selected in advance is to enable branching immediately to the first registered application without issuing an application selection command from an external device in SP12 described later. This step is not essential and may not be prior to determining contact / non-contact. Until the first command is received, the SP2 may be set to be executed immediately after SP5 described later or immediately after SP9, for example.
[0071]
  As application program information, for example, when registering an application program, an application ID and application storage location (branch destination) information are stored in advance for a specific address in the nonvolatile memory 106.
[0072]
  It is determined by referring to the determination result of the contact / non-contact determination means 102 whether the connection is made in contact or non-contact (SP3). If it is determined that the contact type, the processing after SP4 is performed.
[0073]
  Subsequently, an internal flag indicating the contact mode is set to 0 in the volatile memory 105 (SP4). Thereafter, initial response information (ATR: Answer to Reset) is transmitted to the contact external device 110 using the contact I / F 103 (SP5). The ATR is IC card information that is first transmitted from the IC card to the contact external device 110 when the contact IC card and the contact external device 110 are connected to each other. The information notified to the contact external device 110 includes connection information such as a communication speed.
[0074]
  When the transmission shown in SP5 is completed, the command can be transmitted / received between the contact external device 110 and the contact I / F 103 of the combination IC card 100. The command is transmitted from the connected contact external device 110 to the combination IC card 100 in the format of the contact transmission protocol command shown in FIG. A response corresponding to the command execution result is also transmitted from the combination IC card 100 to the contact external device 110 in the same format.
[0075]
  In SP6, command reception processing is performed according to the contact-type transmission protocol shown in FIG. A command is transmitted from the connected contact external device 110, and information received by the contact I / F 103 is stored in the volatile memory 105 for one frame of the command block. Here, the command block indicates one frame of each transmission protocol command shown in FIG.
[0076]
  Subsequently, in order to make it possible for a higher-level application program to refer to the received command information, the information is cut out from the command block stored in the volatile memory 105 and stored in the volatile memory 105 as the shared information shown in FIG. (SP7).
[0077]
  That is, the values of CLA, INS, P1, P2, LC, and LE are stored in the addresses R_a, R_b, R_c, R_d, R_e, and R_f of the volatile memory 105, respectively. The DATA storage address R_DATA_AD and the received data length R_DATA_LEN are stored in the addresses R_g and R_h of the volatile memory 105, respectively.
[0078]
  The protocol information R_PSTAT is stored in the address R_i of the volatile memory 105 as protocol information at the time of command reception in FIG. 6 with reference to the PCB indicating the protocol control information in the head field portion. When receiving a command, RCV_I is stored, and when receiving a response to a wait request, RCV_WRes is stored.
[0079]
  The reception INF length R_INF_LEN is stored in the address R_j of the volatile memory 105 with reference to LEN indicating the length of the information field portion in the head field portion. In the non-contact / contact identification flag ICC_FLAG, the value 0 of the flag set in step SP4 is stored in the address R_k of the volatile memory 105. Next, the processing of SP12 described later is performed.
[0080]
  On the other hand, if it is determined in SP3 that the non-contact type is used, processing after SP8 is performed. First, an internal flag indicating the non-contact mode is set to 1 in the volatile memory 105 (SP8). Thereafter, the initial response command is exchanged using the non-contact external device 109 and the non-contact I / F 101 (SP9).
[0081]
  When the exchange of the initial response command in SP9 is completed, the command can be transmitted / received between the non-contact external device 109 and the non-contact I / F 101 of the combination IC card 100.
[0082]
  The command is transmitted from the non-contact external device 109 to the combination IC card 100 in the non-contact transmission protocol command format shown in FIG. 4B (SP10). A response to the command execution result is also transmitted from the combination IC card 100 to the non-contact external device 109 in the same format.
[0083]
  In SP10, command reception processing is performed using a non-contact transmission protocol. A command is transmitted from the non-contact external device 109, and the information received by the non-contact I / F 101 is stored in the volatile memory 105 for one frame of command block as in the case of the contact type described above. The data structure stored in the information field portion is the same as that of the contact type described above.
[0084]
  Subsequently, in order to make it possible for a higher-level application program to refer to the received command information, the information is cut out from the command block stored in the volatile memory 105 and stored in the volatile memory 105 as shared information shown in FIG. (SP11).
[0085]
  Of the data stored in the volatile memory 105 as shared information, the reception INF length R_INF_LEN does not exist as information in the case of the contactless transmission protocol, so the number of received data is counted within the system program when a command block 1 frame is received. Thus, the value obtained by calculating the length of the information field portion is stored in the address R_j of the volatile memory 105. In the non-contact / contact identification flag ICC_FLAG, the flag value 1 set in step SP8 is stored at the address R_k of the volatile memory 105.
[0086]
  Other shared information is stored at each address of the volatile memory 105 as in the contact type described above. Next, the processing of SP12 is performed.
[0087]
  In SP12, the application program accesses the volatile memory 105 to determine whether the command transmitted from the non-contact external device 109 or the contact external device 110 is a selection command for selecting a specific application mounted on the system program. judge.
[0088]
  If the application program determines that the command is an application selection command, the application program continues the subsequent processing, proceeds to SP14, and stores the branch destination information of the selected application in the volatile memory 105. The branch destination information of the application program is obtained by referring to the branch destination information from the area of the volatile memory 105 stored in step SP2.
[0089]
  In addition, in order to transmit a response to the application selection command to the non-contact external device 109 and the contact external device 110, information to be specified is stored in the volatile memory 105 when the command response shown in FIG. If it is not an application selection command, the process proceeds to SP13, and the branch destination information of the currently selected application is read from the volatile memory 105, and then branched to the application program.
[0090]
  In SP15, it is determined whether the response to the command execution result is transmitted to the non-contact external device 109 or the contact external device 110 by the contact I / F 103 or the non-contact I / F 101. The determination is made based on the value of the internal flag set in each step of SP4 and SP8. When the value of the internal flag is 0, the contact type is determined and SP16 is executed. When the value of the internal flag is 1, it is determined as a non-contact type, and SP17 is executed.
[0091]
  In the case of the contact type, in SP16, the information (transmission data storage address T_DATA_AD and transmission data length T_DATA_LEN) specified at the time of command response transmission shown in FIG. 7 is referred to and converted into the contact transmission protocol command configuration shown in FIG. And stored in the volatile memory 105 as transmission data. Then, the transmission data is sequentially read from the volatile memory 105 and transmitted to the contact external device 110 via the contact I / F 103. After data transmission, return to SP6 to receive the next command.
[0092]
  Information specified at the time of command response transmission shown in FIG. 7 is stored in advance in the volatile memory 105 as follows in SP13 or SP14.
[0093]
  The transmission data storage address T_DATA_AD is stored in the address T_a of the volatile memory 105 in FIG. 7, the transmission data length T_DATA_LEN is stored in the address T_b, and the command execution result SW is stored in the address T_c. These are information for storing data in DATA, SW1, and SW2 in the command response transmission time information field portion of FIG. 4B.
[0094]
  Further, the protocol information T_PSTAT is stored at the address T_d. The protocol information T_PSTAT stores the command response transmission TRS_I or the wait request transmission TRS_WReq shown in the protocol information at the time of command response transmission in FIG. This is information for storing data in the PCB of the first field portion in the contact transmission protocol command shown in FIG. When transmitting a wait request, the wait request value T_WAIT is stored in the address T_e.
[0095]
  It is not always necessary to store all of these pieces of information.
[0096]
  When it is desired to transmit a response to the command, information is stored in the transmission data storage address T_DATA_AD, the transmission data length T_DATA_LEN, and the command execution result SW. The protocol information T_PSTAT stores the command response transmission TRS_I shown in FIG.
[0097]
  When transmitting a wait request, only the protocol information T_PSTAT and the wait request value T_WAIT are stored. The protocol information T_PSTAT stores a wait request transmission TRS_WReq.
[0098]
  The conversion to the contact transmission protocol command configuration of FIG. 4A is performed as follows with reference to the stored information described above. The first field part, information field part, and last field part are stored in the volatile memory 105 in this order.
[0099]
  The NAD in the first field portion stores data in which the NAD transmission source and destination are reversed when a command is received. Control information of protocol information T_PSTAT is stored in the PCB. LEN stores the length of the information field part. DATA in the information field portion stores data read from the transmission data storage address T_DATA_AD stored in the volatile memory 105 by the transmission data length T_DATA_LEN. SW1 and SW2 store command execution result SW data. The final field portion stores the error detection code of the transmission block.
[0100]
  When transmitting a wait request, 1 is stored in the LEN of the head field portion, and the value of the wait request value T_WAIT is stored in the information field DATA portion by 1 byte.
[0101]
  On the other hand, in the case of the non-contact type, the SP17 refers to the information specified at the time of command response transmission shown in FIG. 7, converts it to the non-contact transmission protocol command configuration shown in FIG. 4, and stores it in the volatile memory 105 as transmission data. . Then, the transmission data is sequentially read from the volatile memory 105 and transmitted to the non-contact external device 109 via the non-contact I / F 101. After data transmission, the process returns to SP10 to receive the next command.
[0102]
  Information specified at the time of command response transmission shown in FIG. 7 is stored in advance in the volatile memory 105 in SP13 or SP14 as described above.
[0103]
  The conversion to the non-contact transmission protocol command configuration shown in FIG. 4B is performed as follows with reference to the stored information described above. Each information regarding the first field part, the information field part, and the last field part is stored in the volatile memory 105 in that order.
[0104]
  The control information of the protocol information T_PSTAT is stored in the PCB in the head field portion. The CID stores the value of the CID obtained when the command is received. DATA in the information field portion stores data read from the transmission data storage address T_DATA_AD stored in the volatile memory 105 by the transmission data length T_DATA_LEN. SW1 and SW2 store command execution result SW data. The final field portion stores the error detection code of the transmission block.
[0105]
  When transmitting a wait request, the value of T_WAIT is stored in the information field DATA portion in the information field DATA portion.
[0106]
  Next, the operation procedure of the application program executed in step SP13 shown in FIG. 9 will be described with reference to FIGS.
[0107]
  FIG. 10 is an operation flowchart of a shared application program that can be executed in both contact type and non-contact type. Branching from the system program to this application program (SAP00), and subsequently reading the contact / non-contact identification flag ICC_FLAG from the address R_k of the volatile memory 105 among the shared information stored when receiving the command shown in FIG. The current connection mode is determined (SAP01). When it is determined that the contact mode is selected, command determination processing in the contact mode is performed (SAP02).
[0108]
  The command determination process uses the values of CLA, INS, P1, and P2, which are common information stored in the volatile memory 105 shown in FIG. 5, from the addresses R_a, R_b, R_c, and R_d of the volatile memory 105. It is determined by reading.
[0109]
  Next, command processing in the non-contact mode is executed (SAP03), and the process proceeds to SAP06.
[0110]
  When it is determined in SAP01 that the mode is the non-contact mode, command determination processing in the non-contact mode is performed (SAP04). In the command determination process, the values of CLA, INS, P1, and P2, which are shared information stored in the volatile memory 105 shown in FIG. 5, are obtained from the addresses R_a, R_b, R_c, and R_d of the volatile memory 105. It is determined by reading.
[0111]
  Next, command processing in the non-contact mode is executed (SAP05), and the process proceeds to SAP06. In SAP06, the response information of the command executed in SAP03 or SAP05 is stored in the volatile memory 105 in accordance with the information specified at the time of command response transmission shown in FIG. Thereafter, the system program is restored (SAP07).
[0112]
  FIG. 11 is an operation flowchart of an application program that can be executed only by the contact method. The system program branches to this application program (SAP10), reads the contact / non-contact identification flag ICC_FLAG from the address R_k of the shared information volatile memory 105 stored at the time of command reception shown in FIG. Determine (SAP11).
[0113]
  When it is determined that the contact mode is selected, command determination processing in the contact mode is performed (SAP12). The command determination process is performed by using the values of CLA, INS, P1, and P2, which are common information stored in the volatile memory 105 shown in FIG. 5, from the addresses R_a, R_b, R_c, and R_d of the volatile memory 105. It is determined by reading.
[0114]
  Next, contact mode command processing is executed (SAP13), and the process proceeds to SAP15.
[0115]
  When the SAP 11 determines that it is in the non-contact mode, it determines that the received command cannot be executed in the non-contact mode, and prepares error response information (SAP 14).
[0116]
  In the SAP 15, the response information of the command executed by the SAP 13 or the error response information of the SAP 14 is stored in the volatile memory 105 according to the information specified at the time of command response transmission shown in FIG. Thereafter, the system program is restored (SAP16).
[0117]
  FIG. 12 is an operation flowchart of an application program that can be executed only in a non-contact manner. The system program branches to this application program (SAP20), and reads the contact / non-contact identification flag ICC_FLAG, which is shared information stored when the command shown in FIG. 5 is received, from the address R_k of the volatile memory 105. The connection mode is determined (SAP21).
[0118]
  When it is determined that the mode is the non-contact mode, a command determination process in the non-contact mode is performed (SAP22). The command determination process is performed by using the values of CLA, INS, P1, and P2, which are common information stored in the volatile memory 105 shown in FIG. 5, from the addresses R_a, R_b, R_c, and R_d of the volatile memory 105. Each is read and judged.
[0119]
  Next, command processing in the non-contact mode is executed (SAP23), and the process proceeds to SAP25.
[0120]
  On the other hand, when the SAP 21 determines that the contact mode is selected, it determines that the received command is not executable in the contact mode, and prepares error response information (SAP 24).
[0121]
  In the SAP 25, the response information of the command executed in the SAP 23 or the error response information of the SAP 14 is stored in the volatile memory 105 according to the information specified at the time of command response transmission shown in FIG. Thereafter, the system program is restored (SAP26).
[0122]
  Next, command execution processing executed at each step of SAP03 or SAP05 in FIG. 10, SAP13 in FIG. 11, and SAP23 in FIG. 12 will be described with reference to FIGS.
[0123]
  Some of the command execution processes take time, and since the time is exceeded while the application program is executing a command received from the non-contact external device 109 and the contact external device 110, the non-contact external device 109, the contact external device 110 may determine that there is no response to the command (so-called timeout).
[0124]
  When the command processing takes time as described above, the non-contact external device 109 and the external device for contact are transmitted by transmitting a wait request to the non-contact external device 109 and the external device for contact 110 and receiving the wait response. The device 110 can wait until a response to the transmitted command is received.
[0125]
  If it is desired to extend the wait time, a wait request is made to the non-contact external device 109 and the contact external device 110 again. Each operation of the wait request transmission / response reception is set to be performed by the command processing in FIGS.
[0126]
  As shown in FIG. 13, first, when command processing starts (SC00), it is determined whether a wait request is required for command processing (SC01). As a command that requires a wait request, for example, a command that takes a long time for an arithmetic process involving cryptographic processing such as authentication can be cited. An example of a command that does not require a wait request is a command that does not take a long time to read a file managed by an application program.
[0127]
  As a method for determining whether a wait request is required for command processing, the application determines a command that is known to take a long time in advance, or an internal process that takes a long time to erase the built-in flash memory, etc. In some cases, the system program determines the received command.
[0128]
  For a command that requires a wait request, it is necessary to transmit the wait request to the non-contact external device 109 and the contact external device 110 before executing the command. If it is determined that a wait request is necessary, the protocol information R_PSTAT stored in the volatile memory of the shared information in FIG. 5 is read from the address R_i to determine whether the reception status is the wait response reception RCV_WRes (SC02). .
[0129]
  If it is not RCV_WRes, the wait request has not been made yet, so the process proceeds to SC04, and information for sending the wait request is prepared. Among the information specified at the time of transmission in FIG. 7, information to be stored in the wait request transmission TRS_WReq and the wait request value T_WAIT in FIG. 8 is prepared as information to be stored in the protocol information T_PSTAT.
[0130]
  Further, in order to automatically extend the weight by using the timer circuit 107 and the interrupt circuit 108 of the combination type IC card 100, the time interval of the automatic extension is set in the volatile memory 105 as the timer count number (SC04). Subsequently, the timer circuit 107 is activated (SC05).
[0131]
  If it is determined in SC02 that the reception status is RCV_WRes, that is, it is determined that there is a response to the wait request, the next command is executed (SC06). Subsequently, the timer for automatically extending the wait request is stopped (SC07).
[0132]
  On the other hand, if it is determined in SC01 that the command does not require a wait, it is confirmed that the reception status is command reception RCV_I (SC03), and the process proceeds to SC06 to execute the command. When the reception status is not command reception RCV_I, information for error response transmission is prepared (SC08).
[0133]
  In command execution requiring a wait request, after the first wait request / response, a wait re-extension request is made using the timer interrupt activated in SC04 and SC05 during the command execution in step SC06. . When a timer interrupt occurs during command execution, a wait re-extension request transmission / response reception is performed according to the flow shown in FIG.
[0134]
  First, when the timer-interrupt starts (ST00), the timer count value is read from the volatile memory 105 to check whether it is 0 (ST01). If it is not 0, it is considered that the re-extension time has not yet elapsed, the timer count value is decremented by 1 and stored in the volatile memory 105 (ST03), and the interrupt process is terminated.
[0135]
  If the timer count value is 0, it is considered that the re-extension time has elapsed, a wait request is transmitted to the connected external devices 109 and 110 (ST02), and then a response is received (ST04). ). Then, the timer count is reset in step ST04-1, and the interrupt process is terminated (ST05). Wait time re-extension processing is performed until the command execution of SC06 shown in FIG.
[0136]
  FIG. 15 is a timing chart simply showing exchange of data among external devices, system programs, and applications in the operations described in FIGS. 9, 10, 11, 12, 13, and 14.
[0137]
  In the loop for sending and receiving commands by the contact I / Fs SP6 to SP16 and the command sending and receiving by the non-contact I / Fs SP10 to SP17 in FIG. When transmitted, the command is received by the system program of the combination IC card 100, and the command information is passed to one of the application programs shown in FIGS.
[0138]
  The command is executed in each application program, and when the command is completed, command response information is returned to the system program. In the system program, the contact type or non-contact I / F is determined, and a command response is transmitted to the connected external devices 109 and 110.
[0139]
  When a second command requiring a wait is transmitted from the external device 109 or 110, the command is received by the system program, and the command information is passed to one of the application programs shown in FIGS. .
[0140]
  In FIG. 13, which shows the command execution steps in each application program, when it is determined that a wait request is necessary, the first wait request information is returned (returned) to the system program.
[0141]
  In the system program, it is determined whether the connection state is the contact type I / F 103 or the non-contact I / F 101, and a wait request is transmitted to the connected external devices 109 and 110 according to the determination result. Next, the external devices 109 and 110 transmit a wait response to the first wait request to the system program to the system program.
[0142]
  The wait response information is passed to each application program, and the command execution is started in FIG. If the command execution does not end within the time due to the first wait request, a wait re-extension request / response is performed by the interrupt processing in FIG. 14 in order to make the second wait request.
[0143]
  When command execution is completed, command response information is returned to the system program. In the system program, it is determined whether the connection type is the contact type I / F 103 or the non-contact type I / F 101, and the command response is transmitted to the connected external devices 109 and 110 according to the determination result. .
[0144]
  According to the embodiment as described above, it is possible to absorb the difference between the contact-type and non-contact-type transmission protocols, reliably pass the command to the application program, and reliably return the command execution result to the external device. It is possible to provide a common application method.
[0145]
  Further, when a wait request is made to an external device from an application program mounted on a combination IC card, even if the contact I / F 103 is selected or the non-contact I / F 101 is selected In addition, it is possible to provide a common application method in which a timeout does not occur in the external devices 109 and 110.
[0146]
  Multiple applications such as an application program that can be operated by both contact and non-contact methods, an application program that can be operated only by contact methods, an application that can be operated only by non-contact methods, etc. Even when a program is installed, it is possible to provide a common application method that can reliably pass a command to an application program and reliably return (output) a command execution result to an external device.
[0147]
  In order to solve the above problems, the present invention provides the following means 1. ~ 6. Each offering.
[0148]
  Means 1. In a combination type IC card having a contact I / F and a non-contact I / F and equipped with a system program that can determine which I / F is activated, the system program is received from an external device. A combination type IC card configured to extract command information from a contact I / F command and a non-contact I / F command, store the command information in a volatile memory, and pass the command information to an IC card application program An application sharing method is provided.
[0149]
  Mean 2. In a combination type IC card having a contact I / F and a non-contact I / F and having a system program that can determine which I / F is activated, the system program is obtained from an IC card application program. Common type of IC card application configured to store the transmission information in a volatile memory, convert it into a contact I / F command or a non-contact I / F command, and send it to an external device A system is provided.
[0150]
  Means 3. In a combination type IC card having a contact I / F and a non-contact I / F and equipped with a system program that can determine which I / F is activated, the system program is received from an external device. The command information is extracted from the contact I / F command and the non-contact I / F command, stored in the volatile memory, and passed to the IC card application program. There is provided an application sharing method for a combination type IC card configured such that the command information includes protocol information of a contact I / F or non-contact I / F and can be referred to by an IC card application program.
[0151]
  Means 4. In a combination type IC card having a contact I / F and a non-contact I / F and equipped with a system program that can determine which I / F is activated, the system program is received from an external device. The command information is extracted from the contact I / F command and the non-contact I / F command, stored in the volatile memory, and passed to the IC card application program. Common to common IC card applications configured to include an identification flag of contact mode / non-contact mode of contact I / F or non-contact I / F in the command information, and can be referred to by an IC card application program A system is provided.
[0152]
  Means 5. In a combination type IC card having a contact I / F and a non-contact I / F and having a system program that can determine which I / F is activated, the system program is obtained from an IC card application program. A combination IC card that is configured to send / receive a wait request / response to / from an external device in response to a designated wait request command and automatically send / receive the wait request command when wait time extension is required. A common application method is provided.
[0153]
  Means 6. In a combination type IC card that has a contact I / F and a non-contact I / F and has a system program that can determine which I / F is activated, the system program is a single combination type When multiple application programs are installed on an IC card, such as application programs that can be operated by both contact and non-contact methods, application programs that can be operated only by contact methods, and application programs that can operate only by non-contact methods An application sharing method for a combination type IC card is provided.
[0154]
  Further, in order to solve the above-mentioned problems, the control method for the combination type IC card of the present invention includes the following control methods 1. ~ 5. Each offering.
[0155]
  Control method 1. Has a contact I / F for external devices and a non-contact I / F, and has a storage area for storing a system program and at least one application program that can determine which I / F is activated. In the control method of a combination type IC card that is a contact type and non-contact type IC card, the system program determines whether the current connection mode with an external device is contact type or non-contact type, and the determination result A second step of extracting command information included in each field of the command received from the external device and storing it in a storage area accessible from the application program, and the received command A third step of determining whether or not is a command for selecting an application to be executed, and the third step If the command is an application selection command, information required for executing the selected application is stored in a fourth step, and if the application selection command is not selected in the third step, an already selected application program is executed. 5, a sixth step of storing the execution result information of the command or application program in the storage area, and a transmission (output) of the execution result information stored in the sixth step to the external device as a response. And a seventh step.
[0156]
  Control method 2. Further, when the application program to be executed in the fifth step can be executed in both contact type and non-contact type connection modes, the step in step 5 is further determined in the connection in the first step. An eighth step of confirming the mode; a ninth step of executing the application in the connection mode confirmed in the eighth step; and a result of storing the result information executed in the ninth step in the storage area. Ten steps may be included.
[0157]
  Control method 3. When the application program to be executed in the fifth step can be executed only in the contact mode, the fifth step further includes an eleventh step for confirming the connection mode determined in the first step; When the connection mode confirmed in the eleventh step is not the contact mode, the twelfth step of storing error response information in the storage area and the connection mode confirmed in the eleventh step are the contact mode. In this case, it may include a thirteenth step of executing the application program in the contact mode and a fourteenth step of storing the result information executed in the thirteenth step in the storage area.
[0158]
  Control method 4. When the application program to be executed in the fifth step can be executed only in the non-contact mode, the fifth step further includes a fifteenth step for confirming the connection mode determined in the first step; When the connection mode confirmed in the fifteenth step is not the non-contact mode, the sixteenth step of storing error response information in the storage area, and the connection mode confirmed in the fifteenth step is the non-contact mode. In this case, a seventeenth step of executing the application program in a non-contact mode and an eighteenth step of storing the result information executed in the seventeenth step in the storage area may be included.
[0159]
  4. Control method When the application program to be executed in the fifth step needs to make a weight request to the external device, the step of 5 further receives wait response information from the external device. If the wait response information is not received in the 19th step and the 19th step, the 20th step of storing the wait request information in the storage area and the wait response information in the 19th step If the application has been received and execution of the application has not been completed within a predetermined time, a 21st step of storing the wait request information in the storage area again may be included.
[0160]
  As described above, each control method of the combination type IC card according to the present invention is a computer program readable and executable form, for example, a system program written in C language, for example, a CD-ROM form. Can be distributed in the market.
[0161]
【The invention's effect】
  As described above, according to the present invention, in a combination type IC card having contact and non-contact I / F, an application program that operates in common, an application program that operates only in a contact type, and only in a non-contact type There is an effect that it is possible to provide an application sharing method that realizes a combination type IC card that can be used for various purposes and has a system program that has an application program that operates.
[Brief description of the drawings]
FIG. 1 is a block diagram showing a combination type IC card of the present invention.
FIG. 2 is a block diagram showing a case where one contact / non-contact common application program is configured on a system program in the above-mentioned combination type IC card.
FIG. 3 is a block diagram showing a case where a plurality of application programs such as a contact / contactless common application program, a contact-only application program, and a contactless-only application program are configured on the system program in the combination IC card. .
FIGS. 4A to 4D are frame configuration diagrams of contact and non-contact protocols in the combination IC card.
FIG. 5 is a table of shared information shared by a system program and an application program when a command is received in the combination IC card.
FIG. 6 is a table showing protocol information at the time of command reception in the combination IC card.
FIG. 7 is a table showing information specified at the time of command response transmission in the combination IC card.
FIG. 8 is a table showing protocol information at the time of command response transmission in the combination IC card.
FIG. 9 is an operation flowchart of a system program in the combination IC card.
FIG. 10 is an operation flowchart of a contact / non-contact sharing application in the combination IC card.
FIG. 11 is an operation flowchart of a contact type dedicated application in the combination IC card.
FIG. 12 is an operation flowchart of a contactless dedicated application in the combination IC card.
FIG. 13 is an operation flowchart of application program command execution in the combination IC card.
FIG. 14 is an operation flowchart of wait request exchange using interrupt processing in the combination IC card.
FIG. 15 is a timing chart showing data exchange between an external device, a system program, and an application in the combination IC card.
FIG. 16 is a flowchart showing the operation of a conventional combination IC card.
[Explanation of symbols]
101 Non-contact I / F (interface)
102 Contact / non-contact determination means (determination unit)
103 Contact I / F (interface)
104 CPU (extraction unit)
105 Volatile memory (second storage unit)
106 Non-volatile memory (first storage unit)
109 Non-contact external equipment (external equipment)
110 External device for contact (external device)

Claims (10)

外部機器との通信のための接触用インターフェース及び非接触用インターフェースと、
どちらのインターフェースで起動されているか判別する判別部と、
システムプログラム及び少なくとも1つのアプリケーションプログラムを格納した第一記憶部と、
外部機器から受信した接触用インターフェースまたは非接触用インターフェースを介したコマンドから抽出されたコマンド情報を格納する第二記憶部と、
外部機器から受信した前記コマンドの各フィールドに含まれる上記コマンド情報を前記アプリケーションプログラムによりアクセス可能に抽出する抽出部とを有し
前記第二記憶部には、応答送信コマンド情報として、前記外部機器に対してウエイト要求する処理待ち期間を示すウエイト要求値情報が格納されており、
さらに、割り込み処理回路とタイマ回路と、前記入力したコマンドの実行中に所定時間に設定された上記タイマ回路のカウント終了により割り込みが発生した場合、前記ウエイト要求値を初期値とするカウント値が0でなければ前記カウント値を1減算し、0であれば、外部機器に対してウエイト要求コマンドを送信すると共に、前記カウント値を初期値に再設定する再設定手段とを有していることを特徴とするコンビネーション型ICカード。
A contact interface and a non-contact interface for communication with an external device;
A discriminator for discriminating which interface is running,
A first storage unit storing a system program and at least one application program;
A second storage unit for storing command information extracted from a command via a contact interface or a non-contact interface received from an external device;
An extraction unit that extracts the command information included in each field of the command received from an external device so as to be accessible by the application program ;
The second storage unit stores, as response transmission command information, wait request value information indicating a processing waiting period for requesting a wait for the external device,
Further, when an interrupt occurs due to the end of counting of the timer processing circuit, the timer circuit, and the timer circuit set at a predetermined time during execution of the input command, the count value having the wait request value as an initial value is 0. Otherwise, the count value is decremented by 1. If it is 0, a wait request command is transmitted to the external device, and resetting means for resetting the count value to an initial value is provided. Features a combination IC card.
前記システムプログラム及び少なくとも1つのアプリケーションプログラムを格納した第一記憶部は書き換え可能な不揮発性記憶素子からなることを特徴とする請求項1記載のコンビネーション型ICカード。  2. The combination IC card according to claim 1, wherein the first storage unit storing the system program and at least one application program is composed of a rewritable nonvolatile storage element. 前記コマンド情報を格納する第二記憶部は、揮発性記憶素子からなることを特徴とする請求項1または2記載のコンビネーション型ICカード。  3. The combination type IC card according to claim 1, wherein the second storage unit that stores the command information includes a volatile storage element. 前記第二記憶部には、受信コマンド情報として、受信したコマンドの種別あるいは動作を指定する情報、受信したデータの格納場所情報、受信したコマンドの属性を示すプロトコル情報、及び接触及び非接触のいずれで通信するかを示す接続モード情報からなる群から選択される少なくとも1つが格納されていることを特徴とする請求項1ないし3のいずれか1項に記載のコンビネーション型ICカード。  In the second storage unit, as the received command information, information specifying the type or operation of the received command, storage location information of the received data, protocol information indicating the received command attribute, and any of contact and non-contact The combination IC card according to any one of claims 1 to 3, wherein at least one selected from a group consisting of connection mode information indicating whether or not to communicate is stored. 前記第二記憶部には、応答送信コマンド情報として、送信するデータの格納場所情報、コマンドの実行結果を示すステータス情報、送信するコマンドの属性を示すプロトコル情報、前記外部機器に対してウエイト要求する処理待ち期間を示すウエイト要求値情報からなる群から選択される少なくとも1つが格納されていることを特徴とする請求項1ないし4のいずれか1項に記載のコンビネーション型ICカード。  In the second storage, as response transmission command information, storage location information of data to be transmitted, status information indicating the execution result of the command, protocol information indicating the attribute of the command to be transmitted, and a wait request to the external device 5. The combination IC card according to claim 1, wherein at least one selected from a group consisting of weight request value information indicating a processing waiting period is stored. 外部機器からのコマンドを接触式及び非接触式にてそれぞれ受信でき、接触式及び非接触式の何れで受信したか判別して、コマンドに対応するアプリケーションプログラムを実行し、その実行結果を外部機器に出力する接触式及び非接触式兼用のICカードであるコンビネーション型ICカードの制御方法において、Commands from external devices can be received in contact and non-contact types, respectively, it is determined whether contact type or non-contact type is received, the application program corresponding to the command is executed, and the execution result is sent to the external device In a control method of a combination type IC card which is a contact type and non-contact type IC card that outputs to
外部機器から受信したコマンドの各フィールドに含まれるコマンド情報をアプリケーションプログラムからアクセス可能に抽出し、The command information contained in each field of the command received from the external device is extracted so that it can be accessed from the application program.
前記アプリケーションプログラムの実行が、前記外部機器に対してウエイト要求することを必要とする場合、前記外部機器から既にウエイト応答情報を受信しているか確認し、ウエイト応答情報を受信していなければ、ウエイト要求情報を出力し、ウエイト応答情報If execution of the application program requires a wait request to the external device, it is checked whether wait response information has already been received from the external device. If no wait response information has been received, Output request information and wait response information を受信しており、かつ所定の時間以内に前記アプリケーションプログラムの実行が完了しなかったとき、再度ウエイト要求情報を出力することを特徴とするコンビネーション型ICカードの制御方法。When the execution of the application program is not completed within a predetermined time, the wait request information is output again.
前記アプリケーションプログラムが、接触式及び非接触式のいずれの接続モードでも実行可能な場合、判別された接続モードでアプリケーションプログラムを実行することを特徴とする請求項6に記載のコンビネーション型ICカードの制御方法。 7. The combination type IC card control according to claim 6, wherein the application program is executed in the determined connection mode when the application program can be executed in any of a contact type and a non-contact type connection mode. Method. 前記アプリケーションプログラムが、接触モードでのみ実行可能な場合、判別された接続モードが接触モードでないとき、エラー応答情報を出力し、判別された接続モードが接触モードであるとき、接触モードで前記アプリケーションプログラムを実行することを特徴とする請求項6に記載のコンビネーション型ICカードの制御方法。When the application program can be executed only in the contact mode, error response information is output when the determined connection mode is not the contact mode, and when the determined connection mode is the contact mode, the application program in the contact mode. The method of controlling a combination type IC card according to claim 6, wherein: 前記アプリケーションプログラムが、接触モードでのみ実行可能な場合、判別された接続モードが接触モードでないとき、エラー応答情報を出力し、判別された接続モードが接触モードであるとき、接触モードで前記アプリケーションプログラムを実行することを特徴とする請求項に記載のコンビネーション型ICカードの制御方法。When the application program can be executed only in the non- contact mode, when the determined connection mode is not the non- contact mode, error response information is output, and when the determined connection mode is the non- contact mode, the non- contact mode 7. The method of controlling a combination type IC card according to claim 6 , wherein the application program is executed in a step. 請求項6ないし9の何れか1項に記載の制御方法を実行処理することを特徴とするコンビネーション型ICカードのシステムプログラム。A system program for a combination type IC card, which executes the control method according to any one of claims 6 to 9.
JP2001365116A 2001-11-29 2001-11-29 Combination type IC card, control method therefor, and system program therefor Expired - Fee Related JP3863011B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2001365116A JP3863011B2 (en) 2001-11-29 2001-11-29 Combination type IC card, control method therefor, and system program therefor

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2001365116A JP3863011B2 (en) 2001-11-29 2001-11-29 Combination type IC card, control method therefor, and system program therefor

Publications (2)

Publication Number Publication Date
JP2003168092A JP2003168092A (en) 2003-06-13
JP3863011B2 true JP3863011B2 (en) 2006-12-27

Family

ID=19175188

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2001365116A Expired - Fee Related JP3863011B2 (en) 2001-11-29 2001-11-29 Combination type IC card, control method therefor, and system program therefor

Country Status (1)

Country Link
JP (1) JP3863011B2 (en)

Families Citing this family (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS6260642A (en) * 1985-09-11 1987-03-17 日立電線株式会社 Composite waterproof sheet
JP4072503B2 (en) * 2004-02-04 2008-04-09 シャープ株式会社 IC card with built-in coprocessor for auxiliary operation and control method thereof
JP4617683B2 (en) * 2004-02-24 2011-01-26 ソニー株式会社 Semiconductor integrated circuit, portable module, and message communication method.
JP4590201B2 (en) * 2004-04-01 2010-12-01 大日本印刷株式会社 Data carrier and data carrier program
JP4784138B2 (en) * 2005-04-22 2011-10-05 大日本印刷株式会社 IC card and IC card program
JP4960034B2 (en) 2006-07-27 2012-06-27 株式会社東芝 Information storage medium and information storage medium processing apparatus
JP2008059246A (en) * 2006-08-31 2008-03-13 Yoshikawa Rf System Kk Data carrier and data carrier system
JP2008135003A (en) * 2006-10-31 2008-06-12 Yoshikawa Rf System Kk Data carrier and data carrier system
JP2009252146A (en) * 2008-04-10 2009-10-29 Toppan Printing Co Ltd Information recording medium, semiconductor device, program and initialization method
JP6221454B2 (en) * 2013-07-22 2017-11-01 大日本印刷株式会社 Processing device, IC card, processing method, and processing program
JP5943036B2 (en) * 2014-06-04 2016-06-29 ソニー株式会社 Information processing apparatus, information processing method, and program
US9734111B2 (en) 2015-03-19 2017-08-15 Toshiba Tec Kabushiki Kaisha POS terminal and comparison determination method of I/O card connected with the same
JP6717154B2 (en) * 2016-10-07 2020-07-01 大日本印刷株式会社 IC card
JP7433886B2 (en) 2019-12-20 2024-02-20 株式会社東芝 IC cards and IC card control programs

Also Published As

Publication number Publication date
JP2003168092A (en) 2003-06-13

Similar Documents

Publication Publication Date Title
JP3863011B2 (en) Combination type IC card, control method therefor, and system program therefor
US8504105B2 (en) Simultaneous interface use
US8643470B2 (en) Semiconductor integrated circuit, IC card mounted with the semiconductor integrated circuit, and operation method for the same
JP5758120B2 (en) Method for processing application commands from physical channels using portable electronic devices and corresponding devices and systems
US8830065B1 (en) RFID readers with run commands
US8931705B2 (en) IC card, mobile electronic device and data processing method in IC card
US8016203B2 (en) Smartcard, telephone comprising such a card and method for executing a command in such a card
JP6516133B2 (en) Communication device and communication system
US8669872B1 (en) Encapsulating commands for RFID tags
US8698629B1 (en) RFID readers with encapsulating commands
CN101401113B (en) Ic chip of supporting large size memory and method thereof
US20110197203A1 (en) Communication device, communication method and program
US10931331B2 (en) Communication device and method
EP1478152A2 (en) Mobile unit, data transmission/reception method, and data transmission/reception program
WO2008065524A2 (en) Secure mmc standard smartcard with multi-application operation capability, process of operation
KR101621127B1 (en) Ic card, portable electronic device and reader/writer
JP2008152525A (en) Device equipped with function to output monitoring state and computer equipment
JP3718564B2 (en) IC card
JP5724694B2 (en) COMMUNICATION DEVICE, COMMUNICATION METHOD, AND COMMUNICATION PROCESSING PROGRAM
CN109684888B (en) Method for communicating with smart card and card reader
JP7468754B1 (en) ELECTRONIC INFORMATION STORAGE MEDIUM, IC CHIP, IC CARD, RECEPTION BLOCK PROCESSING METHOD, AND PROGRAM
US20040238646A1 (en) Management of byte transmission in a smartcard
JPH0772891B2 (en) Data transmission method
JP7293669B2 (en) Electronic information storage medium, IC card, communication method and communication program
WO2007105926A1 (en) Ic chip of supporting large size memory and method thereof

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20040618

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20060407

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20060425

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20060626

RD02 Notification of acceptance of power of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7422

Effective date: 20060626

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20060927

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

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

Free format text: PAYMENT UNTIL: 20091006

Year of fee payment: 3

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

Free format text: PAYMENT UNTIL: 20101006

Year of fee payment: 4

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

Free format text: PAYMENT UNTIL: 20111006

Year of fee payment: 5

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

Free format text: PAYMENT UNTIL: 20121006

Year of fee payment: 6

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

Free format text: PAYMENT UNTIL: 20131006

Year of fee payment: 7

LAPS Cancellation because of no payment of annual fees