JP3779479B2 - IC card - Google Patents
IC card Download PDFInfo
- Publication number
- JP3779479B2 JP3779479B2 JP01945799A JP1945799A JP3779479B2 JP 3779479 B2 JP3779479 B2 JP 3779479B2 JP 01945799 A JP01945799 A JP 01945799A JP 1945799 A JP1945799 A JP 1945799A JP 3779479 B2 JP3779479 B2 JP 3779479B2
- Authority
- JP
- Japan
- Prior art keywords
- modn
- remainder
- input
- calculation
- elliptic curve
- 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
Links
Images
Description
【0001】
【発明の属する技術分野】
本発明は、暗号を処理するICカードに関する。
【0002】
【従来の技術】
公開鍵暗号系の暗号であり、1978年にリヴェスト(Rivest)、シャミア(Shamir)、エイドルマン(Adlman)の3人によって発明されたRSA暗号の基本原理を述べる。
【0003】
[RSA暗号の基本原理]秘密鍵を(d,n)、公開鍵を(e,n)、平文をM、暗号文をCとすると暗号化と復号化は次のような計算式で表すことができる。
【0004】
暗号化:C≡Me(modn)
復号化:M≡Cd(modn)
但し、n=p・q(p、qは大きな素数)、λ(n)=LCM{(p−1),(q−1)}(LCM:最小公倍数)、GCD{e,λ(n)}=1(GCD:最大公約数)、d=e−1modλ(n)を満たす。
【0005】
RSA暗号の安全性は、nを素因数分解することの困難さに基づいており、e、d、n、M等のパラメータには1024ビット程度の大きな整数を用いることが推奨されている。この時、1回の暗号化式Memodnにおける処理はバイナリ演算法(D.E.Knuth,“Seminumerical algorithms(arithmetic)”,The Art of Computer Programming,Volume2,Addison−Wesley,1969に詳しく述べられている)を用いた場合、平均1534.5回の剰余乗算演算が必要となる。
【0006】
また、公開鍵暗号系の暗号であり、1985年にコブリッツ(Koblitz)とミラー(Miller)によってそれぞれ独立に提案された楕円曲線暗号の基本原理を述べる。
【0007】
[楕円曲線暗号の原理]楕円曲線の概要を説明する。有限体の位数を素数p、楕円曲線を決定するパラメータ(a,b)に対して以下の式を満たす点の集合に仮想的な無限遠点Oを加えた集合を、楕円曲線Epと呼ぶ。ここでは便宜上、2次元アフィン座標系で表す。
【0008】
Ep:y2≡x3+ax+b(modp)
楕円曲線上では曲線上の2点の間に楕円曲線上の加法が定義され、
P3=P1+P2(但し、Pi=(xi,yi))は以下のように定義される。
【0009】
[(P1≠P2)の場合]以降、この場合を楕円加算演算と呼ぶ。
【0010】
楕円加算演算:加算0回、減算6回、乗算2回、除算1回
λ=(y2−y1)/(x2−x1),x3=λ2−x1−x2,
y3=λ(x1−x3)−y1
[(P1=P2)の場合]以降、この場合を楕円2倍演算と呼ぶ。
【0011】
楕円2倍演算:加算1回、減算3回、乗算3回、除算1回
λ=(3x1 2+a)/2y1,x3=λ2−2x1,
y3=λ(x1−x3)−y1
但し、上記演算はすべてpを法とする剰余系で行われる。
【0012】
楕円曲線暗号の安全性は、楕円曲線上の点Aをx倍(すなわちAをx回加算した)点をB(=x・A)とする時、点Aと点Bの値が分かったとしてもその値からxを求めることが非常に困難であることに基づく。この性質を楕円曲線上の離散対数問題と呼び、RSA暗号の1024ビットと同程度の安全性を確保するためには、p、a、xi、yi等のパラメータには160ビット程度の整数が推奨されている。
【0013】
楕円曲線暗号の基本演算となる点Pのk倍点(k・P)の演算は、上記の楕円曲線上の加法を用いて計算を行うこととなるが、この演算においてはλを求める際に剰余除算演算を行う必要がある。剰余除算演算は拡張ユークリッド互除法等のアルゴリズムを用いて処理するのが一般的であるが、多くの処理時間を必要とする。そのため、2次元アフィン座標系の点を3次元座標系の点に変換することにより、その剰余除算演算を行うことなく楕円曲線上の演算を処理する方法が広く用いられている。詳しくは、D.V.Chudnovsky and G.V.Chudnovsky, ”Sequences of NumbersGenerated by Addition in Formal Groups and New Primality and Factorization Tests”,Advances in Applied Mathematics,7,pp.385−434,1986に述べられている。一例として、2次元アフィン座標系での楕円曲線Ep上の加算演算を、x≡X/Z2(modp)、
y≡Y/Z3(modp)を満たすような3次元射影座標系に変換した場合は、以下のように定義される。
【0014】
楕円加算演算:加算2回、減算5回、乗算16回、除算0回
X3=R2−TW2,2Y3=VR−MW3,Z3=Z1Z2W
但し、W=X1Z2 2−X2Z1 2,R=Y1Z2 3−Y2Z1 3,
T=X1Z2 2+X2Z1 2,M=Y1Z2 3−Y2Z1 3,
V=TW2−2X3
楕円2倍演算:加算1回、減算3回、乗算10回、除算0回
X3=M2−2S,Y3=M(S−X3)−T,Z3=2Y1Z1
但し、M=3X1 2+aZ1 4,S=4X1Y1 2,T=8Y1 4
但し、上記演算はすべてpを法とする剰余系で行われる。
【0015】
この他の座標変換の例としては、x≡X/Z(modp)、
y≡Y/Z(modp)を満たすような3次元同次座標系への変換法などがある。
【0016】
但し、3次元座標系から2次元座標系へ再び変換する時に剰余除算演算が一度必要となる。
【0017】
仮に、160ビット楕円曲線暗号を3次元射影座標系に変換し、k・P演算を上述のバイナリ演算法を用いて処理した場合、平均2862回の剰余乗算演算が必要となる。
【0018】
上述したように、RSA暗号や楕円曲線暗号等の公開鍵暗号ではその基本演算として多くの剰余乗算演算処理を必要とする。そのため、剰余乗算演算の高速アルゴリズムを用いることにより剰余乗算演算の高速化を図り、暗号処理全体の高速化を図る方式が考案されている。
【0019】
特に、RSA暗号はその演算の大部分が剰余乗算演算であることから、剰余乗算演算の高速アルゴリズムを実行するハードウェアと、それを用いることによりRSA暗号処理を高速に実行するICカードが、ICカードの標準規格であるISO7816に基づいて実現されている。
【0020】
【発明が解決しようとする課題】
これに対し、RSA以外の公開鍵暗号やディジタル署名では、剰余除算演算を必要とすることがある。剰余四則演算の中でも剰余除算演算は特に演算時間を必要とするため、暗号処理、署名生成処理の高速化を図る上での大きな課題となっている。剰余除算演算を利用する公開鍵暗号方式の一つとして、楕円曲線暗号がある。この楕円曲線暗号処理における剰余除算演算回数を減らすための方法や、その剰余除算演算を高速に計算する方法が、新保淳"楕円曲線暗号へのモンゴメリ演算の適用"SCIS'97(The 1997 Symposium on Cryptography and Information Security)において検討されている。
【0021】
しかし、この文献における方法を、上記ISO7816規格で規定されるICカードのような装置に適用する場合、上記規格、現在の半導体技術の限界などによりCPUの演算能力に限界がある。したがって剰余除算演算における逆元演算に時間がかかり、処理の高速化を図ることが困難となる。
【0022】
従って、本発明の目的は、剰余乗算演算の高速アルゴリズムを実行するハードウェアを具えた暗号処理装置において、楕円曲線暗号処理を高速に実行できる方法、及びそれを用いた装置、たとえばICカードを提供することである。
【0023】
また、本発明の他の目的は、剰余乗算演算の高速アルゴリズムを実行するハードウェアを具えた装置、たとえばICカードにおいて、ディジタル署名処理を高速に実行する方法、及び該方法を実現する装置を提供することである。
【0024】
本発明の他の目的は、楕円曲線暗号処理において、剰余除算における逆元演算を高速化できる方法およびそれを用いたプログラムまたは装置を提供することである。
【0025】
また、本発明の他の目的は、剰余乗算演算の高速アルゴリズムを実行するハードウェアを具えた暗号処理装置において、DSA署名、Schnorr署名等、各種処理を高速に実行できる方法、及びそれを用いた装置、たとえばICカードを提供することである。
【0026】
本発明の他の目的は、DSA署名、Schnorr署名処理等の剰余除算演算を必要とする各種公開鍵方式、ディジタル署名方式において、剰余除算における逆元演算を高速化できる方法およびそれを用いた装置を提供することである。
【0027】
【課題を解決するための手段】
上記目的を達成するため、本発明に従えば以下の様態が提供される。
まず、本発明の1つの態様に従えば、剰余乗算演算の高速アルゴリズムをハードウェア化した装置(以降、剰余乗算器と呼ぶ)を具えた装置、たとえばICカードにおいて、その剰余乗算器を効果的に利用するように、楕円曲線暗号における演算を剰余乗算演算を中心とした演算で構成する楕円曲線暗号処理方法を提供する。
具体的には、楕円曲線暗号処理に必要な乱数生成の後の剰余演算や、署名作成処理における剰余演算を、剰余乗算器を用いて演算できるように構成する。また、剰余乗算器を楕円曲線上の演算でも効果的に利用するために、楕円曲線上の点を2次元アフィン座標系から3次元座標系に変換することにより、楕円曲線上の加算演算における剰余除算演算を剰余乗算演算に変換し、その剰余乗算演算に剰余乗算器を利用できるように処理する。
【0028】
また、本発明の他の態様では、上記課題にも述べた逆元演算を高速化するために、3次元座標系から2次元アフィン座標系に変換する場合と署名データを求める際に必要となる逆元演算をも、剰余乗算演算を用いて計算する。剰余系における逆元演算は、拡張ユークリッド互除法等のアルゴリズムを用いて求めるのが一般的であるが、剰余の法が素数である場合には、拡張ユークリッド互除法等のアルゴリズムを用いることなく、剰余乗算演算のみを用いて求めることができる。以下にその方法を示す。
フェルマーの小定理によると、素数βと互いに素な正整数αに対し、
αβ−1≡1(modβ)
が成立する。この定理を用いれば、逆元演算α−1modβは以下のように表すことができる。
α−1≡αβ−2(modβ)
本発明では、楕円曲線暗号の安全性を保つために有限体の位数p及びベースポイント位数nの値は大きな素数を用いており、上記フェルマーの小定理における条件、素数βと正整数αは互いに素であることを常に満たす。従って、
α−1modβの値はαβ−2modβと等しくなり、仮にバイナリ演算法を用いて剰余乗算演算を行った場合、平均((|β−2|−1)×3/2)
(ただし|β−2|は(β−2)のビット数を表す)回の剰余乗算を行うことにより逆元演算α−1modβの値を求めることが可能である。この方法を用いた場合、ユークリッド互除法等のアルゴリズムをプログラムとして作成する必要が無いため、プログラムサイズの低減を図ることにもなった。
【0029】
この逆元演算方法は、楕円曲線暗号に限らず、逆元演算を必要とする他の各種公開鍵方式、ディジタル署名方式、例えば、DSA署名、Schnorr署名等の処理にも利用することができる。
【0030】
また、演算で頻繁に使用されるパラメータで、事前に計算可能なものはパソコン等で事前に計算し、システム情報の一つとしてICカード内の書き換え可能な不揮発性メモリに記憶させておくことにより、計算量を削減できる。事前に記憶させておくシステム情報としてのデータは、有限体位数pと、楕円曲線パラメータaを変換したaRmodpと、楕円曲線上の点P(ベースポイント)の2次元アフィン座標(x,y)を3次元射影座標系の座標に変換し、さらに剰余乗算装置用に変換した点P(X,Y,Z)と、ベースポイントの位数nと、秘密鍵dと、楕円曲線上の演算で用いる定数を変換した2Rmodpと3Rmodpと4Rmodpと8Rmodpと2−1Rmodpと、剰余演算に用いるためのRmodpとRmodnとR2modpとR2modnとする。但し、ここで用いたRは有限体位数p,ベースポイントの位数nに対しR>p,R>nを満たす正整数、例えば、p、nのビット数をそれぞれ|p|、|n|と表す時、
|p|+1または|n|+1のうち大きいほうに等しいビット長を持つ最小の正整数、とする。
【0031】
さらに、ICカードにおける楕円曲線上の加算演算における処理回数を減らして全体の計算量を減らすために、ベースポイントの定数倍の点をテーブルとしてICカード内の書き換え可能な不揮発性メモリに記憶させておくこととした。但し、テーブルの数が増加するにつれて計算量は減少するが、逆に前記メモリに記憶するデータサイズが大きくなる。そのため、本発明ではベースポイントの4のべき乗倍の点をテーブルとして持つこととした。この時、テーブルとして持つ点の数、即ちテーブルの個数は有限体位数pのビット数を|p|と表す時、
(|p|/2)個となり、テーブルの値は3次元射影座標系の座標に変換し、さらに剰余乗算装置の演算域に変換した後の点Pi=(Xi,Yi,Zi)
(iは0≦i<|p|/2の整数)とする。
【0032】
また、メモリサイズがより大きな場合には、ベースポイントの2のべき乗倍の点をテーブルとして持つことにより、楕円曲線上の演算を楕円加算演算のみで構成することも可能となり、この場合、さらに処理回数を減らすことができる。
【0033】
なお、一般的には、ベースポイントの2のn乗倍(nは自然数)の点の値をテーブルとして持つ場合、テーブルの個数は、有限体位数pのビット数を|p|と表す時、(|p|/n)個となり、CPUの演算性能とテーブルを記憶するメモリ容量とのトレードオフで決めることが出来る。
【0034】
【発明の実施の形態】
本発明の一実施例を図面を用いて説明する。
【0035】
図1は、本発明による有限体上の楕円曲線における加算演算を用いたディジタル署名システム実行装置を、例えば日立製作所のH8/3111マイコンに基づいて、ICカード内に実現する際の概略構成図を示す。この種のICカード101は、CPU102と、特に本発明を実施する動作命令を含むROM103と、有限体位数や楕円曲線パラメータ等のシステム情報のデータを記憶する書き換え可能な不揮発メモリとしてのEEPROM104と、ICカード101への入力/出力を制御するI/Oポート105と、RAM106と、剰余乗算演算を実行可能な剰余乗算器107と、電源端子Vcc110と、グランド端子Vss111と、クロック端子CLK112と、リセット端子RES1113と、I/O端子I/O114とを含む。ICカード101の各端子は、ICカード101内の必要な部分に接続されている。剰余乗算器は例えば高速演算機能を備えた日立製作所製マイコンH8/3111のコプロセッサにより構成することができる。他の相当コプロセッサを用いることもできる。
【0036】
この剰余乗算器107は内部にCPU102と共通に利用できるCPU・剰余乗算器共通RAM109を具え、そのRAM109は少なくともCDA、CDB、CDNの3本のデータレジスタを備える。剰余乗算器107の演算は、入力データをレジスタCDA,CDB,CDNに記憶させて実行すると、その演算結果はCDAの値を書き換えて記憶される。また、演算後にCDBとCDNの値は変化しない特徴を持つ。この剰余乗算器107は演算タイプを指定することにより、以下の3種類の演算を実行可能な装置にする。
【0037】
CDA←(CDA・CDB)R−1mod(CDN):以降、剰余演算1と呼ぶ。
CDA←(CDA2)R−1mod(CDN):以降、剰余演算2と呼ぶ。
CDA←(CDA)R−1mod(CDN):以降、剰余演算3と呼ぶ。
ICカード101内の前記各素子はバス108により相互接続される。
また、本発明に用いた楕円曲線Epは有限体の位数を素数pとし、楕円曲線を決定するパラメータ(a,b)に対して以下の式を満たす点の集合に仮想的な無限遠点Oを加えた集合とした。ここでは便宜上、アフィン座標系で表す。
Ep:y2≡x3+ax+b(modp)
さらにベースポイントをP(x,y)とし、そのベースポイントの位数も素数nとなるものを用いた。
【0038】
(1)システム情報の記憶
有限体位数pと、楕円曲線パラメータaRmodpと、楕円曲線上の点P(ベースポイント)の座標の定数倍の点Pi(Xi,Yi,Zi)
(iは0≦i<|p|/2の整数、|p|は有限体位数pのビット数を表す)と、ベースポイントの位数nと、秘密鍵dと、楕円曲線上の演算で用いる定数を変換した2Rmodpと3Rmodpと4Rmodpと8Rmodpと2−1Rmodpと、剰余演算に用いるためのRmodpとRmodnとR2modpとR2modnとをEEPROM104に記憶しておく。但し、ここで用いたRは、R>p,R>nを満たす正整数、例えば、p、nのビット数をそれぞれ|p|、|n|と表す時、|p|+1または|n|+1のうち大きいほうに等しいビット長を持つ最小の正整数、とする。
【0039】
これらシステム情報の記憶は、以下の暗号処理が実行される前に行われているものとする。ここでRは定数として与えられる数値であって、多倍長演算手段を構成する、例えばコプロセッサの演算性能に依存して決まるパラメータである。
【0040】
(2)署名作成
図2から図7は、本実施例における楕円曲線暗号処理装置が行うディジタル署名作成のフローチャートを示す。以下、図2を参照しながらディジタル署名作成の概略の手順を示す。
なお、以下の各フローチャートは、CPU102が、RAM106、EEPROM104に格納されたデータを用いながら、必要に応じて剰余演算器107に処理を実行させながら、ROM103に記憶されたプログラムを実行する内容を示している。
【0041】
ステップ201:開始
ステップ202:乱数kを生成し、剰余乗算器107のレジスタCDAにその乱数kを、またレジスタCDBにEEPROM104に記憶しておいたRmodnを記憶させ、剰余乗算器107に前述定義した剰余演算1を実行させる。CDAに記憶される実行結果を改めて乱数kとする。
ステップ203:ステップ202で生成した乱数kとEEPROM104に記憶しておいたシステム情報p、aRmodp、P(X,Y,Z)を入力とし、楕円曲線Ep上においてベースポイントPの乱数k倍の演算k・Pを計算する。この演算は、3次元射影座標系で有限体上の楕円曲線における加算演算すなわちスカラー倍演算をCPU102で行い、その演算における剰余乗算は、コプロセッサである剰余乗算器107を用いて計算する。
【0042】
ステップ204:ステップ203の実行結果(X,Y,Z)は3次元射影座標系の点であるため、アフィン座標系の点(x,y)に変換する。この変換のための演算はx≡X/Z2(modp)であるがその代わりに演算x≡X・Zp−3(modp)を行えばよい。何故ならフェルマーの小定理を応用することによりx≡X・Zp−3(modp)が成り立つからである。従ってx≡X/Z2(modp)を使わずにX・Zp−3(modp)を使うことにより剰余除算演算を用いることなく剰余乗算のみで座標変換を行える。
ステップ205:ステップ202で生成した乱数kと、I/O端子114からI/Oポート105経由で入力された、メッセージMに対するハッシュ値(ダイジェスト値)H(M)と、EEPROM104に記憶しておいた秘密鍵d、ベースポイントの位数nと、ステップ204で計算したxmodpとを用いて以下の演算を行う。
【0043】
署名rの生成:r≡x(modn)
署名sの生成:s≡k−1・(H(M)+d・r)(modn)
上記演算における署名sの演算の際に逆元演算が必要となるが、この演算もステップ204と同様の方法によりk−1modnの値をkn−2modnの剰余乗算に置き換え、その剰余乗算を剰余乗算器107を用いて計算する。この演算結果を署名(r,s)とし、メッセージMに対するディジタル署名としてI/Oポート105を経由してI/O端子114から出力する。
ステップ206:終了
次に図3から図7を用いて、本実施例におけるディジタル署名作成の手順をさらに詳しく説明する。
図3は、図2ステップ203の処理の詳細なフローチャートである。
ステップ301:開始
ステップ302:ステップ202で生成した乱数kの2進数表記を2ビットずつ組にしたk=(ki,ki−1,…,k1,k0)2を計算し、そのビット列を下位から走査してki=(11)である時、その上位ビット列ki+1にたいして(01)を加算し、最上位ビットまでを書き換える。その変換例は、元のビット列を(10,11,10,11)とすると、変換後のビット列は(01,11,00,11,11)となる。この変換を最上位ビットまで行い、改めてそのビット列を
k=(kl,kl−1,…,k1,k0)2(但し、kl≠(00))とする。
この時得られるlの値を楕円曲線上の演算を繰り返す回数として変数i(以降、ループカウンタと呼ぶ)に(l+1)を記憶する。
【0044】
ステップ303:前述したようにEEPROM104に記憶しておいたテーブル値である楕円曲線上のベースポイントの3次元座標変換後の剰余乗算器用に変換した点
Pi(Xi,Yi,Zi)から初期値をRAM106に記憶させ、Piに対応するkiの値を書き換える。
ステップ304:ループカウンタiを1だけカウントダウンする。
ステップ305:ループカウンタiの判定を行う。iが0より小さければステップ307へ進む。そうでなければステップ306へ進む。
ステップ306:kiの値が(00)であれば、ステップ304へ戻る。kiの値が(01)であれば、テーブル値Piを加算する楕円加算演算を行いステップ304へ戻る。kiの値が(10)であれば、テーブル値Piを2倍する楕円2倍演算を行い、その結果を加算する楕円加算演算を行いステップ304へ戻る。kiの値が(11)であれば、テーブル値PiのY座標の値に対し、法をpとした加法に対する逆元を求め、その値を改めてテーブル値PiのY座標とし、その点を加算する楕円加算演算を行いステップ304へ戻る。
ステップ307:終了
図4は、図3の処理における楕円加算演算の詳細なフローチャートである。
ステップ401:開始。ステップ303において剰余乗算器107のCDNにはpが記憶されているため、pを法とした剰余乗算が行われる。
【0045】
ステップ402:剰余乗算器107を用いて剰余演算2を実行する。
ステップ403:剰余乗算器107を用いて剰余演算1を実行する。
ステップ404:剰余乗算器107を用いて剰余演算2を実行する。
ステップ405:剰余乗算器107を用いて剰余演算1を実行する。
ステップ406:CPU102は剰余減算演算を行い、中間値Wを得る。
ステップ407:CPU102は剰余加算演算を行い、中間値Tを得る。
ステップ408:剰余乗算器107を用いて剰余演算1を実行する。
ステップ409:剰余乗算器107を用いて剰余演算1を実行する。
ステップ410:剰余乗算器107を用いて剰余演算1を実行する。
ステップ411:剰余乗算器107を用いて剰余演算1を実行する。
ステップ412:CPU102は剰余減算演算を行い、中間値Rを得る。
ステップ413:CPU102は剰余加算演算を行い、中間値Mを得る。
【0046】
ステップ414:剰余乗算器107を用いて剰余演算1を実行する。
ステップ415:剰余乗算器107を用いて剰余演算1を実行し、楕円加算演算後の点のZ座標を得る。
ステップ416:剰余乗算器107を用いて剰余演算2を実行する。
ステップ417:剰余乗算器107を用いて剰余演算2を実行する。
ステップ418:剰余乗算器107を用いて剰余演算1を実行する。
ステップ419:CPU102は剰余減算演算を行い、楕円加算演算後の点のX座標を得る。
ステップ420:CPU102は剰余減算演算を行い、中間値Vを得る。
ステップ421:剰余乗算器107を用いて剰余演算1を実行する。
ステップ422:剰余乗算器107を用いて剰余演算1を実行する。
ステップ423:剰余乗算器107を用いて剰余演算1を実行する。
ステップ424:CPU102は剰余減算演算を行い、中間値Yを得る。
ステップ425:EEPROM104に記憶しておいた2−1Rmodpと中間値Yを剰余乗算器107に入力し、剰余演算1を実行する。これにより楕円加算演算後の点のY座標を得る。
ステップ426:終了
図5は、図3の処理における楕円2倍演算の詳細なフローチャートを示す。
ステップ501:開始。ステップ303において剰余乗算器107のCDNにはpが記憶されているため、pを法とした剰余乗算が行われる。
ステップ502:剰余乗算器107を用いて剰余演算2を実行する。
ステップ503:剰余乗算器107を用いて剰余演算2を実行する。
ステップ504:剰余乗算器107を用いて剰余演算2を実行する。
ステップ505:剰余乗算器107を用いて剰余演算1を実行する。
ステップ506:EEPROM104に記憶しておいた3Rmodpとステップ502で求めたX1 2Rmodpを剰余乗算器107に入力し、剰余演算1を実行する。
ステップ507:CPU102は剰余加算演算を行い、中間値Mを得る。
ステップ508:剰余乗算器107を用いて剰余演算2を実行する。
ステップ509:剰余乗算器107を用いて剰余演算1を実行する。
ステップ510:EEPROM104に記憶しておいた4Rmodpとステップ509で求めたX1Y1 2Rmodpを剰余乗算器107に入力し、剰余演算1を実行する。これにより中間値Sを得る。
【0047】
ステップ511:剰余乗算器107を用いて剰余演算2を実行する。
ステップ512:EEPROM104に記憶しておいた8Rmodpとステップ511で求めたY1 4Rmodpを剰余乗算器107に入力し、剰余演算1を実行する。これにより中間値Tを得る。
ステップ513:剰余乗算器107を用いて剰余演算1を実行する。
ステップ514:EEPROM104に記憶しておいた2Rmodpとステップ513で求めたY1Z1Rmodpを剰余乗算器107に入力し、剰余演算1を実行する。これにより楕円2倍演算後の点のZ座標を得る。
ステップ515:剰余乗算器107を用いて剰余演算2を実行する。
ステップ516:EEPROM104に記憶しておいた2Rmodpと中間値Sを剰余乗算器107に入力し、剰余演算1を実行する。
ステップ517:CPU102は剰余減算演算を行い、楕円2倍演算後の点のX座標を得る。
ステップ518:剰余乗算器107を用いて剰余演算1を実行する。
ステップ519:CPU102は剰余減算演算を行い、楕円2倍演算後の点のY座標を得る。
ステップ520:終了
図6は、図2ステップ204の処理(逆元演算)の詳細なフローチャートを示す。
ステップ601:開始
ステップ602:EEPROM104に記憶しておいた有限体位数pから(p−3)を計算し、その2進数表記
(p−3)=(jl,jl−1,…,j1,j0)2(但し、jl=1)から得られるlの値を剰余乗算演算を繰り返す回数としてループカウンタiに記憶する。
ステップ603:剰余乗算器107のCDA,CDBにステップ203の演算後の点のZ座標を記憶させる。また、CDNの値はステップ303において剰余乗算器107のCDNにpを記憶させたまま変化していないため、pの値が記憶されている。
ステップ604:ループカウンタiを1だけカウントダウンする。
ステップ605:ループカウンタiの判定を行う。iが0より小さければステップ609へ進む。そうでなければステップ606へ進む。
ステップ606:剰余乗算器107を用いて剰余演算2を実行する。
【0048】
ステップ607:(p−3)のループカウンタiに対する値jiの判定を行う。jiが1でなければステップ604へ戻る。jiが1であればステップ608へ進む。
ステップ608:剰余乗算器107を用いて剰余演算1を実行する。その後、ステップ604へ戻る。
ステップ609:剰余乗算器107のCDBにステップ203の演算後の点のX座標を記憶させる。この時、CDAにはZp−3Rmodpの値が記憶されている。
ステップ610:剰余乗算器107を用いて剰余演算1を実行する。この結果、CDAにはXZp−3Rmodpの値、すなわちステップ203の実行結果の2次元アフィン座標系における座標のx座標の剰余乗算装置の演算域への変換値xR≡XZ−2R(modp)の値が記憶されている。
ステップ611:剰余乗算器107を用いて剰余演算3を実行する。この結果、CDAにはXZ−2modpの値、すなわちステップ203の実行結果の2次元アフィン座標系における座標のx座標x≡XZ−2(modp)の値が記憶されている。上記ステップ604から608では、X/Z2を求める演算の1/Z2を、Zp−3に変換し、剰余演算器107によってその値を求めている。
ステップ612:終了
上述のように、本発明では、剰余乗算器107の多倍長剰余乗算機能を用いることにより、CPU102を用いた多倍長剰余乗算演算を行う必要が無い。このため、演算ステップが少なくて済み、処理の高速化が可能である。
【0049】
図7は、図2ステップ205の処理の詳細なフローチャートである。
ステップ701:開始
ステップ702:ステップ204で計算されたkPのx座標の値xmodpを剰余乗算器107のCDAに記憶させる。
ステップ703:剰余乗算器107のCDBにEEPROM104に記憶しておいたRmodnを記憶させる。Rはコプロセッサの固有の値、nは楕円曲線上のPの位数である。
ステップ704:剰余乗算器107のCDNにEEPROM104に記憶しておいたベースポイント位数nを記憶させる。
ステップ705:剰余乗算器(コプロセッサ)107を用いて剰余演算1を実行する。この演算結果であるxmodnの値がCDAに記憶される。この値が署名
r≡x(modn)となる。次に署名sを求めるステップ706〜713に進む。
ステップ706:剰余乗算器107のCDBに、EEPROM104に記憶させておいたR2modnを記憶させる。
ステップ707:剰余乗算器107を用いて剰余演算1を実行する。この演算結果であるrRmodnの値が、CDAに保持される。
ステップ708:剰余乗算器107のCDBに、EEPROM104に記憶させておいた秘密鍵dを記憶させる。
ステップ709:剰余乗算器107を用いて剰余演算1を実行する。この演算結果であるd・rmodnの値がCDAに記憶される。
【0050】
ステップ710:CPU102を用いて、メッセージMに対するハッシュ値H(M)と、上記ステップ709で求めたd・rmodnとの和を計算し、
(H(M)+d・r)modnの値をRAM106に記憶する。
ステップ711:逆元演算k−1Rmodnを剰余乗算器107を用いた剰余乗算kn−2Rmodnにより計算する。この計算法は、図6におけるステップ601からステップ609までの処理を参照のこと。この演算結果
k−1Rmodnは、剰余乗算器107のCDAに記憶される。
ステップ712:剰余乗算器107のCDBにステップ710でRAM106に記憶しておいた(H(M)+d・r)modnの値を記憶する。
ステップ713:剰余乗算器107を用いて剰余演算1を実行する。この演算結果であるk−1・(H(M)+d・r)modnの値がCDAに記憶される。この値が署名s≡k−1・(H(M)+d・r)(modn)となる。
ステップ714:終了
本発明の効果を確認するために、上記実施例に従ったプログラムを作成して、CPUの動作クロック数が5MHzにおける実行時間を測定した。
具体的には、160ビット鍵長の楕円曲線上のk・P演算を、3次元射影座標系において、それぞれがベースポイントの4のべき乗倍の点の値を示す80個の参照テーブルを用いて行い、さらに逆元計算をフェルマーの小定理とバイナリ演算法とを組み合わせて行うように構成した。実行環境には、日立製作所製の多倍長剰余乗算コプロセッサ内蔵ICカード用マイコンH8/3111エミュレータを使用し、プログラム言語として、アセンブラを用いた。この結果、160ビット鍵長の楕円曲線暗号による署名作成時間(ステップ201からステップ206までにかかった時間)は、0.308秒/署名となった。
【0051】
以上述べたように、本発明によれば、剰余乗算、剰余除算は、剰余乗算器を用いて行い、その他の剰余加算、剰余減算はCPUを用いて行ない、また、事前に計算した値を参照することで、楕円曲線暗号を高速に処理することができる。
なお、上記説明では、ディジタル署名作成処理を中心に説明したが、これに限定されず、同様の方法により、楕円曲線暗号を用いた署名検証処理、暗号作成処理をも高速に行うことができる。
また、上記説明で述べた、逆元演算を剰余乗算器を用いて、高速に処理する方法は、他の逆元演算を利用する各種公開鍵暗号、ディジタル署名方式、例えば、DSA署名、Schnorr署名に対しても適用可能である。
【0052】
また、本発明は、上記実施例のようなICカードには限定されず、CPUの処理能力が限定されていて乗算器を備える同様の装置であれば、これを適用することができる。例えば認証処理を行うマイクロコントローラや暗号化処理のためのIEEE1394LSI等に適用できる。これらの用途はNIKKEI ELECTRONICS 1998.12.14(No.732)pp27−28にも記載されている。
【0053】
また、本発明では、書き換え可能な不揮発メモリ104として、EEPROMを例に挙げたが、これに限定されることはなく、フラッシュメモリを使うことも可能である。また、ROM103に於いてもフラッシュメモリを使うことができる。
図6に示すコプロセッサ107を用いて逆元演算を実現するモジュールは、ソフトウェアや半導体チップなどのハードウェア単体又は、それらの組み合わせ、いずれの形態でも実現でき、汎用/専用を問わず用途は広いことが理解されよう。
【0054】
【発明の効果】
以上説明したように、本発明によって、楕円曲線に基づいたディジタル署名作成処理を剰余乗算演算を効果的に利用する方法を用いて構成したことにより、剰余乗算器を具えた装置において高速に処理可能な方法及び装置を提供できる。
【図面の簡単な説明】
【図1】本発明が適用される装置のブロック図である。
【図2】本発明の一実施例における楕円曲線暗号による署名作成手順を示すフローチャートである。
【図3】図2のステップ203における処理の詳細なフローチャートである。
【図4】図3における楕円加算演算の詳細なフローチャートである。
【図5】図3における楕円2倍演算の詳細なフローチャートである。
【図6】図2のステップ204における処理の詳細なフローチャートである。
【図7】図2のステップ206における処理のフローチャートである。
【符号の説明】
101…ICカード、
102…CPU、
103…ROM、
104…EEPROM、
105…I/Oポート、
106…RAM、
107…剰余乗算器、
108…バス、
109…CPU・剰余乗算器共通RAM、
110…電源(Vcc)端子、
111…グランド(Vss)端子、
112…クロック(CLK)端子、
113…リセット(RES)端子、
114…I/O端子。[0001]
BACKGROUND OF THE INVENTION
The present invention relates to an IC card that processes encryption.
[0002]
[Prior art]
The basic principle of the RSA cryptosystem, which is a public key cryptosystem and was invented in 1978 by three people, Rivest, Shamir, and Adlman.
[0003]
[Basic principle of RSA encryption] When the secret key is (d, n), the public key is (e, n), the plaintext is M, and the ciphertext is C, encryption and decryption are expressed by the following formulas: Can do.
[0004]
Encryption: C≡Me(Modn)
Decryption: M≡Cd(Modn)
Where n = p · q (p and q are large prime numbers), λ (n) = LCM {(p−1), (q−1)} (LCM: least common multiple), GCD {e, λ (n) } = 1 (GCD: greatest common divisor), d = e-1mod λ (n) is satisfied.
[0005]
The security of RSA encryption is based on the difficulty of factoring n, and it is recommended to use large integers of about 1024 bits for parameters such as e, d, n, and M. At this time, one encryption formula MeThe processing in modn uses a binary arithmetic method (DE Knuth, “Seminumeral algorithms (arithmetic)”, The Art of Computer Programming,
[0006]
Also, the basic principle of elliptic curve cryptography, which is a public key cryptosystem and was independently proposed in 1985 by Koblitz and Miller.
[0007]
[Principle of Elliptic Curve Cryptography] An outline of the elliptic curve will be described. A set obtained by adding a virtual infinity point O to a set of points satisfying the following expression with respect to parameters (a, b) that determine the order of a finite field as a prime number p and an elliptic curve is defined as an elliptic curve EpCall it. Here, for convenience, it is expressed in a two-dimensional affine coordinate system.
[0008]
Ep: Y2≡x3+ Ax + b (modp)
On the elliptic curve, the addition on the elliptic curve is defined between two points on the curve,
P3= P1+ P2(However, Pi= (Xi, Yi)) Is defined as follows:
[0009]
[(P1≠ P2In the following case, this case is referred to as an ellipse addition operation.
[0010]
Ellipse addition operation: 0 additions, 6 subtractions, 2 multiplications, 1 division
λ = (y2-Y1) / (X2-X1), X3= Λ2-X1-X2,
y3= Λ (x1-X3-Y1
[(P1= P2)] This case is hereinafter referred to as elliptical doubling.
[0011]
Ellipse doubling: 1 addition, 3 subtractions, 3 multiplications, 1 division
λ = (3x1 2+ A) / 2y1, X3= Λ2-2x1,
y3= Λ (x1-X3-Y1
However, all the above operations are performed in a residue system modulo p.
[0012]
The security of the elliptic curve cryptography is as follows. When the point A on the elliptic curve is x times (ie, A is added x times) is B (= x · A), the values of the points A and B are known. Is based on the fact that it is very difficult to obtain x from the value. This property is called a discrete logarithm problem on an elliptic curve, and in order to ensure the same level of security as the 1024 bits of the RSA cipher, p, a, xi, YiFor such parameters, an integer of about 160 bits is recommended.
[0013]
The calculation of the k-fold point (k · P) of the point P, which is the basic calculation of the elliptic curve cryptography, is performed by using the above addition on the elliptic curve. It is necessary to perform a remainder division operation. The remainder division operation is generally processed using an algorithm such as the extended Euclidean algorithm, but requires a lot of processing time. Therefore, a method is widely used in which a point on an elliptic curve is processed by converting a point in the two-dimensional affine coordinate system into a point in the three-dimensional coordinate system without performing the remainder division calculation. For details, see D.C. V. Chudnovsky and G.C. V. Chudnovsky, "Sequences of Numbers Generated by Addition in Formal Groups and New Primitives and Factories Tests, Advanced Measures in App." 385-434, 1986. As an example, an elliptic curve E in a two-dimensional affine coordinate systempThe above addition operation is expressed as x≡X / Z2(Modp),
y≡Y / Z3When converted to a three-dimensional projective coordinate system satisfying (modp), the following definition is made.
[0014]
Ellipse addition operation: 2 additions, 5 subtractions, 16 multiplications, 0 divisions
X3= R2-TW2, 2Y3= VR-MW3, Z3= Z1Z2W
However, W = X1Z2 2-X2Z1 2, R = Y1Z2 3-Y2Z1 3,
T = X1Z2 2+ X2Z1 2, M = Y1Z2 3-Y2Z1 3,
V = TW2-2X3
Ellipse doubling: 1 addition, 3 subtractions, 10 multiplications, 0 divisions
X3= M2-2S, Y3= M (SX3) -T, Z3= 2Y1Z1
However, M = 3X1 2+ AZ1 4, S = 4X1Y1 2, T = 8Y1 4
However, all the above operations are performed in a residue system modulo p.
[0015]
Other examples of coordinate transformation include x≡X / Z (modp),
There is a conversion method to a three-dimensional homogeneous coordinate system that satisfies y≡Y / Z (modp).
[0016]
However, a remainder division operation is required once when converting from the three-dimensional coordinate system to the two-dimensional coordinate system again.
[0017]
If the 160-bit elliptic curve cryptosystem is converted into a three-dimensional projective coordinate system and the k · P operation is processed using the above-described binary operation method, an average of 2862 times of modular multiplication is required.
[0018]
As described above, public key cryptography such as RSA cryptography and elliptic curve cryptography requires a lot of modular multiplication operations as its basic computation. For this reason, a method has been devised that uses a high-speed algorithm for the remainder multiplication operation to speed up the remainder multiplication operation and speed up the entire cryptographic processing.
[0019]
In particular, since most of the operations of RSA cryptography are modular multiplication operations, hardware that executes a high-speed algorithm of modular multiplication operations and an IC card that executes RSA cryptographic processing at high speed by using it are IC This is realized based on ISO7816 which is a standard of the card.
[0020]
[Problems to be solved by the invention]
In contrast, public key cryptography and digital signatures other than RSA may require a remainder division operation. Among the remainder four arithmetic operations, the remainder division operation particularly requires a computation time, which is a big problem in speeding up the encryption processing and signature generation processing. One of the public key cryptosystems that uses the remainder division operation is elliptic curve cryptography. A method for reducing the number of remainder division operations in this elliptic curve cryptography and a method for calculating the remainder division computation at high speed are described by Shinbo, “Applying Montgomery Arithmetic to Elliptic Curve Ciphers” SCIS '97 (The 1997 Symposium on Cryptography and Information Security).
[0021]
However, when the method in this document is applied to an apparatus such as an IC card defined by the ISO7816 standard, there is a limit to the computing power of the CPU due to the standard and the limitations of the current semiconductor technology. Therefore, the inverse operation in the remainder division operation takes time, and it is difficult to increase the processing speed.
[0022]
SUMMARY OF THE INVENTION Accordingly, an object of the present invention is to provide a method capable of executing elliptic curve cryptographic processing at high speed in a cryptographic processing device having hardware for executing a high-speed algorithm for modular multiplication, and a device using the same, for example, an IC card. It is to be.
[0023]
Another object of the present invention is to provide a device having hardware for executing a high-speed algorithm for modular multiplication, for example, a method for executing digital signature processing at high speed in an IC card, and a device for realizing the method. It is to be.
[0024]
Another object of the present invention is to provide a method capable of speeding up the inverse operation in remainder division and a program or apparatus using the same in elliptic curve cryptography.
[0025]
Another object of the present invention is to use a method capable of executing various processes such as a DSA signature and a Schnorr signature at high speed in a cryptographic processing apparatus having hardware for executing a high-speed algorithm for modular multiplication, and the same. To provide a device, for example an IC card.
[0026]
Another object of the present invention is a method capable of speeding up inverse operation in remainder division in various public key schemes and digital signature schemes that require remainder division operations such as DSA signature and Schnorr signature processing, and an apparatus using the same Is to provide.
[0027]
[Means for Solving the Problems]
In order to achieve the above object, according to the present invention, the following modes are provided.
First, according to one aspect of the present invention, in a device including a device (hereinafter referred to as a residue multiplier) in which a high-speed algorithm for residue multiplication is implemented (for example, an IC card), the remainder multiplier is effectively used. As described above, an elliptic curve encryption processing method is provided in which operations in elliptic curve cryptography are composed of operations centered on remainder multiplication.
Specifically, the remainder calculation after the random number generation necessary for the elliptic curve encryption process and the remainder calculation in the signature creation process can be calculated using a remainder multiplier. Further, in order to effectively use the remainder multiplier also in the computation on the elliptic curve, the remainder in the addition computation on the elliptic curve is obtained by converting the points on the elliptic curve from the two-dimensional affine coordinate system to the three-dimensional coordinate system. The division operation is converted into a remainder multiplication operation, and processing is performed so that the remainder multiplier can be used for the remainder multiplication operation.
[0028]
In another aspect of the present invention, in order to speed up the inverse operation described in the above problem, it is necessary when converting from a three-dimensional coordinate system to a two-dimensional affine coordinate system and when obtaining signature data. The inverse operation is also calculated using a remainder multiplication operation. The inverse operation in the residue system is generally obtained using an algorithm such as the extended Euclidean algorithm, but when the modulus of the remainder is a prime number, without using an algorithm such as the extended Euclidean algorithm, It can be obtained using only a modular multiplication operation. The method is shown below.
According to Fermat's little theorem, for prime β and prime integer α that is relatively prime,
αβ-1≡1 (modβ)
Is established. Using this theorem, the inverse operation α-1mod β can be expressed as follows.
α-1≡αβ-2(Modβ)
In the present invention, in order to maintain the security of elliptic curve cryptography, the values of the order p and the base point order n of the finite field are large prime numbers. The conditions in the Fermat's small theorem, the prime number β and the positive integer α Always satisfy that they are disjoint. Therefore,
α-1The value of mod β is αβ-2If it is equal to mod β and the remainder multiplication operation is performed using the binary operation method, the average ((| β−2 | −1) × 3/2)
(Where | β-2 | represents the number of bits of (β-2)), and the inverse operation α-1It is possible to determine the value of mod β. When this method is used, it is not necessary to create an algorithm such as the Euclidean mutual division method as a program, so that the program size is also reduced.
[0029]
This inverse element calculation method is not limited to elliptic curve cryptography, but can also be used for processing of various other public key schemes and digital signature schemes that require inverse element calculations, such as DSA signatures and Schnorr signatures.
[0030]
Also, parameters that are frequently used in computations that can be calculated in advance can be calculated in advance on a personal computer, etc., and stored in a rewritable non-volatile memory in the IC card as one piece of system information. , Can reduce the amount of calculation. The data as system information stored in advance includes a finite body number p, aRmodp obtained by converting the elliptic curve parameter a, and the two-dimensional affine coordinates (x, y) of the point P (base point) on the elliptic curve. The point P (X, Y, Z) converted to the coordinates of the three-dimensional projective coordinate system, and further converted for the remainder multiplier, the order n of the base point, the secret key d, and the calculation on the elliptic curve are used. 2Rmodp, 3Rmodp, 4Rmodp, 8Rmodp and 2 converted constants-1Rmodp, Rmodp, Rmodn, and R for use in remainder calculation2modp and R2Let it be modn. However, R used here is a positive integer satisfying R> p, R> n with respect to the finite field order p and the base point order n, for example, the numbers of bits of p and n are | p | and | n | When expressing
The smallest positive integer having a bit length equal to the larger of | p | +1 or | n | +1.
[0031]
Further, in order to reduce the total number of calculations in the addition calculation on the elliptic curve in the IC card and reduce the total amount of calculation, a point that is a constant multiple of the base point is stored as a table in a rewritable nonvolatile memory in the IC card. I decided to leave. However, the amount of calculation decreases as the number of tables increases, but the data size stored in the memory increases. For this reason, in the present invention, the table has a point that is a power of 4 times the base point. At this time, the number of points held as a table, that is, the number of tables is represented by | p |
(| P | / 2) pieces, and the values of the table are converted into the coordinates of the three-dimensional projective coordinate system, and further converted into the calculation area of the remainder multiplication device, the point Pi= (Xi, Yi, Zi)
(I is an integer of 0 ≦ i <| p | / 2).
[0032]
In addition, when the memory size is larger, it is possible to configure the operation on the elliptic curve by only the elliptic addition operation by having a point that is a power of 2 of the base point as a table. The number of times can be reduced.
[0033]
In general, in the case where the table has a value of a point that is a power of 2 times the base point (n is a natural number) as a table, the number of tables is represented by | p | (| P | / n), and can be determined by a trade-off between the calculation performance of the CPU and the memory capacity for storing the table.
[0034]
DETAILED DESCRIPTION OF THE INVENTION
An embodiment of the present invention will be described with reference to the drawings.
[0035]
FIG. 1 is a schematic configuration diagram when a digital signature system execution apparatus using an addition operation in an elliptic curve on a finite field according to the present invention is realized in an IC card based on, for example, a Hitachi H8 / 3111 microcomputer. Show. This type of
[0036]
The
[0037]
CDA ← (CDA / CDB) R-1mod (CDN): hereinafter referred to as
CDA ← (CDA2) R-1mod (CDN): hereinafter referred to as
CDA ← (CDA) R-1mod (CDN): hereinafter referred to as
Each element in the
In addition, the elliptic curve E used in the present inventionpThe order of the finite field is a prime number p, and a set of virtual infinity points O is added to a set of points satisfying the following formulas for parameters (a, b) for determining an elliptic curve. Here, for the sake of convenience, the affine coordinate system is used.
Ep: Y2≡x3+ Ax + b (modp)
Furthermore, the base point is P (x, y), and the base point has a prime number n.
[0038]
(1) Storage of system information
A finite body number p, an elliptic curve parameter aRmodp, and a point P that is a constant multiple of the coordinates of a point P (base point) on the elliptic curve.i(Xi, Yi, Zi)
(I is an integer of 0 ≦ i <| p | / 2, | p | represents the number of bits of the finite order p), the base point order n, the secret key d, and the operation on the elliptic curve 2Rmodp, 3Rmodp, 4Rmodp, 8Rmodp and 2 converted constants used-1Rmodp, Rmodp, Rmodn, and R for use in remainder calculation2modp and R2“modn” is stored in the
[0039]
It is assumed that the storage of these system information is performed before the following cryptographic processing is executed. Here, R is a numerical value given as a constant, and is a parameter that is determined depending on, for example, the computing performance of the coprocessor that constitutes the multiple length arithmetic means.
[0040]
(2) Signature creation
2 to 7 show flowcharts for creating a digital signature performed by the elliptic curve cryptographic processing apparatus according to this embodiment. Hereinafter, an outline procedure for creating a digital signature will be described with reference to FIG.
The following flowcharts show the contents of the
[0041]
Step 201: Start
Step 202: A random number k is generated, the random number k is stored in the register CDA of the
Step 203: The random number k generated in
[0042]
Step 204: Since the execution result (X, Y, Z) of
Step 205: The random number k generated in
[0043]
Generation of signature r: r≡x (modn)
Generation of signature s: s≡k-1・ (H (M) + d ・ r) (modn)
An inverse element operation is required when calculating the signature s in the above operation. This operation is also performed by the same method as in step 204.-1The value of modn is kn-2The remainder is replaced with a modular remainder multiplication, and the remainder multiplication is calculated using the
Step 206: End
Next, the procedure for creating a digital signature in this embodiment will be described in more detail with reference to FIGS.
FIG. 3 is a detailed flowchart of the process in
Step 301: Start
Step 302: k = (k) in which the binary notation of the random number k generated in
k = (kl, Kl-1, ..., k1, K0)2(However, kl≠ (00)).
The value of l obtained at this time is stored as (l + 1) in a variable i (hereinafter referred to as a loop counter) as the number of times the computation on the elliptic curve is repeated.
[0044]
Step 303: Points converted for the remainder multiplier after the three-dimensional coordinate conversion of the base point on the elliptic curve which is the table value stored in the
Pi(Xi, Yi, Zi) To store the initial value in the
Step 304: Count down the loop counter i by 1.
Step 305: The loop counter i is determined. If i is smaller than 0, the process proceeds to step 307. Otherwise, go to step 306.
Step 306: kiIf the value of (00) is (00), the process returns to step 304. kiIf the value of (01) is the table value PiThe ellipse addition operation is performed to add and the process returns to step 304. kiIf the value of (10) is, the table value PiThe ellipse doubling operation for doubling is performed, and the ellipse addition operation for adding the results is performed, and the process returns to step 304. kiIf the value of (11) is, the table value PiFor the value of Y coordinate of, find the inverse element for the addition with the modulus p, and change the value to the table value PiThe ellipse addition operation is performed to add the points, and the process returns to step 304.
Step 307: End
FIG. 4 is a detailed flowchart of the ellipse addition operation in the process of FIG.
Step 401: Start. In
[0045]
Step 402: The
Step 403: The
Step 404: The
Step 405: The
Step 406: The
Step 407: The
Step 408: The
Step 409: The
Step 410: The
Step 411: The
Step 412: The
Step 413: The
[0046]
Step 414: The
Step 415: The
Step 416:
Step 417: The
Step 418: The
Step 419: The
Step 420: The
Step 421: The
Step 422: The
Step 423: The
Step 424: The
Step 425: 2 stored in the
Step 426: End
FIG. 5 shows a detailed flowchart of the ellipse doubling operation in the process of FIG.
Step 501: Start. In
Step 502: The
Step 503: The
Step 504: The
Step 505: The
Step 506: 3Rmodp stored in the
Step 507: The
Step 508: The
Step 509: The
Step 510: 4Rmodp stored in the
[0047]
Step 511: The
Step 512: 8Rmodp stored in the
Step 513: The
Step 514: 2Rmodp stored in the
Step 515: The
Step 516: 2Rmodp and intermediate value S stored in the
Step 517: The
Step 518: The
Step 519: The
Step 520: End
FIG. 6 shows a detailed flowchart of the processing (inverse operation) in
Step 601: Start
Step 602: (p-3) is calculated from the finite position number p stored in the
(P-3) = (jl, Jl-1, ..., j1, J0)2(However, jl= 1) is stored in the loop counter i as the number of times the remainder multiplication operation is repeated.
Step 603: The Z coordinate of the point after the calculation in
Step 604: Count down the loop counter i by 1.
Step 605: The loop counter i is determined. If i is smaller than 0, the process proceeds to step 609. Otherwise, go to step 606.
Step 606: The
[0048]
Step 607: Value j for loop counter i in (p-3)iJudgment is made. jiIf is not 1, the process returns to step 604. jiIf is 1, the process proceeds to step 608.
Step 608: The
Step 609: The X coordinate of the point after the calculation in
Step 610: The
Step 611: The
Step 612: End
As described above, in the present invention, it is not necessary to perform a multiple-precision residue multiplication operation using the
[0049]
FIG. 7 is a detailed flowchart of the processing in step 205 in FIG.
Step 701: Start
Step 702: The xP value xmodp of kP calculated in
Step 703: Rmodn stored in the
Step 704: The base point order n stored in the
Step 705: The
r≡x (modn). Next, the process proceeds to
Step 706: R stored in the
Step 707: The
Step 708: The secret key d stored in the
Step 709: The
[0050]
Step 710: Using the
The value of (H (M) + d · r) modn is stored in the
Step 711: Inverse operation k-1Rmodn is a residue multiplication k using a
k-1Rmodn is stored in the CDA of the
Step 712: The value of (H (M) + d · r) modn stored in the
Step 713: The
Step 714: End
In order to confirm the effect of the present invention, a program according to the above embodiment was created, and the execution time when the number of operating clocks of the CPU was 5 MHz was measured.
Specifically, k · P calculation on an elliptic curve with a 160-bit key length is performed using 80 reference tables each indicating a value of a point that is a power of 4 of the base point in a three-dimensional projection coordinate system. In addition, the inverse element calculation is performed by combining Fermat's little theorem and binary arithmetic. As an execution environment, a microcomputer H8 / 3111 emulator for IC cards with a built-in multiple-precision modular multiplication coprocessor manufactured by Hitachi, Ltd. was used, and an assembler was used as a program language. As a result, the signature creation time (time taken from
[0051]
As described above, according to the present invention, remainder multiplication and remainder division are performed using a remainder multiplier, other remainder addition and remainder subtraction are performed using a CPU, and reference is made to pre-calculated values. By doing so, elliptic curve cryptography can be processed at high speed.
In the above description, the digital signature creation process has been mainly described. However, the present invention is not limited to this, and the signature verification process using the elliptic curve cryptography and the cipher creation process can be performed at high speed by the same method.
In addition, as described in the above description, the method of processing the inverse element operation at a high speed using the remainder multiplier is a variety of public key cryptography using other inverse element operations, digital signature schemes such as a DSA signature, Schnorr signature, and the like. It is applicable to.
[0052]
Further, the present invention is not limited to the IC card as in the above-described embodiment, and can be applied to any similar device that has a limited processing capability of the CPU and includes a multiplier. For example, the present invention can be applied to a microcontroller that performs authentication processing, IEEE1394 LSI for encryption processing, or the like. These uses are also described in NIKKEI ELECTRONICS 1998. 12.14 (No. 732) pp27-28.
[0053]
In the present invention, the EEPROM is given as an example of the rewritable
The module that realizes the inverse operation using the
[0054]
【The invention's effect】
As described above, according to the present invention, the digital signature creation process based on the elliptic curve is configured by using a method that effectively uses the remainder multiplication operation, so that it can be processed at high speed in an apparatus including a remainder multiplier. Methods and apparatus can be provided.
[Brief description of the drawings]
FIG. 1 is a block diagram of an apparatus to which the present invention is applied.
FIG. 2 is a flowchart showing a signature creation procedure using elliptic curve cryptography according to an embodiment of the present invention.
FIG. 3 is a detailed flowchart of processing in
4 is a detailed flowchart of an ellipse addition operation in FIG. 3. FIG.
FIG. 5 is a detailed flowchart of the ellipse doubling operation in FIG. 3;
FIG. 6 is a detailed flowchart of processing in
FIG. 7 is a flowchart of processing in
[Explanation of symbols]
101 ... IC card,
102 ... CPU,
103 ... ROM,
104 ... EEPROM,
105 ... I / O port,
106 ... RAM,
107: Remainder multiplier,
108 ... Bus
109: CPU / residue multiplier common RAM,
110: power supply (Vcc) terminal,
111: Ground (Vss) terminal,
112 ... Clock (CLK) terminal,
113 ... reset (RES) terminal,
114: I / O terminal.
Claims (7)
前記メッセージに対する公開鍵暗号処理を行う手段と、
前記公開鍵暗号処理の処理結果を入出力ポートを介して入出力端子から出力する手段とを備え、
前記公開鍵暗号処理手段は、正の整数A、B、N、R(ただし、前記、A、Bは入力変数または中間変数として与えられる変数であり、Nは入力変数として与えられる変数であり、Rは定数として与えられる数値である)に対して中間演算処理で生じる計算対象数値を表すABR−1modNと、A2R−1modN、及びAR−1modNを剰余多倍長の乗算演算で計算する多倍長演算手段と、
前記多倍長演算手段を用いて、有限群上の乗算である前記ABR−1modNと前記A2R−1modNを繰り返して逆元計算を行う計算手段とを備え、
前記計算手段は、素数nと互いに素な正の整数kに対する演算k−1modnを、k−1modn≡kn−2modnという関係式を利用し、前記k−1modnを前記kn−2modnに置き換え、前記kn−2modnの計算を前記ABR−1modNと前記A2R−1modNの剰余乗算演算を繰り返し用いて行う逆元計算手段を備えることを特徴とするICカード。Means for receiving a message from the input / output terminal via the input / output port;
Means for performing public key cryptography on the message;
Means for outputting the processing result of the public key cryptography process from an input / output terminal via an input / output port;
The public key cryptographic processing means is a positive integer A, B, N, R (where A, B are variables given as input variables or intermediate variables, and N is a variable given as an input variable, R is a numerical value given as a constant), and ABR −1 modN, A 2 R −1 modN, and AR −1 modN representing the numerical values to be calculated in the intermediate arithmetic processing are multiplied by a multiple of multiples. Multiple length arithmetic means for calculating;
Using the multiple length arithmetic means, and calculating means for performing inverse element calculation by repeating the ABR −1 modN and the A 2 R −1 modN which are multiplications on a finite group,
The calculation means uses a relational expression k −1 modn≡k n−2 modn for an operation k −1 modn for a prime integer k that is relatively prime to the prime number n, and k −1 modn is the k n− An IC card comprising an inverse element calculation unit that replaces 2 modn and performs calculation of the k n−2 modn by repeatedly using a modular multiplication operation of the ABR −1 modN and the A 2 R −1 modN.
2Rmodp、3Rmodp、4Rmodp、8Rmodp、2−1Rmodp、aRmodp、Rmodp、R2modp、Rmodn、R2modn(ただし、有限体上の楕円曲線Ep:y2≡x3+ax+b(modp)としたときに、有限体位数pに対してR>p、R>nを満たす正整数をRとする)の数値の少なくとも一つを予め記憶し、前記多倍長演算手段から参照可能にされている書き換え可能な不揮発性メモリ
を備えることを特徴とする請求項1または2記載のICカード。The public key cryptography is elliptic curve cryptography,
2Rmodp, 3Rmodp, 4Rmodp, 8Rmodp, 2 −1 Rmodp, aRmodp, Rmodp, R 2 modp, Rmodn, R 2 modn (however, an elliptic curve over a finite field E p : y 2 ≡x 3 + ax + bmod) In addition, at least one of numerical values of R> p and R> n satisfying R> p and R> n is stored in advance, and can be referred to from the multiple length arithmetic means. 3. The IC card according to claim 1, further comprising a non-volatile memory that can be used.
を備えることを特徴とする請求項1ないし3のいずれか一に記載のICカード。A rewritable value in which a value of a positive integer multiple of the base point P on the elliptic curve is stored in advance, and a value of a positive integer multiple of the base point P can be referred to from the multiple length arithmetic means. 4. The IC card according to claim 1, further comprising a non-volatile memory.
前記CPUは、
入出力端子から入出力ポートを経由してメッセージを受け取るステップと、
前記メッセージに対する楕円曲線暗号処理を行うステップと、
前記楕円曲線暗号処理ステップの処理結果を入出力ポートを介して入出力端子から出力するステップと、
を実行し、
前記楕円曲線暗号処理ステップは、
正の整数A、B、N、R(ただし、前記、A、Bは入力変数または中間変数として与えられる変数であり、Nは入力変数として与えられる変数であり、Rは定数として与えられる数値である)に対して中間演算処理で生じる計算対象数値を表すABR−1modNと、A2R−1modN、及びAR−1modNを剰余多倍長の乗算演算で計算するステップと、
前記コプロセッサを用いて、有限群上の乗算である前記ABR−1modNと前記A2R−1modNを繰り返して逆元計算を行うステップと、
を含み、
前記逆元計算ステップは、素数nと互いに素な正の整数kに対する演算k−1modnを、k−1modn≡kn−2modnという関係式を利用し、前記k−1modnを前記kn−2modnに置き換え、前記kn−2modnの計算を前記ABR−1modNと前記A2R−1modNの剰余乗算演算を繰り返し用いて行う逆元計算を実行するステップ
を含むことを特徴とする暗号処理方法。An encryption processing method using an IC card having a CPU and a coprocessor,
The CPU
Receiving a message from the input / output terminal via the input / output port;
Performing elliptic curve cryptography on the message;
Outputting the processing result of the elliptic curve encryption processing step from the input / output terminal via the input / output port;
Run
The elliptic curve encryption processing step includes:
Positive integers A, B, N, R (where A, B are variables given as input variables or intermediate variables, N is a variable given as an input variable, and R is a numerical value given as a constant) Calculating ABR −1 modN, A 2 R −1 modN, and AR −1 modN representing the numerical value to be calculated that occurs in the intermediate arithmetic processing by a multiplication operation of a multiple of the remainder,
Using the coprocessor to iterate the ABR −1 modN and A 2 R −1 modN, which are multiplications on a finite group, to perform inverse element calculations;
Including
In the inverse element calculation step, an operation k −1 modn for a positive integer k that is relatively prime to the prime number n is used as a relational expression k −1 modn≡k n−2 modn, and k −1 modn is changed to the k It is replaced with n-2 modn, and includes a step of executing an inverse element calculation in which the calculation of k n-2 modn is performed by repeatedly using a modular multiplication operation of the ABR −1 modN and the A 2 R −1 modN. Cryptographic processing method.
当該プログラムは、前記ICカードに、
入出力端子から入出力ポートを経由してメッセージを受け取るステップと、
前記メッセージに対する楕円曲線暗号処理を行うステップと、
前記楕円曲線暗号処理ステップの処理結果を入出力ポートを介して入出力端子から出力するステップと、
を実行させ、
前記楕円曲線暗号処理ステップは、
正の整数A、B、N、R(ただし、前記、A、Bは入力変数または中間変数として与えられる変数であり、Nは入力変数として与えられる変数であり、Rは定数として与えられる数値である)に対して中間演算処理で生じる計算対象数値を表すABR−1modNと、A2R−1modN、及びAR−1modNを剰余多倍長の乗算演算で計算するステップと、
前記コプロセッサを用いて、有限群上の乗算である前記ABR−1modNと前記A2R−1modNを繰り返して逆元計算を行うステップと、
を含み、
前記逆元計算ステップは、素数nと互いに素な正の整数kに対する演算k−1modnを、k−1modn≡kn−2modnという関係式を利用し、前記k−1modnを前記kn−2modnに置き換え、前記kn−2modnの計算を前記ABR−1modNと前記A2R−1modNの剰余乗算演算を繰り返し用いて行う逆元計算を実行するステップ
を含むことを特徴とする暗号処理を実行させるためのプログラムを記憶する記録媒体。A C PU, and a recording medium storing a program for causing execution of cryptographic processing to the IC card with a coprocessor,
The program is stored in the IC card .
Receiving a message from the input / output terminal via the input / output port;
Performing elliptic curve cryptography on the message;
Outputting the processing result of the elliptic curve encryption processing step from the input / output terminal via the input / output port;
Was executed,
The elliptic curve encryption processing step includes:
Positive integers A, B, N, R (where A, B are variables given as input variables or intermediate variables, N is a variable given as an input variable, and R is a numerical value given as a constant) Calculating ABR −1 modN, A 2 R −1 modN, and AR −1 modN representing the numerical value to be calculated that occurs in the intermediate arithmetic processing by a multiplication operation of a multiple of the remainder,
Using the coprocessor to iterate the ABR −1 modN and A 2 R −1 modN, which are multiplications on a finite group, to perform inverse element calculations;
Including
In the inverse element calculation step, an operation k −1 modn for a positive integer k that is relatively prime to the prime number n is used as a relational expression k −1 modn≡k n−2 modn, and k −1 modn is changed to the k It is replaced with n-2 modn, and includes a step of executing an inverse element calculation in which the calculation of k n-2 modn is performed by repeatedly using a modular multiplication operation of the ABR −1 modN and the A 2 R −1 modN. recording medium storing a program for causing execution of cryptographic processing to be.
暗号処理において、生成すべき値k、剰余乗算演算器の性能によって決まる定数R、素数nと互いに素な正の整数kに対する演算k−1modnを、k−1modn≡kn−2modnという関係式を利用して演算する逆元演算モジュールであって、
前記剰余乗算演算器でkRmodnを計算し、その計算結果を第1レジスタと第2レジスタとに記憶させる第1手段と、
前記第1レジスタの値を二乗しR−1をかけて、その結果のmodnをとった値を第1レジスタに記憶するA2R−1modNの演算器と、
前記第1レジスタと前記第2レジスタの値を乗算しR−1をかけて、その結果のmodnをとった値を第1レジスタに記憶するABR−1modNの演算器と、
前記A2R−1modNの演算器と前記ABR−1modNの演算器による処理を繰り返し、kn−2modnを求める第2手段と、
を含むことを特徴とする逆元演算モジュール。It is used in an electronic device equipped with a cryptographic processing device using a modular multiplication unit,
In cryptographic processing, the value k to be generated, the constant R determined by the performance of the remainder multiplier, and the operation k −1 modn for a positive integer k that is relatively prime to the prime number n is called k −1 modn≡k n−2 modn. An inverse element calculation module that calculates using a relational expression,
A first means for calculating kRmodn by the remainder multiplier and storing the calculation result in a first register and a second register;
An A 2 R −1 mod N computing unit that squares the value of the first register, multiplies it by R −1 , and stores the resulting modn in the first register;
An ABR -1 modN arithmetic unit that multiplies the values of the first register and the second register, multiplies them by R- 1 , and stores the resulting modn in the first register;
Second means for repeating the processing by the A 2 R −1 mod N computing unit and the ABR −1 mod N computing unit to obtain kn −2 modn;
An inverse element calculation module comprising:
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP01945799A JP3779479B2 (en) | 1998-01-28 | 1999-01-28 | IC card |
Applications Claiming Priority (3)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP1537698 | 1998-01-28 | ||
JP10-15376 | 1998-01-28 | ||
JP01945799A JP3779479B2 (en) | 1998-01-28 | 1999-01-28 | IC card |
Publications (2)
Publication Number | Publication Date |
---|---|
JPH11288215A JPH11288215A (en) | 1999-10-19 |
JP3779479B2 true JP3779479B2 (en) | 2006-05-31 |
Family
ID=26351504
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP01945799A Expired - Fee Related JP3779479B2 (en) | 1998-01-28 | 1999-01-28 | IC card |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP3779479B2 (en) |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR100399048B1 (en) * | 2001-06-18 | 2003-09-26 | 한국전자통신연구원 | Apparatus of Elliptic Curve Cryptosystem |
US20090287939A1 (en) | 2005-12-07 | 2009-11-19 | Matsushita Electric Industrial Co., Ltd. | Secure device, information processing terminal, server, and authentication method |
KR100808953B1 (en) | 2006-05-22 | 2008-03-04 | 삼성전자주식회사 | Modular multiplication method and smart card capable of performing the multiplication method |
-
1999
- 1999-01-28 JP JP01945799A patent/JP3779479B2/en not_active Expired - Fee Related
Also Published As
Publication number | Publication date |
---|---|
JPH11288215A (en) | 1999-10-19 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US6714648B2 (en) | IC card equipped with elliptic curve encryption processing facility | |
EP1248409B1 (en) | Attack-resistant cryptographic method and apparatus | |
JP3950638B2 (en) | Tamper resistant modular processing method | |
Woodbury et al. | Elliptic curve cryptography on smart cards without coprocessors | |
US8024391B2 (en) | Modular multiplication method with precomputation using one known operand | |
US7069287B2 (en) | Method for efficient computation of odd characteristic extension fields | |
US6038581A (en) | Scheme for arithmetic operations in finite field and group operations over elliptic curves realizing improved computational speed | |
US7809133B2 (en) | Randomized modular reduction method and hardware therefor | |
US8417760B2 (en) | Device and method for calculating a multiplication addition operation and for calculating a result of a modular multiplication | |
WO2019121747A1 (en) | Device and method for protecting execution of a cryptographic operation | |
JP4351987B2 (en) | Montgomery conversion device, arithmetic device, IC card, encryption device, decryption device, and program | |
Farzam et al. | Implementation of supersingular isogeny-based Diffie-Hellman and key encapsulation using an efficient scheduling | |
JP2003098962A (en) | Method and device for calculating elliptic curve scalar multiple, and recording medium | |
Paar | Implementation of cryptographic schemes 1 | |
Bertoni et al. | Computing tate pairing on smartcards | |
Aigner et al. | A low-cost ECC coprocessor for smartcards | |
Moon et al. | Fast VLSI arithmetic algorithms for high-security elliptic curve cryptographic applications | |
US8364737B2 (en) | Device and method for calculating a result of a sum with a calculating unit with limited word length | |
JP2009505148A (en) | Circuit arrangement and method for performing inversion operation in encryption operation | |
US6609141B1 (en) | Method of performing modular inversion | |
Jung et al. | A reconfigurable coprocessor for finite field multiplication in GF (2n) | |
JP3779479B2 (en) | IC card | |
Gutub | Efficient utilization of scalable multipliers in parallel to compute GF (p) elliptic curve cryptographic operations | |
Clancy et al. | FPGA-based hyperelliptic curve cryptosystems | |
JP5179933B2 (en) | Data processing device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
RD02 | Notification of acceptance of power of attorney |
Free format text: JAPANESE INTERMEDIATE CODE: A7422 Effective date: 20040309 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20050412 |
|
A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20050613 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20060110 |
|
A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20060201 |
|
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: 20060221 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20060302 |
|
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: 20090310 Year of fee payment: 3 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20100310 Year of fee payment: 4 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20110310 Year of fee payment: 5 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20110310 Year of fee payment: 5 |
|
S111 | Request for change of ownership or part of ownership |
Free format text: JAPANESE INTERMEDIATE CODE: R313111 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20110310 Year of fee payment: 5 |
|
R350 | Written notification of registration of transfer |
Free format text: JAPANESE INTERMEDIATE CODE: R350 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20110310 Year of fee payment: 5 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20120310 Year of fee payment: 6 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20130310 Year of fee payment: 7 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20130310 Year of fee payment: 7 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20140310 Year of fee payment: 8 |
|
S531 | Written request for registration of change of domicile |
Free format text: JAPANESE INTERMEDIATE CODE: R313531 |
|
R350 | Written notification of registration of transfer |
Free format text: JAPANESE INTERMEDIATE CODE: R350 |
|
LAPS | Cancellation because of no payment of annual fees |