JPH05274498A - Ic card and erasing method for its data storage memory - Google Patents

Ic card and erasing method for its data storage memory

Info

Publication number
JPH05274498A
JPH05274498A JP6714592A JP6714592A JPH05274498A JP H05274498 A JPH05274498 A JP H05274498A JP 6714592 A JP6714592 A JP 6714592A JP 6714592 A JP6714592 A JP 6714592A JP H05274498 A JPH05274498 A JP H05274498A
Authority
JP
Japan
Prior art keywords
mode
card
command
erase
change mode
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.)
Granted
Application number
JP6714592A
Other languages
Japanese (ja)
Other versions
JP2779092B2 (en
Inventor
Takeshi Kimura
武史 木村
Seiichi Nanba
誠一 難波
Takashi Kubo
高志 久保
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.)
Maxell Holdings Ltd
Japan Broadcasting Corp
Original Assignee
Nippon Hoso Kyokai NHK
Hitachi Maxell 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 Nippon Hoso Kyokai NHK, Hitachi Maxell Ltd filed Critical Nippon Hoso Kyokai NHK
Priority to JP6714592A priority Critical patent/JP2779092B2/en
Publication of JPH05274498A publication Critical patent/JPH05274498A/en
Application granted granted Critical
Publication of JP2779092B2 publication Critical patent/JP2779092B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Landscapes

  • Read Only Memory (AREA)

Abstract

PURPOSE:To disable writing, reading, and erasure in an area regarding the application program in an E<2>PROM. CONSTITUTION:With a change mode key, the mode is changed from 'normal AP execution mode' to 'ROM command execution mode' and after writing, reading or erasure is carried out, an 'only-erase flag' is set to '1' when the mode is returned to 'normal AP execution mode' by change mode key resetting. When an IC card is issued to a user in this state, 'erase-only flag' is set to '1', so even when the user tries to change the mode to 'ROM command execution mode' with the change mode key after the issue, the mode is changed to 'only-erase executable mode' and only the erasure of the E<2>PROM is enabled.

Description

【発明の詳細な説明】Detailed Description of the Invention

【0001】[0001]

【産業上の利用分野】本発明は、アプリケーションプロ
グラムを実行可能とし、特に、有料放送システム等特定
のユーザを対象とした、システムに用いて好適なICカ
ードとそのデータ記憶用メモリの消去方法に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to an IC card which can execute an application program and is suitable for a particular user such as a pay broadcasting system and is suitable for use in the system and a method for erasing a data storage memory thereof. ..

【0002】[0002]

【従来の技術】近年、ICカードとリーダライタとから
なるICカードシステムの種々の分野への応用が注目さ
れている。従来のICカードでは、E2PROM などの
記憶容量が大きいデータ記憶用メモリやデータ処理機能
を有するCPUが内蔵されており、データの保存や処理
が可能であったが、さらに、データ記憶メモリに所望の
アプリケーションプログラムを格納し、これを実行可能
とすることにより、応用範囲がさらに拡張できる。
2. Description of the Related Art In recent years, application of an IC card system composed of an IC card and a reader / writer to various fields has attracted attention. In the conventional IC card, a data storage memory such as an E 2 PROM having a large storage capacity and a CPU having a data processing function are built in, and data can be stored and processed. By storing a desired application program and making it executable, the application range can be further expanded.

【0003】かかるアプリケーションプログラムを用い
てICカードシステムを応用する分野の1つとして、有
料放送システムが考えられる。かかるシステムでは、送
信側からスクランブルがかけられた放送信号が送信さ
れ、受信側でこのスクランブルを解いて放送信号を受信
可能とするものであるが、ICカードシステムを受信側
に設け、スクランブルされた受信信号をディスクランブ
ル可能とする装置として用いるものである。
A pay broadcasting system is considered as one of the fields in which the IC card system is applied using such an application program. In such a system, a scrambled broadcast signal is transmitted from the transmitting side, and the receiving side descrambling the broadcast signal to enable reception of the broadcasting signal. However, an IC card system is provided on the receiving side to scramble the signal. It is used as a device that can descramble a received signal.

【0004】この場合、送信側からはスクランブルされ
た放送信号とともに、これをディスクランブルするため
のキー情報が送られるが、このディスクランブルキー情
報も暗号化されている。ICカードには、この受信した
ディスクランブルキー情報を復号化するためのキー情報
と、復号化処理のためのアプリケーションプログラムが
格納されており、これらによって復号化されたディスク
ランブルキー情報により、受信装置が受信信号をディス
クランブルすることができる。このようにしてかかるI
Cカードシステムを具備した受信装置のみが、有料放送
を聴取できることになる。
In this case, the transmission side sends the scrambled broadcast signal together with the key information for descrambling the scrambled broadcast signal, which is also encrypted. The IC card stores key information for decrypting the received descramble key information and an application program for decryption processing, and the receiving device uses the descramble key information decrypted by these. Can descramble the received signal. I like this
Only the receiving device equipped with the C card system can listen to the pay broadcast.

【0005】なお、かかるICカードには、課金情報も
格納することができ、これによってプリペイドシステム
またはアフターペイドシステムを実現できる。
It is to be noted that such an IC card can also store billing information, so that a prepaid system or an afterpaid system can be realized.

【0006】ところで、ICカードシステムをこのよう
に所定システムに応用する場合、応用するシステム等に
応じてアプリケーションプログラムが異なる。上記の有
料放送システムの場合、放送形態によって復号化や課金
のためのアプリケーションプログラムが異なる。このた
め、ICカードに格納されるアプリケーションプログラ
ムはダウンロード(書込み)可能としている。
By the way, when the IC card system is applied to the predetermined system in this way, the application program differs depending on the system to which the IC card system is applied. In the case of the above-mentioned pay broadcasting system, the application program for decoding and charging differs depending on the broadcasting mode. Therefore, the application program stored in the IC card can be downloaded (written).

【0007】そこで、ICカードシステムでは、アプリ
ケーションプログラムを実行可能とする「通常AP(ア
プリケーションプログラム)実行モード」とアプリケー
ションプログラムのダウンロードや読出し、消去を可能
とする「ROMコマンド実行モード」とを設け、通常は
「通常AP実行モード」にしておき、アプリケーション
プログラムのダウンロードや読出し、消去を防止するた
めに、「ROMコマンド実行モード」への移行は、チェ
ンジモードキーを含むチェンジモードコマンドを与える
ことにより、行なうことができる。
Therefore, the IC card system is provided with a "normal AP (application program) execution mode" for executing the application program and a "ROM command execution mode" for downloading, reading and erasing the application program. Normally, the "normal AP execution mode" is set, and in order to prevent downloading, reading, and erasing of the application program, the transition to the "ROM command execution mode" is performed by giving a change mode command including a change mode key. Can be done.

【0008】即ち、図14に示すように、ICカードに
も、例えばE2PROMにリーダライタもしくはホスト
(以下、端末/ホストという)と同じチェンジモードキ
ーが格納されており、端末/ホストからチェンジモード
キーを含むチェンジモードコマンドが送られてくると、
ICカードでは、このチェンジモードコマンド中のチェ
ンジモードキーと自己のチェンジモードキーと比較し、
これらが一致したときのみ「通常AP実行モード」から
「ROMコマンド実行モード」へ移行して、その結果を
端末/ホストに知らせる。
That is, as shown in FIG. 14, the same change mode key as that of a reader / writer or a host (hereinafter referred to as a terminal / host) is also stored in the IC card, for example, in the E 2 PROM, and the change from the terminal / host is performed. When a change mode command including the mode key is sent,
For IC cards, compare the change mode key in this change mode command with your own change mode key,
Only when these match, the "normal AP execution mode" is shifted to the "ROM command execution mode" and the result is notified to the terminal / host.

【0009】[0009]

【発明が解決しようとする課題】ところで、上記のよう
なICカードシステムによると、チェンジモードキーが
分かると、少なくとも発行元が同じICカードでは、全
てチェンジモードキーが同じであるから、これを用いて
ICカードのモードを「ROMコマンド実行モード」に
移行させることができて、上記の有料放送システムの場
合、ICカード内の復号化するためのキー情報やアプリ
ケーションプログラムを読み取ることができ、ディスク
ランブルの方法や課金方法を知得されるおそれがある。
また、ICカード内に記憶されている課金情報が改ざん
されるおそれもある。
By the way, according to the above IC card system, when the change mode key is known, at least IC cards of the same issuer have the same change mode key. The mode of the IC card can be switched to the "ROM command execution mode", and in the case of the above-mentioned pay broadcasting system, the key information for decryption in the IC card and the application program can be read, and the descrambling can be performed. There is a risk that the method and charging method will be known.
In addition, the billing information stored in the IC card may be falsified.

