JP3709702B2 - IC card, IC card connection device, IC card system, and program execution control method - Google Patents

IC card, IC card connection device, IC card system, and program execution control method Download PDF

Info

Publication number
JP3709702B2
JP3709702B2 JP05826898A JP5826898A JP3709702B2 JP 3709702 B2 JP3709702 B2 JP 3709702B2 JP 05826898 A JP05826898 A JP 05826898A JP 5826898 A JP5826898 A JP 5826898A JP 3709702 B2 JP3709702 B2 JP 3709702B2
Authority
JP
Japan
Prior art keywords
data
program
card
authentication data
original
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
JP05826898A
Other languages
Japanese (ja)
Other versions
JPH11259289A (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.)
Toppan Inc
Original Assignee
Toppan Inc
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 Toppan Inc filed Critical Toppan Inc
Priority to JP05826898A priority Critical patent/JP3709702B2/en
Publication of JPH11259289A publication Critical patent/JPH11259289A/en
Application granted granted Critical
Publication of JP3709702B2 publication Critical patent/JP3709702B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Landscapes

  • Storage Device Security (AREA)

Description

【0001】
【発明の属する技術分野】
本発明は、ICカード、ICカード接続装置、ICカードシステム及びICカードにおけるプログラム実行制御方法に係り、特に書換可能なメモリを内蔵したICカードのセキュリティを確保することが可能なICカード、ICカード接続装置、ICカードシステム及びプログラム実行制御方法に関する。
【0002】
【従来の技術】
高いセキュリティを確保することが必要なICカードにおいては、使用されるOS(Operating System)は、規格や仕様書で固定化されており、マスクROMの形でICカードに収納されている。
また、より容易にカスタム品に対応すべくOSのプログラムをEEPROMに格納するように構成したICカードも知られている。
【0003】
【発明が解決しようとする課題】
しかしながら、プログラムをマスクROMに格納する構成においては、プログラム変更の度に新たにマスクROMを製造しなければならないため、マスクROMチップの製造時間及びコストがかかってしまうという問題点があった。
【0004】
一方、書き換え可能なEEPROMなどにプログラムを格納するタイプのICカードにおいては、プログラムの書き換えは容易であり、プログラム変更にも柔軟に対応できるが、書き換えが容易なため高いセキュリティを確保するのは困難となってしまうという問題点があった。
【0005】
そこで、本発明の目的は、プログラムの変更に対しても容易、かつ、低コストで対応することができ、しかも高いセキュリティを確保することが可能なICカード、ICカード接続装置、ICカードシステム及びICカードの制御方法を提供することを目的とする。
【0006】
【課題を解決するための手段】
上記課題を解決するため、請求項1記載の構成は、プログラムデータを更新可能に格納するプログラム格納手段と、前記プログラムデータに基づいて当該プログラムデータに固有の原認証データを生成し、格納する原認証データ生成格納手段と、前記プログラム格納手段に格納されたプログラムデータのうち、外部より実行が指示されたプログラムに対応するプログラムデータについての前記原認証データに対し所定の演算を施すことにより認証データを生成する認証データ生成手段と、外部より入力される基準認証データと前記認証データとが一致するか否かを判別する判別手段と、前記判別に基づいて、前記基準認証データと前記認証データとが不一致した場合には、前記プログラムの実行を禁止する実行禁止手段と、を備えたことを特徴としている。
【0007】
請求項2記載の構成は、請求項1記載の構成において、前記原認証データ生成手段は、前記プログラムデータを圧縮することにより前記原認証データを生成することを特徴としている。
請求項3記載の構成は、請求項1または請求項2記載の構成において、前記認証データ生成手段は、乱数データを発生させ、出力する乱数発生手段と、前記乱数データ及び前記原認証データに基づいて予め設定した所定の暗号化処理を行い前記認証データを生成する暗号化手段と、を備えたことを特徴としている。
【0008】
請求項4記載の構成は、請求項3記載の構成において、前記暗号化手段は、暗号化に必要な鍵データを複数記憶可能な鍵データ記憶手段と、外部より入力された鍵指示データに対応する前記鍵データを用いて前記暗号化処理を行う暗号化処理手段と、備えたことを特徴としている。
【0009】
請求項5記載の構成は、請求項1ないし請求項4のいずれかに記載の構成において、前記プログラム格納手段に外部より入力された前記プログラムデータが格納された段階では、当該プログラムデータを、対応するプログラムの実行を許可しない非実行プログラムデータとして設定する実行可能プログラム設定手段を備えたことを特徴としている。
【0010】
請求項6記載の構成は、請求項5記載の構成において、前記実行可能プログラム設定手段は、前記非実行プログラムデータについて前記原認証データが生成された場合には、当該非実行プログラムデータを実行可能プログラムデータとして設定することを特徴としている。
【0011】
請求項7記載の構成は、請求項1ないし請求項6のいずれかに記載のICカードに接続されるICカード接続装置であって、前記プログラム格納手段に格納されている前記プログラムデータのうち、実行させようとするプログラムに対応する前記プログラムデータを特定し、前記ICカードに対しその実行を指示するプログラム実行指示手段と、前記特定したプログラムに対応する前記原認証データを原基準認証データとして予め格納する原基準認証データ格納手段と、前記原基準認証データに対し前記認証データ生成手段における前記所定の演算と同一の演算を施すことにより前記基準認証データを生成する基準認証データ生成手段と、前記判別手段に対し、前記基準認証データを出力する基準認証データ出力手段と、
を備えたことを特徴としている。
【0012】
請求項8記載の構成は、請求項4記載のICカードに接続されるICカード接続装置であって、前記プログラム格納手段に格納されている前記プログラムデータのうち、実行させようとするプログラムに対応する前記プログラムデータを特定し、前記ICカードに対しその実行を指示するプログラム実行指示手段と、前記特定したプログラムに対応する前記原認証データを原基準認証データとして予め格納する原基準認証データ格納手段と、前記鍵データを複数記憶する鍵データ記憶手段と、前記暗号化手段に対し、前記鍵指示データを出力する鍵指示データ出力手段と、前記鍵指示データに対応する鍵データ、前記ICカードより入力された前記乱数データ及び前記原基準認証データに基づいて前記暗号化処理手段と同一の処理を行い、前記基準認証データを生成する基準認証データ生成手段と、前記判別手段に対し、前記基準認証データを出力する基準認証データ出力手段と、を備えたことを特徴としている。
【0013】
請求項9記載の構成は、請求項1ないし請求項6のいずれかに記載のICカードと、請求項7記載のICカード接続装置と、を備えたことを特徴としている。請求項10記載の構成は、請求項4記載のICカードと、請求項8記載のホスト装置と、を備えたことを特徴としている。
【0014】
請求項11記載の構成は、プログラムデータを更新可能に予め格納する格納手段と、当該格納手段に格納されたプログラムデータに基づいたプログラムを実行するための制御手段とを有するICカードにおけるプログラム実行制御方法において、前記制御手段が、格納されている前記プログラムデータに基づいて前記プログラムデータに固有の原認証データを生成する原認証データ生成工程と、前記制御手段が、前記原認証データに対し所定の演算を施すことにより認証データを生成する認証データ生成工程と、前記制御手段が、入力された基準認証データと生成した前記認証データとが一致するか否かを判別する判別工程と、前記制御手段が、前記判別に基づいて、前記基準認証データと前記認証データとが一致した場合には、当該プログラムデータに対応するプログラムの実行を許可する実行許可工程と、を備えたことを特徴としている。
【0015】
【発明の実施の形態】
次に図面を参照して本発明の好適な実施形態について説明する。
[1] ICカードシステムの概要構成
図1のICカードシステムの概要構成ブロック図を示す。
ICカードシステム1は、ICカード2と、ICカード2に対するプログラムデータの書き換えや、ICカード2の出力データに基づいて各種処理を行うICカード接続装置3と、を備えて構成されている。
【0016】
ICカード接続装置3は、ICカード2内のデータの読出/書込を行うICカードリーダ/ライタ3Aと、各種処理を行うICカード接続装置本体3Bと、各種情報の表示を行う表示装置3Cと、を備えて構成されている。
【0017】
[2] ICカードの概要構成
図2にICカードの概要構成ブロック図を示す。
ICカード2は、ICカード2全体の制御を行うCPU11と、暗号化処理に必要なべき乗剰余演算処理を行うことが可能なコプロセッサ12と、ブートプログラムや各種固定データが記憶されたROM13と、電気的にデータの書換が可能で、プログラムデータ等を更新可能に記憶するEEPROM14と、各種データを一時的に記憶するRAM15と、を備えて構成されている。
【0018】
さらにICカード2には、外部より電源を供給するための高電位側電源端子VCC及び低電位側電源端子GND、ICカード接続装置3側よりリセット信号を入力するためのリセット端子RST、ICカード接続装置3との間でデータの送受信などを行うためのI/O端子I/Oと、ICカード接続装置3よりシステムクロック信号が入力されるクロック端子CLKと、が設けられている。
【0019】
[3] EEPROM内のファイル構造
ここで、図3及び図4を参照してEEPROM14内のファイル構造について説明する。
EEPROM14は、大別すると、システム管理領域21と、データ格納領域22と、を備えて構成されている。
【0020】
[3.1] システム管理領域の構成
システム管理領域21は、実際のプログラムデータの格納領域及び格納状態などについての各種情報に対応するプログラム格納ファイル31が記憶されているプログラム格納ファイル領域25と、暗号化処理に用いられる暗号鍵についての各種情報に対応する鍵格納ファイル32が記憶されている鍵格納ファイル領域26と、乱数発生のための情報に対応する種ファイル33が記憶されている種ファイル領域27と、を備えて構成されている。
【0021】
[3.1.1] プログラム格納ファイルのフォーマット
図4(a)にプログラム格納ファイルのフォーマットを示す。
プログラム格納ファイル31は、プログラムデータに割り当てられたファイル番号に対応するファイル番号データ35と、ファイル番号データ35に対応するプログラムデータが実際に格納されている先頭アドレスを表す格納先頭アドレスデータ36と、ファイル番号データ35に対応するプログラムデータが実際に格納されている最終アドレスを表す最終アドレスデータ37と、プログラムデータに対し所定の圧縮処理を施すことにより得られる圧縮データを格納アドレスを表す圧縮値格納アドレスデータ38と、ファイル番号データ35に対応するプログラムデータが実行可能プログラムデータであるか否かを表す実行フラグ39と、を備えて構成されている。
【0022】
[3.1.2] 鍵格納ファイルのフォーマット
図4(b)に鍵格納ファイルのフォーマットを示す。
鍵格納ファイル32は、暗号鍵データに割り当てられたファイル番号に対応するファイル番号データ41と、ファイル番号データ41に対応する暗号鍵データが実際に格納されている先頭アドレスを表す格納先頭アドレスデータ42と、ファイル番号データ41に対応する暗号鍵データが実際に格納されている最終アドレスを表す格納最終アドレスデータ43と、当該暗号鍵データのタイプを表す鍵タイプデータ44と、を備えて構成されている。
【0023】
[3.2] データ格納領域の構成
データ格納領域22は、プログラム格納ファイル31に対応するプログラムファイル45が格納されているプログラムファイル領域46と、鍵格納ファイル32に対応する暗号鍵データ47が格納されている暗号鍵データが格納されている暗号鍵データ領域48と、を備えて構成されている。
プログラムファイル45は、実際のプログラムに対応するプログラムデータ49及びプログラムデータ49に対し所定の圧縮処理を施すことにより得られる圧縮値データ50を有して構成されている。
【0024】
[4] 動作説明
次に図5ないし図9を参照してICカード2のプログラムデータ格納処理からICカードに格納したプログラムデータに基づく実行処理までの動作を、ICカード2の処理動作を主体として説明する。
【0025】
図5にICカード2のメイン処理フローチャートを示す。
まず、ICカード2のCPU11は、I/Oポートを介してICカード接続装置3からコマンドデータなどのデータを受信するための受信処理を行う(ステップS1)。
【0026】
次にCPU11は、受信処理において受信したデータが連続データを含むか否かを判別する(ステップS2)。
ステップS2の判別において連続データを含む場合には、CPU11は、後述するステップS9の処理に移行する。
【0027】
ステップS2の判別において、連続データを含まない場合には、CPU11は受信したデータが実行コマンドデータであるか否かを判別する(ステップS3)。
ここで、実行コマンドデータとは、EEPROM14内に既に格納されており、かつ、既に実行可能状態となっているプログラムデータのファイル番号を指定して、当該プログラムデータに対応するプログラムの実行を行わせるための命令である。
【0028】
ステップS3の判別において、受信したデータが実行コマンドデータである場合には、後述する実行コマンド処理を行い(ステップS4)、レスポンス処理(ステップS5)及びICカード接続装置側に対する送信処理を行って(ステップS6)、処理を終了する。
【0029】
ステップS3の判別において受信したデータが実行コマンドデータではない場合には、CPU11は、受信したデータが実行可能コマンドデータであるか否かを判別する(ステップS7)。ここで、実行可能コマンドデータとは、EEPROM14内に既に格納されているが、いまだ実行可能状態となっていないプログラムデータのファイル番号を指定して、当該プログラムデータを実行可能状態にするための命令である。
【0030】
ステップS7の判別において、受信したデータが実行可能コマンドデータである場合には、後述する実行可能コマンド処理を行い(ステップS8)、レスポンス処理(ステップS5)及びICカード接続装置側に対する送信処理を行って
(ステップS6)、処理を終了する。
【0031】
ステップS7の判別において受信したデータが実行可能コマンドデータではない場合には、CPU11は、受信したデータが格納コマンドデータであるか否かを判別する(ステップS9)。ここで、格納コマンドデータとは、EEPROM14に新しいプログラムデータを格納させるための命令である。
【0032】
ステップS9の判別において、受信したデータが格納行コマンドデータである場合には、後述する格納コマンド処理を行い(ステップS10)、レスポンス処理(ステップS5)及びICカード接続装置側に対する送信処理を行って(ステップS6)、処理を終了する。
【0033】
ステップS9の判別において受信したデータが格納コマンドデータではない場合には、CPU11は、受信したデータが乱数生成を要求する乱数コマンドデータであるか否かを判別する(ステップS11)。ここで、乱数コマンドデータとは、乱数を生成させ、ICカード接続装置3に出力させるための命令である。
【0034】
ステップS11の判別において、受信したデータが乱数コマンドデータである場合には、後述する乱数生成コマンド処理を行い(ステップS12)、レスポンス処理(ステップS5)及びICカード接続装置側に対する送信処理を行って
(ステップS6)、処理を終了する。
【0035】
ステップS11の判別において、受信したデータが乱数コマンドデータではない場合には、対応するコマンドデータが存在しない受信エラーであると判断して、エラー告知などのエラー処理を行い、レスポンス処理(ステップS5)及びICカード接続装置側に対する送信処理を行って(ステップS6)、処理を終了することとなる。
【0036】
[4.1] 格納コマンド処理
次に格納コマンド処理について図6及び図7を参照して説明する。
まず格納コマンド処理の説明に先立ち、図6(a)を参照して格納コマンドデータのデータフォーマットについて説明する。図6(a)において括弧内は対応するデータのバイト数である。
【0037】
格納コマンドデータ51は、当該データが格納コマンドデータ51であることを示す1[バイト]の命令データ(instruction data)52と、格納しようとするプログラムデータを特定するための2[バイト]のファイル番号データ53と、格納しようとするプログラムデータの長さを表す長さデータ54と、連続データであり実際に格納しようとする1〜65535[バイト]のプログラムデータ49と、を備えて構成されている。
【0038】
図7に格納コマンド処理の処理フローチャートを示す。
CPU11は、ICカード接続装置3から受信したデータが連続データであるか否か、すなわち、プログラムデータ49であるか否かを判別する(ステップS21)。
ステップS21の判別において、受信したデータが連続データではない場合には(ステップS;No)、格納コマンドデータ51の先頭部分であるので、ファイル番号データ53に対応するファイル番号に相当するプログラムファイル領域46にプログラムデータを49を格納可能か否か、すなわち、当該ファイル番号に対応する領域が存在し、かつ、当該領域には既にプログラムデータ49が格納されていないか否かを判別する(ステップS22)。
【0039】
ステップS22の判別において、当該ファイル番号に対応する領域が存在せず、あるいは、当該領域にはプログラムデータ49が既に格納されている場合には(ステップS22;No)、対応するエラー処理を行って処理を終了する。
ステップS22の判別において、当該ファイル番号に対応する領域が存在し、かつ、当該領域にはプログラムデータ49が格納されていない場合には、格納先頭アドレスを設定する(ステップS23)。
【0040】
そしてCPU11は、ICカード接続装置3から受信したプログラムデータ49を格納するための格納アドレスをセットし(ステップS24)、当該セットした格納アドレスにプログラムデータ49をプログラムファイル45の一部として格納し(ステップS25)、対応するプログラム格納ファイル31の実行フラグ39をオフ(=例えば、“0”)とする(ステップS26)。
【0041】
ステップS21の判別において、ICカード接続装置3から受信したデータが連続データである場合には(ステップS21;Yes)、当該受信したデータはプログラムデータ49を構成するデータであるので、受信したプログラムデータ49を構成するデータを格納するための格納アドレスをセットし(ステップS24)、当該セットした格納アドレスにプログラムデータ49を構成するデータを格納し(ステップS25)、対応するプログラム格納ファイル31の実行フラグ39をオフとする(ステップS26)。
【0042】
そして、全てのプログラムデータ49を構成するデータを受信すると、対応するプログラム格納ファイル31のファイル番号データ35、当該プログラムデータ49が実際に格納されているプログラムファイル領域46の先頭アドレスを表す格納先頭アドレスデータ36と、当該プログラムデータ49が実際に格納されているプログラムファイル領域46における最終アドレスを表す最終アドレスデータ37と、を更新するレスポンス処理を行い(ステップS5)、プログラムデータ49を受信し、格納した旨をICカード接続装置3に通知する送信処理を行う(ステップS6)。
【0043】
以上のようにして、ICカード接続装置3から送信されたプログラムデータ49は、EEPROM14のプログラムファイル領域46に格納される。
しかしながら、この時点においては、格納されたプログラムデータ49に対応するプログラム格納ファイル31の実行フラグ39はオフであるため、実行することはできない非実行可能プログラムとなっている。
【0044】
[4.2] 実行可能コマンド処理
次に実行可能コマンド処理について図6及び図8を参照して説明する。
まず実行可能コマンド処理の説明に先立ち、図6(b)を参照して実行可能コマンドデータのデータフォーマットについて説明する。図6(b)において括弧内は対応するデータのバイト数である。
【0045】
実行可能コマンドデータ56は、当該データが実行可能コマンドデータ56であることを示す1[バイト]の命令データ57と、EEPROM14のプログラムファイル領域46に格納されているプログラムデータ49のうち、実行可能状態にしようとするプログラムデータ49を特定するための2[バイト]のファイル番号データ58と、を備えて構成されている。
【0046】
図8に実行可能コマンド処理の処理フローチャートを示す。
まず、CPU11は、ICカード接続装置3から受信した実行可能コマンドデータ56のファイル番号データ58に対応するファイル番号に相当するプログラム格納ファイル31に基づいて、プログラムファイル領域46内のプログラムファイル45を検索するためのプログラムファイルサーチを行い、ICカード接続装置3から受信した実行可能コマンドデータ56に対応するプログラムファイル領域46に処理対象であるプログラムデータ49が既に格納されているか否かを判別する(ステップS31)。
【0047】
ステップS31の判別において、ファイル番号に相当するプログラムファイル領域46にプログラムデータ49が格納されていない場合、あるいは、既に実行可能コマンド処理が終了したプログラムデータ49が格納されている場合には(ステップS31;No)、処理対象が存在しないので、対応するエラー処理を行って(ステップS37)、処理を終了する。
【0048】
ステップS31の判別において、ファイル番号に相当するプログラムファイル領域46に処理対象であるプログラムデータ49が既に格納されている場合には、プログラムデータを圧縮して得られるはずの圧縮値データ50を格納するためのプログラムファイル領域46における圧縮先頭アドレスを設定する(ステップS32)。
【0049】
次に1アドレスずつプログラム圧縮を行い(ステップS33)、現在の圧縮対象データのアドレスが当該プログラムデータ49の最終アドレスか否か、すなわち、現在の圧縮対象のデータが当該プログラムデータ49の最終データであるか否かを判別する(ステップS34)。
【0050】
ステップS34の判別において、現在の圧縮対象データのアドレスが当該プログラムデータ49の最終アドレスではない場合には(ステップS34;No)、次のアドレスのデータの圧縮処理を行うべく処理を再びステップS33に移行する。
【0051】
ステップS34の判別において、現在の圧縮対象データのアドレスが当該プログラムデータ49の最終アドレスである場合には、得られた圧縮値データを格納し、当該圧縮データの格納アドレスをプログラム格納ファイル31の圧縮値格納アドレスデータ38として設定し(ステップS35)、当該プログラム格納ファイル31の実行フラグ39をオン(=例えば、“1”)とする。
【0052】
以上の結果、当該プログラム格納ファイルに対応するプログラムデータ49は実行可能プログラムデータとなり、後述するプログラム実行コマンド処理において、正規のプログラムデータであると認証されれば、実行することが可能となる。
【0053】
[4.3] 実行コマンド処理
次に実行コマンド処理について図6及び図9を参照して説明する。
まず実行コマンド処理の説明に先立ち、図6(c)及び図6(d)を参照して実行コマンドデータ及び乱数生成コマンドのデータフォーマットについて説明する。図6(c)及び図6(d)において括弧内は対応するデータのバイト数である。
【0054】
実行コマンドデータ62は、図6(d)に示すように、当該データがプログラムデータを実行させるための実行コマンドデータ62であることを示す1[バイト]の命令データ63と、実行させようとするプログラムデータを特定するための2[バイト]のファイル番号データ64と、ファイル番号データ64で特定されるプログラムデータ49の実行に必要な認証データを生成するのに必要な暗号鍵の情報を含む鍵格納ファイル32を特定するための鍵ファイル番号データ65と、後述する基準認証データ67の長さを表す長さデータと、8〜128[バイト]の基準認証データ67と、を備えて構成されている。
【0055】
この場合において、基準認証データ67の長さとしては、一般的に暗号化方式にDESを用いた場合は64[バイト]、RASを用いた場合は1024[バイト]が用いられる。
乱数生成コマンドデータ59は、図6(c)に示すように、当該データが乱数を発生させるための乱数生成コマンドデータ59であることを示す1[バイト]との命令データ60と、乱数を種ファイル33を利用してソフトウェア的に発生させるべく、使用する種ファイルを特定するための2[バイト]の種ファイル番号データ61とを備えて構成されている。
【0056】
図9に実行コマンド処理の処理フローチャートを示す。
まず、ICカード接続装置3は、実行コマンドデータ62の送信に先立って、乱数生成コマンドデータ59をCPU11に送信する。
この結果、CPU11は、種ファイル番号データ61に対応する種ファイル33をEEPROM14の種ファイル領域27から読み出し、乱数を生成して(ステップS12)、レスポンス処理として乱数送信用データを生成し(ステップS5、ICカード接続装置3に対して乱数データを送信する(ステップS6)。
【0057】
次にICカード接続装置3は、実行コマンドデータ62をCPU11に送信する。
これによりCPU11は、受信した実行コマンドデータ62のファイル番号データに対応するプログラム格納ファイル31を参照し、実行フラグ39がオンになっているか否かを判別する(ステップS41)。
ステップS41の判別において実行フラグ39がオフである場合には(ステップS41;No)、当該ファイル番号データに対応するプログラムデータ49は非実行可能状態であるので、対応するエラー処理を行って(ステップS49)、処理を終了する。
【0058】
ステップS41の判別において実行フラグ39がオンである場合には(ステップS41;Yes)、EEPROM14内のプログラムファイル領域46をサーチし、対応するプログラムファイル45が存在するか否かを判別する(ステップS42)。
【0059】
ステップS42の判別において、対応するプログラムファイル45が存在しない場合には(ステップS42;No)、その旨を告知する等のエラー処理を行い(ステップS49)、処理を終了する。
ステップS42の判別において、対応するプログラムファイル45が存在する場合には(ステップS42;Yes)、プログラム格納ファイル31の圧縮値格納アドレスデータ38を参照して格納されている圧縮値データ50を読み出し(ステップS43)、読み出した圧縮値データ50に生成した乱数データを結合することにより、原認証コードデータを生成する(ステップS44)。結合の方法としては、単なる四則演算、排他論理和演算などの論理演算などが考えられる。
【0060】
この結果、圧縮値データ50が同一の場合でも、原認証コードデータは異なるものとなり、原認証コードデータを解析しても、圧縮値データ50を求めることは困難となる。
次にCPU11は、実行コマンドデータ62の鍵ファイル番号データ65に基づいて対応する鍵格納ファイル32をサーチし、サーチできたか否かを判別する(ステップS45)。
【0061】
ステップS45の判別において、鍵ファイル番号データ65に対応する鍵格納ファイルがサーチできなかった場合には(ステップS45;No)、後述する暗号化処理を行うことができないので、対応するエラー処理(ステップS39)を行って処理を終了する。
【0062】
ステップS45の判別において、鍵ファイル番号データ65に対応する鍵格納ファイルをサーチできた場合には(ステップS;Yes)、格納先頭アドレスデータ42、格納最終アドレスデータ43及び鍵タイプデータに基づいて、暗号下記データ領域48から暗号鍵データ47を読出して、当該暗号鍵データ47を用いて原認証コードデータをコプロセッサ12により暗号化処理し、認証コードデータを生成する(ステップS46)。
【0063】
より具体的には、RSA暗号アルゴリズムを用いる場合、暗号鍵データ47に含まれている暗号鍵N及び暗号鍵e(d)を用いてコプロセッサ12により原認証コードデータ(=圧縮値データ+乱数データ)に対し、べき乗剰余演算を行うことにより認証コードデータを得ることとなる。
【0064】
ところで、このICカード2側の認証コードデータの生成に先だって、ICカード接続装置3は、予めプログラムデータ49を圧縮することにより得られる圧縮値データ(以下、基準圧縮値データという。)を求めておく。この基準圧縮値データは、ICカード2のEEPROM14に格納されているプログラムデータが改竄などがなされていない正規のプログラムデータである場合には、圧縮値データ50に等しい。
【0065】
そしてICカード接続装置3は、ICカード2側から送信された乱数データを結合することにより原基準認証コードデータを生成する。結合方法としては、ICカード2側で行われる結合方法と同一の方法が用いられる。
さらにICカード接続装置3は、RSA暗号アルゴリズムを用いる場合、送信しようとする実行コマンドデータ中の鍵ファイル番号データに対応する鍵ファイルに相当する暗号鍵N及び暗号鍵e(d)を用いて原基準認証コードデータ(=基準圧縮値データ+乱数データ)に対し、べき乗剰余演算を行うことにより基準認証コードデータを得る。
【0066】
そしてICカード接続装置3は、基準認証コードデータを実行コマンドデータ62の基準認証データ67としてICカード2に送信している。
これらの結果、CPU11は、実行コマンドデータ62に含まれる基準認証コードデータ67と生成した認証コードデータを比較することにより照合し、基準認証コードデータ67と生成した認証コードデータとが一致するか否かを判別する(ステップS47)。
【0067】
そして、CPU11は、ステップS47の判別において、基準認証コードデータ67と生成した認証コードデータとが一致しない場合には、EEPROM14に格納されているプログラムデータ49が改竄などがなされた不正のものである可能性があるため、対応するエラー処理を行って(ステップS49)、処理を終了し、プログラムの実行は行わない。
【0068】
また、ステップS47の判別において、基準認証コードデータ67と生成した認証コードデータとが一致した場合には、EEPROM14に格納されているプログラムデータ49は正規のプログラムデータであるとして認証し、当該プログラムデータに対応するプログラムを実行し(ステップS48)、送信データの生成などのレスポンス処理(ステップS5)及び送信データのICカード接続装置3への送信(ステップS6)を行って処理を終了する。
【0069】
[5] 実施形態の変形例
以上の説明においては、ICカード接続装置3がICカードに基準認証コードデータの送信を行う場合には、実行コマンドデータに基準認証コードデータを含めて送信していたが、ICカード2側から要求があった場合に別のデータとして送信したりすることも可能である。
【0070】
また、原認証コードデータ(あるいは原基準認証コードデータ)を生成するための圧縮方法としては、MD4、MD5、SHA等の一般的に知られている一方向ハッシュ関数を用いることが可能である。
さらに、原認証コードデータから認証コードデータ(あるいは原基準認証コードデータから基準認証コードデータ)を生成する場合の演算処理として暗号化処理を行っていたが、容易に認証コードデータ(あるいは基準認証コードデータ)を生成できない処理であれば、いかなる演算処理を適用することも可能である。
【0071】
また、暗号化処理としては、RSAに限らず、DES、FEAL等の他の暗号化処理を用いることが可能である。
さらに上記説明においては、乱数生成をソフトウェア的に行っていたが、乱数発生ICなどのハードウェアで構成された乱数発生器を用いて構成することも可能である。この場合においては、上記説明中の種ファイルを用いる必要はない。
【0072】
以上の説明においては、プログラムデータを格納するメモリとしてEEPROMを用いたが、NVRAM等のように不揮発性であり、容易にデータ更新可能な記憶装置であれば構わない。
【0073】
[6] 実施形態の効果
以上の説明のように、プログラムデータを圧縮することにより得られる圧縮値データと生成した乱数データを結合して原認証データを生成し、さらに原認証データに暗号化処理を行って、実際に認証を行うための認証データを生成しているので、認証データをICカード内に格納しておく必要がないので、認証データが外部に漏れることがない。
【0074】
また、認証コードデータの生成に複雑な計算が要求される暗号化処理を用いているので、認証コードデータの改竄が困難であり、従って、格納したプログラムデータを不正に実行させることが非常に困難となって高度にセキュリティを確保したプログラム実行機能を実現することができる。
【0075】
一方、正規のプログラムデータの書込で有れば、セキュリティを確保した状態で実行可能にEEPROMに容易に書き込むことが可能であり、プログラムの変更、改良などを低コストで容易、かつ、迅速に行うことが可能となる。
【0076】
【発明の効果】
本発明によれば、ICカードは、格納しているプログラムデータに対して圧縮処理や暗号化処理などの所定の処理、演算などを行うことにより実際に認証を行うための認証データを生成しているので、認証データをICカード内に格納しておく必要がなく、認証データが外部に漏れることがないので、高いセキュリティを確保することが可能となる。
【0077】
さらに、プログラムデータに対応するプログラムを実行するために必要な認証コードデータの生成に複雑な演算が要求される所定の演算処理を用いているので、認証コードデータの改竄が困難であり、従って、格納したプログラムデータを不正に実行させることが非常に困難となって高度にセキュリティを確保したプログラム実行機能を実現することができる。
【0078】
さらにまた、プログラムデータの格納には、EEPROMなどのようにプログラムデータを更新可能に格納するプログラム格納手段を用いているので、プログラムの変更に対しても容易、かつ、低コストで対応することができる。
【図面の簡単な説明】
【図1】 実施形態のICカードシステムの概要構成図である。
【図2】 ICカードの概要構成図である。
【図3】 EEPROM内のデータ格納状態の説明図である。
【図4】 プログラム格納ファイル及び鍵格納ファイルのデータフォーマットの説明図である。
【図5】 実施形態の概要処理フローチャートである。
【図6】 各コマンドデータのデータフォーマットの説明図である。
【図7】 格納コマンド処理の処理フローチャートである。
【図8】 実行可能コマンド処理の処理フローチャートである。
【図9】 実行コマンド処理の処理フローチャートである。
【符号の説明】
1 ICカードシステム
2 ICカード
3 ICカード接続装置
11 CPU
12 コプロセッサ
13 ROM
14 EEPROM
15 RAM
21 システム管理領域
22 データ格納領域
25 プログラム格納ファイル領域
26 鍵格納ファイル領域
27 種ファイル領域
31 プログラム格納ファイル
32 鍵格納ファイル
33 種ファイル
35 ファイル番号データ
36 格納先頭アドレスデータ
37 格納最終アドレスデータ
38 圧縮値格納アドレスデータ
39 実行フラグ
41 ファイル番号データ
42 格納先頭アドレスデータ
43 格納最終アドレスデータ
44 鍵タイプデータ
45 プログラムファイル
46 プログラムファイル領域
47 暗号鍵データ
48 暗号鍵データ領域
49 プログラムデータ
50 圧縮値データ
51 格納コマンドデータ
56 実行可能コマンドデータ
59 乱数生成コマンドデータ
60 実行コマンドデータ
[0001]
BACKGROUND OF THE INVENTION
The present invention relates to an IC card, an IC card connection device, an IC card system, and an IC card. Program in of Execution An IC card, an IC card connection device, an IC card system, and an IC card capable of ensuring the security of an IC card with a built-in rewritable memory, in particular program of Execution It relates to a control method.
[0002]
[Prior art]
In an IC card that needs to ensure high security, an OS (Operating System) used is fixed according to standards and specifications, and is stored in the IC card in the form of a mask ROM.
There is also known an IC card configured to store an OS program in an EEPROM in order to more easily correspond to a custom product.
[0003]
[Problems to be solved by the invention]
However, in the configuration in which the program is stored in the mask ROM, the mask ROM must be newly manufactured each time the program is changed, and thus there is a problem that it takes time and cost to manufacture the mask ROM chip.
[0004]
On the other hand, in an IC card of a type that stores a program in a rewritable EEPROM or the like, the program can be easily rewritten and can be flexibly adapted to program change, but it is difficult to ensure high security because it is easy to rewrite. There was a problem of becoming.
[0005]
SUMMARY OF THE INVENTION An object of the present invention is to provide an IC card, an IC card connection device, an IC card system, and an IC card that can easily cope with program changes at low cost and can ensure high security. An object is to provide a method for controlling an IC card.
[0006]
[Means for Solving the Problems]
In order to solve the above-described problem, the configuration according to claim 1 includes a program storage unit that stores program data in an updatable manner, and an original authentication data that is generated and stored based on the program data. Authentication data generating and storing means, and authentication data by performing a predetermined operation on the original authentication data for the program data corresponding to the program instructed to be executed from the outside among the program data stored in the program storing means Authentication data generating means for generating, a determination means for determining whether or not the reference authentication data inputted from the outside matches the authentication data, and based on the determination, the reference authentication data and the authentication data And an execution prohibiting means for prohibiting the execution of the program when there is a mismatch. It is set to.
[0007]
The configuration described in claim 2 is the configuration described in claim 1, wherein the original authentication data generation means generates the original authentication data by compressing the program data.
The configuration according to claim 3 is based on the configuration according to claim 1 or 2, wherein the authentication data generating means generates and outputs random number data, and the random number data and the original authentication data. And encryption means for generating authentication data by performing predetermined encryption processing set in advance.
[0008]
The configuration according to claim 4 is the configuration according to claim 3, wherein the encryption means corresponds to key data storage means capable of storing a plurality of key data necessary for encryption, and key instruction data input from the outside. And encryption processing means for performing the encryption processing using the key data.
[0009]
The configuration according to claim 5 corresponds to the configuration according to any one of claims 1 to 4, wherein the program data is handled at a stage where the program data inputted from the outside is stored in the program storage means. An executable program setting means for setting as non-executable program data that does not permit execution of the program to be executed is provided.
[0010]
The configuration according to claim 6 is the configuration according to claim 5, wherein the executable program setting means can execute the non-executable program data when the original authentication data is generated for the non-executable program data. It is characterized by being set as program data.
[0011]
The configuration according to claim 7 is an IC card connection device connected to the IC card according to any one of claims 1 to 6, wherein the program data stored in the program storage unit includes: The program data corresponding to the program to be executed is specified, a program execution instruction means for instructing the IC card to execute the program data, and the original authentication data corresponding to the specified program is previously used as original reference authentication data. Original reference authentication data storing means for storing; reference authentication data generating means for generating the reference authentication data by performing the same operation as the predetermined operation in the authentication data generating means for the original reference authentication data; Reference authentication data output means for outputting the reference authentication data to the determination means;
It is characterized by having.
[0012]
The configuration according to claim 8 is an IC card connection device connected to the IC card according to claim 4, and corresponds to a program to be executed among the program data stored in the program storage means. Program execution instruction means for specifying the program data to be executed and instructing the IC card to execute the program data, and original reference authentication data storage means for storing the original authentication data corresponding to the specified program in advance as original reference authentication data A key data storage unit that stores a plurality of the key data, a key instruction data output unit that outputs the key instruction data to the encryption unit, key data corresponding to the key instruction data, and the IC card The input random number data and the original Standard A reference authentication data generating unit that performs the same processing as the encryption processing unit based on authentication data and generates the reference authentication data; and a reference authentication data output unit that outputs the reference authentication data to the determination unit; It is characterized by having.
[0013]
According to a ninth aspect of the present invention, the IC card according to any one of the first to sixth aspects and the IC card connecting device according to the seventh aspect are provided. According to a tenth aspect of the present invention, there is provided an IC card according to the fourth aspect and a host device according to the eighth aspect.
[0014]
The configuration according to claim 11 is a storage means for storing program data in an updatable manner in advance. And control means for executing a program based on the program data stored in the storage means IC card with Program in of Execution In the control method, The control means is An original authentication data generating step for generating original authentication data unique to the program data based on the stored program data; The control means is An authentication data generating step for generating authentication data by performing a predetermined operation on the original authentication data; The control means is A determination step of determining whether or not the input reference authentication data matches the generated authentication data; The control means is Based on the determination, when the reference authentication data matches the authentication data, an execution permission step of permitting execution of a program corresponding to the program data is provided.
[0015]
DETAILED DESCRIPTION OF THE INVENTION
Next, preferred embodiments of the present invention will be described with reference to the drawings.
[1] Outline configuration of IC card system
FIG. 2 shows a schematic block diagram of the IC card system of FIG. 1.
The IC card system 1 includes an IC card 2 and an IC card connection device 3 that rewrites program data for the IC card 2 and performs various processes based on output data of the IC card 2.
[0016]
The IC card connection device 3 includes an IC card reader / writer 3A that reads / writes data in the IC card 2, an IC card connection device body 3B that performs various processes, and a display device 3C that displays various information. , And is configured.
[0017]
[2] Outline configuration of IC card
FIG. 2 shows a schematic block diagram of the IC card.
The IC card 2 includes a CPU 11 that controls the entire IC card 2, a coprocessor 12 that can perform a modular multiplication operation that is necessary for encryption processing, a ROM 13 that stores a boot program and various fixed data, It is configured to include an EEPROM 14 that can electrically rewrite data and store program data and the like in an updatable manner, and a RAM 15 that temporarily stores various data.
[0018]
Further, the IC card 2 has a high potential side power supply terminal VCC and a low potential side power supply terminal GND for supplying power from outside, a reset terminal RST for inputting a reset signal from the IC card connection device 3 side, and an IC card connection. An I / O terminal I / O for transmitting / receiving data to / from the apparatus 3 and a clock terminal CLK to which a system clock signal is input from the IC card connection apparatus 3 are provided.
[0019]
[3] File structure in EEPROM
Here, the file structure in the EEPROM 14 will be described with reference to FIGS.
The EEPROM 14 is roughly configured to include a system management area 21 and a data storage area 22.
[0020]
[3.1] Configuration of system management area
The system management area 21 includes a program storage file area 25 in which a program storage file 31 corresponding to various information about the storage area and storage state of the actual program data is stored, and an encryption key used for encryption processing. A key storage file area 26 in which a key storage file 32 corresponding to various information is stored, and a seed file area 27 in which a seed file 33 corresponding to information for generating random numbers is stored. Yes.
[0021]
[3.1.1] Program storage file format
FIG. 4A shows the format of the program storage file.
The program storage file 31 includes file number data 35 corresponding to the file number assigned to the program data, storage head address data 36 representing the head address where the program data corresponding to the file number data 35 is actually stored, A final address data 37 representing the final address where program data corresponding to the file number data 35 is actually stored, and a compressed value storage representing compressed data obtained by applying a predetermined compression process to the program data The address data 38 and an execution flag 39 indicating whether or not the program data corresponding to the file number data 35 is executable program data are configured.
[0022]
[3.1.2] Key storage file format
FIG. 4B shows the format of the key storage file.
The key storage file 32 includes file number data 41 corresponding to the file number assigned to the encryption key data, and storage start address data 42 representing the start address where the encryption key data corresponding to the file number data 41 is actually stored. And storage final address data 43 representing the final address where the encryption key data corresponding to the file number data 41 is actually stored, and key type data 44 representing the type of the encryption key data. Yes.
[0023]
[3.2] Configuration of data storage area
The data storage area 22 stores a program file area 46 in which a program file 45 corresponding to the program storage file 31 is stored, and encryption key data in which encryption key data 47 corresponding to the key storage file 32 is stored. And an encryption key data area 48.
The program file 45 includes program data 49 corresponding to an actual program and compressed value data 50 obtained by subjecting the program data 49 to predetermined compression processing.
[0024]
[4] Operation explanation
Next, operations from the program data storage process of the IC card 2 to the execution process based on the program data stored in the IC card will be described with reference to FIGS.
[0025]
FIG. 5 shows a main process flowchart of the IC card 2.
First, the CPU 11 of the IC card 2 performs reception processing for receiving data such as command data from the IC card connection device 3 via the I / O port (step S1).
[0026]
Next, the CPU 11 determines whether or not the data received in the reception process includes continuous data (step S2).
If the determination at step S2 includes continuous data, the CPU 11 proceeds to the process at step S9 described later.
[0027]
If it is determined in step S2 that continuous data is not included, the CPU 11 determines whether the received data is execution command data (step S3).
Here, execution command data designates the file number of program data already stored in the EEPROM 14 and already in an executable state, and executes a program corresponding to the program data. It is an instruction for.
[0028]
If it is determined in step S3 that the received data is execution command data, execution command processing described later is performed (step S4), response processing (step S5), and transmission processing to the IC card connection device side are performed ( Step S6), the process ends.
[0029]
If the received data is not execution command data in the determination in step S3, the CPU 11 determines whether the received data is executable command data (step S7). Here, the executable command data is an instruction for specifying the file number of the program data that has already been stored in the EEPROM 14 but is not yet executable, and makes the program data executable. It is.
[0030]
If it is determined in step S7 that the received data is executable command data, executable command processing described later is performed (step S8), response processing (step S5), and transmission processing to the IC card connection device side are performed. hand
(Step S6), the process ends.
[0031]
If the received data is not executable command data in the determination in step S7, the CPU 11 determines whether the received data is stored command data (step S9). Here, the stored command data is an instruction for storing new program data in the EEPROM 14.
[0032]
If it is determined in step S9 that the received data is stored row command data, a storage command process (to be described later) is performed (step S10), a response process (step S5) and a transmission process to the IC card connection device side are performed. (Step S6), the process ends.
[0033]
If the received data is not stored command data in the determination in step S9, the CPU 11 determines whether the received data is random command data for requesting random number generation (step S11). Here, the random number command data is a command for generating a random number and outputting it to the IC card connection device 3.
[0034]
If it is determined in step S11 that the received data is random number command data, random number generation command processing described later is performed (step S12), response processing (step S5), and transmission processing to the IC card connection device side are performed.
(Step S6), the process ends.
[0035]
If it is determined in step S11 that the received data is not random command data, it is determined that the corresponding command data does not exist, and an error process such as error notification is performed, and a response process (step S5). And the transmission process with respect to the IC card connection apparatus side is performed (step S6), and the process is terminated.
[0036]
[4.1] Stored command processing
Next, the storage command process will be described with reference to FIGS.
Prior to the description of the storage command process, the data format of the storage command data will be described with reference to FIG. In FIG. 6A, the numbers in parentheses are the number of bytes of the corresponding data.
[0037]
The storage command data 51 includes 1 [byte] instruction data 52 indicating that the data is the storage command data 51 and a 2 [byte] file number for specifying the program data to be stored. Data 53, length data 54 representing the length of program data to be stored, and 1 to 65535 [bytes] of program data 49 which is continuous data and is actually stored are configured. .
[0038]
FIG. 7 shows a processing flowchart of the storage command processing.
The CPU 11 determines whether or not the data received from the IC card connection device 3 is continuous data, that is, whether or not the data is program data 49 (step S21).
If it is determined in step S21 that the received data is not continuous data (step S; No), the program file area corresponding to the file number corresponding to the file number data 53 is the head portion of the stored command data 51. It is determined whether or not the program data 49 can be stored in 46, that is, whether or not there is an area corresponding to the file number and the program data 49 is not already stored in the area (step S22). ).
[0039]
If it is determined in step S22 that there is no area corresponding to the file number, or if the program data 49 is already stored in the area (step S22; No), the corresponding error processing is performed. The process ends.
If it is determined in step S22 that an area corresponding to the file number exists and the program data 49 is not stored in the area, a storage head address is set (step S23).
[0040]
Then, the CPU 11 sets a storage address for storing the program data 49 received from the IC card connection device 3 (step S24), and stores the program data 49 as a part of the program file 45 in the set storage address ( In step S25), the execution flag 39 of the corresponding program storage file 31 is turned off (= “0”, for example) (step S26).
[0041]
If it is determined in step S21 that the data received from the IC card connection device 3 is continuous data (step S21; Yes), the received data is data constituting the program data 49. 49 is set (step S24), the data constituting the program data 49 is stored at the set storage address (step S25), and the execution flag of the corresponding program storage file 31 is stored. 39 is turned off (step S26).
[0042]
When data constituting all the program data 49 is received, the file number data 35 of the corresponding program storage file 31 and the storage start address indicating the start address of the program file area 46 where the program data 49 is actually stored are stored. Response processing for updating the data 36 and the final address data 37 representing the final address in the program file area 46 where the program data 49 is actually stored is performed (step S5), and the program data 49 is received and stored. A transmission process for notifying the IC card connecting device 3 of the fact is performed (step S6).
[0043]
As described above, the program data 49 transmitted from the IC card connection device 3 is stored in the program file area 46 of the EEPROM 14.
However, at this time, the execution flag 39 of the program storage file 31 corresponding to the stored program data 49 is off, so that the program is a non-executable program that cannot be executed.
[0044]
[4.2] Executable command processing
Next, executable command processing will be described with reference to FIGS.
Prior to the description of the executable command process, the data format of the executable command data will be described with reference to FIG. In FIG. 6B, the number of bytes of the corresponding data is in parentheses.
[0045]
Executable command data 56 is an executable state among 1 [byte] instruction data 57 indicating that the data is executable command data 56 and program data 49 stored in the program file area 46 of the EEPROM 14. 2 [bytes] file number data 58 for specifying the program data 49 to be set.
[0046]
FIG. 8 shows a flowchart of the executable command process.
First, the CPU 11 searches the program file 45 in the program file area 46 based on the program storage file 31 corresponding to the file number corresponding to the file number data 58 of the executable command data 56 received from the IC card connection device 3. To determine whether or not the program data 49 to be processed has already been stored in the program file area 46 corresponding to the executable command data 56 received from the IC card connection apparatus 3 (step). S31).
[0047]
If it is determined in step S31 that no program data 49 is stored in the program file area 46 corresponding to the file number, or if program data 49 for which executable command processing has already been completed is stored (step S31). No), since there is no processing target, the corresponding error processing is performed (step S37), and the processing is terminated.
[0048]
If it is determined in step S31 that the program data 49 to be processed is already stored in the program file area 46 corresponding to the file number, the compressed value data 50 that should be obtained by compressing the program data is stored. The compression start address in the program file area 46 is set (step S32).
[0049]
Next, program compression is performed for each address (step S33), and whether or not the address of the current compression target data is the final address of the program data 49, that is, the current compression target data is the final data of the program data 49. It is determined whether or not there is (step S34).
[0050]
If it is determined in step S34 that the current address of the compression target data is not the final address of the program data 49 (step S34; No), the process returns to step S33 to perform the compression process of the data at the next address. Transition.
[0051]
If it is determined in step S34 that the current address of the compression target data is the final address of the program data 49, the obtained compressed value data is stored, and the storage address of the compressed data is stored in the program storage file 31. The value storage address data 38 is set (step S35), and the execution flag 39 of the program storage file 31 is turned on (= “1”, for example).
[0052]
As a result, the program data 49 corresponding to the program storage file becomes executable program data, and can be executed if it is authenticated as legitimate program data in the program execution command processing described later.
[0053]
[4.3] Execution command processing
Next, execution command processing will be described with reference to FIGS.
Prior to the description of the execution command process, the data format of the execution command data and the random number generation command will be described with reference to FIGS. 6C and 6D. In FIG. 6C and FIG. 6D, the numbers in parentheses are the number of bytes of the corresponding data.
[0054]
As shown in FIG. 6D, the execution command data 62 is to be executed with 1 [byte] of instruction data 63 indicating that the data is execution command data 62 for executing the program data. A key including 2 [bytes] file number data 64 for specifying program data and encryption key information necessary for generating authentication data necessary for executing the program data 49 specified by the file number data 64 Key file number data 65 for specifying the storage file 32, length data indicating the length of reference authentication data 67, which will be described later, and reference authentication data 67 of 8 to 128 [bytes]. Yes.
[0055]
In this case, the length of the reference authentication data 67 is generally 64 [bytes] when DES is used as an encryption method and 1024 [bytes] when RAS is used.
As shown in FIG. 6C, the random number generation command data 59 includes instruction data 60 of 1 [byte] indicating that the data is random number generation command data 59 for generating a random number, and a random number as a seed. In order to be generated in software using the file 33, 2 [bytes] seed file number data 61 for specifying a seed file to be used is provided.
[0056]
FIG. 9 shows a process flowchart of the execution command process.
First, the IC card connection device 3 transmits random number generation command data 59 to the CPU 11 prior to transmission of the execution command data 62.
As a result, the CPU 11 reads the seed file 33 corresponding to the seed file number data 61 from the seed file area 27 of the EEPROM 14, generates a random number (step S12), and generates random number transmission data as a response process (step S5). Then, random number data is transmitted to the IC card connection device 3 (step S6).
[0057]
Next, the IC card connection device 3 transmits the execution command data 62 to the CPU 11.
Thereby, the CPU 11 refers to the program storage file 31 corresponding to the file number data of the received execution command data 62, and determines whether or not the execution flag 39 is turned on (step S41).
If the execution flag 39 is OFF in the determination in step S41 (step S41; No), the program data 49 corresponding to the file number data is in a non-executable state, and therefore corresponding error processing is performed (step S41). S49), the process ends.
[0058]
If the execution flag 39 is ON in the determination in step S41 (step S41; Yes), the program file area 46 in the EEPROM 14 is searched to determine whether the corresponding program file 45 exists (step S42). ).
[0059]
If it is determined in step S42 that the corresponding program file 45 does not exist (step S42; No), an error process such as notification to that effect is performed (step S49), and the process ends.
If it is determined in step S42 that the corresponding program file 45 exists (step S42; Yes), the stored compressed value data 50 is read with reference to the compressed value storage address data 38 of the program storage file 31 ( Step S43), by combining the generated random number data with the read compressed value data 50, the original authentication code data is generated (Step S44). As a combination method, a simple arithmetic operation, a logical operation such as an exclusive OR operation, or the like can be considered.
[0060]
As a result, even if the compressed value data 50 is the same, the original authentication code data is different, and it is difficult to obtain the compressed value data 50 even if the original authentication code data is analyzed.
Next, the CPU 11 searches the corresponding key storage file 32 based on the key file number data 65 of the execution command data 62, and determines whether or not the search has been completed (step S45).
[0061]
If it is determined in step S45 that the key storage file corresponding to the key file number data 65 cannot be searched (step S45; No), the encryption processing described later cannot be performed, and the corresponding error processing (step S39) is performed and the process is terminated.
[0062]
If it is determined in step S45 that the key storage file corresponding to the key file number data 65 can be searched (step S; Yes), based on the storage head address data 42, the storage final address data 43, and the key type data, The encryption key data 47 is read from the data area 48 below the encryption, and the original authentication code data is encrypted by the coprocessor 12 using the encryption key data 47 to generate the authentication code data (step S46).
[0063]
More specifically, when the RSA encryption algorithm is used, the original authentication code data (= compressed value data + random number) is obtained by the coprocessor 12 using the encryption key N and the encryption key e (d) included in the encryption key data 47. Authentication code data is obtained by performing a power-residue operation on (data).
[0064]
By the way, prior to the generation of the authentication code data on the IC card 2 side, the IC card connection device 3 obtains compressed value data (hereinafter referred to as reference compressed value data) obtained by compressing the program data 49 in advance. deep. This reference compressed value data is equal to the compressed value data 50 when the program data stored in the EEPROM 14 of the IC card 2 is regular program data that has not been tampered with.
[0065]
Then, the IC card connection device 3 generates original reference authentication code data by combining the random number data transmitted from the IC card 2 side. As a coupling method, the same method as that performed on the IC card 2 side is used.
Further, when using the RSA encryption algorithm, the IC card connection device 3 uses the encryption key N and the encryption key e (d) corresponding to the key file corresponding to the key file number data in the execution command data to be transmitted. Reference authentication code data is obtained by performing a power-residue operation on the reference authentication code data (= reference compression value data + random number data).
[0066]
The IC card connection device 3 transmits the reference authentication code data to the IC card 2 as the reference authentication data 67 of the execution command data 62.
As a result, the CPU 11 compares the reference authentication code data 67 included in the execution command data 62 with the generated authentication code data, and checks whether the reference authentication code data 67 matches the generated authentication code data. Is determined (step S47).
[0067]
If the reference authentication code data 67 and the generated authentication code data do not match in the determination in step S47, the CPU 11 is an unauthorized one in which the program data 49 stored in the EEPROM 14 is falsified. Since there is a possibility, the corresponding error processing is performed (step S49), the processing is terminated, and the program is not executed.
[0068]
If it is determined in step S47 that the reference authentication code data 67 matches the generated authentication code data, the program data 49 stored in the EEPROM 14 is authenticated as normal program data, and the program data Is executed (step S48), response processing such as generation of transmission data (step S5) and transmission of transmission data to the IC card connection device 3 (step S6) are performed, and the processing is terminated.
[0069]
[5] Modification of embodiment
In the above description, when the IC card connection device 3 transmits the reference authentication code data to the IC card, the execution command data includes the reference authentication code data, but the request is received from the IC card 2 side. It is also possible to transmit as another data when there is.
[0070]
As a compression method for generating original authentication code data (or original reference authentication code data), generally known one-way hash functions such as MD4, MD5, and SHA can be used.
Further, although encryption processing is performed as an arithmetic processing when generating authentication code data from original authentication code data (or reference authentication code data from original reference authentication code data), authentication code data (or reference authentication code is easily processed). Any arithmetic processing can be applied as long as it is processing that cannot generate (data).
[0071]
The encryption process is not limited to RSA, and other encryption processes such as DES and FEAL can be used.
Further, in the above description, the random number generation is performed by software, but it is also possible to use a random number generator configured by hardware such as a random number generation IC. In this case, it is not necessary to use the seed file described above.
[0072]
In the above description, the EEPROM is used as the memory for storing the program data. However, any storage device such as NVRAM that is nonvolatile and can easily update data may be used.
[0073]
[6] Effects of the embodiment
As described above, the original authentication data is generated by combining the compressed value data obtained by compressing the program data and the generated random number data, and then the original authentication data is encrypted and actually authenticated. Since the authentication data for performing the authentication is generated, it is not necessary to store the authentication data in the IC card, so that the authentication data does not leak outside.
[0074]
In addition, since encryption processing that requires complicated calculation is used to generate authentication code data, it is difficult to tamper with authentication code data, and therefore it is very difficult to illegally execute stored program data. Thus, it is possible to realize a program execution function with high security.
[0075]
On the other hand, if the regular program data is written, it is possible to easily write to the EEPROM so that it can be executed in a state where security is ensured. Can be done.
[0076]
【The invention's effect】
According to the present invention, the IC card generates authentication data for actual authentication by performing predetermined processing such as compression processing and encryption processing, calculation, etc. on the stored program data. Therefore, it is not necessary to store the authentication data in the IC card, and the authentication data does not leak to the outside, so that high security can be ensured.
[0077]
Further, since a predetermined calculation process that requires a complicated calculation is required to generate the authentication code data necessary for executing the program corresponding to the program data, it is difficult to tamper with the authentication code data. It becomes very difficult to illegally execute the stored program data, and a highly secure program execution function can be realized.
[0078]
Furthermore, since program storage means such as an EEPROM is used for storing program data so that the program data can be updated, it is possible to cope with program changes easily and at low cost. it can.
[Brief description of the drawings]
FIG. 1 is a schematic configuration diagram of an IC card system according to an embodiment.
FIG. 2 is a schematic configuration diagram of an IC card.
FIG. 3 is an explanatory diagram of a data storage state in an EEPROM;
FIG. 4 is an explanatory diagram of data formats of a program storage file and a key storage file.
FIG. 5 is a flowchart of an outline process according to the embodiment.
FIG. 6 is an explanatory diagram of a data format of each command data.
FIG. 7 is a process flowchart of a storage command process.
FIG. 8 is a process flowchart of an executable command process.
FIG. 9 is a process flowchart of an execution command process.
[Explanation of symbols]
1 IC card system
2 IC card
3 IC card connection device
11 CPU
12 Coprocessor
13 ROM
14 EEPROM
15 RAM
21 System management area
22 Data storage area
25 Program storage file area
26 Key storage file area
27 file areas
31 Program storage file
32 Key storage file
33 types of files
35 File number data
36 Storage start address data
37 Last address data stored
38 Compressed value storage address data
39 execution flag
41 File number data
42 Store start address data
43 Last address data stored
44 Key type data
45 program files
46 Program file area
47 Encryption key data
48 Encryption key data area
49 Program data
50 Compressed value data
51 Stored command data
56 Executable command data
59 Random number generation command data
60 Execution command data

