JP4021956B2 - IC card - Google Patents
IC card Download PDFInfo
- Publication number
- JP4021956B2 JP4021956B2 JP22495096A JP22495096A JP4021956B2 JP 4021956 B2 JP4021956 B2 JP 4021956B2 JP 22495096 A JP22495096 A JP 22495096A JP 22495096 A JP22495096 A JP 22495096A JP 4021956 B2 JP4021956 B2 JP 4021956B2
- Authority
- JP
- Japan
- Prior art keywords
- card
- data
- memory
- value
- stored
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Expired - Lifetime
Links
Images
Description
【0001】
【発明の属する技術分野】
本発明は、外部より与えられたデータ又はその内部に有するデータを暗号化又は復号化することが可能なICカードに関するものである。
【0002】
【従来の技術】
ICカードは、磁気カードに代わる新しい情報記憶媒体として、近年注目を集めている。特に、CPUを内蔵したICカードは、高度なセキュリティを実現できることから、高度情報化社会の種々の分野において利用されることが期待されている。
一般にICカードは、ROM、RAM、EEPROMの3種類のメモリと、それらメモリにアクセスするCPUとを備えている。EEPROMは、書き換え可能な不揮発性メモリであり、ICカードユーザに関する個人情報等のデータが保存される。RAMは、CPUがプログラムを実行するときに作業領域として使用する揮発性のメモリである。ROMは、読み出し専用メモリであり、CPUが実行すべき処理を示すプログラムが格納されている。また、外部との通信のためのI/O端子を備えている。
【0003】
ICカードを使用するときは、ICカードをリーダ・ライタに接続し、リーダ・ライタからコマンドをI/O端子を介してICカードに送信する。コマンドを受信したICカードでは、CPUが、ROMに格納されているプログラムのうち、コマンドに対応する部分を実行する。この結果、コマンドの処理がなされ、EEPROMに新たなデータを書き込むなどの処理が行われる。
【0004】
一般にICカードは、リーダ・ライタとの間でデータを暗号化して送受信する。これは、リーダ・ライタとICカードとの間の通信信号を第三者が不正に取得し、データの内容を盗むことを防止するためにである。データの暗号化の方法としては、例えばRSAがある。
RSAとは、非対称キー(非対称鍵)方式による暗号化方法の一種であり、複数の通信相手に共通に公開する「公開キー」と、その公開キーとは異なるICカード専用の「秘密キー」とを用いてデータを暗号化又は復号化することを特徴とするものである。つまり、RSAによる暗号化では、例えば誰でも知りうる公開キーでデータを暗号化し、唯一カードが持つ秘密キーを用いてそのデータの復号化を行うのである。
【0005】
この点においてRSAは、DES等の対称キー方式の暗号化方法と相違している。対称キー方式の暗号化方法では、ICカードと通信相手とは、互いに共通な暗号キーを予め分かち合わねばならい。このために、不特定多数の相手と暗号通信を行う場合は、多数のキーの受渡し管理が通信相手の数だけ必要となり、管理が大変煩雑となる。これに対してRSAでは、暗号通信の際に必要なキーデータを予め分かち合うのではなく、第三者が公開されている公開キーのみを使用して暗号文の生成又は復号化を行うことが可能となっている。つまり、RSAは、キーの受渡し管理を必要とせず、不特定多数の通信相手が存在する暗号通信に適している。
【0006】
図11は、リーダ・ライタ等の外部機器において、RSAによりデータを暗号化し、得られた暗号文をICカードへ送信する場合を示した概念図である。また、図12は、RSAによる平文の暗号化、又は、暗号文の復号化の処理手順を示す流れ図である。
図11に示すように、外部機器は、ICカードに送信すべきデータの平文Xを暗号キーe、Nを用いて暗号化する。すなわち、図12(a)に示されるように、外部機器には、はじめに平文X及び暗号化キーe、Nが入力される(S1202)。次に、平文Xについて、次式(1)の計算が実行される。
C=X^e mod N ・・・ (1)
ここで、「X^e」はXのe乗を意味する。S1202の処理の結果、暗号文Cが取得され、それが出力される(S1206)。
【0007】
取得された暗号文Cは、ICカードに送信される(図11参照)。ICカードは、受信した暗号文Cを秘密キーdと公開キーNを用いて、式(2)を計算することにより復号化する(図12(b)、S1212、S1214)。
X=C^d mod N ・・・ (2)
上記の計算を実行した結果、ICカードは、平文Xを取得し、これを例えばEEPROMに書き込み保存する。
【0008】
【発明が解決しようとする課題】
しかし、前述した従来のICカードは、RAM、ROM、EEPROM等のメモリ容量が小さく、また、CPUのデータ処理速度も小さい。このような問題に対し、ICカードに高速演算コプロセッサを搭載し、そのデータ処理速度を向上させることも可能ではあるが、この場合にも、ICカードの動作速度は、汎用のコンピュータ等と比較して極めて遅い。
一方、図12のS1204、S1214において行われる式(1)、式(2)の計算は、べき乗剰余の計算を含むために、多大の時間を必要とする。特に、X、C、d、e、Nの各変数は、一般に512ビットから構成されるデータであるので、計算の負担は大きい。式(1)等を計算するためには、通常、図13に示すMongomery法等の計算アルゴリズムを用い、計算の高速化が図られる。しかしながら、計算の高速化には限界があり、ICカード内でのデータの暗号化又は復号化が迅速に行えないという問題があった。
【0009】
そこで、本発明の課題は、データの暗号化、復号化を迅速に実行することが可能なICカードを提供することである。
【0010】
【課題を解決するための手段】
前記課題を解決するために、請求項1に係る発明は、CPUと、前記CPUが実行可能なプログラム及び前記CPUがアクセス可能なデータを保存するメモリとを備え、前記メモリに保存している鍵情報を用いて、外部より取得したデータ又は前記メモリに保存しているデータを暗号化又は復号化するデータ変換プログラムを有し、外部からの命令に従い、前記データを暗号化又は復号化するICカードにおいて、前記データ変換プログラムは、暗号化又は復号化すべき前記データの内容に依存しない処理を行う前処理部、及び、前記データの内容に依存する処理を行う主要処理部とを有し、前記鍵情報を前記メモリに保存する場合には、前記前処理部を実行し、その結果取得された前処理値を前記鍵情報に関連づけて前記メモリに保存し、前記鍵情報を前記メモリに保存する場合に、前記前処理値を保存するか否かを外部からの命令により選択可能であり、前記鍵情報とともに前記前処理値を前記メモリに保存することを命ずる第1の命令と、前記鍵情報のみを前記メモリに保存することを命ずる第2の命令とのいずれか一方を選択して外部より与えることにより、前記前処理値を保存するか否かが選択可能であることを特徴とする。
【0012】
請求項2に係る発明は、請求項1に記載のICカードにおいて、前記外部からの命令が有する引数の内容を変更することにより、前記前処理値を前記メモリに保存するか否かが選択可能であることを特徴とする。
請求項3に係る発明は、請求項1又は請求項2に記載のICカードにおいて、前記前処理値を保存する場合は、前記前処理値を保存した旨の識別情報を前記メモリに保存することを特徴とする。
請求項4に係る発明は、請求項1から請求項3までのいずれか1項に記載のICカードにおいて、前記データの暗号化又は復号化を行う場合は、前記メモリに保存されている前記前処理値を用いて、前記データ変換プログラムの主要処理部を実行することを特徴とする。
【0013】
請求項5に係る発明は、請求項4に記載のICカードにおいて、前記データ変換プログラムを実行する場合は、使用する前記鍵情報に関連づけられた前記前処理値が前記メモリに保存されているか否かを予め確認することを特徴とする。
請求項6に係る発明は、請求項5に記載のICカードにおいて、使用する前記鍵情報に関連づけられた前記前処理値が前記メモリに保存されていることが確認されなかった場合には、前記データ変換プログラムの前処理部及び主要処理部の双方を実行することにより、前記データの暗号化又は復号化を行うことを特徴とする。
【0014】
【発明の実施の形態】
以下、図面等を参照して、本発明に係る実施形態について説明する。
(第1実施形態)
本発明に係る第1実施形態は、非対称キー方式の暗号化方法であるRSAに基づき、平文のデータを暗号化、又は、暗号化されたデータを復号化することが可能なICカードである。RSAの実行は、図13に示したMongomery法による計算アルゴリズム(以下「RSA計算アルゴリズム」という)を用いて行われる。
【0015】
本実施形態は、図13に示すRSA計算アルゴリズムが、暗号化すべき平文X(又は復号化すべき暗号文C)に依存せずにその計算を実行できる第2行目(以下「前処理部」という)と、平文Xに依存した計算である、第3行目以降の部分(以下「主要処理部」という)とからなる点に着目し、ICカード内の暗号化又は復号化処理の速度向上を図るものである。すなわち、本実施形態では、前処理部を予め1回だけ計算し、その結果得られた値(以下「前処理値」という)をEEPROMに保存する。そして、その後、実際に暗号文の復号化等を行う場合には、EEPROMに保存されている前処理値を利用し、主要処理部の計算のみを行う。これにより、本実施形態では、暗号化/復号化処理のたびに前処理部の計算を繰り返すという無駄を排除し、迅速な処理を実現する。
【0016】
図1は、本発明の第1実施形態であるICカードの構成を示す図である。図1に示されるように、ICカード10は、読み出し専用メモリであるROM12、揮発性メモリであるRAM14、随時書き換え可能な不揮発性メモリであるEEPROM16、及びこれらのメモリにアクセスするCPU18を備えている。また、ICカード10は、リーダ・ライタ22と通信を行うためのI/Oインターフェイス20を備えている。
【0017】
ICカード10内の各メモリ(12、14、16)へのアクセスは、すべてCPU18を介して行われ、外部からこれらメモリを直接アクセスすることはできない。すなわち、リーダ・ライタ22からCPU18に対して所定の「コマンド」を与えると、CPU18はこの「コマンド」を解釈実行し、その結果を、リーダ・ライタ22に対して「レスポンス」として返送する。なお、「コマンド」とは、リーダ・ライタからICカードへ送られる情報であって、ICカードに所定の動作させるためのものをいう。
【0018】
例えば、EEPROM16内の所定のファイルに書き込みを行う場合には、「書込コマンド」とともに、書込対象となるデータをCPU18に与え、CPU18による「書込コマンド」の実行という形式で書込処理が行われることになる。逆に、EEPROM16内の所定のファイルからデータの読み出しを行う場合には、所定の「読出コマンド」をCPU18に与え、CPU18による「読出コマンド」の実行という形式によって読出処理が行われることになる。このように、ICカード10内において「コマンド」の実行が終了すると、実行した「コマンド」に対する「レスポンス」が外部に対して返送される。例えば、「書込コマンド」を与えた場合には、書込処理が支障なく実行されたか否かを示す「レスポンス」が返送され、「読出コマンド」を与えた場合には、読出対象となったデータがレスポンスという形で返送されることになる。ただし、EEPROM16へのアクセスは、無条件で行われるわけではなく、所定のアクセス条件が満足されることが前提となる。このアクセス条件は、例えば個々のファイルごとに設定される。
【0019】
図2は、図1に示すEEPROM16内の階層構造を示すブロック図である。本実施形態のEEPROMは、4つの階層から構成される。すなわち、第1層のMF( Master File) 、第2層のDF( Dedicated File) 、第3層のEF( Elementary File) 及び第4層である不図示のレコード構造である。
MFは、データメモリ全体のファイルである。MFは、各アプリケーション(サービス)に共通したデータを格納するためのファイルであり、例えば、このICカード10の所有者の氏名、住所、電話番号などの情報が記録される。
DFは、専用ファイルであり、一般的にはアプリケーションごとにDFの設定がなされる。
EFは、基礎ファイルであり、キー・データを格納するIEFと、アプリケーションが使用するデータを格納するWEFの2種類がある。
レコード構造は、アクセスの最小単位である。
【0020】
MF及び各DFは、それぞれ別個独立に1又は2以上のIEF及びWEFを有している。前述したように、WEFには、ICカード10に記録すべき本来のデータが記録されるのに対して、IEFには、各領域をアクセスするために必要なキーが格納される。例えば、DF1内に設けられたIEFには、DF1内のWEFに対するアクセスを行うときに照合されるキーが記録されている。
【0021】
上述した各ファイルは、ディレクトリ・ファイルにより管理される。
図3は、一例としてWEFを管理するディレクトリ・ファイルの構造を示す図である。WEFのディレクトリ・ファイル60には、先頭アドレス62、全容量63等を格納する領域のほか、アクセス条件を格納するアクセス条件情報領域65が設けられている。ここで、アクセス条件とは、当該WEFにアクセスする際に満たされていなければならない条件であり、照合済み状態でなければならないキーの種類を規定するものである。
【0022】
図4は、アクセス条件情報領域65に格納されているアクセス条件を例示する図である。アクセス条件は、ファイルへのアクセスの態様ごとに、すなわち、データの「読み出し」、「書き込み」又は「更新」のそれぞれについて定められている。各アクセス条件は、8つのキーより構成されている。各キーにおいて、「1」は、当該ファイルにアクセスするためには、そのキーが照合済み状態でなければいけないことを意味する。また、「0」は照合が不要であることを示す。図4の例では、データの「読み出し」については、少なくともK1が照合済み状態であること、「書き込み」については、少なくともK1及びK4が照合済み状態であること、また、「更新」については、少なくともK1及びK5が照合済み状態であることが条件として定められている。
【0023】
図5は、本実施形態で使用するコマンドのうち、SELECTコマンド、WRITE_N&CONSTコマンド(以下「WRITE」コマンドと略す)及びRSA_CALCULATEコマンド(以下「CALCULATEコマンド」と略す)のフォーマットを示す図である。
SELECTコマンドは、カレントDF下のEFを選択するためのコマンドである。SELECTコマンドは、各々1バイトからなる5つの情報(CLA〜LC)と、それに続くデータから構成される。最初の5バイトは、それぞれコマンドのクラスを示すCLA、種別を示すINS、コマンドのパラメータP1、P2、及び後に続くDATAの長さ(バイト数)を示すLCである。DATAは、ファイル名等、選択すべきEFに関する情報である。
【0024】
WRITEコマンドは、SELECTコマンドで選択されたIEFに、RSA暗号キーの除数部Nを新規に書き込むとともに、RSA計算アルゴリズムの前処理部を実行し、その結果得られた前処理値をIEFに書き込むためのコマンドである。WRITEコマンドの最初の5バイトは、SELECTコマンドと同じCLA等である。また、その後に続くDATAは、公開キーの除数部Nである。
【0025】
CALCULATEコマンドは、ICカード10に、外部機器22より受け取った暗号化(複合化)されているデータを復号化(暗号化)させるためのコマンドである。CALCULATEコマンドの最初の5バイトは、SELECTコマンドと同じCLA等である。第6バイト目以降のDATAは、暗合化されるべき平文X、又は復号化されるべき暗号文Cである。また、DATAの後に続く1バイトのデータであるLEは、レスポンスの期待値である。本実施形態では、暗号化又は復号化されたデータを最大256バイトを限度として全てレスポンスとして返信するよう、LEの値を設定している。
【0026】
図6は、リーダ・ライタ22よりICカード10に、EFを選択するためのSELECTコマンドを送信した場合におけるICカードの動作を示す流れ図である。
ICカード10は、SELECTコマンドを受信すると、まず、カレントDF以降に作成されたEFを順次検索し、SELECTコマンドのDATAにより指定されたEFが存在するか否かのチェックを行う(S602)。該当するEFが存在しなかった場合(S602:NO)には、エラーステータスをリーダ・ライタ22に送信し(S608)、処理を終了する。一方、S602において該当するEFが存在していた場合には、そのファイルのディレクトリ・アドレスをRAM14の所定領域に格納する(S604)。最後に、リーダ・ライタ22にコマンド処理が正常に終了した旨のレスポンスを送信し、ICカード10はSELECTコマンドの処理を終了する。
【0027】
図7は、リーダ・ライタ22よりICカード10にWRITEコマンドが送信された場合におけるICカードの動作を示す流れ図である。
ICカード10がWRITEコマンドを受信すると、CPU18は、はじめに図6のS604においてRAM14の所定領域に格納された情報、すなわち、選択されたIEFのディレクトリ・アドレスを読み取る(S702)。次にCPU18は、ディレクトリより、IEF内で書き込みが可能である領域のアドレスを示すポインタを取得する(S704)。ポインタを取得したCPU18は、それが示すアドレスから始まるレコードに、コマンドで指定した値「01」を有するタグを付けるとともに、公開キーの除数部Nを書き込む(S706)。
【0028】
次にCPU18は、RSA計算アルゴリズムの前処理部、すなわち「R^2
mod N」の計算を実行し、前処理値を取得する(S708)。S708での計算を終了すると、CPU18は、公開キーの除数部Nを書き込んだレコードの次のレコードに、自動的に値「02」を有するタグを付し、さらにS708で得られた前処理値を書き込む(S710)。
最後にCPU18は、コマンドの処理が正常に終了したことを示すレスポンスをリーダ・ライタ22に送信し(S712)、コマンドの実行を終了する。
【0029】
図8は、リーダ・ライタ22よりICカード10にCALCULATEコマンドを送信した場合におけるICカードの動作を示す流れ図である。
ICカード10がCALCULATEコマンドを受信すると、CPU18は、あらかじめSELECTコマンドの実行により選択されているIEFのディレクトリを参照し、IEFの先頭のアドレスを取得する(S802)。次にCPU18は、取得したアドレスより後の各レコードのタグを参照することにより、レコードの検索を行う(S804、S808、S814、S822)。
【0030】
具体的には、まず値「01」を有するタグを検索する(S804)。その結果タグ「01」を発見できなかった場合には、エラーステータスをレスポンスとしてリーダ・ライタ22に送信し(S830)、コマンド処理を終了する。また、タグ「01」を発見した場合には、そのレコードの内容を読み出すことにより公開キーの除数部Nを取得する(S806)。
次に、値「02」を有するタグの検索が行われる(S808)。その結果、タグ「02」が発見された場合には、IEFにRSA計算アルゴリズムで使用する前処理値が保存されていることが意味される。そこで、CPU18は、RSA計算アルゴリズムを実行するときには、前処理部の計算は不要である旨を意味するフラグFLGをONに設定する(S810)。一方、タグ「02」が発見されなかった場合には、前処理値はIEFに保存されていないことが意味されるので、FLGはOFFに設定される(S812)。
【0031】
次に、値「03」を有するタグの検索が行われる(S814)。タグ「03」は、公開キーの指数部eが格納されているレコードに付されるタグである。検索の結果、タグ「03」が発見された場合には、CALCULATEコマンドのDATAにある平文Xの暗号化処理が行われる。具体的には、CPU18は、タグ「03」が付されたレコードより公開キーの指数部eを取得する(S816)。次にCPU18は、キーの指数部e、キーの除数部N、平文X、及びフラグFLGがそれぞれ格納されているメモリ領域の開始アドレスを指定してRSA暗号モジュールをコールする(S818)。RSA暗号モジュールとは、RSA計算アルゴリズムを実行するためのサブルーチンである。
RSA暗号モジュールの実行が終了すると、CPU18は、その結果を含むレスポンス情報をリーダ・ライタ22に送信し(S820)、CALCULATEコマンドの処理を終了する。
【0032】
一方、S814において、タグ「03」が発見されなかった場合には、次にタグ「04」の検索を行う(S822)。タグ「04」が付けられているレコードは、秘密キーの指数部dが格納されているレコードである。検索の結果、タグ「04」が発見された場合には、CALCULATEコマンドのDATAにある暗号文Cの復号化処理が実行される。具体的には、まず値「02」を有するタグの検索が行われる(S823)。その結果、タグ「02」が発見された場合には、CPU18は、RSA計算アルゴリズムを実行するときには、前処理部の計算は不要である旨を意味するフラグFLGをONに設定する(S824)。一方、タグ「02」が発見されなかった場合には、FLGはOFFに設定される(S825)。
【0033】
次にCPU18は、タグ「04」が付されたレコードより秘密キーの指数部dを取得する(S826)。さらにCPU18は、キーの指数部d、キーの除数部N、暗号文C、及びFLGのそれぞれが格納されているメモリ領域の開始アドレスを指定してRSA暗号モジュールをコールする(S828)。RSA暗号モジュールの実行が終了すると、CPU18は、その結果を含むレスポンス情報をリーダ・ライタ22に送信し(S829)、CALCULATEコマンドの処理を終了する。
一方、S822においてタグ「04」が発見されなかった場合には、CPU18は、エラーステータスを送信し(S832)、コマンドの処理を終了する。
【0034】
次に、図8のS818及びS828において、RSAモジュールが行う処理について説明する。図9は、RSAモジュールの処理内容を示す流れ図である。
前述のように、RSAモジュールは、RSA計算アルゴリズムを実行し、平文Xの暗号化、又は暗号文Cの復号化を行うサブルーチンである。RSAモジュールでは、まずFLGがONに設定されているか否かが確認される(S902)。FLGがONに設定されている場合には、選択されているIEFに前処理値が保存されていることが意味されるので、CPU18は、IEFにおいてタグ「02」が付されているレコードを検索し、そのレコードに格納されている前処理値を読み出す(S910)。
【0035】
一方、S902においてFLGがOFFに設定されている場合には、選択されたIEFに前処理値が保存されていないことが意味される。そこで、CPU18は、RSA計算アルゴリズムの前処理部を実行し、前処理値を取得する(S904)。S904又はS910の処理が終了すると、CPU18は、RSA計算アルゴリズムの主要処理部を実施し、平文Xの暗号化、又は暗号文Cの復号化を行う(S906)。S906の計算を終了すると、その計算結果は返値として図8のS818又はS828に返され(S908)、RSAモジュールの処理は終了する。
【0036】
以上説明したように、本実施形態では、RSA計算アルゴリズムを前処理部と主要処理部に分けて取り扱い、ICカード10に公開キーの除数部Nを保存する場合には、そのキーNを用いて前処理部の計算を実行し、その結果取得された前処理値をキーNが保存されるIEFと同一のIEFに保存する。前述のように、前処理部の計算内容は、暗号化されるべき平文X、又は復号化されるべき暗号文Cに依存しないものであり、暗号化/復号化のたびに同一の計算を行い同一の計算結果(前処理値)を取得するものである。そこで、本実施形態は、一度取得した前処理値を不揮発性メモリであるEEPROMに格納することにより、その前処理値をその後も有効利用できるようにしたものである。また、本実施形態では、前処理値がキーNと同じIEFに格納されるので、異なるIEFを複数用意すれば、複数の公開キーをそれぞれの前処理値とともにEEPROM16に保存することが可能となっている。
【0037】
また、本実施形態では、前処理値をIEFのレコードに書き込むときに、そのレコードに値「02」を有するタグを付することとしている。このタグ「02」は、前処理値をIEFに保存しているか否かの識別情報として機能するものである。つまり、IEFに前処理値が保存されているか否かを判断する必要がある場合には、IEFにタグ「02」が存在するか否かを検索すれば足りる。つまり、本実施形態では、前処理値の存在の有無を確認するためにIEFの全情報を参照する必要がなく、迅速な判断を行うことが可能である。
【0038】
また、本実施形態では、ICカード10の内部でデータの復号化を行う場合には、IEFに保存されている前処理値を用いて、RSA計算アルゴリズムの主要処理部を実行することにより行う。つまり、本実施形態では、毎回の暗号化/復号化の処理においてRSA計算アルゴリズムの前処理部を実行する必要を回避し、もって暗号化/復号化処理の要する時間を短縮している。特に本実施形態では、RSA計算アルゴリズムの前処理部がべき乗剰余の計算を含むために、前処理部の計算を回避することにより暗号化/復号化処理の著しい効率化が図れる。
【0039】
また、本実施形態では、データの暗号化/復号化処理を実行する場合は、使用する公開キーNに関連づけられた前処理値がIEFに保存されているか否かを予め確認する。これにより、不慮の事態その他の事情により、IEFに前処理値が保存されていない場合であっても、IEF内の不適切な情報が前処理値の代わりに参照され、暗号化/復号化処理が実施されることが防止される。
さらに、本実施形態では、使用する公開キーNに関連づけられた前処理値がIEFに保存されていることが確認されなかった場合には、RSA計算アルゴリズムの前処理部及び主要処理部の双方を実行することにより、データの暗号化/復号化処理を実行する。つまり、本実施形態では、IEFに前処理値が保存されている否かを問わず、確実にデータの暗号化/復号化処理が行われる。
【0040】
(第2実施形態)
次に本発明の第2実施形態について説明する。本実施形態のICカードは、WRITEコマンドと類似の機能を有するWRITE_RSAKEYコマンドを処理する機能を有する点において第1実施形態のICカードと異なる。
図14は、WRITE_RSAKEYコマンドのフォーマットを示す図である。図に示されるように、WRITE_RSAKEYのフォーマットは、第1実施形態のWRITEコマンドと同様であり、CLA、INS等の実際の内容が異なるのみである。
図10は、WRITE_RSAKEYコマンドを受信した場合のICカード10が行う処理内容を示す流れ図である。図10において、S1002からS1006までは、図7のS702からS706までの処理と同一であり、S1008はS712の処理と同一である。すなわち、WRITE_RSAKEYコマンドは、公開キーの除数部Nのみを選択されたIEFに書き込むコマンドであり、RSA計算アルゴリズムの前処理値をIEFに保存しない点においてWRITEコマンドと相違する。
【0041】
本実施形態では、上記2つのコマンドを適切に選択して使用することにより、公開キーNをIEFに保存する際に、RSA計算アルゴリズムの前処理値をも保存するか否かを選択することが可能である。2つのコマンドは、例えばICカードを発行する段階において、カード発行機の能力に応じて使い分ける。
例えば、ICカードの生産工場において、カード発行専用機によりICカードを発行する場合には、WRITE_RSAKEYコマンドを用いて、公開キーNをICカードのEEPROMに保存する。カード発行専用機は、一般に演算処理能力がICカードより高く、また、発行するカードの枚数が膨大であることから、計算負荷の高いRSAの前処理部の計算をカード発行専用機において高速に行い、前処理値を公開キーとは別個にEEPROMに書き込むためである。これにより、前処理の計算をICカードに行わせるよりもカード1枚あたりの発行時間を短縮でき、短時間に大量のICカードを発行することが可能となる。
【0042】
一方、小売店等において、パーソナルコンピュータ等を用いて顧客にICカードを発行する場合には、WRITEコマンドを用いて公開キーNをICカードのEEPROMに書き込む。小売店等におけるカード発行数は比較的少数であるため、カード発行時間の短縮に対する要請が少なく、また、パーソナルコンピュータ等の演算処理能力は前述のカード発行専用機ほどには高くないことから、RSAの前処理部をICカードの外部で処理する利点が少ないからである。したがって、このような場合には、ICカードの機能を有効利用すべく、WRITEコマンドを用いて前処理値をICカードに求めさせるのである。
【0043】
また、多数の公開キーNをEEPROMに保存する必要がある場合は、WRITE_RSAKEYコマンドを用いて公開キーNのみを保存する。EEPROM16のメモリ容量が比較的小さいことから、多数の前処理値を保存することによるメモリ資源の消費を回避するためである。この場合には、前処理値は、復号化処理等を行う際にその都度計算して求める。つまり、本実施形態では、EEPROMのメモリ容量と、それに保存する暗号キーの数との関係に応じて、暗号キーとともに前処理値をも保存するか否かを適切に選択し、ICカードの限られたメモリ資源を有効に活用することが可能となっている。
【0044】
(その他の実施形態)
なお、本発明は、上記実施形態に限定されるものではない。上記実施形態は、例示であり、本発明の特許請求の範囲に記載された技術的思想と実質的に同一な構成を有し、同様な作用効果を奏するものは、いかなるものであっても本発明の技術的範囲に包含される。
【0045】
1)第1実施形態においては、非対称鍵方式の暗号化方法を利用するICカードを例に説明をしたが、これは、本発明の適用範囲を限定する意味のものではない。本発明の技術的思想は、DES等の対称鍵方式の暗号化方法を利用するICカードにも適用可能である。
2)第2実施形態においては、2種類の別個独立のコマンドを用意し、いずれか一方を選択してICカードに付与することにより、公開キーNをEEPROMに書き込む際に、前処理値をも書き込むか否かを選択できることとしているが、これは、1のコマンドを使用し、そのコマンドの有するパラメータの値を変更することにより、前処理値をも書き込むか否かを選択可能とすることであってもよい。このように、2つのコマンドの機能を1のコマンドに集約した場合には、ICカードのROM等に格納すべきプログラムをより簡潔なものとし、ICカードの有限なメモリ資源を有効に活用することができるという効果が得られる。
【0046】
【発明の効果】
以上詳しく説明したように、本発明によれば、以下のような効果がある。
(1)鍵情報をメモリに保存する場合には、前処理部を実行し、その結果取得された前処理値を鍵情報に関連づけてメモリに保存するので、一度取得した前処理値をその後も有効に活用することが可能である。
(2)鍵情報を前記メモリに保存する場合に、前処理値を保存するか否かを外部からの命令により選択可能であるので、ICカードの発行の効率化、及びメモリ資源の有効活用を図ることが可能である。
【0047】
(3)前処理値を保存する場合は、前処理値を保存した旨の識別情報を前記メモリに保存するので、前処理値の存在の有無を容易かつ迅速に確認することが可能となった。
(4)データの暗号化又は復号化を行う場合は、メモリに保存されている前処理値を用いて、データ変換プログラムの主要処理部を実行することとしたので、暗号化/復号化の処理を迅速に行うことが可能となっている。
(5)データ変換プログラムを実行する場合は、使用する鍵情報に関連づけられた前処理値がメモリに保存されているか否かを予め確認することとしたので、前処理値が保存されていない場合であっても、誤った処理が実行されることはない。
【0048】
(6)使用する鍵情報に関連づけられた前処理値がメモリに保存されていることが確認されなかった場合には、データ変換プログラムの前処理部及び主要処理部の双方を実行することにより、データの暗号化又は復号化を行うこととしたので、前処理値が保存されるか、いないかに関わらず必ず暗号化/復号化の処理を実行することが可能である。
【図面の簡単な説明】
【図1】本発明の第1実施形態であるICカードの構成を示す図である。
【図2】図1に示すEEPROM16内の階層構造を示すブロック図である。
【図3】WEFを管理するディレクトリ・ファイルの構造を示す図である。
【図4】EFへのアクセス条件を例示する図である。
【図5】本発明の第1実施形態において使用されるコマンドのフォーマットを示す図である。
【図6】SELECTコマンドを実行するICカードの動作を示す流れ図である。
【図7】RSA_WRITEコマンドを実行するときのICカードの動作を示す流れ図である。
【図8】RSA_CALCULATEコマンドを実行するICカードの動作を示す流れ図である。
【図9】RSAモジュールの処理内容を示す流れ図である。
【図10】WRITE_RSAKEYコマンドを処理する場合のICカード10の動作を示す流れ図である。
【図11】外部機器でRSAによりデータを暗号化し、得られた暗号文をICカードへ送信する場合を示した概念図である。
【図12】RSAによる平文の暗号化、又は、暗号分の復号化の処理手順を示す流れ図である。
【図13】Mongomery法の計算アルゴリズムを示す図である
【図14】WRITE_RSAKEYコマンドのフォーマットを示す図である。
【符号の説明】
10 ICカード
12 ROM
14 RAM
16 EEPROM
18 CPU[0001]
BACKGROUND OF THE INVENTION
The present invention relates to an IC card capable of encrypting or decrypting data given from the outside or data held therein.
[0002]
[Prior art]
The IC card has recently attracted attention as a new information storage medium replacing the magnetic card. In particular, an IC card with a built-in CPU is expected to be used in various fields of an advanced information society because it can realize a high level of security.
In general, an IC card includes three types of memories, ROM, RAM, and EEPROM, and a CPU that accesses these memories. The EEPROM is a rewritable nonvolatile memory and stores data such as personal information related to the IC card user. The RAM is a volatile memory used as a work area when the CPU executes a program. The ROM is a read-only memory and stores a program indicating processing to be executed by the CPU. In addition, an I / O terminal for communication with the outside is provided.
[0003]
When using an IC card, the IC card is connected to a reader / writer, and a command is transmitted from the reader / writer to the IC card via an I / O terminal. In the IC card that has received the command, the CPU executes a portion corresponding to the command in the program stored in the ROM. As a result, command processing is performed, and processing such as writing new data to the EEPROM is performed.
[0004]
In general, an IC card transmits and receives data encrypted with a reader / writer. This is to prevent a third party from illegally acquiring a communication signal between the reader / writer and the IC card and stealing the data contents. As a data encryption method, for example, there is RSA.
RSA is a kind of encryption method based on an asymmetric key (asymmetric key) method. A “public key” that is publicly disclosed to a plurality of communication partners, and a “secret key” dedicated to an IC card that is different from the public key. The data is encrypted or decrypted using the. In other words, in RSA encryption, for example, data is encrypted with a public key that anyone can know, and the data is decrypted using a private key that is unique to the card.
[0005]
In this respect, RSA is different from a symmetric key encryption method such as DES. In the symmetric key encryption method, the IC card and the communication partner must share a common encryption key in advance. For this reason, when performing cryptographic communication with an unspecified number of partners, it is necessary to manage the delivery of a large number of keys by the number of communication partners, and the management becomes very complicated. On the other hand, RSA does not share key data necessary for encrypted communication in advance, but generates or decrypts ciphertext using only a public key disclosed by a third party. It is possible. That is, RSA does not require key delivery management and is suitable for encrypted communication in which there are a large number of unspecified communication partners.
[0006]
FIG. 11 is a conceptual diagram showing a case where an external device such as a reader / writer encrypts data by RSA and transmits the obtained ciphertext to the IC card. FIG. 12 is a flowchart showing a processing procedure of plaintext encryption or decryption of ciphertext by RSA.
As shown in FIG. 11, the external device encrypts the plaintext X of the data to be transmitted to the IC card using the encryption keys e and N. That is, as shown in FIG. 12A, the plaintext X and the encryption keys e and N are first input to the external device (S1202). Next, for the plaintext X, the calculation of the following formula (1) is executed.
C = X ^ e mod N (1)
Here, “X ^ e” means X to the e power. As a result of the processing of S1202, ciphertext C is acquired and output (S1206).
[0007]
The acquired ciphertext C is transmitted to the IC card (see FIG. 11). The IC card decrypts the received ciphertext C by calculating equation (2) using the secret key d and the public key N (FIG. 12B, S1212, S1214).
X = C ^ d mod N (2)
As a result of executing the above calculation, the IC card acquires the plain text X, and writes and stores it in, for example, an EEPROM.
[0008]
[Problems to be solved by the invention]
However, the conventional IC card described above has a small memory capacity such as a RAM, a ROM, and an EEPROM, and the data processing speed of the CPU is also low. To deal with these problems, it is possible to improve the data processing speed by installing a high-speed arithmetic coprocessor on the IC card. In this case, however, the operating speed of the IC card is comparable to that of a general-purpose computer. And very slow.
On the other hand, the calculations of Expressions (1) and (2) performed in S1204 and S1214 of FIG. 12 require a great deal of time because they include the calculation of a power residue. In particular, since each variable of X, C, d, e, and N is generally composed of 512 bits, the calculation burden is large. In order to calculate the equation (1) and the like, usually, a calculation algorithm such as the Mongomery method shown in FIG. 13 is used to speed up the calculation. However, there is a limit to speeding up the calculation, and there is a problem that data cannot be encrypted or decrypted in the IC card quickly.
[0009]
Accordingly, an object of the present invention is to provide an IC card capable of quickly executing data encryption and decryption.
[0010]
[Means for Solving the Problems]
In order to solve the above-described problem, the invention according to
[0012]
Claim2The invention according to claim1In the IC card according to
Claim3The invention according to claim 1OrClaim2In the IC card described in (1), when the preprocess value is stored, identification information indicating that the preprocess value is stored is stored in the memory.
Claim4The invention according to
[0013]
Claim5The invention according to claim4In the IC card according to
Claim6The invention according to claim5If it is not confirmed that the preprocess value associated with the key information to be used is stored in the memory, the preprocessing unit and the main processing unit of the data conversion program The data is encrypted or decrypted by executing both of the above.
[0014]
DETAILED DESCRIPTION OF THE INVENTION
Embodiments according to the present invention will be described below with reference to the drawings.
(First embodiment)
The first embodiment of the present invention is an IC card capable of encrypting plaintext data or decrypting encrypted data based on RSA, which is an asymmetric key encryption method. The execution of RSA is performed using a calculation algorithm (hereinafter referred to as “RSA calculation algorithm”) based on the Monogomer method shown in FIG.
[0015]
In the present embodiment, the RSA calculation algorithm shown in FIG. 13 can execute the calculation without depending on the plaintext X to be encrypted (or the ciphertext C to be decrypted) (hereinafter referred to as “preprocessing unit”). ) And the calculation that depends on the plaintext X, and the part after the third line (hereinafter referred to as “main processing unit”), the speed of encryption or decryption processing in the IC card is improved. It is intended. That is, in this embodiment, the preprocessing unit is calculated once in advance, and a value obtained as a result (hereinafter referred to as “preprocessing value”) is stored in the EEPROM. After that, when actually decrypting the ciphertext, the preprocessing values stored in the EEPROM are used, and only the calculation of the main processing unit is performed. Thereby, in this embodiment, the waste of repeating the calculation of the preprocessing unit every time encryption / decryption processing is eliminated, and rapid processing is realized.
[0016]
FIG. 1 is a diagram showing a configuration of an IC card according to the first embodiment of the present invention. As shown in FIG. 1, the
[0017]
All accesses to the memories (12, 14, 16) in the
[0018]
For example, when writing to a predetermined file in the
[0019]
FIG. 2 is a block diagram showing a hierarchical structure in the
MF is a file of the entire data memory. The MF is a file for storing data common to each application (service). For example, information such as the name, address, and telephone number of the owner of the
The DF is a dedicated file, and is generally set for each application.
The EF is a basic file, and there are two types: IEF that stores key data and WEF that stores data used by an application.
The record structure is the smallest unit of access.
[0020]
The MF and each DF each independently have one or more IEFs and WEFs. As described above, the original data to be recorded in the
[0021]
Each file described above is managed by a directory file.
FIG. 3 is a diagram showing the structure of a directory file for managing WEF as an example. The WEF directory file 60 is provided with an access
[0022]
FIG. 4 is a diagram illustrating access conditions stored in the access
[0023]
FIG. 5 is a diagram showing a format of a SELECT command, a WRITE_N & CONST command (hereinafter abbreviated as “WRITE” command), and an RSA_CALCULATE command (hereinafter abbreviated as “CALCULATE command”) among commands used in the present embodiment.
The SELECT command is a command for selecting an EF under the current DF. The SELECT command is composed of five pieces of information (CLA to LC) each consisting of 1 byte and subsequent data. The first 5 bytes are CLA indicating the command class, INS indicating the type, command parameters P1 and P2, and LC indicating the length (number of bytes) of the following DATA. DATA is information on the EF to be selected, such as a file name.
[0024]
The WRITE command newly writes the divisor part N of the RSA encryption key to the IEF selected by the SELECT command, executes the preprocessing part of the RSA calculation algorithm, and writes the preprocessed value obtained as a result to the IEF. Command. The first 5 bytes of the WRITE command are the same CLA as the SELECT command. The subsequent DATA is the divisor part N of the public key.
[0025]
The CALCULATE command is a command for causing the
[0026]
FIG. 6 is a flowchart showing the operation of the IC card when a SELECT command for selecting an EF is transmitted from the reader / writer 22 to the
When receiving the SELECT command, the
[0027]
FIG. 7 is a flowchart showing the operation of the IC card when the WRITE command is transmitted from the reader / writer 22 to the
When the
[0028]
Next, the CPU 18 pre-processes the RSA calculation algorithm, that is, “
“mod N” is calculated, and the preprocess value is acquired (S708). When the calculation in S708 ends, the CPU 18 automatically attaches a tag having a value “02” to the record next to the record in which the divisor part N of the public key is written, and further, the preprocess value obtained in S708 Is written (S710).
Finally, the CPU 18 transmits a response indicating that the processing of the command has been completed normally to the reader / writer 22 (S712), and ends the execution of the command.
[0029]
FIG. 8 is a flowchart showing the operation of the IC card when the reader / writer 22 sends a CALCULATE command to the
When the
[0030]
Specifically, first, a tag having a value “01” is searched (S804). As a result, when the tag “01” cannot be found, the error status is transmitted as a response to the reader / writer 22 (S830), and the command processing is terminated. If the tag “01” is found, the divisor part N of the public key is obtained by reading the contents of the record (S806).
Next, a tag having the value “02” is searched (S808). As a result, when the tag “02” is found, it means that the preprocess value used in the RSA calculation algorithm is stored in the IEF. Therefore, when executing the RSA calculation algorithm, the CPU 18 sets a flag FLG, which means that the calculation of the preprocessing unit is unnecessary, to ON (S810). On the other hand, if the tag “02” is not found, it means that the preprocess value is not stored in the IEF, and therefore FLG is set to OFF (S812).
[0031]
Next, a tag having the value “03” is searched (S814). The tag “03” is a tag attached to the record in which the exponent part e of the public key is stored. If the tag “03” is found as a result of the search, the plaintext X encryption processing in DATA of the CALCULATE command is performed. Specifically, the CPU 18 obtains the exponent part e of the public key from the record with the tag “03” (S816). Next, the CPU 18 specifies the start address of the memory area in which the key exponent part e, the key divisor part N, the plaintext X, and the flag FLG are stored, and calls the RSA cryptographic module (S818). The RSA cryptographic module is a subroutine for executing an RSA calculation algorithm.
When the execution of the RSA cryptographic module is completed, the CPU 18 transmits response information including the result to the reader / writer 22 (S820), and ends the processing of the CALCULATE command.
[0032]
On the other hand, if the tag “03” is not found in S814, the tag “04” is searched for next (S822). The record with the tag “04” is a record in which the exponent part d of the secret key is stored. If the tag “04” is found as a result of the search, the decryption process of the ciphertext C in the DATA of the CALCULATE command is executed. Specifically, first, a tag having a value “02” is searched (S823). As a result, when the tag “02” is found, when executing the RSA calculation algorithm, the CPU 18 sets a flag FLG indicating that the calculation of the pre-processing unit is unnecessary (S824). On the other hand, if the tag “02” is not found, the FLG is set to OFF (S825).
[0033]
Next, the CPU 18 obtains the exponent part d of the secret key from the record with the tag “04” (S826). Further, the CPU 18 designates the start address of the memory area in which each of the exponent part d of the key, the divisor part N of the key, the ciphertext C, and the FLG is stored, and calls the RSA cryptographic module (S828). When the execution of the RSA cryptographic module is completed, the CPU 18 transmits response information including the result to the reader / writer 22 (S829), and ends the processing of the CALCULATE command.
On the other hand, if the tag “04” is not found in S822, the CPU 18 transmits an error status (S832) and ends the command processing.
[0034]
Next, processing performed by the RSA module in S818 and S828 of FIG. 8 will be described. FIG. 9 is a flowchart showing the processing contents of the RSA module.
As described above, the RSA module is a subroutine that executes the RSA calculation algorithm and performs encryption of plaintext X or decryption of ciphertext C. In the RSA module, first, it is confirmed whether or not FLG is set to ON (S902). If FLG is set to ON, it means that the preprocessed value is stored in the selected IEF, so the CPU 18 searches for a record with the tag “02” in the IEF. Then, the preprocess value stored in the record is read (S910).
[0035]
On the other hand, if FLG is set to OFF in S902, it means that the preprocess value is not stored in the selected IEF. Therefore, the CPU 18 executes the preprocessing unit of the RSA calculation algorithm and acquires the preprocess value (S904). When the processing of S904 or S910 ends, the CPU 18 executes the main processing unit of the RSA calculation algorithm, and encrypts plaintext X or decrypts ciphertext C (S906). When the calculation of S906 ends, the calculation result is returned as a return value to S818 or S828 of FIG. 8 (S908), and the processing of the RSA module ends.
[0036]
As described above, in this embodiment, the RSA calculation algorithm is divided into a preprocessing unit and a main processing unit, and when the divisor part N of the public key is stored in the
[0037]
In this embodiment, when a preprocess value is written in an IEF record, a tag having a value “02” is attached to the record. This tag “02” functions as identification information indicating whether or not the preprocess value is stored in the IEF. That is, when it is necessary to determine whether or not the preprocess value is stored in the IEF, it is sufficient to search whether or not the tag “02” exists in the IEF. That is, in the present embodiment, it is not necessary to refer to all information of the IEF in order to confirm the presence / absence of the preprocess value, and it is possible to make a quick determination.
[0038]
Further, in the present embodiment, when data is decrypted inside the
[0039]
In this embodiment, when data encryption / decryption processing is executed, it is checked in advance whether or not the preprocess value associated with the public key N to be used is stored in the IEF. Accordingly, even if the preprocess value is not stored in the IEF due to an unexpected situation or other circumstances, inappropriate information in the IEF is referred to instead of the preprocess value, and the encryption / decryption process is performed. Is prevented from being implemented.
Furthermore, in this embodiment, when it is not confirmed that the preprocessing value associated with the public key N to be used is stored in the IEF, both the preprocessing unit and the main processing unit of the RSA calculation algorithm are By executing, data encryption / decryption processing is executed. That is, in the present embodiment, the data encryption / decryption process is reliably performed regardless of whether the preprocess value is stored in the IEF.
[0040]
(Second Embodiment)
Next, a second embodiment of the present invention will be described. The IC card of the present embodiment is different from the IC card of the first embodiment in that it has a function of processing a WRITE_RSAKEY command having a function similar to the WRITE command.
FIG. 14 is a diagram showing the format of the WRITE_RSAKEY command. As shown in the figure, the format of WRITE_RSAKEY is the same as the WRITE command of the first embodiment, and only the actual contents such as CLA and INS are different.
FIG. 10 is a flowchart showing the contents of processing performed by the
[0041]
In the present embodiment, by appropriately selecting and using the above two commands, it is possible to select whether or not to save the preprocess value of the RSA calculation algorithm when the public key N is saved in the IEF. Is possible. The two commands are selectively used according to the capability of the card issuing machine at the stage of issuing an IC card, for example.
For example, when an IC card is issued by a dedicated card issuing machine at an IC card production factory, the public key N is stored in the EEPROM of the IC card using a WRITE_RSKEY command. Card issuing machines generally have higher processing power than IC cards, and the number of cards to be issued is enormous. Therefore, the pre-processing unit for RSA, which has a high calculation load, performs calculations at high speed on the card issuing machine. This is because the preprocess value is written in the EEPROM separately from the public key. As a result, it is possible to reduce the issuing time per card as compared with the case where the IC card performs the preprocessing calculation, and it is possible to issue a large number of IC cards in a short time.
[0042]
On the other hand, when issuing an IC card to a customer using a personal computer or the like at a retail store or the like, the public key N is written into the EEPROM of the IC card using a WRITE command. Since there are relatively few card issuances at retail stores, etc., there are few requests for shortening the card issuance time, and the arithmetic processing capability of personal computers and the like is not as high as that of the above-mentioned card issuance machine. This is because there are few advantages of processing the pre-processing unit outside the IC card. Therefore, in such a case, in order to effectively use the function of the IC card, the IC card is caused to obtain a preprocess value using a WRITE command.
[0043]
If a large number of public keys N need to be stored in the EEPROM, only the public key N is stored using the WRITE_RSAKEY command. This is because the memory capacity of the
[0044]
(Other embodiments)
The present invention is not limited to the above embodiment. The above-described embodiment is an exemplification, and the present invention has substantially the same configuration as the technical idea described in the claims of the present invention, and any device that exhibits the same function and effect is the present invention. It is included in the technical scope of the invention.
[0045]
1) In the first embodiment, an IC card using an asymmetric key encryption method has been described as an example, but this is not meant to limit the scope of application of the present invention. The technical idea of the present invention is also applicable to an IC card using a symmetric key type encryption method such as DES.
2) In the second embodiment, two types of independent commands are prepared, and one of them is selected and given to the IC card, so that when the public key N is written to the EEPROM, the preprocessing value is also stored. Whether or not to write can be selected, but by using one command and changing the value of the parameter of that command, it is possible to select whether or not to write the preprocess value. There may be. As described above, when the functions of the two commands are combined into one command, the program to be stored in the ROM of the IC card is made simpler and the limited memory resources of the IC card are effectively used. The effect of being able to be obtained.
[0046]
【The invention's effect】
As detailed above,BookAccording to the invention,There are the following effects.
(1)When storing key information in memory, the pre-processing unit is executed, and the pre-processing values obtained as a result are stored in the memory in association with the key information, so that the pre-processing values once acquired can be used effectively thereafter. Is possible.
(2)When storing key information in the memory, it is possible to select whether or not to store a preprocessed value by an external command.Possession ofEffective utilization is possible.
[0047]
(3)When the preprocess value is stored, the identification information indicating that the preprocess value is stored is stored in the memory, so that the presence or absence of the preprocess value can be easily and quickly confirmed.
(4)When encrypting or decrypting data, the main processing part of the data conversion program is executed using the preprocessed value stored in the memory, so that the encryption / decryption process can be performed quickly. It is possible to do.
(5)dataconversionWhen executing the program, since it is determined in advance whether or not the preprocess value associated with the key information to be used is stored in the memory, even if the preprocess value is not stored, Incorrect processing is never performed.
[0048]
(6)If it is not confirmed that the preprocess value associated with the key information to be used is stored in the memory, the data encryption is performed by executing both the preprocessing unit and the main processing unit of the data conversion program. Therefore, the encryption / decryption process can always be executed regardless of whether the preprocess value is stored or not.
[Brief description of the drawings]
FIG. 1 is a diagram showing a configuration of an IC card according to a first embodiment of the present invention.
FIG. 2 is a block diagram showing a hierarchical structure in the
FIG. 3 is a diagram showing a structure of a directory file for managing WEF.
FIG. 4 is a diagram illustrating an access condition to an EF.
FIG. 5 is a diagram showing a command format used in the first embodiment of the present invention;
FIG. 6 is a flowchart showing the operation of an IC card that executes a SELECT command.
FIG. 7 is a flowchart showing an operation of the IC card when an RSA_WRITE command is executed.
FIG. 8 is a flowchart showing the operation of an IC card that executes an RSA_CALCULATE command.
FIG. 9 is a flowchart showing processing contents of an RSA module.
FIG. 10 is a flowchart showing an operation of the
FIG. 11 is a conceptual diagram showing a case where data is encrypted by RSA with an external device and the obtained ciphertext is transmitted to an IC card.
FIG. 12 is a flowchart showing a processing procedure of plaintext encryption by RSA or decryption of an encrypted part.
FIG. 13 is a diagram showing a calculation algorithm of the Mongomery method
FIG. 14 is a diagram illustrating a format of a WRITE_RSAKEY command.
[Explanation of symbols]
10 IC card
12 ROM
14 RAM
16 EEPROM
18 CPU
Claims (6)
前記CPUが実行可能なプログラム及び前記CPUがアクセス可能なデータを保存するメモリとを備え、
前記メモリに保存している鍵情報を用いて、外部より取得したデータ又は前記メモリに保存しているデータを暗号化又は復号化するデータ変換プログラムを有し、外部からの命令に従い、前記データを暗号化又は復号化するICカードにおいて、
前記データ変換プログラムは、暗号化又は復号化すべき前記データの内容に依存しない処理を行う前処理部、及び、前記データの内容に依存する処理を行う主要処理部とを有し、
前記鍵情報を前記メモリに保存する場合には、
前記前処理部を実行し、その結果取得された前処理値を前記鍵情報に関連づけて前記メモリに保存し、
前記鍵情報を前記メモリに保存する場合に、
前記前処理値を保存するか否かを外部からの命令により選択可能であり、
前記鍵情報とともに前記前処理値を前記メモリに保存することを命ずる第1の命令と、前記鍵情報のみを前記メモリに保存することを命ずる第2の命令とのいずれか一方を選択して外部より与えることにより、前記前処理値を保存するか否かが選択可能である
ことを特徴とするICカード。CPU,
A memory for storing a program executable by the CPU and data accessible by the CPU;
Using key information stored in the memory, it has a data conversion program for encrypting or decrypting data acquired from the outside or data stored in the memory, and in accordance with an instruction from the outside, the data In IC card to encrypt or decrypt,
The data conversion program has a preprocessing unit that performs processing independent of the content of the data to be encrypted or decrypted, and a main processing unit that performs processing dependent on the content of the data,
When storing the key information in the memory,
Executing the pre-processing unit, storing the pre-process value acquired as a result in the memory in association with the key information ;
When storing the key information in the memory,
Whether to save the preprocess value can be selected by an instruction from the outside,
Select one of a first instruction that orders to save the preprocessed value together with the key information in the memory, and a second instruction that orders to save only the key information in the memory. By giving more, it is possible to select whether or not to save the preprocess value .
前記外部からの命令が有する引数の内容を変更することにより、前記前処理値を前記メモリに保存するか否かが選択可能である
ことを特徴とするICカード。In the IC card according to claim 1 ,
IC card, wherein said by changing the content of the argument instruction has from the outside, whether to save the pre-treatment values in the memory can be selected.
前記前処理値を保存する場合は、前記前処理値を保存した旨の識別情報を前記メモリに保存する
ことを特徴とするICカード。In the IC card according to claim 1 or 2 ,
In the case of storing the preprocess value, identification information indicating that the preprocess value is stored is stored in the memory.
前記データの暗号化又は復号化を行う場合は、
前記メモリに保存されている前記前処理値を用いて、前記データ変換プログラムの主要処理部を実行する
ことを特徴とするICカード。In the IC card according to any one of claims 1 to 3 ,
When encrypting or decrypting the data,
An IC card, wherein a main processing unit of the data conversion program is executed using the preprocess value stored in the memory.
前記データ変換プログラムを実行する場合は、使用する前記鍵情報に関連づけられた前記前処理値が前記メモリに保存されているか否かを予め確認する
ことを特徴とするICカード。In the IC card according to claim 4 ,
When executing the data conversion program, it is confirmed in advance whether or not the preprocess value associated with the key information to be used is stored in the memory.
使用する前記鍵情報に関連づけられた前記前処理値が前記メモリに保存されていることが確認されなかった場合には、前記データ変換プログラムの前処理部及び主要処理部の双方を実行することにより、前記データの暗号化又は復号化を行う
ことを特徴とするICカード。The IC card according to claim 5 ,
When it is not confirmed that the preprocessing value associated with the key information to be used is stored in the memory, by executing both the preprocessing unit and the main processing unit of the data conversion program An IC card that encrypts or decrypts the data.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP22495096A JP4021956B2 (en) | 1996-08-27 | 1996-08-27 | IC card |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP22495096A JP4021956B2 (en) | 1996-08-27 | 1996-08-27 | IC card |
Publications (2)
Publication Number | Publication Date |
---|---|
JPH1063580A JPH1063580A (en) | 1998-03-06 |
JP4021956B2 true JP4021956B2 (en) | 2007-12-12 |
Family
ID=16821739
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP22495096A Expired - Lifetime JP4021956B2 (en) | 1996-08-27 | 1996-08-27 | IC card |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP4021956B2 (en) |
Families Citing this family (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2002065287A1 (en) | 2001-02-16 | 2002-08-22 | Sony Corporation | Data processing method and its apparatus |
JP4670158B2 (en) * | 2001-02-16 | 2011-04-13 | ソニー株式会社 | Data processing method and semiconductor circuit |
CA2464361C (en) * | 2001-10-25 | 2010-09-14 | Research In Motion Limited | Multiple-stage system and method for processing encoded messages |
JP5101378B2 (en) * | 2008-04-16 | 2012-12-19 | ソニー株式会社 | Reader / Writer, Communication Processing Device, Communication Processing Method, Data Management System, and Communication System |
JP5235764B2 (en) * | 2009-04-16 | 2013-07-10 | 株式会社日立製作所 | IC chip and information processing apparatus equipped with the same |
-
1996
- 1996-08-27 JP JP22495096A patent/JP4021956B2/en not_active Expired - Lifetime
Also Published As
Publication number | Publication date |
---|---|
JPH1063580A (en) | 1998-03-06 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP4681314B2 (en) | Wireless communication system, reader / writer device, key management method, and computer program | |
EP1733305A1 (en) | Semiconductor memory | |
WO2009013700A2 (en) | Method, system and trusted service manager for securely transmitting an application to a mobile phone | |
JP2006065538A (en) | Wireless ic tag system, wireless ic tag access control device, wireless ic tag access control method, wireless ic tag access control program and wireless ic tag | |
EP2228775A2 (en) | Information storage medium, authentication data generation method, and medium authentication system | |
KR100659633B1 (en) | Ic card with cipher key conversion function, ic card system and settlement terminal | |
CN100541528C (en) | Data revise the method for preventing and data are revised anti-locking system | |
JPH1091738A (en) | Post-initialization method for chip card | |
JP4828809B2 (en) | IC card and processing method in IC card | |
JP4021956B2 (en) | IC card | |
US6971025B1 (en) | Secure personalization of chip cards | |
US6732272B1 (en) | Program writable integrated circuit card and method therefore | |
JP4723187B2 (en) | Update management of coded data in memory | |
US20040230804A1 (en) | Digital signature generating apparatus, method, computer program and computer-readable storage medium | |
US8468493B2 (en) | Information processing apparatus, information processing method, and program | |
JPH1173375A (en) | Ic card | |
JPH09179949A (en) | Portable information recording medium and its reader/ writer device | |
JP7136237B2 (en) | Information processing device and program | |
JP3317979B2 (en) | IC card | |
JP4059452B2 (en) | IC card | |
JP3931001B2 (en) | IC card processing method capable of program writing | |
JP2023122884A (en) | Electronic information storage medium, key data setting method, and program | |
JP3828681B2 (en) | Programmable IC card and processing method thereof | |
JP2002024788A (en) | Program-writable ic card | |
JP2003162699A (en) | Multi-application ic card and writing method thereof |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20060913 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20061003 |
|
RD02 | Notification of acceptance of power of attorney |
Free format text: JAPANESE INTERMEDIATE CODE: A7422 Effective date: 20061124 |
|
A521 | Request for written amendment filed |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20061201 |
|
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: 20070925 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20070928 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20101005 Year of fee payment: 3 |
|
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: 20111005 Year of fee payment: 4 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20121005 Year of fee payment: 5 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20131005 Year of fee payment: 6 |
|
EXPY | Cancellation because of completion of term |