【0010】例えば、ICカードにアプリケーションプ
ログラムをダウンロードする場合、ICカードシステム
をホストに接続し、ホストからICカードシステムにチ
ェンジモードキーを送ってICカードを「ROMコマン
ド実行モード」とし、しかる後、アプリケーションプロ
グラムのダウンロード等を行なうが、図14で説明した
ように、端末/ホスト、ICカード間の回線を通してチ
ェンジモードキーを含むチェンジモードコマンドが送ら
れるから、端末/ホスト、ICカード間の回線をモニタ
することにより、チェンジモードキーを知ることも不可
能ではない。また、チェンジモードキーを知っている例
えばICカード発行元関係のものが不正使用することも
考えられる。
For example, when the application program is downloaded to the IC card, the IC card system is connected to the host and the host sends a change mode key to the IC card system to set the IC card to the "ROM command execution mode". Although the application program is downloaded, as described in FIG. 14, since the change mode command including the change mode key is sent through the line between the terminal / host and the IC card, the line between the terminal / host and the IC card is connected. It is not impossible to know the change mode key by monitoring. In addition, it is conceivable that, for example, those associated with the IC card issuer who know the change mode key are illegally used.

【0011】本発明の目的は、かかる問題を解消し、チ
ェンジモードキーが知られても、それに応答しないよう
にしたICカードとそのデータ記憶用メモリの消去方法
を提供することにある。
An object of the present invention is to solve the above problem and to provide a method of erasing an IC card and its data storage memory that does not respond even if a change mode key is known.

【0012】[0012]

【課題を解決するための手段】上記目的を達成するため
に、本発明によるICカードは、アプリケーションプロ
グラムを実行可能とする第1のモード、データ記憶用メ
モリでの書込み、読出し、消去を可能とする第2のモー
ド、該データ記憶用メモリでの消去のみを実行可能とす
る第3のモードとを有し、チェンジモードキーによって
該第3のモードに移行すると「イレーズのみフラグ」が
立ち、該「イレーズのみフラグ」が立っているときに
は、チェンジモードキーによって該第1のモードから移
行するモードを該第3モードとする。
In order to achieve the above object, the IC card according to the present invention enables a first mode in which an application program can be executed, and writing, reading and erasing in a data storage memory. A second mode that enables the data storage memory and a third mode that enables only erasing in the data storage memory. When the change mode key is used to switch to the third mode, an "erase only flag" is set, When the "erase only flag" is set, the mode that shifts from the first mode by the change mode key is set to the third mode.

【0013】また、本発明によるデータ記憶用メモリの
消去方法は、該データ記憶用メモリにはアプリケーショ
ンプログラム、該アプリケーションプログラムを管理す
るテーブル、該テーブルを有効とし該アプリケーション
プログラムを実行可能とするテーブル有効フラグ、チェ
ンジモードキー及び「イレーズのみフラグ」が格納さ
れ、最初に該テーブル有効フラグを消去し、最後に該チ
ェンジモードと該「イレーズのみフラグ」を消去するよ
うにする。
In the data storage memory erasing method according to the present invention, the data storage memory has an application program, a table for managing the application program, and a table valid for enabling the table and executing the application program. A flag, a change mode key, and an "erase only flag" are stored. First, the table valid flag is erased, and finally, the change mode and the "erase only flag" are erased.

【0014】[0014]

【作用】本発明によるICカードでは、これにアプリケ
ーションプログラムが格納されていて使用可能であると
きには、「イレーズのみフラグ」が立っており、このた
め、チェンジモードキーを知ってこれを使用しても、第
3のモードが設定されてしまい、アプリケーションプロ
グラム等の消去以外の操作はできなくなってしまう。
In the IC card according to the present invention, when the application program is stored in the IC card and is usable, the "erase only flag" is set. Therefore, even if the change mode key is known and used. The third mode is set, and operations other than erasing the application program and the like cannot be performed.

【0015】また、本発明によるデータ記憶用メモリの
消去方法では、まず、テーブル有効フラグが消去される
から、テーブルが無効となり、アプリケーションプログ
ラムは実行不能となって消去されたのと同等となる。ア
プリケーションプログラムの消去が電源のオフ等によっ
て途中で終ってしまう場合もあるが、このようなばあい
でも、途中からのアプリケーションプログラムが実行し
て暴走するようなことはない。また、チェンジモードキ
ーや「イレーズのみフラグ」が最後に消去されるから、
消去が完了するまでこれらのセキュリティ強度が変化す
ることはない。
Further, in the method of erasing the data storage memory according to the present invention, first, the table valid flag is erased, so that the table becomes invalid and the application program becomes unexecutable, which is equivalent to erasing. There is a case where the erasing of the application program ends midway due to the power being turned off or the like, but in such a case, the application program does not run and run away from the midway. Also, since the change mode key and the "erase only flag" are erased at the end,
These security strengths do not change until the erase is complete.

【0016】[0016]

【実施例】以下、本発明の実施例を図面により説明す
る。図1は本発明によるICカードシステムの一実施例
を示すブロック構成図であって、1はICカード、2は
MPU(マイクロプロセサユニット)、3はRAM(ラ
ンダムアクセスメモリ)、4はE2PROM (電気的に
消去可能なプログラマブルROM)、5はROM(リー
ドオンリメモリ)、6はI/Oインターフェースであ
る。
Embodiments of the present invention will be described below with reference to the drawings. FIG. 1 is a block diagram showing an embodiment of an IC card system according to the present invention, in which 1 is an IC card, 2 is an MPU (microprocessor unit), 3 is a RAM (random access memory), and 4 is an E 2 PROM. (Electrically erasable programmable ROM), 5 is a ROM (read only memory), and 6 is an I / O interface.

【0017】同図において、ICカード1内には、MP
U2、RAM3、E2PROM4 、ROM5及びI/O
インターフェース6が内蔵されている。ROM5には、
MPU2を制御動作させるための制御プログラムが格納
されている。E2PROM4は、通常、データを格納す
るものであるが、アプリケーションプログラムやアプリ
ケーションプログラムによって処理されるデータも、通
常のデータと同様に、格納可能である。また、このE2
PROM4 には、その機能を後述する「イレーズのみ
フラグ」も格納されている。MPU2のデータ処理のた
めのRAM3には「モードフラグ」が格納されている。
この「モードフラグ」は、その機能を後述するが、IC
カード1のモードを設定するものであって、これによっ
て設定される特定のモードのとき、MPU2はE2PR
OM4 に格納されているアプリケーションプログラム
を実行可能である。さらに、E2PROM4 やROM5
には、端末/ホストと同一のチェンジモードキーが格納
されるようにする。
In FIG. 1, the IC card 1 has an MP
U2, RAM3, E 2 PROM4, ROM5 and I / O
The interface 6 is built in. In ROM5,
A control program for controlling the MPU 2 is stored. The E 2 PROM 4 normally stores data, but an application program and data processed by the application program can also be stored in the same manner as normal data. Also, this E 2
The PROM 4 also stores an "erase only flag" whose function will be described later. A “mode flag” is stored in the RAM 3 for data processing of the MPU 2.
The function of this "mode flag" will be described later.
The mode of the card 1 is set, and when the specific mode set by this is set, the MPU 2 sets the E 2 PR
The application program stored in the OM4 can be executed. In addition, E 2 PROM4 and ROM5
Is stored with the same change mode key as the terminal / host.

【0018】図2は図1に示したICカード1でのモー
ドとその移行を示す図である。同図において、ICカー
ド1では、アプリケーションプログラムの実行を可能と
する「通常AP実行モード」とアプリケーションプログ
ラムのダウンロード、読出し、消去、チェンジモードキ
ーの書替え等を可能とする「ROMコマンド実行モー
ド」とデータ記憶用メモリとしてのE2PROM4 (図
1)の消去(チップイレーズ)のみを実行可能とする
「イレーズのみ実行可能なモード」の3つのモードが設
定可能であり、これらモードは図1に示したICカード
1のRAM3に格納されている「モードフラグ」によっ
て管理される。
FIG. 2 is a diagram showing modes and transitions in the IC card 1 shown in FIG. In FIG. 1, the IC card 1 has a “normal AP execution mode” that enables execution of an application program and a “ROM command execution mode” that enables downloading, reading, erasing of an application program, rewriting of a change mode key, etc. It is possible to set three modes, "erasable only mode", which enables only erasing (chip erase) of the E 2 PROM4 (Fig. 1) as a memory for data storage, and these modes are shown in Fig. 1. It is managed by the "mode flag" stored in the RAM 3 of the IC card 1.