Claims (11)

プログラムデータを更新可能に格納するプログラム格納手段と、
前記プログラムデータに基づいて当該プログラムデータに固有の原認証データを生成し、格納する原認証データ生成格納手段と、
前記プログラム格納手段に格納されたプログラムデータのうち、外部より実行が指示されたプログラムに対応するプログラムデータについての前記原認証データに対し所定の演算を施すことにより認証データを生成する認証データ生成手段と、
外部より入力される基準認証データと前記認証データとが一致するか否かを判別する判別手段と、
前記判別に基づいて、前記基準認証データと前記認証データとが不一致した場合には、前記プログラムの実行を禁止する実行禁止手段と、
を備えたことを特徴とするICカード。
Program storage means for storing program data in an updatable manner;
Original authentication data generation and storage means for generating and storing original authentication data unique to the program data based on the program data;
Authentication data generation means for generating authentication data by performing a predetermined operation on the original authentication data for the program data corresponding to the program instructed to be executed from the outside among the program data stored in the program storage means When,
Discriminating means for discriminating whether or not the reference authentication data inputted from the outside matches the authentication data;
Based on the determination, if the reference authentication data and the authentication data do not match, execution prohibiting means for prohibiting execution of the program,
An IC card characterized by comprising:
請求項1記載のICカードにおいて、
前記原認証データ生成手段は、前記プログラムデータを圧縮することにより前記原認証データを生成することを特徴とするICカード。
The IC card according to claim 1, wherein
The original authentication data generating means generates the original authentication data by compressing the program data.
請求項1または請求項2記載のICカードにおいて、
前記認証データ生成手段は、乱数データを発生させ、出力する乱数発生手段と、
前記乱数データ及び前記原認証データに基づいて予め設定した所定の暗号化処理を行い前記認証データを生成する暗号化手段と、
を備えたことを特徴とするICカード。
In the IC card according to claim 1 or 2,
The authentication data generation means generates random number data and outputs random number generation means;
Encryption means for generating the authentication data by performing a predetermined encryption process set in advance based on the random number data and the original authentication data;
An IC card characterized by comprising:
請求項3記載のICカードにおいて、
前記暗号化手段は、暗号化に必要な鍵データを複数記憶可能な鍵データ記憶手段と、
外部より入力された鍵指示データに対応する前記鍵データを用いて前記暗号化処理を行う暗号化処理手段と、
を備えたことを特徴とするICカード。
In the IC card according to claim 3,
The encryption means includes key data storage means capable of storing a plurality of key data necessary for encryption,
Encryption processing means for performing the encryption processing using the key data corresponding to the key instruction data input from the outside;
An IC card characterized by comprising:
請求項1ないし請求項4のいずれかに記載のICカードにおいて、
前記プログラム格納手段に外部より入力された前記プログラムデータが格納された段階では、当該プログラムデータを、対応するプログラムの実行を許可しない非実行プログラムデータとして設定する実行可能プログラム設定手段を備えたことを特徴とするICカード。
In the IC card according to any one of claims 1 to 4,
When the program data input from the outside is stored in the program storage means, the program storage means is provided with executable program setting means for setting the program data as non-executable program data that does not permit execution of the corresponding program. Characteristic IC card.
請求項5記載のICカードにおいて、
前記実行可能プログラム設定手段は、前記非実行プログラムデータについて前記原認証データが生成された場合には、当該非実行プログラムデータを実行可能プログラムデータとして設定することを特徴とするICカード。
In the IC card according to claim 5,
The executable card setting means sets the non-executable program data as executable program data when the original authentication data is generated for the non-executable program data.
請求項1ないし請求項6のいずれかに記載のICカードに接続されるICカード接続装置であって、
前記プログラム格納手段に格納されている前記プログラムデータのうち、実行させようとするプログラムに対応する前記プログラムデータを特定し、前記ICカードに対しその実行を指示するプログラム実行指示手段と、
前記特定したプログラムに対応する前記原認証データを原基準認証データとして予め格納する原基準認証データ格納手段と、
前記原基準認証データに対し前記認証データ生成手段における前記所定の演算と同一の演算を施すことにより前記基準認証データを生成する基準認証データ生成手段と、
前記判別手段に対し、前記基準認証データを出力する基準認証データ出力手段と、
を備えたことを特徴とするICカード接続装置。
An IC card connection device connected to the IC card according to any one of claims 1 to 6,
Program execution instruction means for specifying the program data corresponding to the program to be executed out of the program data stored in the program storage means and instructing the IC card to execute the program data;
Original standard authentication data storage means for previously storing the original authentication data corresponding to the specified program as original standard authentication data;
Reference authentication data generating means for generating the reference authentication data by performing the same calculation as the predetermined calculation in the authentication data generating means for the original reference authentication data;
Reference authentication data output means for outputting the reference authentication data to the determination means;
An IC card connection device comprising:
請求項4記載のICカードに接続されるICカード接続装置であって、
前記プログラム格納手段に格納されている前記プログラムデータのうち、実行させようとするプログラムに対応する前記プログラムデータを特定し、前記ICカードに対しその実行を指示するプログラム実行指示手段と、
前記特定したプログラムに対応する前記原認証データを原基準認証データとして予め格納する原基準認証データ格納手段と、
前記鍵データを複数記憶する鍵データ記憶手段と、
前記暗号化手段に対し、前記鍵指示データを出力する鍵指示データ出力手段と、
前記鍵指示データに対応する鍵データ、前記ICカードより入力された前記乱数データ及び前記原基準認証データに基づいて前記暗号化処理手段と同一の処理を行い、前記基準認証データを生成する基準認証データ生成手段と、
前記判別手段に対し、前記基準認証データを出力する基準認証データ出力手段と、
を備えたことを特徴とするICカード接続装置。
An IC card connection device connected to the IC card according to claim 4,
Program execution instruction means for specifying the program data corresponding to the program to be executed out of the program data stored in the program storage means and instructing the IC card to execute the program data;
Original standard authentication data storage means for previously storing the original authentication data corresponding to the specified program as original standard authentication data;
Key data storage means for storing a plurality of the key data;
Key instruction data output means for outputting the key instruction data to the encryption means;
Reference authentication for generating the reference authentication data by performing the same processing as the encryption processing means based on the key data corresponding to the key instruction data, the random number data input from the IC card, and the original reference authentication data Data generation means;
Reference authentication data output means for outputting the reference authentication data to the determination means;
An IC card connection device comprising:
請求項1ないし請求項6のいずれかに記載のICカードと、
請求項7記載のICカード接続装置と、
を備えたことを特徴とするICカードシステム。
An IC card according to any one of claims 1 to 6;
An IC card connection device according to claim 7;
An IC card system comprising:
請求項4記載のICカードと、
請求項8記載のICカード接続装置と、
を備えたことを特徴とするICカードシステム。
An IC card according to claim 4;
The IC card connection device according to claim 8,
An IC card system comprising:
プログラムデータを更新可能に予め格納する格納手段と、当該格納手段に格納されたプログラムデータに基づいたプログラムを実行するための制御手段とを有するICカードにおけるプログラム実行制御方法において、
前記制御手段が、格納されている前記プログラムデータに基づいて前記プログラムデータに固有の原認証データを生成する原認証データ生成工程と、
前記制御手段が、前記原認証データに対し所定の演算を施すことにより認証データを生成する認証データ生成工程と、
前記制御手段が、入力された基準認証データと生成した前記認証データとが一致するか否かを判別する判別工程と、
前記制御手段が、前記判別に基づいて、前記基準認証データと前記認証データとが一致した場合には、当該プログラムデータに対応するプログラムの実行を許可する実行許可工程と、
を備えたことを特徴とするプログラム実行制御方法。
In an execution control method for a program in an IC card , comprising storage means for preliminarily storing program data and control means for executing a program based on the program data stored in the storage means ,
An original authentication data generation step in which the control means generates original authentication data unique to the program data based on the stored program data;
An authentication data generating step in which the control means generates authentication data by performing a predetermined operation on the original authentication data;
A determining step for determining whether or not the input reference authentication data matches the generated authentication data;
Said control means, on the basis of the determination, if the reference authentication data and the authentication data match, the execution permission step of permitting execution of the program corresponding to the program data,
A program execution control method comprising:
JP05826898A 1998-03-10 1998-03-10 IC card, IC card connection device, IC card system, and program execution control method Expired - Fee Related JP3709702B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP05826898A JP3709702B2 (en) 1998-03-10 1998-03-10 IC card, IC card connection device, IC card system, and program execution control method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP05826898A JP3709702B2 (en) 1998-03-10 1998-03-10 IC card, IC card connection device, IC card system, and program execution control method

