JP4080079B2 - IC card - Google Patents

IC card Download PDF

Info

Publication number
JP4080079B2
JP4080079B2 JP34780398A JP34780398A JP4080079B2 JP 4080079 B2 JP4080079 B2 JP 4080079B2 JP 34780398 A JP34780398 A JP 34780398A JP 34780398 A JP34780398 A JP 34780398A JP 4080079 B2 JP4080079 B2 JP 4080079B2
Authority
JP
Japan
Prior art keywords
application program
card
decryption
procedure
program
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
JP34780398A
Other languages
Japanese (ja)
Other versions
JP2000155819A (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.)
Dai Nippon Printing Co Ltd
Original Assignee
Dai Nippon Printing Co Ltd
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 Dai Nippon Printing Co Ltd filed Critical Dai Nippon Printing Co Ltd
Priority to JP34780398A priority Critical patent/JP4080079B2/en
Publication of JP2000155819A publication Critical patent/JP2000155819A/en
Application granted granted Critical
Publication of JP4080079B2 publication Critical patent/JP4080079B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Landscapes

  • Memory System (AREA)

Description

【0001】
【発明の属する技術分野】
本発明はICカードに関し、特に、CPUとメモリとを有し、メモリ内に格納されたアプリケーションプログラムをCPUによって実行させることにより、種々の処理を行うICカードに関する。
【0002】
【従来の技術】
キャッシュカードやクレジットカードとして利用されてきた磁気カードに代わって、光カードやICカードが普及し始めている。特に、CPUを内蔵したICカードは、高度なセキュリティを確保することができるため、高額な商取引にも利用することができる利点を有する。
【0003】
現在、一般に利用されているCPUを有するICカードには、メモリとして、ROM,EEPROM,RAMが内蔵されている。通常、ROMには、CPUに実行させるべき基本的なプログラムが格納され、EEPROMには、ユーザデータや種々のアプリケーションプログラムが格納され、RAMはCPUの作業領域として利用される。EEPROMは書換可能なメモリであるため、ここにユーザごとに必要なデータやアプリケーションプログラムを格納することができる。
【0004】
ICカードにデータやプログラムを書き込んだり、これらを読み出したりする際には、いわゆるリーダライタ装置と呼ばれる外部装置が用いられる。この外部装置とICカードとの間では、物理的な伝送線を介してまたは非接触な伝送路を介して、相互にデータやプログラムの伝送が行われる。通常、外部装置からICカードへの情報伝送は、コマンドという形式で与えられ、種々の指示やデータは、このコマンドの中の一情報としてICカード側へと伝えられる。これに対して、ICカードから外部装置への情報伝送は、レスポンスという形式で与えられ、処理結果やデータは、このレスポンスの中の一情報として外部装置側へと伝えられる。
【0005】
【発明が解決しようとする課題】
上述したように、ICカードを一般の商取引に利用する場合、セキュリティの確保が重大な課題となる。CPU内蔵型の一般的なICカードでは、外部装置からICカード内のメモリをアクセスする際に、必ず内蔵CPUを介してアクセスするような構成を採ることにより、データアクセスに関するセキュリティをかなり高めることができる。そこで、通常は、外部装置からICカードにアクセスする際に、種々の暗証コードなどの照合を条件とするような設定がなされ、照合に失敗すると、内蔵CPUによってアクセスは拒絶される。また、外部装置とICカードとの間で情報伝送をする際に、信号伝送路上でのセキュリティを確保するために、伝送情報を暗号化するなどの手段も講じられている。
【0006】
しかしながら、これらのセキュリティ対策は、外部からICカードに対してソフトウエア的にアクセスする際のセキュリティを確保する対策であり、ICカード自身のハードウエア的なセキュリティに関する対策ではない。これまで、ICカード自身は、ハードウエア的には十分なセキュリティが確保されている、との考え方が一般的であった。これは、ICカード内の情報を、ハードウエア的に外部に読み出すことはほとんど不可能である、という見地に立った考え方である。ところが、ICカードが高額な商取引に利用されるようになると、ハードウエア的なセキュリティに関しても万全を期する必要がある。たとえば、ICカードを物理的に分解し、内蔵メモリを機械的に切断し、その切断面を解析すれば、メモリ内のビットパターンを認識することは不可能ではない。したがって、高額な商取引に利用されるICカードの場合、従来のセキュリティ対策だけでは必ずしも万全とは言えない。
【0007】
そこで本発明は、より万全なセキュリティを確保することが可能なICカードを提供することを目的とする。
【0008】
【課題を解決するための手段】
(1) 本発明の第1の態様は、CPUとメモリとを有し、メモリ内に格納されたアプリケーションプログラムをCPUによって実行させることにより、種々の処理を行うICカードにおいて、
所定の暗号化手順に基づいて暗号化されたアプリケーションプログラムを格納するための暗号化プログラム格納部と、
この暗号化手順に対応した復号化手順を格納するための復号化手順格納部と、
この復号化手順によって復号化されたアプリケーションプログラムを格納するための復号化プログラム格納部と、
をメモリ上に設け、
外部装置からアプリケーションプログラムに関する実行指示が与えられるまでは、アプリケーションプログラムを暗号化した状態で暗号化プログラム格納部に格納しておき、
実行指示が与えられた場合は、格納されている復号化手順に基づいて復号化を行い、復号化されたアプリケーションプログラムを復号化プログラム格納部に格納し、この復号化されたアプリケーションプログラムを実行した後、この復号化されたアプリケーションプログラムを復号化プログラム格納部から消去する処理を行うようにしたものである。
【0009】
(2) 本発明の第2の態様は、上述の第1の態様に係るICカードにおいて、
アプリケーションプログラムを、その一部分のみを暗号化した状態で、暗号化プログラム格納部に格納しておくようにしたものである。
【0010】
(3) 本発明の第3の態様は、上述の第1の態様に係るICカードにおいて、
アプリケーションプログラムを複数のブロックに分割し、それぞれ異なる複数の暗号化手順に基づいて個々のブロックを暗号化し、暗号化した各ブロックを暗号化プログラム格納部に格納しておくようにし、
複数の暗号化手順のそれぞれに対応した復号化手順を復号化手順格納部に格納しておき、
アプリケーションプログラムの復号化を行う際には、各ブロックごとにそれぞれ対応した復号化手順を用いた復号化を行うようにしたものである。
【0011】
(4) 本発明の第4の態様は、上述の第1〜第3の態様に係るICカードにおいて、
複数のアプリケーションプログラムをそれぞれ暗号化して暗号化プログラム格納部に格納しておくようにし、
外部装置から特定のアプリケーションプログラムを選択する指示が与えられた場合に、この選択されたアプリケーションプログラムについての復号化を行うようにしたものである。
【0012】
(5) 本発明の第5の態様は、上述の第4の態様に係るICカードにおいて、
選択されたアプリケーションプログラムの実行が終了した場合に、復号化プログラム格納部に格納されている選択アプリケーションプログラムについての復号化プログラムを消去する処理を行うようにしたものである。
【0013】
(6) 本発明の第6の態様は、上述の第1〜第3の態様に係るICカードにおいて、
外部装置から特定のアプリケーションプログラムについての特定のコマンドが与えられた場合に、この特定のアプリケーションプログラムのうち、少なくとも与えられた特定のコマンドの実行に必要な部分についての復号化を行うようにしたものである。
【0014】
(7) 本発明の第7の態様は、上述の第6の態様に係るICカードにおいて、
外部装置から与えられた特定のコマンドの実行が終了するたびに、復号化プログラム格納部内に格納されている復号化プログラムを消去する処理を行うようにしたものである。
【0015】
(8) 本発明の第8の態様は、上述の第1〜第7の態様に係るICカードにおいて、
復号化手順として、外部から与えられたキーを利用して復号化を行う手順を用いるようにしたものである。
【0016】
(9) 本発明の第9の態様は、上述の第1〜第8の態様に係るICカードにおいて、
復号化プログラム格納部を、電源を遮断すると記憶内容が失われる揮発性メモリ内に設けるようにしたものである。
【0017】
【発明の実施の形態】
以下、本発明を図示する実施形態に基づいて説明する。図1は、一般的なICカード10と、外部装置(リーダライタ装置)20との間で、情報の伝送を行っている状態を示すブロック図である。この例では、ICカード10は、種々の演算処理機能をもったCPU11と、外部装置20に対する情報の送受を行うI/Oインターフェイス12と、ROM13,EEPROM14,RAM15なるメモリとを備えている。ROM13は書換不能な不揮発性メモリであり、CPU11は、このROM13内に格納されている基本プログラムに基づいて所定の処理を実行する。EEPROM14は、書換可能な不揮発性メモリであり、ユーザデータや種々のアプリケーションプログラムが格納される。RAM15は、CPU11が種々の処理を実行する際の作業領域として利用される書換可能な揮発性メモリである。
【0018】
ICカード10と外部装置20とは、物理的な信号線による接続、赤外線による接続、電磁気を利用した非接触型接続、などの方法によって互いに接続され、情報の送受が行われる。外部装置20からICカード10へは、コマンドという形式で情報が送信される。送信されたこのコマンドは、I/Oインターフェイス12を介してCPU11に与えられる。逆に、ICカード10から外部装置20へは、与えられたコマンドに対するレスポンスという形式で情報が送信される。このレスポンスは、CPU11からI/Oインターフェイス12を介して、外部装置20へと送信される。既に述べたように、外部装置20からICカード10に対してソフトウエア的にアクセスを行う際のセキュリティ対策については、従来から様々な手法が提案されている。図示のとおり、すべてのメモリへのアクセスは、CPU11を介して行われることになり、外部装置20からICカード10内のメモリへの直接アクセスは、行うことはできない。
【0019】
しかしながら、ICカード10内の各メモリに対して、ハードウエア的にアクセスすることは可能である。ICカード10に対する電源供給は、通常、外部装置20側から行われるため、ICカード10と外部装置20との接続を解除すると、ICカード10への電源供給は遮断される。これにより、揮発性メモリであるRAM15内のデータは失われることになる。ところが、ROM13およびEEPROM14は、電源供給遮断後にも記憶内容が温存される不揮発性メモリであるため、ハードウエア的なアクセスにより、記憶内容が外部に読み出される可能性がある。たとえば、不正な手段で入手したICカード10を物理的に分解し、内蔵されていたROM13をスライスして、その断面を観察すれば、記憶されていたビットパターンを抽出することは不可能ではない。また、EEPROM14についても、各部の静電容量などを細かく測定すれば、やはり記憶されていたビットパターンを抽出することは不可能ではない。
【0020】
このような不正な手段によるメモリ内容の読み出し行為が行われた場合、特に重大な問題が生じるのは、内蔵されていたアプリケーションプログラムが解析されてしまうことである。もちろん、ユーザデータが読み出されて解析された場合も、問題が生じることになるが、ユーザデータは一個人に関する情報であるのに対し、アプリケーションプログラムは、多数のICカードに共通して利用されているプログラムであり、その内容が解析されると、今度は、ソフトウエア的な不正行為を助長することになる。
【0021】
本発明の主眼は、このようなハードウエア的な不正行為により、ROM13やEEPROM14内に格納されていたアプリケーションプログラムが解析されるのを未然に防ぐことにある。そのために、本発明に係るICカードは、次の3つの特徴を備えている。
▲1▼アプリケーションプログラムは、暗号化された状態でROM13あるいはEEPROM14内に格納される。
▲2▼暗号化されたアプリケーションプログラムを復号化するための手順が、ROM13あるいはEEPROM14に格納されており、アプリケーション実行時には、これをICカード内で復号化して利用する。
▲3▼アプリケーションの実行終了後には、復号化されたアプリケーションプログラムを消去する。
【0022】
このような3つの特徴により、不正な手段で、ICカード内部のアプリケーションプログラムが解析されるという事態を未然に防ぐことができる。すなわち、特徴▲1▼により、ROM13あるいはEEPROM14内のアプリケーションプログラムは暗号化された状態で格納されるため、不正行為により、ハードウエア的にビットパターンが読み出されたとしても、直ちにアプリケーションプログラムを解析することはできない。また、特徴▲2▼により、正当な行為として、アプリケーションプログラムを実行させる必要がある場合には、ICカード内部で復号化が行われ、アプリケーションプログラムは復号化された状態で実行されるため、正当利用する限りは、何ら支障は生じない。更に、特徴▲3▼により、アプリケーションの実行が終了したら、実行に用いた復号化アプリケーションプログラムは消去されるため、やはり不正行為により、ハードウエア的にビットパターンが読み出されたとしても、直ちにアプリケーションプログラムを解析することはできない。
【0023】
なお、実用上は、1つのアプリケーションプログラムを複数のブロックに分割し、それぞれ異なる複数の暗号化手順に基づいて個々のブロックを暗号化し、暗号化した各ブロックをROM13あるいはEEPROM14内に格納するのが好ましい。このような方法によれば、同一のアプリケーションプログラムでありながら、その部分ごとに異なる暗号化手順が用いられるため、万一、不正な手段によりビットパターンが読み出されたとしても、用いられた暗号化手順を推測することがより困難になり、アプリケーションプログラムの解析をより困難にすることができるためである。もちろん、このように各ブロックごとに異なる暗号化手順を用いて暗号化した場合、この複数の暗号化手順のそれぞれに対応した復号化手順をICカード内部に用意する必要があり、アプリケーションプログラムの復号化を行う際には、各ブロックごとにそれぞれ対応した復号化手順を用いた復号化を行うようにする必要がある。
【0024】
図2は、このようなブロックごとの暗号化の方法を示す概念図である。実際には、この暗号化の手順は、ICカード10の外部で行われる。ここでは、1つのアプリケーションプログラム30を暗号化する方法を示す。まず、アプリケーションプログラム30を複数のブロックに分割する。図示の例では、第1のブロック31と第2のブロック32との2つのブロックに分割しているが、もちろん、3つ以上のブロックに分割してもかまわない。こうして、ブロックごとの分割が完了したら、個々のブロックごとに暗号化を行うことになるが、このとき、各ブロックごとに異なる暗号化手順を用いるようにする。図示の例では、第1のブロック31に対しては、暗号化手順Aに基づく暗号化が行われて第1の暗号化ブロック41が得られ、第2のブロック32に対しては、暗号化手順Bに基づく暗号化が行われて第2の暗号化ブロック42が得られることになる。
【0025】
ここに示す実施形態では、各暗号化ブロックに、それぞれ暗号化手順情報と長さ情報を付加するようにしている。暗号化手順情報は、どの暗号化手順に基づいて暗号化が行われたかを示す情報であり、長さ情報は暗号化ブロックの長さ(たとえば、バイト数)を示す情報である。図示の例では、第1の暗号化ブロック41に、暗号化手順情報Ra(暗号化手順Aに基づく暗号化が行われたことを示す情報)と、長さ情報L11(第1の暗号化ブロック41の長さを示す情報)とを付加することにより、第1の登録用暗号化ブロック51を形成し、同様に、第2の暗号化ブロック42に、暗号化手順情報Rb(暗号化手順Bに基づく暗号化が行われたことを示す情報)と、長さ情報L12(第2の暗号化ブロック42の長さを示す情報)とを付加することにより、第2の登録用暗号化ブロック52を形成している。ここで付加された暗号化手順情報Ra,Rbは、後に復号化を行う際に、どの復号化手順を用いて復号化処理を行うべきかを選択するために利用される。
【0026】
こうして、第1および第2の登録用暗号化ブロック51,52が作成されたら、これを外部装置20からICカード10へと伝送し、ICカード10内のEEPROM14内に登録する処理が行われる。以上は、1つのアプリケーションプログラム30を、EEPROM14内に登録するための手順であるが、この実施形態では、EEPROM14内に複数のアプリケーションプログラムが同様の手順で登録された場合を考えることにする。
【0027】
図3は、本発明の一実施形態に係るICカードにおけるメモリ内の情報格納状態を示すブロック図である。上述したように、このICカードには、ROM13、EEPROM14、RAM15が内蔵されており、いずれのメモリも内蔵CPU11によってアクセスされる。
【0028】
ここに示す例では、EEPROM14は、上述した暗号化手順に基づいて暗号化されたアプリケーションプログラムを格納するための暗号化プログラム格納部として機能する。図では、EEPROM14内に、暗号化された第1のアプリケーションプログラムおよび第2のアプリケーションプログラムが格納された状態が示されている。第1のアプリケーションプログラムは、図2に示されている第1および第2の登録用暗号化ブロック51,52から構成されており、第2のアプリケーションプログラムは、同様に、第1および第2の登録用暗号化ブロック61,62から構成されている。ここで、Ra,Rb,Rcは、どの暗号化手順に基づく暗号化が行われたかを示す暗号化手順情報であり、それぞれ暗号化手順A,B,Cに基づく暗号化が行われたことを示している。また、L11,L12,L21,L22は、各暗号化ブロックの長さを示す長さ情報である。
【0029】
また、ROM13は、各暗号化手順に対応した復号化手順を格納するための復号化手順格納部として機能する。図には、3種類の復号化手順AA,BB,CCが格納された状態が示されているが、これらの復号化手順はそれぞれ暗号化手順A,B,Cに対応した復号化手順となっている。たとえば、暗号化手順Aに基づいて暗号化されたブロックは、復号化手順AAによって復号化が可能になる。したがって、図示の例の場合、EEPROM14内に登録されたブロック51,52,61,62は、ROM13内に用意されているいずれかの復号化手順に基づいて復号化が可能である。逆に言えば、EEPROM14内に登録するアプリケーションプログラムは、ROM13内に用意されているいずれかの復号化手順に対応した暗号化手順で暗号化する必要がある。
【0030】
一方、RAM15は、ROM13内に用意された復号化手順によって復号化されたアプリケーションプログラムを格納するための復号化プログラム格納部として機能する。すなわち、CPU11は、EEPROM14内のブロックについての復号化を行う場合、復号化されたコードを逐次RAM15内に展開する処理を行うことになる。図示の例では、RAM15内に、復号化された第1のアプリケーションプログラムが展開されている状態が示されている。この復号化されたプログラムは、第1のブロック31と第2のブロック32とから構成されており、これらのブロック31,32は、図2に示すアプリケーションプログラム30を構成するブロックである。
【0031】
図3には、RAM15内に復号化された第1のアプリケーションプログラムが格納された状態が示されているが、実際には、外部装置20からこの第1のアプリケーションプログラムに関する実行指示が与えられるまでは、この第1のアプリケーションプログラムは、暗号化された状態でEEPROM14(暗号化プログラム格納部)に格納されている。もちろん、CPU11は、暗号化された状態のアプリケーションプログラムをそのまま実行することはできない。そこで、特定のアプリケーションを実行する必要が生じた場合は、CPU11は、EEPROM14内のこの特定のアプリケーションを、復号化してRAM15内に展開する処理を実行する。たとえば、第1のアプリケーションプログラムを実行する必要が生じた場合、CPU11は、EEPROM14内の第1の登録用暗号化ブロック51と第2の登録用暗号化ブロック52とに対する復号化処理を行い、その結果を、RAM15内に展開する処理を行うことになる。たとえば、第1の登録用暗号化ブロック51の復号化を行う際には、暗号化手順情報Raによって、このブロックが暗号化手順Aに基づいて暗号化されたことを認識し、これに対応した復号化手順AA(ROM13内に用意されている)を利用して復号化処理を行うことになる。図3は、このような復号化処理が行われた後の状態を示している。CPU11は、このようにしてRAM15上に得られた第1のアプリケーションプログラム(復号化された状態のもの)を用いてこれを実行する。
【0032】
こうして、第1のアプリケーションプログラムの実行が完了すると、CPU11は、RAM15内に展開された第1のアプリケーションプログラム(すなわち、第1のブロック31および第2のブロック32)を消去する処理(たとえば、00などの任意のデータを上書きする処理)を行う。結局、第1のアプリケーションプログラムは、実行に必要な期間だけ、復号化された状態でRAM15内に滞在していたことになり、実行完了後には、ICカード10内には、復号化状態の第1のアプリケーションプログラムは存在しないことになる。従って、不正なハードウエア的アクセスによって、復号化状態のアプリケーションプログラムが外部へと読み出される可能性は極めて低くなる。
【0033】
なお、図3に示す例では、復号化手順をROM13内に格納するようにしているが、復号化手順はEEPROM14内に格納するようにしてもかまわない。この場合は、必要な復号化手順をその都度、EEPROM14内に書き込んで利用することができるようになる。また、図3に示す例では、暗号化されたアプリケーションプログラムを、EEPROM14内に書き込んで利用するようにしているが、暗号化されたアプリケーションプログラムは、予めROM13内に用意しておいてもよい。更に、図3に示す例では、復号化したアプリケーションプログラムを展開するメモリとして、RAM15を用いているが、EEPROM14上に復号化したアプリケーションプログラムを展開するようにしてもよい。ただ、実用上は、RAM15を復号化プログラム格納部として利用するのが好ましい。その理由は、EEPROM14が、電源の遮断後にも記憶内容が保持される不揮発性メモリであるのに対し、RAM15は、電源を遮断すると記憶内容が失われる揮発性メモリであるためである。たとえば、不正行為者が、ICカード10を外部装置20に接続した状態で何らかの操作を行っている最中に、強制的に両者の接続を切断するような行為を行った場合、RAM15内のデータは失われるが、EEPROM14内のデータはそのまま残ることになる。したがって、EEPROM14を復号化プログラム格納部として利用した場合は、復号化された状態のアプリケーションプログラムが、消去されずにそのままEEPROM14内に残る危険性が生じることになる。
【0034】
図4は、本発明に係るICカード10で行われる処理手順の一例を示す流れ図である。このような処理手順自身は、ROM13内に予め用意されており、CPU11によって実行されることになる。まず、ステップS1において、コマンド受信が行われる。前述したように、このICカード10に対する外部装置20側からの指示は、すべてコマンドの形式で与えられる。そこで、まず、I/Oインターフェイスを介して、外部装置20側から与えられたコマンドが受信される。この実施形態では、こうして与えられるコマンドは、3つのタイプに分けられる。すなわち、アプリケーション選択コマンド、アプリケーション終了コマンド、一般コマンドの3タイプである。アプリケーション選択コマンドは、EEPROM14内に登録されている複数のアプリケーションプログラム(いずれも暗号化された状態で格納されている)のうちの特定の1つを、実行対象として選択する指示を与えるためのコマンドであり、アプリケーション終了コマンドは、現在選択されているアプリケーションプログラムの実行を終了する指示を与えるためのコマンドである。実際には、アプリケーションが既に選択されている状態において、新たなアプリケーションを選択するコマンドを与えると、新アプリケーションが選択されるとともに、旧アプリケーションの選択は解除されて終了することになる。したがって、このようなコマンドは、アプリケーション選択コマンドとアプリケーション終了コマンドとの双方を兼ねたコマンドということになるが、ここでは説明の便宜上、両コマンドが別々のコマンドとして与えられる場合の例を示してある。また、一般コマンドは、現在選択されているアプリケーションプログラムに対する種々のコマンドであり、その内容は、各アプリケーションプログラムによってそれぞれ定まっている。
【0035】
ICカード10に所定のアプリケーションプログラムを実行させるためには、通常、外部装置20側から次のような手順でコマンドを送信すればよい。まず、アプリケーション選択コマンドを送信し、特定のアプリケーションプログラムを選択させる。続いて、この選択されたアプリケーションプログラムに対応した種々の一般コマンドを順次送信し、選択されたアプリケーションプログラムによって所望の処理を行わせる。最後に、アプリケーション終了コマンドを送信し、現在実行中のアプリケーションプログラムの選択を解除する(実際には、前述したように、新たなアプリケーションを選択するコマンドが、旧アプリケーションの終了コマンドを兼ねたコマンドとして用いられることが多い)。以上のような順番で、外部装置20からICカード10へとコマンドが与えられる、という前提で、図4の流れ図を見てみよう。
【0036】
まず、ステップS1において受信されたコマンドは、ステップS2において、アプリケーション選択コマンドであるか否かが判断され、ステップS3において、アプリケーション終了コマンドであるか否かが判断される。そのいずれでもない場合には、一般コマンド(特定のアプリケーションプログラムに対するコマンド)と判断され、ステップS4において、アプリケーションが選択済か否かが判断される。ここで、アプリケーションが選択済みではない場合は、ステップS5において、エラーがセットされ、ステップS6において、このセットされたエラーがレスポンスとして外部装置20側へ伝送されることになる。このエラーは、アプリケーションプログラムの選択が行われていない状態において、特定のアプリケーションプログラムに対するコマンドが与えられたことを意味する。
【0037】
さて、受信したコマンドが、アプリケーション選択コマンドであった場合は、ステップS2からステップS7へと進み、アプリケーションの選択処理が行われる。すなわち、いずれかのアプリケーションプログラムが選択状態となる(具体的には、たとえば、選択されたアプリケーションプログラムを示すフラグがRAM15上に記録される)。続いて、ステップS8において、選択されたアプリケーションプログラムの復号化が行われる。復号化されたアプリケーションプログラムは、RAM15内に展開されることになり、ステップS6において、アプリケーションの選択手続が完了した旨のレスポンスが送信される。
【0038】
一方、受信したコマンドが、アプリケーション終了コマンドであった場合は、ステップS3からステップS9へと進み(新たなアプリケーションを選択するコマンドが、旧アプリケーションの終了コマンドを兼ねる場合は、ステップS8からステップS9へと進めばよい)、現在選択されているアプリケーションプログラムの選択解除処理が行われる(具体的には、たとえば、選択されたアプリケーションプログラムを示すRAM15上のフラグを消す)。続いて、ステップS10において、終了したアプリケーションプログラムの消去が行われる。すなわち、RAM15内に展開されていた復号化されたアプリケーションプログラムが消去される。そして、ステップS6において、アプリケーションの終了手続が完了した旨のレスポンスが送信される。
【0039】
また、受信したコマンドが、一般コマンドであり、その時点でいずれかのアプリケーションプログラムが選択済みの状態であった場合には、ステップS4からステップS11へと進み、与えられた一般コマンドが、選択済みアプリケーションプログラムの対応コマンドであるか否かが判断される。対応コマンドでなかった場合には、ステップS5においてエラーがセットされ、ステップS6において、このエラーがレスポンスとして送信される。対応コマンドであった場合には、ステップS12へと進み、RAM15内に展開されている復号化されたアプリケーションプログラム(現在選択中のアプリケーションプログラム)により、与えられたコマンドが実行され、その結果が、ステップS6においてレスポンスとして送信されることになる。
【0040】
結局、この図4の流れ図に示す手順によれば、外部装置20から、特定のアプリケーションプログラムを選択する指示が与えられた場合に、この選択されたアプリケーションプログラムが復号化されてRAM15内に展開され、この選択されたアプリケーションプログラムの実行が終了した場合に、RAM15内に格納されている復号化プログラムが消去されることになる。そして、選択されたアプリケーションプログラムの実行中は、RAM15内に展開されている復号化されたアプリケーションプログラムによって、一般コマンドが実行されることになる。
【0041】
ところで、図4に示す手順では、アプリケーションプログラムは選択された段階でその全体が復号化され、また、アプリケーションプログラムの終了を待って、復号化されたプログラム全体が消去されるようにしているが、必ずしも全体を復号化し、全体を消去するという手順を採る必要はなく、部分ごとに復号化し、部分ごとに消去するという手順を採ってもかまわない。たとえば、外部装置20から特定のアプリケーションプログラムについての特定のコマンドが与えられた場合に、この特定のアプリケーションプログラムのうち、少なくとも与えられた特定のコマンドの実行に必要な部分についての復号化を行うようにし、この特定のコマンドの実行が終了するたびに、復号化されたプログラムを消去するようにしてもよい。通常、アプリケーションプログラムには、多数のコマンドが定義されており、1つ1つのコマンドの実行には、当該アプリケーションプログラムの中の一部分のルーチンのみが使用される。したがって、与えられたコマンドの実行に必要なルーチンの部分のみをその都度復号化して利用するという手法を採れば、無用な復号化処理を行う必要はなくなる。また、RAM15内に展開される復号化プログラムも、実行に必要なルーチンの部分のみとなるため、アプリケーションプログラム全体が外部に読み出される可能性を更に低減させることが可能になる。
【0042】
以上、本発明を図示する実施形態に基づいて述べたが、本発明はこれらの実施形態に限定されるものではなく、この他にも種々の態様で実施可能である。たとえば、上述の実施形態では、アプリケーションプログラム全体を暗号化して、ICカード内に登録するようにしているが、アプリケーションプログラムの暗号化は必ずしも全体に対して行う必要はなく、セキュリティ上、特に必要な一部分のみを暗号化し、残りの部分は暗号化しない状態でICカード内に登録するようにしてもかまわない。
【0043】
また、本発明を実施する上では、ICカード内に復号化手順を用意する必要があるが、この復号化手順が不正な手段によって外部に読み出される可能性もある。したがって、よりセキュリティを向上させるためには、暗号化および復号化に所定のキーを利用するような手法を採るのが好ましい。この場合、復号化手順を実施するためには、外部からICカードに対してキーを与える必要があるため、たとえ不正な手段によって、ICカード内部の復号化手順が読み出されたとしても、この復号化手順を用いて、直ちに復号化を行うことはできないため、安全性が向上することになる。なお、復号化に必要なキーは、たとえば、アプリケーション選択コマンドとともに、外部装置20側からICカード10へと与えるようにすればよい。
【0044】
【発明の効果】
以上のとおり本発明に係るICカードによれば、アプリケーションプログラムを暗号化した状態でICカード内に格納し、必要なときにだけこれを復号化して利用し、利用後に復号化プログラムを消去するようにしたため、より万全なセキュリティを確保することが可能になる。
【図面の簡単な説明】
【図1】一般的なICカード10と、外部装置(リーダライタ装置)20との間で、情報の伝送を行っている状態を示すブロック図である。
【図2】本発明で用いるブロックごとの暗号化の方法を示す概念図である。
【図3】本発明の一実施形態に係るICカードにおけるメモリ内の情報格納状態を示すブロック図である。
【図4】本発明に係るICカードで行われる処理手順の一例を示す流れ図である。
【符号の説明】
10…ICカード
11…CPU
12…I/Oインターフェイス
13…ROM
14…EEPROM
15…RAM
20…外部装置
30…アプリケーションプログラム
31…第1のブロック
32…第2のブロック
41…第1の暗号化ブロック
42…第2の暗号化ブロック
51…第1の登録用暗号化ブロック
52…第2の登録用暗号化ブロック
61…第1の登録用暗号化ブロック
62…第2の登録用暗号化ブロック
A,B…暗号化手順
AA,BB,CC…復号化手順
L11,L12,L21,L22…ブロックの長さ情報
Ra,Rb,Rc…ブロックの暗号化手順情報
[0001]
BACKGROUND OF THE INVENTION
The present invention relates to an IC card, and more particularly, to an IC card that has a CPU and a memory and performs various processes by causing the CPU to execute an application program stored in the memory.
[0002]
[Prior art]
Instead of magnetic cards that have been used as cash cards and credit cards, optical cards and IC cards have begun to spread. In particular, an IC card with a built-in CPU has an advantage that it can be used for expensive commercial transactions because it can ensure a high level of security.
[0003]
Currently, an IC card having a CPU that is generally used incorporates ROM, EEPROM, and RAM as memories. Usually, a basic program to be executed by the CPU is stored in the ROM, user data and various application programs are stored in the EEPROM, and the RAM is used as a work area of the CPU. Since the EEPROM is a rewritable memory, necessary data and application programs can be stored for each user.
[0004]
When data or programs are written to or read from an IC card, an external device called a so-called reader / writer device is used. Between the external device and the IC card, data and programs are transmitted to each other via a physical transmission line or a non-contact transmission path. Normally, information transmission from an external device to the IC card is given in the form of a command, and various instructions and data are transmitted to the IC card as one piece of information in the command. On the other hand, information transmission from the IC card to the external device is given in the form of a response, and the processing result and data are transmitted to the external device as one piece of information in the response.
[0005]
[Problems to be solved by the invention]
As described above, when using an IC card for general commercial transactions, ensuring security is an important issue. In a general IC card with a built-in CPU, when a memory in the IC card is accessed from an external device, the access to the memory via the built-in CPU is always used, so that the security related to data access can be considerably increased. it can. Therefore, normally, when accessing the IC card from an external device, settings such as various passwords are set as a condition, and if the verification fails, access is denied by the built-in CPU. In addition, when information is transmitted between an external device and an IC card, means for encrypting transmission information is also taken in order to ensure security on the signal transmission path.
[0006]
However, these security measures are measures for ensuring security when accessing the IC card from the outside by software, and are not measures related to the hardware security of the IC card itself. Until now, the general idea was that the IC card itself had sufficient security in terms of hardware. This is an idea from the viewpoint that it is almost impossible to read information in the IC card to the outside by hardware. However, when IC cards are used for high-priced business transactions, it is necessary to make every effort to ensure hardware security. For example, if the IC card is physically disassembled, the built-in memory is mechanically cut, and the cut surface is analyzed, it is not impossible to recognize the bit pattern in the memory. Therefore, in the case of an IC card used for expensive commercial transactions, it cannot always be said that the conventional security measures alone are perfect.
[0007]
SUMMARY OF THE INVENTION An object of the present invention is to provide an IC card that can ensure more complete security.
[0008]
[Means for Solving the Problems]
(1) A first aspect of the present invention is an IC card that includes a CPU and a memory, and performs various processes by causing the CPU to execute an application program stored in the memory.
An encryption program storage unit for storing an application program encrypted based on a predetermined encryption procedure;
A decryption procedure storage unit for storing a decryption procedure corresponding to the encryption procedure;
A decryption program storage for storing the application program decrypted by the decryption procedure;
On the memory,
Until the execution instruction regarding the application program is given from the external device, the application program is stored in the encrypted program storage unit in an encrypted state,
When an execution instruction is given, decryption is performed based on the stored decryption procedure, the decrypted application program is stored in the decryption program storage unit, and the decrypted application program is executed. Thereafter, a process of deleting the decrypted application program from the decrypted program storage unit is performed.
[0009]
(2) According to a second aspect of the present invention, in the IC card according to the first aspect described above,
The application program is stored in the encrypted program storage unit with only a part of the application program encrypted.
[0010]
(3) According to a third aspect of the present invention, in the IC card according to the first aspect described above,
The application program is divided into a plurality of blocks, each block is encrypted based on a plurality of different encryption procedures, and each encrypted block is stored in the encryption program storage unit.
The decryption procedure corresponding to each of the plurality of encryption procedures is stored in the decryption procedure storage unit,
When the application program is decrypted, decryption is performed using a decryption procedure corresponding to each block.
[0011]
(4) A fourth aspect of the present invention is the IC card according to the first to third aspects described above,
Multiple application programs are encrypted and stored in the encrypted program storage unit,
When an instruction to select a specific application program is given from an external device, the selected application program is decrypted.
[0012]
(5) According to a fifth aspect of the present invention, in the IC card according to the fourth aspect described above,
When the execution of the selected application program is completed, a process for deleting the decryption program for the selected application program stored in the decryption program storage unit is performed.
[0013]
(6) According to a sixth aspect of the present invention, in the IC card according to the first to third aspects described above,
When a specific command for a specific application program is given from an external device, at least a part of the specific application program necessary for execution of the given specific command is decrypted It is.
[0014]
(7) According to a seventh aspect of the present invention, in the IC card according to the sixth aspect described above,
Every time the execution of a specific command given from an external device is completed, a process of deleting the decryption program stored in the decryption program storage unit is performed.
[0015]
(8) The eighth aspect of the present invention is the IC card according to the first to seventh aspects described above,
As a decryption procedure, a decryption procedure using a key given from the outside is used.
[0016]
(9) A ninth aspect of the present invention is the IC card according to the first to eighth aspects described above,
The decryption program storage unit is provided in a volatile memory whose stored contents are lost when the power is turned off.
[0017]
DETAILED DESCRIPTION OF THE INVENTION
Hereinafter, the present invention will be described based on the illustrated embodiments. FIG. 1 is a block diagram showing a state in which information is transmitted between a general IC card 10 and an external device (reader / writer device) 20. In this example, the IC card 10 includes a CPU 11 having various arithmetic processing functions, an I / O interface 12 for transmitting / receiving information to / from the external device 20, and memories such as a ROM 13, an EEPROM 14, and a RAM 15. The ROM 13 is a non-rewritable nonvolatile memory, and the CPU 11 executes predetermined processing based on a basic program stored in the ROM 13. The EEPROM 14 is a rewritable nonvolatile memory and stores user data and various application programs. The RAM 15 is a rewritable volatile memory used as a work area when the CPU 11 executes various processes.
[0018]
The IC card 10 and the external device 20 are connected to each other by a method such as a connection using a physical signal line, a connection using infrared rays, or a non-contact connection using electromagnetics, and information is transmitted and received. Information is transmitted from the external device 20 to the IC card 10 in the form of a command. The transmitted command is given to the CPU 11 via the I / O interface 12. Conversely, information is transmitted from the IC card 10 to the external device 20 in the form of a response to a given command. This response is transmitted from the CPU 11 to the external device 20 via the I / O interface 12. As already described, various techniques have been proposed for security measures when accessing the IC card 10 from the external device 20 by software. As shown in the figure, access to all memories is performed via the CPU 11, and direct access to the memory in the IC card 10 from the external device 20 cannot be performed.
[0019]
However, it is possible to access each memory in the IC card 10 by hardware. Since power supply to the IC card 10 is normally performed from the external device 20 side, when the connection between the IC card 10 and the external device 20 is released, the power supply to the IC card 10 is cut off. As a result, data in the RAM 15 which is a volatile memory is lost. However, since the ROM 13 and the EEPROM 14 are non-volatile memories in which the stored contents are preserved even after the power supply is cut off, the stored contents may be read out by hardware access. For example, it is not impossible to extract the stored bit pattern by physically disassembling the IC card 10 obtained by unauthorized means, slicing the built-in ROM 13, and observing the cross section thereof. . Also, with respect to the EEPROM 14, it is not impossible to extract the stored bit pattern if the capacitance of each part is measured finely.
[0020]
When memory contents are read by such illegal means, a particularly serious problem is that the built-in application program is analyzed. Of course, when user data is read and analyzed, problems will arise, but user data is information related to one person, whereas application programs are commonly used in many IC cards. If the contents are analyzed, software fraud is promoted this time.
[0021]
The main point of the present invention is to prevent an application program stored in the ROM 13 or the EEPROM 14 from being analyzed by such a hardware fraud. Therefore, the IC card according to the present invention has the following three features.
(1) The application program is stored in the ROM 13 or the EEPROM 14 in an encrypted state.
(2) A procedure for decrypting the encrypted application program is stored in the ROM 13 or the EEPROM 14, and this is decrypted and used in the IC card when the application is executed.
(3) After the application execution is completed, the decrypted application program is deleted.
[0022]
With these three features, it is possible to prevent a situation in which an application program inside the IC card is analyzed by unauthorized means. That is, because of the feature (1), the application program in the ROM 13 or the EEPROM 14 is stored in an encrypted state. Therefore, even if a bit pattern is read out in hardware by an illegal act, the application program is immediately analyzed. I can't do it. Further, according to the feature (2), when it is necessary to execute the application program as a legitimate action, the decryption is performed inside the IC card, and the application program is executed in the decrypted state. As long as it is used, there will be no trouble. Furthermore, because of the feature (3), when the execution of the application is completed, the decryption application program used for the execution is erased, so even if the bit pattern is read out by hardware, the application immediately The program cannot be analyzed.
[0023]
In practice, one application program is divided into a plurality of blocks, each block is encrypted based on a plurality of different encryption procedures, and each encrypted block is stored in the ROM 13 or the EEPROM 14. preferable. According to such a method, although the same application program is used, a different encryption procedure is used for each part. Therefore, even if a bit pattern is read by unauthorized means, This is because it becomes more difficult to infer the conversion procedure, and the analysis of the application program can be made more difficult. Of course, when encryption is performed using different encryption procedures for each block in this way, it is necessary to prepare a decryption procedure corresponding to each of the plurality of encryption procedures in the IC card, and decryption of the application program When performing the conversion, it is necessary to perform decoding using a decoding procedure corresponding to each block.
[0024]
FIG. 2 is a conceptual diagram showing such an encryption method for each block. Actually, this encryption procedure is performed outside the IC card 10. Here, a method of encrypting one application program 30 is shown. First, the application program 30 is divided into a plurality of blocks. In the example shown in the figure, the first block 31 and the second block 32 are divided into two blocks, but of course, the blocks may be divided into three or more blocks. Thus, when the division for each block is completed, encryption is performed for each individual block. At this time, different encryption procedures are used for each block. In the illustrated example, the first block 31 is encrypted based on the encryption procedure A to obtain the first encrypted block 41, and the second block 32 is encrypted. The encryption based on the procedure B is performed, and the second encryption block 42 is obtained.
[0025]
In the embodiment shown here, encryption procedure information and length information are added to each encryption block. The encryption procedure information is information indicating which encryption procedure is used for encryption, and the length information is information indicating the length (for example, the number of bytes) of the encryption block. In the illustrated example, the first encryption block 41 includes encryption procedure information Ra (information indicating that encryption based on the encryption procedure A has been performed) and length information L11 (first encryption block). The first registration encryption block 51 is formed by adding the encryption procedure information Rb (encryption procedure B) to the second encryption block 42. And the length information L12 (information indicating the length of the second encryption block 42) and the second registration encryption block 52 by adding the length information L12 (information indicating the length of the second encryption block 42). Is forming. The encryption procedure information Ra and Rb added here is used to select which decryption procedure should be used for decryption when decrypting later.
[0026]
When the first and second registration encryption blocks 51 and 52 are created in this way, processing for transmitting them from the external device 20 to the IC card 10 and registering them in the EEPROM 14 in the IC card 10 is performed. The above is a procedure for registering one application program 30 in the EEPROM 14, but in this embodiment, a case will be considered in which a plurality of application programs are registered in the EEPROM 14 in the same procedure.
[0027]
FIG. 3 is a block diagram showing an information storage state in the memory in the IC card according to the embodiment of the present invention. As described above, the IC card includes the ROM 13, the EEPROM 14, and the RAM 15, and all the memories are accessed by the built-in CPU 11.
[0028]
In the example shown here, the EEPROM 14 functions as an encryption program storage unit for storing an application program encrypted based on the above-described encryption procedure. In the figure, a state in which the encrypted first application program and second application program are stored in the EEPROM 14 is shown. The first application program is composed of first and second registration encryption blocks 51 and 52 shown in FIG. 2, and the second application program is similar to the first and second encryption blocks. It consists of registration encryption blocks 61 and 62. Here, Ra, Rb, and Rc are encryption procedure information indicating which encryption procedure is performed based on the encryption procedure, and indicate that encryption based on the encryption procedures A, B, and C is performed. Show. L11, L12, L21, and L22 are length information indicating the length of each encrypted block.
[0029]
In addition, the ROM 13 functions as a decryption procedure storage unit for storing a decryption procedure corresponding to each encryption procedure. The figure shows a state in which three types of decryption procedures AA, BB, and CC are stored. These decryption procedures are decryption procedures corresponding to the encryption procedures A, B, and C, respectively. ing. For example, a block encrypted based on the encryption procedure A can be decrypted by the decryption procedure AA. Therefore, in the case of the illustrated example, the blocks 51, 52, 61, 62 registered in the EEPROM 14 can be decrypted based on any decryption procedure prepared in the ROM 13. In other words, the application program registered in the EEPROM 14 needs to be encrypted by an encryption procedure corresponding to one of the decryption procedures prepared in the ROM 13.
[0030]
On the other hand, the RAM 15 functions as a decryption program storage unit for storing the application program decrypted by the decryption procedure prepared in the ROM 13. That is, when the CPU 11 performs decoding on the block in the EEPROM 14, the CPU 11 performs processing for sequentially expanding the decoded code in the RAM 15. In the illustrated example, a state where the decrypted first application program is expanded in the RAM 15 is shown. The decrypted program is composed of a first block 31 and a second block 32. These blocks 31 and 32 are blocks constituting the application program 30 shown in FIG.
[0031]
FIG. 3 shows a state in which the decrypted first application program is stored in the RAM 15, but actually, until an execution instruction regarding the first application program is given from the external device 20. The first application program is stored in the EEPROM 14 (encrypted program storage unit) in an encrypted state. Of course, the CPU 11 cannot execute the encrypted application program as it is. Therefore, when it becomes necessary to execute a specific application, the CPU 11 executes a process of decrypting the specific application in the EEPROM 14 and developing it in the RAM 15. For example, when it becomes necessary to execute the first application program, the CPU 11 performs a decryption process on the first registration encryption block 51 and the second registration encryption block 52 in the EEPROM 14. A process of expanding the result in the RAM 15 is performed. For example, when decrypting the first registration encryption block 51, the encryption procedure information Ra recognizes that this block has been encrypted based on the encryption procedure A, and corresponds to this. Decoding processing is performed using the decoding procedure AA (prepared in the ROM 13). FIG. 3 shows a state after such a decoding process is performed. The CPU 11 executes this using the first application program (in a decrypted state) obtained on the RAM 15 in this way.
[0032]
Thus, when the execution of the first application program is completed, the CPU 11 erases the first application program (that is, the first block 31 and the second block 32) expanded in the RAM 15 (for example, 00 Process to overwrite any data such as). Eventually, the first application program stayed in the RAM 15 in the decrypted state only for the period required for execution. After the completion of the execution, the first application program is in the IC card 10 in the decrypted state. One application program does not exist. Therefore, the possibility that an application program in a decrypted state is read out to the outside due to unauthorized hardware access is extremely low.
[0033]
In the example shown in FIG. 3, the decoding procedure is stored in the ROM 13, but the decoding procedure may be stored in the EEPROM 14. In this case, the necessary decryption procedure can be written into the EEPROM 14 each time and used. In the example shown in FIG. 3, the encrypted application program is written and used in the EEPROM 14. However, the encrypted application program may be prepared in the ROM 13 in advance. Further, in the example shown in FIG. 3, the RAM 15 is used as a memory for developing the decrypted application program. However, the decrypted application program may be expanded on the EEPROM 14. However, in practice, it is preferable to use the RAM 15 as a decryption program storage unit. The reason is that the EEPROM 14 is a non-volatile memory whose stored contents are retained even after the power is shut off, while the RAM 15 is a volatile memory whose stored contents are lost when the power is shut off. For example, if an unauthorized person performs an act of forcibly disconnecting the both while the IC card 10 is connected to the external device 20 and performing any operation, the data in the RAM 15 Is lost, but the data in the EEPROM 14 remains as it is. Therefore, when the EEPROM 14 is used as the decryption program storage unit, there is a risk that the decrypted application program remains in the EEPROM 14 without being erased.
[0034]
FIG. 4 is a flowchart showing an example of a processing procedure performed in the IC card 10 according to the present invention. Such a processing procedure itself is prepared in advance in the ROM 13 and is executed by the CPU 11. First, in step S1, command reception is performed. As described above, all instructions from the external device 20 to the IC card 10 are given in the form of commands. Therefore, first, a command given from the external device 20 side is received via the I / O interface. In this embodiment, the commands given in this way are divided into three types. That is, there are three types: an application selection command, an application end command, and a general command. The application selection command is a command for giving an instruction to select a specific one of a plurality of application programs (all stored in an encrypted state) registered in the EEPROM 14 as an execution target. The application end command is a command for giving an instruction to end the execution of the currently selected application program. Actually, when a command for selecting a new application is given in a state where an application has already been selected, the new application is selected and the selection of the old application is canceled and the process ends. Therefore, such a command is a command that serves as both an application selection command and an application end command. Here, for convenience of explanation, an example in which both commands are given as separate commands is shown. . The general commands are various commands for the currently selected application program, and the contents thereof are determined by each application program.
[0035]
In order to cause the IC card 10 to execute a predetermined application program, it is usually sufficient to transmit a command in the following procedure from the external device 20 side. First, an application selection command is transmitted to select a specific application program. Subsequently, various general commands corresponding to the selected application program are sequentially transmitted, and a desired process is performed by the selected application program. Finally, an application termination command is transmitted, and the selection of the currently executing application program is canceled (in fact, as described above, the command for selecting a new application is a command that also serves as the termination command for the old application. Often used). Let's look at the flowchart of FIG. 4 on the premise that commands are given from the external device 20 to the IC card 10 in the above order.
[0036]
First, in step S2, it is determined whether the command received in step S1 is an application selection command, and in step S3, it is determined whether it is an application end command. If it is neither of them, it is determined as a general command (command for a specific application program), and it is determined in step S4 whether or not an application has been selected. If the application has not been selected, an error is set in step S5, and the set error is transmitted to the external apparatus 20 as a response in step S6. This error means that a command for a specific application program is given in a state where the application program is not selected.
[0037]
If the received command is an application selection command, the process proceeds from step S2 to step S7, and an application selection process is performed. That is, one of the application programs is selected (specifically, for example, a flag indicating the selected application program is recorded on the RAM 15). Subsequently, in step S8, the selected application program is decrypted. The decrypted application program is expanded in the RAM 15, and a response indicating that the application selection procedure is completed is transmitted in step S6.
[0038]
On the other hand, if the received command is an application termination command, the process proceeds from step S3 to step S9 (if the command for selecting a new application also serves as the termination command for the old application, the process proceeds from step S8 to step S9. The selection cancellation processing of the currently selected application program is performed (specifically, for example, the flag on the RAM 15 indicating the selected application program is deleted). Subsequently, in step S10, the completed application program is deleted. That is, the decrypted application program developed in the RAM 15 is deleted. In step S6, a response indicating that the application termination procedure has been completed is transmitted.
[0039]
If the received command is a general command and one of the application programs has been selected at that time, the process proceeds from step S4 to step S11, and the given general command has been selected. It is determined whether the command corresponds to the application program. If it is not a corresponding command, an error is set in step S5, and this error is transmitted as a response in step S6. If the command is a corresponding command, the process proceeds to step S12, and the given command is executed by the decrypted application program (currently selected application program) developed in the RAM 15, and the result is In step S6, it is transmitted as a response.
[0040]
After all, according to the procedure shown in the flowchart of FIG. 4, when an instruction to select a specific application program is given from the external device 20, the selected application program is decrypted and expanded in the RAM 15. When the execution of the selected application program is completed, the decryption program stored in the RAM 15 is deleted. During execution of the selected application program, the general command is executed by the decrypted application program developed in the RAM 15.
[0041]
By the way, in the procedure shown in FIG. 4, the entire application program is decrypted at a selected stage, and the entire decrypted program is erased after waiting for the end of the application program. It is not always necessary to take the procedure of decoding the whole and erasing the whole, but it is possible to take the procedure of decoding every part and erasing every part. For example, when a specific command for a specific application program is given from the external device 20, at least a part necessary for execution of the given specific command is decrypted in the specific application program. The decrypted program may be deleted each time execution of this specific command is completed. Normally, many commands are defined in the application program, and only a part of the routines in the application program is used to execute each command. Therefore, if a method of decoding and using only a part of a routine necessary for execution of a given command is unnecessary, there is no need to perform unnecessary decoding processing. Further, since the decryption program expanded in the RAM 15 is only a part of the routine necessary for execution, it is possible to further reduce the possibility that the entire application program is read out.
[0042]
As mentioned above, although this invention was described based on embodiment shown in figure, this invention is not limited to these embodiment, In addition to this, it can implement in a various aspect. For example, in the above-described embodiment, the entire application program is encrypted and registered in the IC card. However, the encryption of the application program is not necessarily performed on the whole, and is particularly necessary for security. Only a part may be encrypted, and the remaining part may be registered in the IC card without being encrypted.
[0043]
In order to implement the present invention, it is necessary to prepare a decryption procedure in the IC card. However, there is a possibility that the decryption procedure is read out by an unauthorized means. Therefore, in order to further improve the security, it is preferable to adopt a method that uses a predetermined key for encryption and decryption. In this case, in order to execute the decryption procedure, it is necessary to give a key to the IC card from the outside. Therefore, even if the decryption procedure inside the IC card is read by an unauthorized means, Since decoding cannot be performed immediately using the decoding procedure, security is improved. The key necessary for decryption may be given to the IC card 10 from the external device 20 side, for example, together with the application selection command.
[0044]
【The invention's effect】
As described above, according to the IC card of the present invention, the application program is stored in the IC card in an encrypted state, and is decrypted and used only when necessary, and the decrypted program is erased after use. As a result, it becomes possible to ensure more complete security.
[Brief description of the drawings]
FIG. 1 is a block diagram showing a state in which information is transmitted between a general IC card 10 and an external device (reader / writer device) 20. FIG.
FIG. 2 is a conceptual diagram showing a block-by-block encryption method used in the present invention.
FIG. 3 is a block diagram showing an information storage state in a memory in the IC card according to the embodiment of the present invention.
FIG. 4 is a flowchart showing an example of a processing procedure performed by the IC card according to the present invention.
[Explanation of symbols]
10 ... IC card
11 ... CPU
12 ... I / O interface
13 ... ROM
14… EEPROM
15 ... RAM
20 ... External device
30 ... Application program
31 ... first block
32 ... the second block
41. First encryption block
42. Second encryption block
51... First registration encryption block
52 ... Second registration encryption block
61. First registration encryption block
62 ... Second registration encryption block
A, B ... Encryption procedure
AA, BB, CC ... Decoding procedure
L11, L12, L21, L22 ... block length information
Ra, Rb, Rc ... Block encryption procedure information

Claims (9)

CPUとメモリとを有し、メモリ内に格納されたアプリケーションプログラムをCPUによって実行させることにより、種々の処理を行うICカードにおいて、
所定の暗号化手順に基づいて暗号化されたアプリケーションプログラムを格納するための暗号化プログラム格納部と、
前記暗号化手順に対応した復号化手順を格納するための復号化手順格納部と、
前記復号化手順によって復号化されたアプリケーションプログラムを格納するための復号化プログラム格納部と、
をメモリ上に設け、
外部装置から前記アプリケーションプログラムに関する実行指示が与えられるまでは、前記アプリケーションプログラムを暗号化した状態で前記暗号化プログラム格納部に格納しておき、
前記実行指示が与えられた場合は、前記復号化手順に基づいて復号化を行い、復号化されたアプリケーションプログラムを前記復号化プログラム格納部に格納し、この復号化されたアプリケーションプログラムを実行した後、この復号化されたアプリケーションプログラムを前記復号化プログラム格納部から消去する処理を行う機能を有することを特徴とするICカード。
In an IC card that has a CPU and a memory and performs various processes by causing the CPU to execute application programs stored in the memory,
An encryption program storage unit for storing an application program encrypted based on a predetermined encryption procedure;
A decryption procedure storage unit for storing a decryption procedure corresponding to the encryption procedure;
A decryption program storage for storing the application program decrypted by the decryption procedure;
On the memory,
Until the execution instruction related to the application program is given from an external device, the application program is stored in the encrypted program storage unit in an encrypted state,
When the execution instruction is given, the decryption is performed based on the decryption procedure, the decrypted application program is stored in the decryption program storage unit, and the decrypted application program is executed. An IC card having a function of performing a process of erasing the decrypted application program from the decrypted program storage unit.
請求項1に記載のICカードにおいて、
アプリケーションプログラムを、その一部分のみを暗号化した状態で、暗号化プログラム格納部に格納しておくことを特徴とするICカード。
In the IC card according to claim 1,
An IC card, wherein an application program is stored in an encrypted program storage unit in a state where only a part thereof is encrypted.
請求項1に記載のICカードにおいて、
アプリケーションプログラムを複数のブロックに分割し、それぞれ異なる複数の暗号化手順に基づいて個々のブロックを暗号化し、暗号化した各ブロックを暗号化プログラム格納部に格納しておくようにし、
前記複数の暗号化手順のそれぞれに対応した復号化手順を復号化手順格納部に格納しておき、
アプリケーションプログラムの復号化を行う際には、各ブロックごとにそれぞれ対応した復号化手順を用いた復号化を行うことを特徴とするICカード。
In the IC card according to claim 1,
The application program is divided into a plurality of blocks, each block is encrypted based on a plurality of different encryption procedures, and each encrypted block is stored in the encryption program storage unit.
A decryption procedure corresponding to each of the plurality of encryption procedures is stored in a decryption procedure storage unit,
An IC card characterized in that when an application program is decrypted, decryption is performed using a decryption procedure corresponding to each block.
請求項1〜3のいずれかに記載のICカードにおいて、
複数のアプリケーションプログラムをそれぞれ暗号化して暗号化プログラム格納部に格納しておくようにし、
外部装置から特定のアプリケーションプログラムを選択する指示が与えられた場合に、この選択されたアプリケーションプログラムについての復号化を行うようにしたことを特徴とするICカード。
In the IC card according to any one of claims 1 to 3,
Multiple application programs are encrypted and stored in the encrypted program storage unit,
An IC card characterized in that, when an instruction to select a specific application program is given from an external device, the selected application program is decrypted.
請求項4に記載のICカードにおいて、
選択されたアプリケーションプログラムの実行が終了した場合に、復号化プログラム格納部に格納されている前記選択されたアプリケーションプログラムについての復号化プログラムを消去する処理を行うことを特徴とするICカード。
In the IC card according to claim 4,
An IC card that performs a process of erasing a decryption program for the selected application program stored in a decryption program storage unit when execution of the selected application program is completed.
請求項1〜3のいずれかに記載のICカードにおいて、
外部装置から特定のアプリケーションプログラムについての特定のコマンドが与えられた場合に、前記特定のアプリケーションプログラムのうち、少なくとも前記特定のコマンドの実行に必要な部分についての復号化を行うようにすることを特徴とするICカード。
In the IC card according to any one of claims 1 to 3,
When a specific command for a specific application program is given from an external device, at least a part necessary for execution of the specific command in the specific application program is decrypted. IC card.
請求項6に記載のICカードにおいて、
外部装置から与えられた特定のコマンドの実行が終了するたびに、復号化プログラム格納部内に格納されている復号化プログラムを消去する処理を行うことを特徴とするICカード。
In the IC card according to claim 6,
An IC card that performs a process of erasing a decryption program stored in a decryption program storage unit every time execution of a specific command given from an external device is completed.
請求項1〜7のいずれかに記載のICカードにおいて、
復号化手順として、外部から与えられたキーを利用して復号化を行う手順を用いることを特徴とするICカード。
In the IC card according to any one of claims 1 to 7,
An IC card characterized in that a decryption procedure using a key given from the outside is used as a decryption procedure.
請求項1〜8のいずれかに記載のICカードにおいて、
復号化プログラム格納部を、電源を遮断すると記憶内容が失われる揮発性メモリ内に設けたことを特徴とするICカード。
In the IC card according to any one of claims 1 to 8,
An IC card, wherein a decryption program storage unit is provided in a volatile memory in which stored contents are lost when the power is turned off.
JP34780398A 1998-11-20 1998-11-20 IC card Expired - Fee Related JP4080079B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP34780398A JP4080079B2 (en) 1998-11-20 1998-11-20 IC card

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP34780398A JP4080079B2 (en) 1998-11-20 1998-11-20 IC card

Publications (2)

Publication Number Publication Date
JP2000155819A JP2000155819A (en) 2000-06-06
JP4080079B2 true JP4080079B2 (en) 2008-04-23

Family

ID=18392698

Family Applications (1)

Application Number Title Priority Date Filing Date
JP34780398A Expired - Fee Related JP4080079B2 (en) 1998-11-20 1998-11-20 IC card

Country Status (1)

Country Link
JP (1) JP4080079B2 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11042489B2 (en) 2017-10-23 2021-06-22 Samsung Electronics Co., Ltd. Data encryption method and electronic apparatus performing data encryption method

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
AU770396B2 (en) * 1998-10-27 2004-02-19 Visa International Service Association Delegated management of smart card applications
US6895506B1 (en) * 2000-05-16 2005-05-17 Loay Abu-Husein Secure storage and execution of processor control programs by encryption and a program loader/decryption mechanism
CN1276363C (en) * 2002-11-13 2006-09-20 深圳市朗科科技有限公司 Method of actualizing safety data storage and algorithm storage in virtue of semiconductor memory device
JP5775738B2 (en) 2011-04-28 2015-09-09 富士通株式会社 Information processing apparatus, secure module, information processing method, and information processing program
JP2013069108A (en) * 2011-09-22 2013-04-18 Toshiba Corp Ic card, portable electronic device and ic card control method
JP5492172B2 (en) * 2011-11-04 2014-05-14 株式会社東芝 Portable electronic device, IC card and IC module
JP5984625B2 (en) 2012-10-31 2016-09-06 ルネサスエレクトロニクス株式会社 Semiconductor device and encryption key writing method
JP6493318B2 (en) * 2016-06-24 2019-04-03 株式会社デンソー Data processing system

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11042489B2 (en) 2017-10-23 2021-06-22 Samsung Electronics Co., Ltd. Data encryption method and electronic apparatus performing data encryption method

Also Published As

Publication number Publication date
JP2000155819A (en) 2000-06-06

Similar Documents

Publication Publication Date Title
US4295041A (en) Device for the protection of access to a permanent memory of a portable data carrier
US8533856B2 (en) Secure compact flash
JP2537199B2 (en) IC card
KR970004106B1 (en) Ic card
JP4651212B2 (en) Portable information storage medium and authentication method thereof
JP2007226839A (en) Memory unit and system for storing data structure
JPH08305558A (en) Ciphering program arithmetic unit
JP2004272400A (en) Memory card
JP4974613B2 (en) IC memory, access device for IC memory, and validity verification method
US7076667B1 (en) Storage device having secure test process
JP4080079B2 (en) IC card
US20070124534A1 (en) Data storing apparatus, IC card, and data storing method
JP2002111660A (en) Cryptographic communication method and apparatus
JP3620834B2 (en) Portable electronic device and output method of initial response thereof
JP2011060136A (en) Portable electronic apparatus, and data management method in the same
JP4509291B2 (en) IC card, IC card program update device, and method thereof
JPH09179949A (en) Portable information recording medium and its reader/ writer device
JP2002024790A (en) Information processing system, portable electronic device, and key changing method
JP4324100B2 (en) Data writing control device and data writing control method
JP2537200B2 (en) Portable electronic devices
CN102637152B (en) There is the equipment of processing unit and information-storing device
JP4859574B2 (en) Security management apparatus and security management method
JPH03224047A (en) Portable electronic device
JPH06309531A (en) Checking method for instruction format given to ic card
JP2017200064A (en) IC chip

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20051111

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20080130

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20080206

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

Free format text: PAYMENT UNTIL: 20110215

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

Year of fee payment: 3

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

Free format text: PAYMENT UNTIL: 20120215

Year of fee payment: 4

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

Free format text: PAYMENT UNTIL: 20130215

Year of fee payment: 5

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

Free format text: PAYMENT UNTIL: 20130215

Year of fee payment: 5

LAPS Cancellation because of no payment of annual fees