【0019】「モードフラグ」の値は、ここでは、「通
常AP実行モード」のとき“0”、「ROMコマンド実
行モード」のとき“1”、「イレーズのみ実行可能なモ
ード」のとき“2”とする。なお、この「モードフラ
グ」はMPU2(図1)がリセットされると“0”にリ
セットされる。従って、「モードフラグ」はリセットさ
れると、ICカード1は「通常AP実行モード」にあ
る。
The value of the "mode flag" is "0" in the "normal AP execution mode", "1" in the "ROM command execution mode", and "2" in the "erasable only mode". ” The "mode flag" is reset to "0" when the MPU 2 (Fig. 1) is reset. Therefore, when the "mode flag" is reset, the IC card 1 is in the "normal AP execution mode".

【0020】端末/ホストからチェンジモードキーとモ
ード情報とを含むチェンジモードコマンドが送られてく
ると、ICカード1においては、このチェンジモードコ
マンドがI/Oインターフェース6(図1)を介してM
PU2に供給され、制御プログラム(図1)によって動
作するこのMPU2がこのチェンジモードコマンドに応
答して「モードフラグ」をこのモード情報に応じて変更
し、これによってICカード1のモードが上記のいずれ
かのモードに変更される。
When a change mode command including a change mode key and mode information is sent from the terminal / host, the change mode command is sent to the IC card 1 via the I / O interface 6 (FIG. 1).
This MPU2 supplied to the PU2 and operated by the control program (FIG. 1) changes the "mode flag" according to this mode information in response to this change mode command, so that the mode of the IC card 1 is one of the above. It is changed to that mode.

【0021】ここで、ICカード1のモードを「通常A
P実行モード」から「ROMコマンド実行モード」に移
行させるためには、チェンジモードキーとモード情報
“01”が必要であり、「ROMコマンド実行モード」
から「イレーズのみ実行可能モード」に移行させるため
には、チェンジモードキーとモード情報“02”が必要
である。なお、図1、図2における「イレーズのみフラ
グ」は「イレーズのみ実行可能モード」への移行を制御
するためのフラグであり、ICカード1が未発行の場合
には、未セット状態“0”にあって、モード情報“0
2”のチェンジモードコマンドによって“1”にセット
される。
Here, the mode of the IC card 1 is set to "normal A
A change mode key and mode information “01” are required to shift from the “P execution mode” to the “ROM command execution mode”.
A change mode key and mode information “02” are required to shift from “erasure only executable mode” to. Note that the "erase only flag" in FIGS. 1 and 2 is a flag for controlling the shift to the "erase only executable mode", and when the IC card 1 is not issued, the unset state is "0". Therefore, the mode information "0
It is set to "1" by the change mode command of "2".

【0022】図3は端末/ホストからのチェンジモード
コマンドによる制御プログラムのモード設定動作を示す
フローチャートである。
FIG. 3 is a flow chart showing the mode setting operation of the control program by the change mode command from the terminal / host.