Publications (2)

Publication Number Publication Date
JPH11259289A JPH11259289A (en) 1999-09-24
JP3709702B2 true JP3709702B2 (en) 2005-10-26

Family

ID=13079439

Family Applications (1)

Application Number Title Priority Date Filing Date
JP05826898A Expired - Fee Related JP3709702B2 (en) 1998-03-10 1998-03-10 IC card, IC card connection device, IC card system, and program execution control method

Country Status (1)

Country Link
JP (1) JP3709702B2 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100423506B1 (en) * 2001-07-26 2004-03-18 주식회사 쓰리비 시스템 method of preventing an illegal software copy on-line using an IC chip installed card
KR100586063B1 (en) * 2005-05-06 2006-06-08 주식회사 아이오셀 Data structure of flash memory with variable size system field which can be updated, usb memory therewith and a control method of the system field
KR101279213B1 (en) * 2010-07-21 2013-06-26 삼성에스디에스 주식회사 Device and method for providing soc-based anti-malware service, and interface method

Also Published As

Publication number Publication date
JPH11259289A (en) 1999-09-24

Similar Documents

Publication Publication Date Title
US7849331B2 (en) Program update method and server
US7650503B2 (en) Memory card
JP3638770B2 (en) Storage device with test function
EP2434683A1 (en) Electronic device, key generation program, recording medium, and key generation method
JPWO2002057904A1 (en) Control device with download function
US20090037721A1 (en) Program development method, program development supporting system, and program installation method
US20050259465A1 (en) Nonvolatile memory apparatus
CN109814934B (en) Data processing method, device, readable medium and system
US20210374230A1 (en) Cryptography module and method for operating same
JP3709702B2 (en) IC card, IC card connection device, IC card system, and program execution control method
CN111512593B (en) Semiconductor device, method of providing update data, method of receiving update data, and medium
JP5759827B2 (en) MEMORY SYSTEM, INFORMATION PROCESSING DEVICE, MEMORY DEVICE, AND MEMORY SYSTEM OPERATION METHOD
US7543153B2 (en) Digital signature generating apparatus, method, computer program and computer-readable storage medium
JP2004503860A (en) Data processing method and apparatus for execution of protected instructions
JP3930576B2 (en) Computer system with software misuse prevention function
JP2005516317A (en) Update management of coded data in memory
JP2002014871A (en) Contents check method, contents update method and processor
JP4583305B2 (en) Recording method, recording apparatus, and IC card
JPH09102020A (en) Ic card terminal
CN115185562B (en) Application online upgrading method, system and storage medium based on dual cores
JP7487837B1 (en) ELECTRONIC INFORMATION STORAGE MEDIUM, IC CHIP, IC CARD, KEY DATA STORAGE METHOD, AND PROGRAM
CN220651103U (en) Embedded device
JP4397437B2 (en) IC card
US20220343034A1 (en) System on a chip and method guaranteeing the freshness of the data stored in an external memory
JP3789994B2 (en) IC card

Legal Events

Date Code Title Description
A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20050216

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20050308

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20050509

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20050801

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

Year of fee payment: 3

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

Free format text: PAYMENT UNTIL: 20090819

Year of fee payment: 4

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

Free format text: PAYMENT UNTIL: 20090819

Year of fee payment: 4

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

Free format text: PAYMENT UNTIL: 20100819

Year of fee payment: 5

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

Free format text: PAYMENT UNTIL: 20110819

Year of fee payment: 6

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

Free format text: PAYMENT UNTIL: 20110819

Year of fee payment: 6

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

Free format text: PAYMENT UNTIL: 20120819

Year of fee payment: 7

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

Free format text: PAYMENT UNTIL: 20120819

Year of fee payment: 7

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

Free format text: PAYMENT UNTIL: 20130819

Year of fee payment: 8

LAPS Cancellation because of no payment of annual fees