【0023】同図において、端末/ホストからチェンジ
モードコマンドが送られてきて、このチェンジモードコ
マンドに含まれるモード情報が“01”のときには(ス
テップ300)、「イレーズのみフラグ」が“1”にセ
ットされているか否かが判定される(ステップ30
1)。「イレーズのみフラグ」が“1”にセットされて
いなければ、「モードフラグ」は“1”にセットされ、
ICカード1のモードは「ROMコマンド実行モード」
になる(ステップ302)が、「イレーズのみフラグ」
が“1”にセットされているときには(ステップ30
1)、「モードフラグ」は“2”にセットされ、ICカ
ード1のモードは「イレーズのみ実行可能モード」にな
る(ステップ303)。また、端末/ホストから送られ
てきたチェンジモードコマンドに含まれるモード情報が
“02”であるときには(ステップ300)、「モード
フラグ」は“2”にセットされてICカード1のモード
は「イレーズのみ実行可能モード」になり(ステップ3
04)、これとともに、「イレーズのみフラグ」が
“1”にセットされる(ステップ305)。
In the figure, when a change mode command is sent from the terminal / host and the mode information included in this change mode command is "01" (step 300), the "erase only flag" is set to "1". It is determined whether or not it is set (step 30).
1). If the "erase only flag" is not set to "1", the "mode flag" is set to "1",
The mode of the IC card 1 is "ROM command execution mode"
(Step 302) is the "erase only flag"
Is set to "1" (step 30
1), the "mode flag" is set to "2", and the mode of the IC card 1 becomes the "erasure only executable mode" (step 303). When the mode information included in the change mode command sent from the terminal / host is "02" (step 300), the "mode flag" is set to "2" and the mode of the IC card 1 is "erasure". Only executable mode ”(Step 3
Along with this, the "erase only flag" is set to "1" (step 305).

【0024】次に、この実施例の実際の使用形態につい
て説明する。先ず、ICカード発行者がICカードを発
行する場合には、端末/ホストからチェンジモードキー
とモード情報“01”を含むチェンジモードコマンドを
ICカード1に送出する。すると、図1におけるE2
ROM4内の「イレーズのみフラグ」が初期状態ではセ
ットされていないため、図1におけるRAM3内の「モ
ードフラグ」が“1”となり、ICカード1のモードは
「ROMコマンド実行モード」に移行する。これによ
り、端末/ホストから所望のアプリケーションプログラ
ムを送ってICカード1のE2PROM4 にダウンロー
ドすることができる。
Next, an actual usage pattern of this embodiment will be described. First, when the IC card issuer issues an IC card, the terminal / host sends a change mode command including a change mode key and mode information “01” to the IC card 1. Then, E 2 P in FIG.
Since the "erase only flag" in the ROM 4 is not set in the initial state, the "mode flag" in the RAM 3 in FIG. 1 becomes "1", and the mode of the IC card 1 shifts to the "ROM command execution mode". As a result, a desired application program can be sent from the terminal / host and downloaded to the E 2 PROM 4 of the IC card 1.

【0025】ダウンロードが終ってICカード1をエン
ドユーザに引き渡す場合、端末/ホストからICカード
1にチェンジモードキーとモード情報“02”を含むチ
ェンジモードコマンドを送る。これにより、ICカード
1のモードは「イレーズのみ実行可能モード」に移り、
「イレーズのみフラグ」が“1”にセツトされる。しか
る後、ICカード1をリセットすると、「モードフラ
グ」が“0”となってICカード1のモードは「通常A
P実行モード」となり、ICカード1内のE2PROM
4に格納されているアプリケーションプログラムの実行
が可能となる。
When the IC card 1 is handed over to the end user after downloading, a change mode command including a change mode key and mode information "02" is sent from the terminal / host to the IC card 1. As a result, the mode of the IC card 1 shifts to the "erasure only executable mode",
The "erase only flag" is set to "1". Then, when the IC card 1 is reset, the "mode flag" becomes "0" and the mode of the IC card 1 becomes "normal A".
P execution mode ”, and E 2 PROM in IC card 1
It becomes possible to execute the application program stored in 4.

【0026】このような状態でエンドユーザに引き渡さ
れるICカード1は、「イレーズのみフラグ」が“1”
にセットされている。従って、その後、チェンジモード
キーとモード情報“01”をICカード1に送っても、
ICカード1のモードは「ROMコマンド実行モード」
とはならず、「イレーズのみ実行可能モード」に移行し
てしまい、チップイレーズしか行なえない状態となる。
In the IC card 1 delivered to the end user in such a state, the "erase only flag" is "1".
Is set to. Therefore, even if the change mode key and the mode information “01” are sent to the IC card 1 thereafter,
The mode of the IC card 1 is "ROM command execution mode"
However, the state shifts to the “erasure only executable mode” and only chip erase can be performed.

【0027】従って、一旦アプリケーションプログラム
やチェンジモードキー等がダウンロードされたICカー
ド1に対しては、第三者がこのチェンジモードキーを知
ってこれを使用したとしても、このICカード1のチッ
プイレーズのみが可能であり、E2PROM4 に格納さ
れているアプリケーションプログラムを読み出すことが
できない。このようにして、アプリケーションプログラ
ムの秘密保持が確実なものとなる。
Therefore, even if a third party knows the change mode key and uses it for the IC card 1 in which the application program, the change mode key, etc. are once downloaded, the chip erase of the IC card 1 is performed. However, the application program stored in the E 2 PROM 4 cannot be read. In this way, the confidentiality of the application program is ensured.

【0028】なお、ICカード1のモードが「ROMコ
マンド実行モード」にあるときにリセットをかけると、
2PROM4 の記憶状態をそのままとして「通常AP
実行モード」に移る。この際、「イレーズのみフラグ」
は未セットの状態のままであるから、再度「通常AP実
行モード」から「ROMコマンド実行モード」に移すこ
とができ、再び書込み、読出し等の動作を行なうことが
できる。
If the IC card 1 is reset in the "ROM command execution mode",
With the memory state of the E 2 PROM 4 unchanged, "normal AP
Execution mode ". At this time, "Erase only flag"
Remains in the unset state, it is possible to shift from the "normal AP execution mode" to the "ROM command execution mode" again, and write and read operations can be performed again.

【0029】以上のようにしてチェンジモードキーがI
Cカード1の発行者以外の第三者にわかっても、ICカ
ード1に格納されたアプリケーションプログラムの秘密
保持が可能であり、また、カード発行後は発行者による
データ改ざん等の不正行為も防止できるが、さらに、チ
ェンジモードキーの秘密保持を確実にするための方策が
講じられており、以下、これについて説明する。
As described above, the change mode key is I
Even if it is known to a third party other than the issuer of the C card 1, the application program stored in the IC card 1 can be kept secret, and fraudulent acts such as data falsification by the issuer can be prevented after the card issuance. However, further measures have been taken to ensure the confidentiality of the change mode key, which will be described below.

【0030】この方法は、ICカード1で擬似乱数を発
生させ、端末/ホストはこの擬似乱数をモードチェンジ
キーで暗号化してICカード1に送るものであり、図4
において、ICカード1のモードをチェンジする場合、
まず、端末/ホストは、擬似乱数発生を要求するG.
R.N(Get Random Number)コマン
ドをICカード1に送出する。これにより、ICカード
1は例えば7バイトの擬似乱数を発生し、端末/ホスト
に送る。端末/ホストに送出される擬似乱数はICカー
ド1内にも保持される。端末/ホストでは、暗号化関数
にもとづいて擬似乱数をチェンジモードキーで暗号化
し、暗号文としてのチェンジモードコマンドを生成して
ICカード1に送る。このチェンジモードコマンドは、
モード情報とデータとしての7バイトの擬似乱数とを含
み、これらモード情報と擬似乱数とがチェンジモードキ
ーによって暗号化されている。
In this method, the IC card 1 generates a pseudo random number, and the terminal / host encrypts the pseudo random number with the mode change key and sends it to the IC card 1.
When changing the mode of IC card 1,
First, the terminal / host requests G.G.
R. An N (Get Random Number) command is sent to the IC card 1. As a result, the IC card 1 generates, for example, a 7-byte pseudo random number and sends it to the terminal / host. The pseudo random number sent to the terminal / host is also held in the IC card 1. The terminal / host encrypts the pseudo random number with the change mode key based on the encryption function, generates a change mode command as a ciphertext, and sends it to the IC card 1. This change mode command
The mode information and the pseudo random number of 7 bytes as data are included, and the mode information and the pseudo random number are encrypted by the change mode key.

【0031】ICカード1では、E2PROM4 に上記
のチェンジモードキーと等しいチェンジモードキーが格
納可能であり、また、CPUの制御プログラムを格納し
たROMにも同じチェンジモードキーが格納されてい
る。
In the IC card 1, a change mode key equivalent to the above change mode key can be stored in the E 2 PROM 4, and the same change mode key is also stored in the ROM storing the control program of the CPU.

【0032】そこで、ICカード1は、端末/ホストか
らチェンジモードコマンドを受けると、E2PROM4
のチェンジモードキー、これがなければ、ROM中のチ
ェンジモードキーを使用し、復号化関数にもとづいてチ
ェンジモードコマンドを復号化し、7バイトの擬似乱数
を含むコマンドを得る。このコマンドの擬似乱数は先に
説明したように保持されている擬似乱数と比較され、こ
れらが一致したとき、モード情報によってモードを切り
換える。これとともに、モードチェンジしたか否かの結
果を端末/ホストに送る。
Therefore, when the IC card 1 receives a change mode command from the terminal / host, the E 2 PROM 4
Change mode key, if not present, the change mode key in ROM is used to decrypt the change mode command based on the decryption function to obtain a command containing a pseudo random number of 7 bytes. The pseudo random number of this command is compared with the held pseudo random number as described above, and when they match, the mode is switched according to the mode information. At the same time, the result of whether or not the mode is changed is sent to the terminal / host.

【0033】このようにして、チェンジモードキーは確
実にICカード1に送られたと判定でき、しかも、チェ
ンジモードキーの伝送途中で不当にモニタされても、伝
送情報はチェンジモードキーで擬似乱数が暗号化された
ものであるから、チェンジモードキーを解読することが
できないし、また、繰り返しモニタしても、その都度伝
送される暗号文は異なり、順次モニタされる暗号文間に
は何らの関連性がないから、チェンジモードキーを解読
することは不可能である。
In this way, it can be judged that the change mode key has been sent to the IC card 1 without fail, and even if the change mode key is improperly monitored during the transmission, the transmission information is a pseudo random number with the change mode key. Since it is encrypted, the change mode key cannot be decrypted, and even if it is repeatedly monitored, the ciphertext that is transmitted each time is different, and there is no relation between the ciphertexts that are sequentially monitored. It is impossible to decipher the change mode key because it has no property.

【0034】このようにして、チェンジモードキーの秘
密保持も確実なものとなる。従って、ICカード1のモ
ードを上記の「ROMコマンド実行モード」にも設定す
ることはできず、図1で説明したようなICカード1に
格納された情報を破壊するような事態にも至らない。ま
た、何らかの方法でチェンジモードキーが不当に知られ
たとしても、この実施例では、図1で説明したように、
アプリケーションプログラムの秘密が保持される。
In this way, the confidentiality of the change mode key is ensured. Therefore, the mode of the IC card 1 cannot be set to the "ROM command execution mode" described above, and the information stored in the IC card 1 as described in FIG. 1 is not destroyed. .. Further, even if the change mode key is unknowingly improperly known by any method, in this embodiment, as described with reference to FIG.
The secret of the application program is kept.

【0035】なお、以上の方法はチェンジモードコマン
ドにモード情報を含むものであったが、モード情報を含
まない場合には、図5に示す方法により、処理速度を速
めることができる。
In the above method, the change mode command includes the mode information. However, when the change mode command does not include the mode information, the processing speed can be increased by the method shown in FIG.

【0036】即ち、図5において、端末/ホストでは、
ICカード1から送られた擬似乱数のみをチェンジモー
ドキーで暗号化し、チェンジモードコマンドを生成して
ICカード1に送る。この間、ICカード1では、端末
/ホストに送った同じ擬似乱数をE2PROM4 もしく
はROMのチェンジモードキーで暗号化し、暗号文とし
て保持しておく。
That is, in FIG. 5, in the terminal / host,
Only the pseudo-random number sent from the IC card 1 is encrypted with the change mode key, a change mode command is generated and sent to the IC card 1. During this period, the IC card 1 encrypts the same pseudo-random number sent to the terminal / host with the change mode key of the E 2 PROM 4 or the ROM and holds it as a ciphertext.

【0037】端末/ホストからチェンジモードコマンド
が送られてくると、ICカード1は、このチェンジモー
ドコマンドのデータ(即ち、チェンジモードキーで暗号
化された擬似乱数)と保持しておいた上記の暗号文とを
比較し、これらが一致すればチェンジモードキーが送ら
れてきたと判定する。
When a change mode command is sent from the terminal / host, the IC card 1 holds the data of this change mode command (that is, the pseudo random number encrypted with the change mode key). The ciphertext is compared, and if they match, it is determined that the change mode key has been sent.

【0038】この方法によると、チェンジモードコマン
ドが送られてくると、直ちに比較判定処理を行なうこと
ができるから、その分処理速度が速くなる。
According to this method, when the change mode command is sent, the comparison / judgment process can be performed immediately, so that the processing speed is increased accordingly.

【0039】なお、図4のようにチェンジモードコマン
ドにモード情報が含まれる場合には、「ROMコマンド
実行モード」に移ると、直ちにこのモード情報で指定さ
れるモードが実行可能となるが、図5のようにチェンジ
モードコマンドにモード情報が含まれない場合には、チ
ェンジモードキーで「ROMコマンド実行モード」に移
ると、端末/ホストからICカード1にモード情報が送
られる。但し、モードの移行順序が決められている場合
には、(例えば、「通常AP実行モード」→「ROMコ
マンド実行モード」→「イレーズのみ実行可能モード」
→「通常AP実行モード」)、チェンジモードキーが送
られる毎に順次モードが切り換えられるようにすること
もできる。あるいはまた、実行モードが「通常AP実行
モード」と「ROMコマンド実行モード」のみからなる
従来のICカード1においても、かかる実施例を適用し
て、チェンジモードキーが送られてくる毎に「通常AP
実行モード」と「ROMコマンド実行モード」とを交互
に切り替えるようにすることもできる。
If the change mode command includes mode information as shown in FIG. 4, the mode designated by this mode information can be executed immediately after shifting to the "ROM command execution mode". When the change mode command does not include the mode information as in No. 5, the mode information is sent from the terminal / host to the IC card 1 when the mode is changed to the "ROM command execution mode" with the change mode key. However, when the order of mode transition is determined (for example, “normal AP execution mode” → “ROM command execution mode” → “erase only executable mode”)
→ "normal AP execution mode"), the mode can be sequentially switched each time the change mode key is sent. Alternatively, even in the conventional IC card 1 in which the execution modes include only the "normal AP execution mode" and the "ROM command execution mode", the embodiment is applied, and the "normal mode" is sent every time the change mode key is sent. AP
It is also possible to alternately switch between the "execution mode" and the "ROM command execution mode".

【0040】図6は図1に示したICカード1のE2
ROM4 におけるアプリケーションに関する領域を示
すものであって、ここでは、この領域は16進数でアド
レス“6000”からアドレス“7FFF”までの領域
としている。
FIG. 6 shows the E 2 P of the IC card 1 shown in FIG.
This shows an area related to the application in the ROM 4, and this area is a hexadecimal area from address "6000" to address "7FFF".

【0041】この領域では、アドレス順にアプリケーシ
ョンプログラム(AP)、「AP管理テーブル有効フラ
グ」、AP管理テーブル、チェンジモードキー、「イレ
ーズのみフラグ」の各エリア及び擬似乱数エリアが設け
られている。擬似乱数エリアには擬似乱数の初期値が記
憶されており、ICカード1を起動させたときの擬似乱
数発生器を初期化するために用いられる。
In this area, an application program (AP), an "AP management table valid flag", an AP management table, a change mode key, an "erase only flag" area and a pseudo random number area are provided in the order of addresses. The pseudo random number area stores initial values of pseudo random numbers, which are used to initialize the pseudo random number generator when the IC card 1 is activated.

【0042】かかる領域には、予めチェンジモードキー
として擬似乱数の初期値が記憶されており、また、「A
P管理テーブル有効フラグ」と「イレーズのみフラグ」
は“0”となっている。そして、ICカード1をユーザ
に発行するに際しては、この領域にアプリケーションプ
ログラム及びAP管理テーブルが書き込まれ、これらの
書込みが終ると、「AP管理テーブル有効フラグ」が
“1”に立てられる。アプリケーションプログラムは、
矢印で示すように、アドレス順にダウンロードされる。
このとき、「イレーズのみフラグ」は“0”のままであ
る。「イレーズのみフラグ」が“0”の場合には、E2
PROM4 のチップイレーズは行なわない。このフラ
グはE2PROM4 に格納されているので、電源のオ
ン,オフに影響されない。かかる動作は図2の「ROM
コマンド実行モード」が設定されて行なわれる。
In this area, the initial value of the pseudo random number is stored in advance as a change mode key, and "A
P management table valid flag "and" erase only flag "
Is "0". When the IC card 1 is issued to the user, the application program and the AP management table are written in this area, and when these writings are completed, the "AP management table valid flag" is set to "1". The application program is
As indicated by the arrow, the files are downloaded in order of address.
At this time, the "erase only flag" remains "0". When "Erase only flag" is "0", E 2
The chip erase of PROM4 is not performed. Since this flag is stored in the E 2 PROM 4, it is not affected by turning the power on or off. This operation is performed by the "ROM
Command execution mode "is set.

【0043】次に、この実施例の具体的な動作をフロー
チャートで説明する。図7はICカード1のメイン処理
を示すフローチャートである。
Next, a specific operation of this embodiment will be described with reference to a flow chart. FIG. 7 is a flowchart showing the main processing of the IC card 1.

【0044】まず、ICカード1は図2の「通常AP実
行モード」にあり、端末/ホストからのコマンドの待ち
状態にある(ステップ700)。コマンドを受けると、
その種類を判定して(ステップ701)、ROMに登録
されているROMコマンドであるか否かを判定する(ス
テップ702,703)。ここで、ROMコマンドとし
ては、上記のG.R.Nコマンド、チェンジモードコマ
ンドやデータを書き込んだり、読み出すためのコマン
ド、チップイレーズのコマンド、チェンジモードキーを
書き替えるためのコマンド等がある。
First, the IC card 1 is in the "normal AP execution mode" of FIG. 2 and is in a waiting state for a command from the terminal / host (step 700). When you receive a command,
The type is determined (step 701), and it is determined whether or not the command is a ROM command registered in the ROM (steps 702 and 703). Here, as the ROM command, the above G. R. There are N commands, change mode commands, commands for writing and reading data, chip erase commands, commands for rewriting change mode keys, and the like.

【0045】受信したコマンドがこれらのいずれかのコ
マンドであると、このコマンドを起動して実行する(ス
テップ708)。
If the received command is one of these commands, this command is activated and executed (step 708).

【0046】受信コマンドが登録されているROMコマ
ンドでないときには、APコマンドテーブルをチェック
し(ステップ704)、このテーブルが有効であれば
(ステップ705)、受信コマンドがAPコマンドであ
るか否か判定する(ステップ706,707)。APコ
マンドでなければ、コマンドなしのエラーレスポンスを
端末/ホストに送るが(ステップ709)、APコマン
ドであれば、このコマンドを起動して実行する(ステッ
プ708)。これにより、E2PROM4 のアプリケー
ションプログラムが実行される。
When the received command is not the registered ROM command, the AP command table is checked (step 704). If this table is valid (step 705), it is determined whether the received command is the AP command. (Steps 706 and 707). If it is not an AP command, an error response without a command is sent to the terminal / host (step 709), but if it is an AP command, this command is activated and executed (step 708). As a result, the application program of the E 2 PROM 4 is executed.

【0047】ROMコマンドが起動したときには(ステ
ップ708)、このコマンドに応じた動作が行なわれる
が、このためには、まず、図2で説明したように、「R
OMコマンド実行モード」に設定されなければならな
い。従って、所望のROMコマンドを実行させる前に、
端末/ホストから、まず、チェンジモードキーとモード
情報“01”が送られて来なければならない。
When the ROM command is activated (step 708), the operation according to this command is performed. For this purpose, first, as described with reference to FIG.
OM command execution mode ". Therefore, before executing the desired ROM command,
First, the terminal / host must send a change mode key and mode information "01".

【0048】次に、チェンジモードについて説明する。
図8は端末/ホストの図4に示したチェンジモードのた
めの動作を示すものである。
Next, the change mode will be described.
FIG. 8 shows the operation of the terminal / host for the change mode shown in FIG.

【0049】同図において、G.R.Nコマンドを生成
して(ステップ800)ICカード1に送ると(ステッ
プ801)、ICカード1からは、7バイトの擬似乱数
とともに、G.R.Nコマンドを正常に受信したか否か
を示す情報をレスポンスとして送られてくる(ステップ
802)。この情報から正常に受信したことが判明する
と(ステップ803)、7バイトの擬似乱数を抽出して
(ステップ804)その擬似乱数の先端にモード情報を
付加し、チェンジモードキーによって暗号化して(ステ
ップ805)チェンジモードコマンドを生成する(ステ
ップ806)。このチェンジモードコマンドをICカー
ド1に送り(ステップ807)、その後、ICカード1
からレスポンスがあると(ステップ808)、これによ
ってICカード1が正常に応答してモードをチェンジし
たか否かを判定する(ステップ809)。そして、正常
に応答したことが判定すると、動作を終了する。
Referring to FIG. R. When an N command is generated (step 800) and sent to the IC card 1 (step 801), the IC card 1 sends a G.G. R. Information indicating whether or not the N command is normally received is sent as a response (step 802). When it is determined from this information that the packet was normally received (step 803), a 7-byte pseudo random number is extracted (step 804), mode information is added to the end of the pseudo random number, and encrypted with the change mode key (step 804). 805) A change mode command is generated (step 806). This change mode command is sent to the IC card 1 (step 807), and then the IC card 1
When there is a response from (step 808), it is determined whether or not the IC card 1 responds normally and changes the mode (step 809). When it is determined that the response is normal, the operation ends.

【0050】ICカード1からのレスポンスでICカー
ド1が正常にモードチェンジしなかったことが判明する
と(ステップ809)、所定のエラー処理を行なって
(ステップ810)動作を終了する。なお、図5の場合
には、擬似乱数にモード情報を付加しないで暗号化す
る。
When it is determined from the response from the IC card 1 that the IC card 1 has not changed the mode normally (step 809), a predetermined error process is performed (step 810) and the operation ends. In the case of FIG. 5, the pseudo random number is encrypted without adding the mode information.

【0051】図9はICカード1の図4に示したチェン
ジモードのための動作を示すものである。同図におい
て、端末/ホストからのコマンドが図7のステップ70
3でG.R.Nコマンドと判明すると、このフォーマッ
トが正しいか否かを判定し(ステップ901)、“N
O”と判定された場合には、エラーレスポンスを設定し
て(ステップ915)端末/ホストに送出する(ステッ
プ916)。
FIG. 9 shows the operation of the IC card 1 for the change mode shown in FIG. In the figure, the command from the terminal / host is the step 70 in FIG.
G.3. R. If it is determined to be an N command, it is determined whether this format is correct (step 901) and "N
If it is determined to be "O", an error response is set (step 915) and sent to the terminal / host (step 916).

【0052】ステップ901の判定が“YES”の場合
には、端末/ホストに擬似乱数を送出して(ステップ9
02)待機する。次に、図7のステップ703によって
端末/ホストからのコマンドがチェンジモードコマンド
と判明すると(ステップ903)、E2PROM4 にチ
ェンジモードキーが格納されていればこれを選択し(ス
テップ904,906)、これに格納されていなけれれ
ば、ROMのチェンジモードキーを選択する(ステップ
904,905)。そして、このチェンジモードキーで
チェンジモードコマンドを復号化し(ステップ90
7)、復号化された擬似乱数を自己に保持している擬似
乱数とを比較する(ステップ908)。これらが一致し
なければ(ステップ909)、エラーレスポンスを設定
して端末/ホストに送出するが(ステップ915,91
6)、一致していれば、復号化されたモード情報を抽出
する(ステップ910)。
If the determination in step 901 is "YES", a pseudo random number is sent to the terminal / host (step 9
02) Wait. Next, when the command from the terminal / host is found to be the change mode command in step 703 of FIG. 7 (step 903), if the change mode key is stored in the E 2 PROM 4, this is selected (steps 904 and 906). If it is not stored therein, the change mode key of the ROM is selected (steps 904 and 905). Then, this change mode key is used to decrypt the change mode command (step 90
7) The decrypted pseudo random number is compared with the pseudo random number held in itself (step 908). If they do not match (step 909), an error response is set and sent to the terminal / host (steps 915, 91).
6) If they match, the decrypted mode information is extracted (step 910).

【0053】ところで、「通常AP実行モード」(図
2)にあるときに送られてきるモード情報は“01”で
あり(ステップ911)、これにより、RAM3(図
1)内の「モードフラグ」が“1”となって「ROMコ
マンド実行モード」(図2)が設定される(ステップ9
12)。また、「ROMコマンド実行モード」にあると
きに送られるモード情報は“02”であり(ステップ9
11)、これにより、「イレーズのみフラグ」が“1”
となる(ステップ913)。そして、「モードフラグ」
が“2”となって「イレーズのみ実行可能モード」(図
2)が設定されると(ステップ917)、レスポンスが
設定され(ステップ914)、端末/ホストに送出され
る(ステップ916)。
By the way, the mode information sent in the "normal AP execution mode" (FIG. 2) is "01" (step 911), which causes the "mode flag" in the RAM 3 (FIG. 1). Becomes "1" and the "ROM command execution mode" (FIG. 2) is set (step 9).
12). The mode information sent when in the "ROM command execution mode" is "02" (step 9).
11), so that the "erase only flag" is "1"
(Step 913). And "mode flag"
Becomes "2" and the "erase only executable mode" (FIG. 2) is set (step 917), a response is set (step 914) and sent to the terminal / host (step 916).

【0054】なお、図9に対する以上の説明は、図2の
実線矢印で示す「通常AP実行モード」→「ROMコマ
ンド実行モード」→「イレーズのみ実行可能モード」の
移行についてのものである。しかし、図9には図示しな
いが、ステップ909,910間に「イレーズのみフラ
グ」が“1”か否かの判定ステップと、これが“1”で
あるとき「イレーズのみ実行モード」を設定し、E2
ROM4 をチップイレーズするステップが設けられ、
これにより、図1で説明したICカード1の記憶情報の
秘密確保を可能としている。
The above description with respect to FIG. 9 relates to the transition from the "normal AP execution mode" to the "ROM command execution mode" to the "erase only executable mode" shown by the solid arrow in FIG. However, although not shown in FIG. 9, a step of determining whether the “erase only flag” is “1” between steps 909 and 910, and when this is “1”, the “erase only execution mode” is set, E 2 P
A step of chip erasing ROM4 is provided,
This makes it possible to secure the secret of the stored information of the IC card 1 described in FIG.

【0055】図9の処理動作によって「ROMコマンド
実行モード」が設定されると、データの書込み、読出
し、チップのイレーズ、チェンジモードキーの書換え等
が可能となる。
When the "ROM command execution mode" is set by the processing operation of FIG. 9, data writing, data reading, chip erasing, change mode key rewriting, and the like are possible.

【0056】図7で受信されたコマンドがチップイレー
ズコマンドであるときには、同様にステップ708に移
って図10の動作が行なわれる。
When the command received in FIG. 7 is the chip erase command, the process similarly proceeds to step 708 and the operation of FIG. 10 is performed.

【0057】この動作では、E2PROM4 の図6に示
した各データが消去されるのであるが、この消去は次の
ような順序で行なわれる。即ち、まず、「AP管理テー
ブル有効フラグ」が最初に消去され、チェンジモードキ
ーと「イレーズのみフラグ」が最後に消去される。擬似
乱数の初期値は消去されない。アプリケーションプログ
ラム(AP)とAP管理テーブルとはアドレス順に消去
される。
In this operation, each data shown in FIG. 6 of the E 2 PROM 4 is erased, and this erasing is performed in the following order. That is, first, the "AP management table valid flag" is erased first, and the change mode key and the "erase only flag" are erased last. The initial value of the pseudo-random number is not erased. The application program (AP) and the AP management table are deleted in the order of addresses.

【0058】アプリケーションプログラムの消去動作中
に電源オフ等によって動作が停止すると、アプリケーシ
ョンプログラムの一部がE2PROM4 中に残ってしま
う。そこで、「AP管理テーブル有効フラグ」がそのま
ま残っていると、電源オン後APコマンドを受けると、
この残った分のアプリケーションプログラムが実行さ
れ、CPUが暴走してしまう。このために、上記のよう
に、まず、AP管理プログラム有効フラグを消去し、A
P管理テーブルを無効としてアプリケーションプログラ
ムを消去したのと同等の状態とする。
If the operation is stopped due to power-off or the like during the erase operation of the application program, a part of the application program remains in the E 2 PROM 4. Therefore, if the "AP management table valid flag" remains as it is, when the AP command is received after the power is turned on,
The remaining application program is executed and the CPU runs out of control. Therefore, as described above, first, the AP management program valid flag is erased and A
The P management table is invalidated and the same state as when the application program is erased is set.

【0059】チェンジモードキーや「イレーズのみフラ
グ」を最後に消去するのは、これらのセキュリティ(機
密性)強度を消去動作が終るまで変えないようにするた
めである。即ち、チェンジモードキーが残っても、この
チェンジキーを使用しない限り、第三者はこのICカー
ド1を自由に使用することができない。また、チップイ
レーズが誤って中断しても、チェンジモードキーが残っ
ているので、チップイレーズを再開できる。また、「イ
レーズのみフラグ」が“1”の状態でチップイレーズが
中断した場合、この「イレーズのみフラグ」が消去され
て“0”になってしまうと、第三者がチェンジモードキ
ーを使用可能な場合、ICカード1を自由に使用するこ
とができるようになる。「イレーズのみフラグ」が
“1”のままであれば、チェンジモードキーが知られて
いても、これを使用すれば、チップイレーズが行なわれ
るだけである。
The reason why the change mode key and the "erase only flag" are erased at the end is to keep the security (confidentiality) strength unchanged until the erase operation is completed. That is, even if the change mode key remains, a third party cannot freely use the IC card 1 unless the change key is used. Even if the chip erase is accidentally interrupted, the chip erase can be restarted because the change mode key remains. Also, if the chip erase is interrupted while the "erase only flag" is "1", if this "erase only flag" is erased to "0", a third party can use the change mode key. In this case, the IC card 1 can be used freely. If the "erase only flag" remains "1", even if the change mode key is known, if this is used, chip erase is only performed.

【0060】図7のステップ708に移ると、図10に
おいて、上記各動作と同様に「ROMコマンド実行モー
ド」にあるか否か(ステップ1300)、チップイレー
ズコマンドのフォーマットが正しいか否か(ステップ1
301)が判定され、いずれもYESである場合、前回
実行したコマンドがチップイレーズコマンドであったか
否か判定する(ステップ1302)。
Moving to step 708 in FIG. 7, in FIG. 10, whether or not in the "ROM command execution mode" as in the above-described operations (step 1300) and whether or not the format of the chip erase command is correct (step 1300). 1
301), and if both are YES, it is determined whether the previously executed command was a chip erase command (step 1302).

【0061】前回実行のコマンドがチップイレーズコマ
ンドでないときには、まず、E2PROM4 中の「AP
管理テーブル有効フラグ」(図6)を“0”とし(ステ
ップ1303)、アプリケーションプログラムを消去し
たのと同等な状態とする。しかる後、先頭のアドレスか
ら消去を開始する(ステップ1304)。この消去は所
定時間行なわれ、これによって全エリアの消去が行なわ
れなかったときには(ステップ1306)、消し残りエ
リアの最初のアドレスを記憶しておき(ステップ130
8)、レスポンスを設定して(ステップ1308)、端
末/ホストに送る(ステップ1310)。
When the previously executed command is not the chip erase command, first, "AP" in the E 2 PROM 4 is
The "management table valid flag" (FIG. 6) is set to "0" (step 1303), and the state is the same as when the application program is erased. Then, erasing is started from the top address (step 1304). This erasure is performed for a predetermined time, and when the erasure of all areas has not been performed (step 1306), the first address of the erase remaining area is stored (step 130).
8) Set a response (step 1308) and send it to the terminal / host (step 1310).

【0062】このようにE2PROM4 に消し残りがあ
る場合には、端末/ホストは再びチップイレーズコマン
ドをICカード1に送る。これにより、ICカード1で
は、再びステップ1300〜1302の処理が行なわれ
るが、このとき前回実行したコマンドはチップイレーズ
コマンドであるから、前の消し残りエリアの最初のアド
レスから上記所定時間消去を行なう。
When the E 2 PROM 4 has the unerased portion, the terminal / host again sends the chip erase command to the IC card 1. As a result, in the IC card 1, the processing of steps 1300 to 1302 is performed again, but since the previously executed command at this time is the chip erase command, erasing is performed from the first address of the previous erase remaining area for the predetermined time. ..

【0063】このようにして、E2PROM4 の全エリ
アが消去されるまで上記の動作が繰り返えされ、全エリ
アが消去されると(ステップ1306)、レスポンスを
設定して(ステップ1308)端末/ホストに送り(ス
テップ1310)、「チップイレーズ」動作が完了す
る。
In this way, the above operation is repeated until the entire area of the E 2 PROM 4 is erased, and when the entire area is erased (step 1306), the response is set (step 1308). / Send to host (step 1310) to complete the "chip erase" operation.

【0064】なお、この場合も、「ROMコマンド実行
モード」が設定されないとき(ステップ1300)、チ
ップイレーズコマンドのフォーマットが正しくない(ス
テップ1301)のときには、エラーレスポンスが設定
されて(ステップ1309)端末/ホストに送られる
(ステップ1310)。
Also in this case, when the "ROM command execution mode" is not set (step 1300) or the format of the chip erase command is incorrect (step 1301), an error response is set (step 1309). / Sent to host (step 1310).

【0065】かかる「チップイレーズ」動作は図2にお
ける「ROMコマンド実行モード」が設定されていると
きの動作であった。これに対し、上記のように、「イレ
ーズのみフラグ」が“1”のとき、チェンジモードキー
が送られてくると、この場合でも、「チップイレーズ」
動作が行なわれる。この「チップイレーズ」動作は、図
9のステップ909でYESとの判定があると、「イレ
ーズのみフラグ」が“1”か否かの判定が行なわれ、こ
れが“1”のとき、その旨のレスポンスを設定して端末
/ホストに送る。これに応答して端末/ホストはICカ
ード1に「チップイレーズ」コマンドを送る。
The "chip erase" operation is the operation when the "ROM command execution mode" in FIG. 2 is set. On the other hand, as described above, when the change mode key is sent when the "erase only flag" is "1", the "chip erase" is generated even in this case.
The operation is performed. In this "chip erase" operation, if "YES" is determined in step 909 of FIG. 9, it is determined whether or not the "erase only flag" is "1". Set the response and send it to the terminal / host. In response to this, the terminal / host sends a "chip erase" command to the IC card 1.

【0066】そこで、ICカード1では、図10の動作
を行なうが、この場合、「ROMコマンド実行モード」
にないが(ステップ1300)、「イレーズのみフラ
グ」が“1”であるから(ステップ1311)、ステッ
プ1301から処理が行なわれてE2PROM4 がチッ
プイレーズされる。
Therefore, the IC card 1 performs the operation shown in FIG. 10, but in this case, the "ROM command execution mode".
Although it is not present (step 1300), since the "erase only flag" is "1" (step 1311), the processing is performed from step 1301 and the E 2 PROM4 is chip erased.

【0067】[0067]

【発明の効果】以上説明したように、本発明によれば、
チェンジモードキーを用いてデータ記憶用メモリでの書
込み、読出し、消去を可能とする「ROMコマンド実行
モード」を設定しようとしても、自動的に「イレーズの
み実行可能モード」が設定されてしまい、データ記憶用
メモリ内はチップイレーズのみしか実行できないので、
データ記憶用メモリ内の情報を不当に読み出したり、細
工してしまうなどの処理を防止することができるし、ま
た、このような不正なチェンジモードキーの再度の使用
も不可能とすることができる。
As described above, according to the present invention,
Even if you try to set the "ROM command execution mode" that enables writing, reading, and erasing in the data storage memory using the change mode key, the "erasure only execution mode" is automatically set, and the data Since only the chip erase can be executed in the memory for storage,
It is possible to prevent the information stored in the data storage memory from being unduly read or modified, and it is also possible to prevent such unauthorized use of the change mode key again. ..

【0068】また、本発明によれば、アプリケーション
プログラムの消去前に、該アプリケーションプログラム
の管理テーブルを有効にするフラグが消去されるので、
消去動作が中断して該アプリケーションプログラムの消
し残りが生じても、この消し残り部分は動作することが
なく、処理装置の暴走を防止することができる。
Further, according to the present invention, the flag for validating the management table of the application program is erased before the application program is erased.
Even if the erasing operation is interrupted and the unerased portion of the application program occurs, the unerased portion does not operate and the runaway of the processor can be prevented.

【図面の簡単な説明】[Brief description of drawings]

【図1】本発明によるICカードの一実施例を示すブロ
ック構成図である。
FIG. 1 is a block diagram showing an embodiment of an IC card according to the present invention.

【図2】図1に示したICカードでのモードとモード移
行とを示す図である。
FIG. 2 is a diagram showing modes and mode transitions in the IC card shown in FIG.

【図3】図1に示したICカードでのチェンジモードコ
マンドによる制御動作を示す図である。
FIG. 3 is a diagram showing a control operation by a change mode command in the IC card shown in FIG.

【図4】図2でのチェンジモードキーの伝送の一具体例
を示す図である。
FIG. 4 is a diagram showing a specific example of transmission of a change mode key in FIG.

【図5】図2でのチェンジモードキーの伝送の他の具体
例を示す図である。
5 is a diagram showing another specific example of transmission of a change mode key in FIG.

【図6】本発明によるICカードの一実施例でのE2
ROM のメモリ領域を示す図である。
FIG. 6 shows an E 2 P in one embodiment of the IC card according to the present invention.
It is a figure which shows the memory area of ROM.

【図7】本発明によるICカードの一実施例でのメイン
処理を示すフローチャートである。
FIG. 7 is a flowchart showing main processing in one embodiment of the IC card according to the present invention.

【図8】本発明によるICカードの一実施例に対する端
末/ホストのチェンジモードコマンド生成動作を示すフ
ローチャートである。
FIG. 8 is a flowchart showing a change mode command generation operation of a terminal / host for one embodiment of an IC card according to the present invention.

【図9】本発明によるICカードの一実施例でのチェン
ジモード処理を示すフローチャートである。
FIG. 9 is a flowchart showing change mode processing in an embodiment of the IC card according to the present invention.

【図10】本発明によるICカードのデータ記憶用メモ
リの消去方法の一実施例を示すフローチャートである。
FIG. 10 is a flowchart showing an embodiment of a method for erasing a data storage memory of an IC card according to the present invention.

【図11】従来のICカードシステムの一例を示す図で
ある。
FIG. 11 is a diagram showing an example of a conventional IC card system.

【符号の説明】[Explanation of symbols]

1 ICカード 2 MPU 3 RAM 4 E2PROM 5 ROM1 IC card 2 MPU 3 RAM 4 E 2 PROM 5 ROM

───────────────────────────────────────────────────── フロントページの続き (51)Int.Cl.5 識別記号 庁内整理番号 FI 技術表示箇所 G11C 16/06 (72)発明者 久保 高志 大阪府茨木市丑寅一丁目1番88号 日立マ クセル株式会社内─────────────────────────────────────────────────── ─── Continuation of the front page (51) Int.Cl. 5 Identification number Internal reference number FI Technical display location G11C 16/06 (72) Inventor Takashi Kubo 1-88, Tora-ta, Ibaraki-shi, Osaka Hitachi Maxell Within the corporation

Claims (2)

【特許請求の範囲】[Claims] 【請求項1】 データ記憶用メモリにアプリケーション
プログラムを記憶可能としたICカードにおいて、 該アプリケーションプログラムを実行可能とする第1の
モードと、該データ記憶用メモリでの書込み、読出し及
び消去の各動作を実行可能とする第2のモードと、該デ
ータ記憶用メモリでの消去のみを実行する第3のモード
とを有し、 該第1のモードからチェンジモードキーにもとづいて第
2のモードに移行して該第2のモードが終了すると、イ
レーズのみフラグを立たせ該第1のモードに移行し、 該イレーズのみフラグが立っているときには、該チェン
ジモードキーによって該第1のモードから移行するモー
ドは該第3のモードのみであることを特徴とするICカ
ード。
1. An IC card in which an application program can be stored in a data storage memory, a first mode in which the application program can be executed, and write, read, and erase operations in the data storage memory. And a third mode in which only erasing in the data storage memory is executed, and a transition is made from the first mode to the second mode based on the change mode key. Then, when the second mode ends, the erase only flag is set to shift to the first mode, and when the erase only flag is set, the mode to shift from the first mode by the change mode key is An IC card which is only in the third mode.
【請求項2】 請求項1記載の前記データ記憶用メモリ
には、アプリケーションプログラム、該アプリケーショ
ンプログラムを管理するテーブル、該テーブルを有効に
し該アプリケーションプログラムを実行可能とするテー
ブル有効フラグ、前記チェンジモードキー、前記イレー
ズのみフラグが記憶され、 前記第2のモードもしくは前記第3のモードの消去動作
では、該テーブル有効フラグを最初に消去し、前記チェ
ンジモードキー及び前記イレーズのみフラグを最後に消
去することを特徴とするICカードのデータ記憶用メモ
リの消去方法。
2. The data storage memory according to claim 1, wherein an application program, a table for managing the application program, a table valid flag for enabling the table and enabling execution of the application program, and the change mode key , The erase only flag is stored, and in the erase operation of the second mode or the third mode, the table valid flag is erased first, and the change mode key and the erase only flag are erased last. A method for erasing a data storage memory of an IC card, characterized by:
JP6714592A 1992-03-25 1992-03-25 Erasing method for IC card and its data storage memory Expired - Fee Related JP2779092B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP6714592A JP2779092B2 (en) 1992-03-25 1992-03-25 Erasing method for IC card and its data storage memory

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP6714592A JP2779092B2 (en) 1992-03-25 1992-03-25 Erasing method for IC card and its data storage memory

Publications (2)

Publication Number Publication Date
JPH05274498A true JPH05274498A (en) 1993-10-22
JP2779092B2 JP2779092B2 (en) 1998-07-23

Family

ID=13336452

Family Applications (1)

Application Number Title Priority Date Filing Date
JP6714592A Expired - Fee Related JP2779092B2 (en) 1992-03-25 1992-03-25 Erasing method for IC card and its data storage memory

Country Status (1)

Country Link
JP (1) JP2779092B2 (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7996911B2 (en) 2003-06-20 2011-08-09 Renesas Electronics Corporation Memory card
JP2012155363A (en) * 2011-01-21 2012-08-16 Fujitsu Semiconductor Ltd Semiconductor device
JP2013097524A (en) * 2011-10-31 2013-05-20 Dainippon Printing Co Ltd Ic chip, data protection method, data protection program, ic card and recording medium

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7996911B2 (en) 2003-06-20 2011-08-09 Renesas Electronics Corporation Memory card
JP2012155363A (en) * 2011-01-21 2012-08-16 Fujitsu Semiconductor Ltd Semiconductor device
JP2013097524A (en) * 2011-10-31 2013-05-20 Dainippon Printing Co Ltd Ic chip, data protection method, data protection program, ic card and recording medium

Also Published As

Publication number Publication date
JP2779092B2 (en) 1998-07-23

Similar Documents

Publication Publication Date Title
US7389536B2 (en) System and apparatus for limiting access to secure data through a portable computer to a time set with the portable computer connected to a base computer
US7406604B2 (en) Method for protecting a memory card, and a memory card
US7162645B2 (en) Storage device including a non-volatile memory
KR100397316B1 (en) Storage device, encrypting/decrypting device, and method for accessing nonvolatile memory
US6158004A (en) Information storage medium and security method thereof
JPH08305558A (en) Ciphering program arithmetic unit
US5625690A (en) Software pay per use system
JP5272637B2 (en) Information processing apparatus, encryption switching method, and program
US7953985B2 (en) Memory card, application program holding method, and holding program
US20040215909A1 (en) Nonvolatile memory device and data processing system
US7076667B1 (en) Storage device having secure test process
JPH0844805A (en) Security managing method for card type storage medium, card type storage medium and transaction device for card type storage medium
JP2004104539A (en) Memory card
JP2003526965A (en) Public cryptographic control unit and its system
JP2007004522A (en) Storage device
JP2003044363A (en) Memory device having data security in processor
JPH05217033A (en) Data authenticating method
JP2004252707A (en) Memory device
JP3034118B2 (en) IC card system and IC card
JP2779092B2 (en) Erasing method for IC card and its data storage memory
JP4373239B2 (en) IC card issuance method, IC card program and IC card
JPH0816385A (en) Protecting method for software analysis
JP4120765B2 (en) Internal ROM rewrite method for CPU for gaming machine
JP2003091240A (en) Method for managing enciphered information
JP2004326335A (en) Ic card and encryption processing system

Legal Events

Date Code Title Description
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 19980421

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

S111 Request for change of ownership or part of ownership

Free format text: JAPANESE INTERMEDIATE CODE: R313117

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

LAPS Cancellation because of no payment of annual fees