JP4019762B2 - Inverse element operation apparatus, inverse element operation method, RSA key pair generation apparatus, RSA key pair generation method - Google Patents
Inverse element operation apparatus, inverse element operation method, RSA key pair generation apparatus, RSA key pair generation method Download PDFInfo
- Publication number
- JP4019762B2 JP4019762B2 JP2002092150A JP2002092150A JP4019762B2 JP 4019762 B2 JP4019762 B2 JP 4019762B2 JP 2002092150 A JP2002092150 A JP 2002092150A JP 2002092150 A JP2002092150 A JP 2002092150A JP 4019762 B2 JP4019762 B2 JP 4019762B2
- Authority
- JP
- Japan
- Prior art keywords
- inverse element
- value
- inverse
- modulus
- operand value
- 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】
【発明の属する技術分野】
本発明は、法の値が偶数である剰余環において、逆元を演算する逆元演算装置及びその方法に関する。また、公開鍵アルゴリズムであるRSAの鍵対を生成する、RSA鍵生成装置、及びその方法に関する。
【0002】
【従来の技術】
RSA暗号の鍵対は、個々の機器にて生成することにより、より高い安全性が確保できる。これは、センターが鍵対を生成して機器に配布するといった方法に比べ、秘密鍵が機器から外にでないためである。特に、機器自身に高い安全性が必要とされる、ICカードシステムにおいては、演算リソースが制限されているICカード内での効率的なRSA暗号鍵対生成が必要となる。
【0003】
通常、RSA暗号鍵対生成方法は、次の手順で行う。
【0004】
(1) 素数p、qを生成する。n=p×qとする。
【0005】
(2) 1≦e:奇数<L=LCM(p−1、q−1)を決めて、eの逆元dを求める(LCMとは最小公倍数のことである)。
【0006】
(3) (n、e)を公開し、(p、q、d)を秘密にする。
【0007】
この手順のうち(2)のeからdの算出には、Lを法とする剰余環上の逆元演算が必要となる。
【0008】
以下では、従来の逆元演算を説明し、演算リソースが限定されている機器にて逆元演算を実装することを前提に、
・内部変数が蓄積されるメモリ容量が少ない
・制御が簡易である
という観点より評価する。
【0009】
剰余環上の逆元演算方法としては、ユークリッド互除法、レーマ法、バイナリユークリッド互除法などが知られている。例えば文献「暗号処理入門」(岡本栄司著、共立出版、1993)のp.8には、ユークリッド互除法のアルゴリズムが記載されている。この記載に基づき、ユークリッド互除法を用いて剰余環上の逆元を求めるアルゴリズムを説明する。
【0010】
図1は前記文献に示されたアルゴリズムをフローチャートにしたもので、入力値Aに対して、pを法とした剰余環上の逆元を求めるものである。
【0011】
最初に入力ステップ101において、逆元演算を行う被演算数A、及び剰余環の法の値pを入力する。次に内部変数初期化ステップ102において、U1、U2、V1、V2という4つの内部変数をそれぞれ初期化する。次にユークリッド互除法演算ステップ103において、内部変数U1、U2、V1、V2、の値を更新してゆく。更新した値について判定ステップ104において条件が成立しない限り、ユークリッド互除法演算ステップ103が繰り返される。判定ステップ104において条件が成立すると、GCD確認ステップ105に進む。GCDとは最大公約数のことである。GCD確認ステップ105では、GCDの値が1か否かを確認する。そして最後に出力ステップ106において値を出力する。GCD確認ステップ105においてGCDが1であると確認された時は、出力ステップ106において演算された逆元の値が出力される。また1でないと確認された時は、出力ステップ106においてエラーが出力される。
【0012】
図2はユークリッド互除法ステップ103の詳細をフローチャートにしたものである。ここでは、さらに3つの内部変数W、T1、T2を用い、最初に初期化した変数U1、U2、V1、V2の値を更新してゆく。
【0013】
この方法によって正しい値が出力されることは前記文献等に記されているためここでは省略する。この方法の特徴としては、内部変数の更新に多精度の除算を用いるということが挙げられる。また中間値を格納する内部変数として、7つの多精度の変数格納領域を必要とするということも挙げられる。単精度が32ビットで、法の値が1024ビットのRSA暗号を考えると、この7つの多精度変数は、7×32=224ワードのワークメモリを必要とする。
【0014】
次に別の従来例であるレーマ法について説明する。レーマ法は前記ユークリッドの互除法を改良した方法で、単精度の除算を用いることによって多精度乗算の回数を減らしたものである。例えば文献「HANDBOOK of APPLIED CRYPTOGRAPHY」(Alfred J.Menezes他、CRC Press、1997)のp.607には、レーマ法のアルゴリズムが記載されている。但しここには剰余環上の逆元を求めるアルゴリズムではなく、GCDを求めるアルゴリズムとして記述してある。また同書のp.67にはGCDを求めるユークリッド互除法から、GCDが1の時の剰余環上の逆元を求める拡張方法が記述してある。従ってこの二つの記載に基づけばレーマ法を用いて剰余環上の逆元を求めるアルゴリズムが導き出せる。ここでは前記二つの記載方法に基づいたレーマ法のアルゴリズムを説明する。
【0015】
図3はレーマ法のアルゴリズムをフローチャートにしたもので、入力値Aに対して、pを法とした剰余環上の逆元を求めるものである。図1と比較すると分かる通り、内部変数を更新する部分を除くとユークリッド互除法と全く同じである。301がレーマ演算ステップで、ユークリッド互除法のユークリッド互除法演算ステップ103に相当する処理である。
【0016】
図4は図3のレーマ演算ステップの詳細フローチャートである。図4においてアルファベット大文字で始まる変数は多精度の値を、アルファベット小文字で始まる変数は単精度の値を示している。ここで単精度とはレーマの演算を行う時に定める演算単位で、通常8、16、32、64などの値が用いられる。
【0017】
401は単精度変数初期化ステップで、u、v、a、b、c、dの6つの単精度変数を初期化している。u、vはそれぞれU2の0でない最上位単精度値、及びV2の同位桁の単精度値が代入される。402は第1のレーマ演算判定ステップで、レーマ演算が継続できるか否かを判定する。継続できない場合には、それまでに計算されたa〜dの値を用いて内部変数U1、V1、U2、V2の値の更新処理に移る。403は第2のレーマ演算判定ステップで、レーマ演算によりa〜dの値が正しく計算できるか否かを判定する。演算が正しく計算できない場合には、q、q’の値が異なるため、第1のレーマ演算判定ステップと同様、それまでに計算されたa〜dの値を用いて内部変数U1、V1、U2、V2の値の更新処理に移る。
【0018】
404は単精度変数更新ステップで、a〜dの単精度変数を更新する。これらの変数は図1のユークリッド互除法における内部変数Wにあたり、複数の単精度変数を持つことにより複数の多精度乗算を一度に行うことが可能となっている。またこの単精度変数更新ステップが実行されると、第1のレーマ演算判定ステップ402に戻り、レーマ演算が継続可能な限り単精度変数更新ステップ404が繰り返される。405はまとめ演算判定ステップで、単精度変数bの値により多精度乗算のまとめ演算を行うか否かを判定する。406は第1の内部変数更新ステップで、これまでに計算されたa〜dの単精度変数の値を用い、それぞれただ一度の乗算でU1、U2、V1、V2の4つの内部変数の値を更新する。407は第2の内部変数更新ステップで、第1の内部変数更新ステップが使えない時に通常のユークリッド互除法と同じ除算、乗算による内部変数の更新を行う。
【0019】
この方法は単精度変数更新ステップ404を繰り返すことにより、406、407の多精度演算となる内部変数更新回数を減少させることができ、ユークリッド互除法に比べ実行速度が速くなるという特徴がある。しかし第1の内部変数更新ステップ406が使えない時に、第2の内部変数更新ステップ407を用いるため、多精度の除算を行わなくて済むようにはできない。またフローチャートを見ても分かるよう、多精度値から単精度値を取得するなど、非常に制御が複雑になる。さらにレーマ法の特徴としては、ユークリッド互除法と同様、中間値を格納する領域として、7つの多精度の内部変数を必要とするということが挙げられる。即ち、単精度が32ビットで、法の値が1024ビットのRSA暗号では224ワードのワークメモリを必要とする。
【0020】
また特願2001−092481号公報によれば、多精度の除算を行わず、近似値を用いた改良レーマ法について記されている。しかしこの方法も通常のレーマ法と同様制御が複雑になることに変わりはない。また多精度の除算を行わない分、多精度内部変数の数が減少するが、それでも6つ必要となる。即ち、単精度が32ビットで、法の値が1024ビットのRSA暗号では6×32=192ワードのワークメモリを必要とする。
【0021】
次に別の従来例であるバイナリユークリッド互除法について説明する。前記ユークリッドの互除法では、ユークリッド互除法演算ステップ103において乗除算が必要であった。また前記レーマ法では、多精度値から単精度値を取得するなど複雑な制御が必要であった。バイナリユークリッド互除法は、これらのいずれも使用せず、加減算とシフト算のみで同じ効果を得るものである。加減算とシフト算はハードウェアの実装が容易な演算である。
【0022】
例えば文献「HANDBOOK of APPLIED CRYPTOGRAPHY」(Alfred J.Menezes他、CRC Press、1997)のp.608には、バイナリユークリッド互除法のアルゴリズムが記載されている。図5〜図7がバイナリユークリッド互除法を用い剰余環上の逆元を求めるアルゴリズムを、フローチャートにしたものである。これらの図を用いてバイナリユークリッド互除法を説明する。またバイナリユークリッド互除法は、前記ユークリッド互除法を改良したものであるため、そのフロー図である図1の各ステップとの対応も同時に説明する。
【0023】
図5はバイナリユークリッド互除法の大きな流れを図にしたもので入力値Aに対して、pを法とした剰余環上の逆元を求めるものである。但しここではpを奇数と限定している。図1と比較すると分かる通り、内部変数を更新する部分を除くとユークリッド互除法と全く同じである。501がバイナリユークリッド互除法演算ステップで、ユークリッド互除法のユークリッド互除法演算ステップ103に相当する処理である。
【0024】
図6はバイナリユークリッド互除法演算ステップの詳細フローチャートで、第1の内部変数更新停止判定ステップ601、第1の内部変数更新ステップ602、第2の内部変数更新停止判定ステップ603、第2の内部変数更新ステップ604、第3の内部変数更新ステップ605において、それぞれの内部変数を更新してゆく。これらのステップが、ユークリッド互除法における図2に対応する。
【0025】
第1の内部変数更新停止判定ステップ601では、V2が偶数か奇数かを判定する。ここでV2が奇数と判定された時は、変数V1、V2の更新を停止し次の処理に移る。第1の内部変数更新ステップ602では、内部変数V1、V2を2で割る。V1については剰余体上において2で割る処理を行う。この2で割る処理がシフト演算で実現できるため、バイナリユークリッド互除法では乗除算を必要としない。
【0026】
第2の内部変数更新停止判定ステップ603では、U2が偶数か奇数かを判定する。ここでU2が奇数と判定された時は、変数U1、U2の更新を停止し次の処理に移る。第2の内部変数更新ステップ604では、内部変数U1、U2を2で割る。但し第1の内部変数更新ステップ602と同様U1については剰余体上において2で割る処理を行う。
【0027】
ここまでの内部変数更新処理において、U2、V2のどちらかは必ず奇数であり、U1、U2の更新、もしくは、V1、V2の更新のどちらかしか行われない。従って、これらの処理が図2の内部変数Wの演算(201)と内部変数Wの値を乗算する演算処理(202の一部)に対応する。
【0028】
次に第3の内部変数更新ステップ605において、U1、U2、もしくはV1、V2の内部変数を更新する。この処理は図2の減算(202の一部)、及び内部変数U1、U2、V1、V2の更新処理(203、204)に対応する。
【0029】
この方法は多精度の乗除算を行わなくて済むという特徴があるが、その分ユークリッド互除法に比べ実行速度が遅くなる。また、ここに示したフローチャートは、法の値を奇数と限定した時のものであるが、必要な内部変数が4つで良いという特徴がある。即ち、単精度が32ビットで、法の値が1024ビットのRSA暗号の場合4×32=128ワードのワークメモリがあれば良い。
【0030】
法の値が偶数の場合、図6の詳細フローチャート中、第1の内部変数更新ステップ602、第2の内部変数更新ステップ604、第3の内部変数更新ステップ605が異なってくる。図7は、法の値が偶数の時の、第1の内部変数更新停止判定ステップから第1の内部変数更新ステップにかけての詳細フロー図である。図で見ると分かるように、V3という新たな内部変数を用い、その値も内部変数として更新する形となる。第2の内部変数更新ステップ、第3の内部変数更新ステップの詳細フロー図は省略するが、同様にU3という新たな内部変数も必要となってくる。即ち法の値が偶数の時には、さらにU3、V3といった2つの内部変数の追加が必要になり、必要な多精度の内部変数の数は6つとなる。即ち、単精度が32ビットで、法の値が1024ビットのRSA暗号の場合、192ワードのワークメモリを必要とする。
【0031】
【発明が解決しようとする課題】
これらの従来の技術を見てみると、RSA暗号の鍵対生成処理に必要となる逆元演算では、法の値が偶数の逆元演算を行わなければならず、少なくとも内部変数として多精度変数が6つ必要であった。これは、例えばICカードのようにメモリ容量に制限がある環境での実装を困難にする要因であった。一方、法の値が奇数の時に逆元を求める方法として、多精度変数が4つでよい変数削減版拡張バイナリユークリッド互除法があった。しかしこの変数削減版拡張バイナリユークリッド互除法はRSA暗号の鍵対生成処理には使えないという課題があった。
【0032】
そこで本発明はかかる問題点に鑑みてなされたものであり、法の値が偶数のときの逆元演算を、法の値が奇数の時の変数削減版拡張バイナリユークリッド互除法を利用して行うことを目的とする。即ち多精度の内部変数の数を4つにとどめながらRSA暗号の鍵対生成で使われる逆元演算を行うことを目的とする。多精度の内部変数は、ハードウェア回路を作成する際、通常メモリ領域として実装するため、少ないメモリ量でRSA暗号の鍵対生成を実行することも目的となる。
【0033】
【課題を解決するための手段】
この課題を解決するために本発明に係る逆元演算装置は、法の値が偶数である剰余環上の逆元を求める逆元演算装置であって、256ビット幅以上の4つの変数を記憶する多精度記憶手段と、偶数である法N、及び逆元を求める被演算値Aを受け取り、前記被演算値Aが前記法N未満であるか否かを判定し、前記N未満である場合に、前記法Nと前記被演算値Aを前記多精度記憶手段に格納する入力手段と、前記多精度記憶手段に記憶された前記法Nの値を変数Mの値として設定し、前記Mを前記多精度記憶手段に格納し、前記多精度記憶手段に記憶された前記Mを最下位ビットが1となるように右へtビットシフトする法分割手段と、前記多精度記憶手段に記憶された前記被演算値Aとシフト後の前記Mを用いて、前記Mを法とした剰余環上の前記被演算値Aの逆元X1を演算によって算出し、前記X1を前記多精度記憶手段に格納する第1逆元演算手段と、前記法分割手段から前記tの値を受け取り、前記多精度記憶手段に記憶された前記被演算値Aを用いて、前記被演算値Aの下位tビットの値を被演算値Bの値として設定し、2tを法とした剰余環上の前記被演算値Bの逆元X2を演算によって算出する第2逆元演算手段と、前記第2逆元演算手段から演算された前記X2を受け取り、前記多精度記憶手段に記憶された前記X1を用いて、前記Nを法とした剰余環上の前記被演算値Aの逆元を演算によって算出する合成演算手段を備えたことを特徴とする。
【0034】
また、本発明に係る逆元演算装置は、法の値が偶数である剰余環上の逆元を求める逆元演算装置であって、前記特徴に加え、前記第1逆元演算手段は、前記被演算値Aの逆元が存在しないと判断した場合に、前記合成演算手段にエラーを通知し、前記合成演算手段は、前記第1逆元演算手段からエラーが通知された時、前記逆元Xを算出する演算を行わないことを特徴とする。
【0036】
【発明の実施の形態】
以下、本発明の実施の形態について、図面を用いて説明する。
【0037】
(実施の形態1)
図8は、本発明における、入力値Aに対して、偶数であるNを法とした剰余環上の逆元を求める逆元演算方法の、大きな流れをフローチャートにしたものである。801は入力処理で、逆元演算対象となる値の入力を行う。802は法分割処理で、入力処理で入力された値のうち法の値を、以降の処理で使用できるように分割する。803は第1逆元演算処理で、法分割処理802で分割された一方の値を用い、第1の部分的な逆元を求める。804は第2逆元演算処理で、法分割処理802で分割された値のうち、第1逆元演算処理803で用いなかった値を用い、第2の部分的な逆元を用いる。なお、この実施の形態では第1逆元演算処理、第2逆元演算処理の順序で処理を行っているが、逆の順序で処理を行っても良い。またこの二つの処理は独立して実行できるため、同時に並列に処理を行っても良い。805は合成演算処理で、第1逆元演算処理803と第2逆元演算処理804で求められた二つの部分的な逆元を合成し、入力値に対する逆元を求める。806は出力処理で、求められた逆元を出力する。各処理の詳細を以降に説明する。
【0038】
図9は、図8における入力処理801の詳細フローチャートである。901は値入力ステップで、逆元を求める剰余環の法の値としてNを、逆元を求める被演算値としてAを入力する。但しここではAを奇数、Nを偶数とする。902は入力値検証ステップで、値入力ステップで入力された被演算値が法Nより小さい値であるかを検証する。903は入力値補正ステップで、入力値検証ステップ902で入力値Aが法の値N以上であると判定された場合にのみ、剰余演算を行うことで被演算値をN未満に補正する。なお、この実施の形態では被演算値として入力される値が奇数であるという限定を行ったが、任意の値を被演算値として入力し、その値が偶数の場合には出力処理でエラー出力を行っても良い。
【0039】
図10は、図8における法分割処理802の詳細フローチャートである。1001は分割値初期設定ステップで、変数tの値を0に、変数Mの値をNに初期設定する。1002は分割値更新ステップで、tの値を1増加させ、Mの値を右に1ビットシフトする。右へ1ビットシフトすることは、2で割ることと同じ処理である。ここで、入力された値Nは必ず偶数である。従って初期状態での値Mも必ず偶数となり、1002の分割値更新ステップを最初に通る時、Mを1ビット右シフトする、即ち2で割ることは、必ず実行可能である。1003は分割値更新終了判定ステップで、Mの最下位ビットを判定する。Mの最下位ビットが0の場合は、再び分割値更新ステップに戻る。分割値更新ステップ1002と分割値更新終了判定ステップ1003により、逆元を求める剰余環の法Nを、N=M×2tとなるMとtに分割する処理が行われる。なお、この実施の形態では分割値のために新たな変数を用いたが、Nは以降の処理では使用しないため、Mの代わりにNを用い、分割値更新ステップ1002でNの値を更新し、分割値更新終了判定ステップ1003でNの最下位ビットを判定するとしても良い。
【0040】
図11は、図8における第1逆元演算処理803の詳細フローチャートである。1101は第1被演算値補正ステップで、法分割処理802で求めた分割値のうちMを用い、A mod Mの値をCに設定する。1102は第1部分逆元演算ステップで、Mを法とした剰余環上のCの逆元を演算する。Mは奇数となるため、従来技術の拡張バイナリユークリッド互除法を用いることができるが、Mを法とした剰余集合は、体ではなく環であるため、逆元が存在しない場合がある。従って、逆元が存在しない時X1を0に、逆元が存在する時X1をその値(C(-1) mod M)に設定する。なお、この実施の形態では、第1部分逆元演算ステップ1102における逆元演算方法として、従来技術の拡張バイナリユークリッド互除法を用いたが、他の従来技術を用いても良い。またこの実施の形態では被演算値の補正値のために新たな変数を用いたが、Aは下位tビットを除いて以降の処理では使用しない。従って下位tビットを保持しておけば、Cの代わりにAを用い逆元の演算を行っても良い。
【0041】
図12は、図8における第2逆元演算処理804の詳細フローチャートである。1201は分割値判定ステップで、法分割処理802で求めた分割値のうちtの値が8以下であるかどうかを確認する。8以下の場合、以降の処理が1バイト値の演算となるためである。1202は第2被演算値補正ステップで、Aの下位tビットをBに設定する。1203は第2部分逆元演算ステップで、分割値判定ステップ1201でtの値が8以下の時、従来技術の拡張ユークリッド互除法を用いて、2tを法とした剰余環上のBの逆元を演算しX2に設定する。1204は演算不能値設定ステップで、分割値判定ステップ1201でtの値が8より大きい時、X2に0を設定する。なお、この実施の形態では、単精度を8ビット値として分割値判定ステップの判定条件を定めたが、使用する計算機の精度に合わせ判定条件の値を8以外の値(16、32など)にしても良い。また、使用する計算機が高速で多精度の演算処理が可能な時などに、分割値判定ステップ1201、演算不能値設定ステップ1204を行わず、常に第2被演算値補正ステップ1202、第2部分逆元演算ステップ1203を実行する構成としても良い。また、第2部分逆元演算ステップ1203における逆元演算方法として、従来技術の拡張ユークリッド互除法を用いたが、他の従来技術を用いても良い。
【0042】
図13は、図8における合成演算処理805の詳細フローチャートである。1301は合成判定ステップで、X1の値、及びX2の値が0以外の時次のステップを実行する。1302は中国人の剰余定理演算ステップで、これまでの処理で求めた値を、中国人の剰余定理に適用し、求める逆元を演算する。中国人の剰余定理は、例えば文献「暗号処理入門」(岡本栄司著、共立出版、1993)のp.10に詳しく述べられている。具体的には、2tを法とした剰余環上のMの逆元を求めY1とし、X2−X1に対し2tの剰余をY2とし、2tを法とした剰余環上のY1×Y2の値とMの積にX1を加算することで、入力値AのNを法とした剰余環上の逆元Xを求める。
【0043】
図14は、図8における出力処理806の詳細フローチャートである。1401は第1エラー判定ステップで、X1が0かどうか判定する。1402は第1エラー出力ステップで、第1エラー判定ステップ1401でX1が0と判定された時、求める逆元が存在しない旨のエラーを出力する。1403は第2エラー判定ステップで、第1エラー判定ステップ1401でX1が0でないと判定された時、X2が0かどうか判定する。1404は第2エラー出力ステップで、第2エラー判定ステップ1403でX2が0と判定された時、2tの値が単精度を超えたため演算できない旨のエラーを出力する。1405は逆元出力ステップで、第2エラー出力ステップでX2が0でないと判定された時、合成演算処理805で計算されたXの値を求める逆元として出力する。
【0044】
図15は、本発明における逆元演算装置の全体構成図である。1501は入力部で、図9のアルゴリズムに従って被演算値Aと剰余環の法の値Nを入力する。被演算値Aは、後述する第1逆元演算部と第2逆元演算部に送信する。法の値Nは、後述する法分割部に送信する。1502は法分割部で、図10のアルゴリズムに従い、法NをN=M×2t(Mは奇数)を満たすMとtに分割する。値Mは後述する第1逆元演算部に送信する。値tは後述する第2逆元演算部に送信する。
【0045】
1503は第1逆元演算部で、図11のアルゴリズムに従い、X1=A(-1) mod Mを満たすX1を求める。値X1は後述する合成演算部に送信する。1504は第2逆元演算部で、図12のアルゴリズムに従い、X2=A(-1) mod 2tを満たすX2を求める。値X2は後述する合成演算部に送信する。
【0046】
1505は合成演算部で、図13のアルゴリズムに従い、法の値がNである剰余環上のAの逆元値Xを求める。値Xは後述する出力部に送信する。1506は出力部で求めた値Xを出力する。
【0047】
なお、この実施の形態ではエラー処理に関する部分を省略したが、図9〜図13のアルゴリズムによるエラー判定を入力部1501、第1逆元演算部1503、第2逆元演算部1504、合成演算部1505で行い、その結果をエラー情報として出力部1506に送信するとしても良い。そして出力部1506では送信されたエラー情報に従ってエラー値を出力するとしても良い。
【0048】
図18は、本発明における逆元演算方法で用いられる変数の数を、従来方法と合わせて表にしたものである。多精度変数は、例えば256ビット幅など、大きな領域を取る変数である、単精度変数は、例えば8ビット幅など、小さな領域を取る変数である。本発明による方法では第1の逆元演算処理では拡張バイナリユークリッド互除法を、第2の演算処理では拡張ユークリッド互除法を使用した場合の変数の数を表している。本発明による方法では中国人の剰余定理を使って最後に合成を行っているが、その時の変数は第1の逆元演算処理で一時的に使っていたものを再利用すれば良い。従って、全体として必要なのは拡張バイナリユークリッド互除法における多精度変数(4つ)と、拡張ユークリッド互除法における単精度変数(7つ)になる。
【0049】
(実施の形態2)
図16は、本発明におけるRSA鍵対生成方法の流れをフローチャートにしたものである。1601は素数取得処理で、従来技術を用い、異なる素数p、qを取得する。1602は法演算処理で、素数取得処理1601で得られた素数を用い(p−1)と(q−1)の積を求め法の値Nとする。なお、この実施の形態では(p−1)、(q−1)の積を法Nの値としたが、(p−1)、(q−1)の最小公倍数を法Nと値としても良い。
【0050】
1603は公開鍵取得処理で、従来技術を用い小さいビット数(8ビット程度)の奇数乱数を取得し値eとする。なお、この実施の形態では値eとして奇数乱数を取得したが、奇数値を入力する形としても良い。
【0051】
1604は逆元演算処理で、実施の形態1を用い、偶数を法とした剰余環上の逆元を求める。
【0052】
1605は繰り返し制御処理で、逆元演算処理1604の結果がエラーである時、公開鍵取得処理1603と逆元演算処理1604を再び行う。逆元演算処理1604の結果が正常の時、次の処理にすすむ。なお、この実施の形態では逆元演算処理の結果がエラーである時、公開鍵取得処理を行う形としたが、公開鍵取得処理の代わりに、素数取得処理と法演算処理を行う形としても良い。
【0053】
1606は鍵対出力処理で、これまでの処理で得られた結果を元にRSA公開鍵、RSA秘密鍵の値を計算し出力する。
【0054】
図17は、本発明におけるRSA鍵対生成装置の全体構成図である。1701は素数取得部で、従来技術を用い、異なる素数p、qを取得する。素数p、qは、後述する法演算部と鍵対出力部に送信する。1702は法演算部で、(p−1)と(q−1)の積を法Nの値とする。法Nは後述する逆元演算部に送信する。なお、この実施の形態では法Nの値を(p−1)と(q−1)の積としたが、この二つの値の最小公倍数としても良い。
【0055】
1703は公開鍵取得部で、従来技術を用い小さいビット数(8ビット程度)の奇数乱数を取得し値eとする。値eは後述する逆元演算部と鍵対出力部に送信する。なお、この実施の形態では値eとして奇数乱数を取得したが、奇数値を入力する公開鍵入力部としても良い。
【0056】
1704は逆元演算部で、偶数を法とした剰余環上の逆元d=e(-1) modNを求める。この逆元演算部の詳細が、実施の形態1で説明したものになり、その構成図が図15となる。
【0057】
1705は繰り返し制御部で、逆元演算部の結果を受け、逆元演算部が正常出力を行った時、後述する鍵対出力部を動作させ、逆元演算部がエラー出力を行った時、公開鍵取得部と逆元演算部を再び動作させる。なお、この実施の形態では逆元演算部がエラー出力を行った時、公開鍵取得部と逆元演算部を再び動作させる形としたが、素数取得部と法演算部と逆元演算部を再び動作させる形としても良い。また逆元演算部がエラー出力を行った時、後述する鍵対出力部においてエラー出力を行うように制御しても良い。
【0058】
1706は鍵対出力部で逆元演算部が正常出力を行った時、RSA公開鍵の値として(e、p×q)を、RSA秘密鍵の値として(d、p、q)を出力する。
【0059】
(実施の形態3)
図19は、本発明によるRSA鍵生成装置を組み込んだメッセージ送受信システム例である。(a)はメッセージにRSA署名を付加する場合である。1901はメッセージ送信装置で、メッセージをメッセージ受信装置に送信する。またこの装置はRSA署名を行うための機構を組み込んでいる。1902はメッセージ受信装置で、メッセージをメッセージ送信装置から受信する。またこの装置は、RSA署名検証を行うための機構を組み込んでいる。1903はメッセージ送信装置に組み込まれたRSA署名装置で、メッセージからRSA署名を生成する。その際RSA秘密鍵を必要とする。1904はRSA検証装置で、RSA署名を検証する。その際メッセージ送信装置のRSA公開鍵を必要とする。1905は本発明によるRSA鍵生成装置で、RSA公開鍵、秘密鍵のペアを生成し、RSA署名装置にRSA秘密鍵を、RSA検証装置にRSA公開鍵を提供する。
【0060】
この構成により、メッセージ送信装置は、RSA鍵生成を行い、メッセージにRSA署名を行うと共に、署名とRSA公開鍵をメッセージ受信装置に送信する。メッセージ装置は、受け取った情報からRSA署名検証を行うことでメッセージを復元し、送信者と送信されてきたメッセージを認証することができる。
【0061】
(b)はメッセージをRSA暗号化する場合である。1906はメッセージ送信装置で、メッセージをRSA暗号化してメッセージ受信装置に送信する。1907はメッセージ受信装置で、暗号化メッセージをメッセージ送信装置から受信し復号する。1908はメッセージ送信装置に組み込まれたRSA暗号装置で、メッセージをRSA暗号する。その際メッセージ受信装置のRSA公開鍵を必要とする。1909はRSA復号装置で、暗号メッセージをRSA復号する。その際RSA秘密鍵を必要とする。1910は本発明によるRSA鍵生成装置で、RSA公開鍵、秘密鍵のペアを生成し、RSA暗号装置にRSA公開鍵を、RSA復号装置にRSA秘密鍵を提供する。
【0062】
この構成により、メッセージ送信装置は、受け取ったRSA公開鍵を用い、メッセージの暗号化を行い、暗号化メッセージをメッセージ受信装置に送信する。メッセージ装置は、RSA鍵生成を行い、RSA公開鍵をメッセージ送信装置に渡すと共に、受信した暗号化メッセージを復号することで秘匿通信を行うことができる。
【0063】
【発明の効果】
以上のように本発明によれば、図11〜図13に示したように、逆元の演算を、法が奇数の時の拡張バイナリユークリッド互除法、単精度の拡張ユークリッド互除法、中国人の剰余定理の演算のみで行うことができる。また図15に示したように、逆元演算装置を、上記3つの演算を行う手段を備えた構成とすることができる。従って、従来の方法と比較した変数の数が、図18に示した表のようになり、ハードウェアに適した制御のみで、メモリ量を少なくした逆元演算装置となる。
【0064】
また、図16、17に示したように、上記逆元演算方法を用いたRSA鍵生成方法とし、上記逆元演算装置によって構成されたRSA鍵生成装置とすることができる。従って、ハードウェアに適した制御のみで、メモリ量を少なくしたRSA鍵生成装置となる。
【図面の簡単な説明】
【図1】従来のユークリッド互除法による逆元演算処理のフローチャート
【図2】従来のユークリッド互除法のユークリッド互除法演算処理詳細フローチャート
【図3】従来のレーマ法による逆元演算処理の全体フローチャート
【図4】従来のレーマ法のレーマ演算処理詳細フローチャート
【図5】従来のバイナリユークリッド互除法による逆元演算処理の全体フローチャート
【図6】従来のバイナリユークリッド互除法のバイナリユークリッド互除法演算処理詳細フローチャート
【図7】従来のバイナリユークリッド互除法で入力された法の値が偶数の時の演算処理詳細フローチャート
【図8】本発明の実施の形態1による逆元演算処理の全体フローチャート
【図9】本発明の実施の形態1による入力処理詳細フローチャート
【図10】本発明の実施の形態1による法分割処理詳細フローチャート
【図11】本発明の実施の形態1による第1逆元演算処理詳細フローチャート
【図12】本発明の実施の形態1による第2逆元演算処理詳細フローチャート
【図13】本発明の実施の形態1による合成演算処理詳細フローチャート
【図14】本発明の実施の形態1による出力処理詳細フローチャート
【図15】本発明の実施の形態1による逆元演算装置の全体構成図
【図16】本発明の実施の形態2によるRSA鍵対生成処理の全体フローチャート
【図17】本発明の実施の形態2によるRSA鍵対生成装置の全体構成図
【図18】本発明の実施の形態1と従来方法で使用する変数の数を表す比較図
【図19】本発明の実施の形態3によるメッセージ送受信システムの全体構成図
【符号の説明】
1501 入力部
1502 法分割部
1503 第1逆元演算部
1504 第2逆元演算部
1505 合成演算部
1506 出力部
1701 素数取得部
1702 法演算部
1703 公開鍵取得部
1704 逆元演算部
1705 繰り返し制御部
1706 鍵対出力部
1901 メッセージ送信装置
1902 メッセージ受信装置
1903 RSA署名装置
1904 RSA検証装置
1905 RSA鍵生成装置
1906 メッセージ送信装置
1907 メッセージ受信装置
1908 RSA暗号装置
1909 RSA復号装置
1910 RSA鍵生成装置[0001]
BACKGROUND OF THE INVENTION
The present invention relates to an inverse element computing apparatus and method for computing an inverse element in a remainder ring having an even number of modulus. The present invention also relates to an RSA key generation apparatus and method for generating an RSA key pair that is a public key algorithm.
[0002]
[Prior art]
A higher security can be ensured by generating an RSA encryption key pair in each device. This is because the secret key is not out of the device as compared with a method in which the center generates a key pair and distributes it to the device. In particular, in an IC card system in which high security is required for the device itself, it is necessary to efficiently generate an RSA encryption key pair in an IC card in which computational resources are limited.
[0003]
Usually, the RSA encryption key pair generation method is performed by the following procedure.
[0004]
(1) Generate prime numbers p and q. Let n = p × q.
[0005]
(2) 1 ≦ e: odd number <L = LCM (p−1, q−1) is determined, and an inverse element d of e is obtained (LCM is the least common multiple).
[0006]
(3) Publish (n, e) and keep (p, q, d) secret.
[0007]
In this procedure, the calculation of e to d in (2) requires an inverse operation on the remainder ring modulo L.
[0008]
In the following, the conventional inverse element calculation will be described, and it is assumed that the inverse element calculation is implemented on a device with limited calculation resources.
・ Insufficient memory capacity to store internal variables
・ Simple control
We evaluate from the viewpoint of.
[0009]
As the inverse element calculation method on the remainder ring, the Euclidean mutual division method, the Reemer method, the binary Euclidean mutual division method, and the like are known. For example, the document “Introduction to Cryptographic Processing” (Eiji Okamoto, Kyoritsu Shuppan, 1993) p. 8 describes an algorithm of the Euclidean mutual division method. Based on this description, an algorithm for obtaining an inverse element on the remainder ring using the Euclidean algorithm will be described.
[0010]
FIG. 1 is a flowchart of the algorithm disclosed in the above-mentioned document, and obtains an inverse element on a remainder ring modulo p for an input value A.
[0011]
First, in
[0012]
FIG. 2 is a flowchart showing details of the Euclidean
[0013]
Outputting a correct value by this method is described in the above-mentioned document and the like, and is omitted here. A feature of this method is that multi-precision division is used to update internal variables. Another example is that seven multi-precision variable storage areas are required as internal variables for storing intermediate values. Considering an RSA cipher with a single precision of 32 bits and a modulo value of 1024 bits, these seven multi-precision variables require 7 × 32 = 224 words of work memory.
[0014]
Next, another conventional example will be described. The Römer method is an improved version of the Euclidean algorithm, and the number of multi-precision multiplications is reduced by using single-precision division. For example, in the document “HANDBOOK of APPLYED CRYPTOGRAPHY” (Alfred J. Menezes et al., CRC Press, 1997), p. Reference numeral 607 describes an algorithm of the reaming method. However, it is described here as an algorithm for obtaining GCD, not an algorithm for obtaining an inverse element on the remainder ring. Also, p. 67 describes an extension method for obtaining an inverse element on the remainder ring when GCD is 1 from the Euclidean mutual division method for obtaining GCD. Therefore, based on these two descriptions, it is possible to derive an algorithm for obtaining an inverse element on the remainder ring using the reamer method. Here, an algorithm of the reaming method based on the two description methods will be described.
[0015]
FIG. 3 is a flowchart of the algorithm of the Reemer method. For the input value A, the inverse element on the remainder ring modulo p is obtained. As can be seen from the comparison with FIG. 1, except for the part that updates the internal variable, it is exactly the same as the Euclidean algorithm.
[0016]
FIG. 4 is a detailed flowchart of the reamer calculation step of FIG. In FIG. 4, variables starting with uppercase letters indicate multi-precision values, and variables starting with lowercase letters indicate single-precision values. Here, the single precision is an arithmetic unit determined when the reamer is operated, and values such as 8, 16, 32, and 64 are usually used.
[0017]
[0018]
[0019]
This method is characterized in that by repeating the single precision
[0020]
Japanese Patent Application No. 2001-092481 describes an improved reamer method using approximate values without performing multi-precision division. However, this method still has the same complicated control as the normal reaming method. In addition, the number of multi-precision internal variables is reduced by not performing multi-precision division, but six are still required. That is, 6 × 32 = 192 words of work memory is required for RSA cryptography having a single precision of 32 bits and a modulo value of 1024 bits.
[0021]
Next, another conventional Euclidean binary Euclidean algorithm will be described. In the Euclidean algorithm, multiplication / division is required in the Euclidean
[0022]
For example, in the document “HANDBOOK of APPLYED CRYPTOGRAPHY” (Alfred J. Menezes et al., CRC Press, 1997), p. Reference numeral 608 describes an algorithm of binary Euclidean algorithm. FIGS. 5 to 7 are flowcharts showing an algorithm for obtaining an inverse element on the remainder ring using the binary Euclidean algorithm. The binary Euclidean mutual division method will be described using these figures. Since the binary Euclidean algorithm is an improvement of the Euclidean algorithm, the correspondence with each step in FIG.
[0023]
FIG. 5 is a diagram showing a large flow of binary Euclidean mutual division, and obtains an inverse element on a remainder ring modulo p for input value A. However, here, p is limited to an odd number. As can be seen from the comparison with FIG. 1, except for the part that updates the internal variable, it is exactly the same as the Euclidean algorithm.
[0024]
FIG. 6 is a detailed flowchart of the binary Euclidean algorithm division calculation step. The first internal variable update
[0025]
In a first internal variable update
[0026]
In a second internal variable update
[0027]
In the internal variable update processing so far, either U2 or V2 is always an odd number, and only U1 or U2 update or V1 or V2 update is performed. Therefore, these processes correspond to the calculation process (201) of the internal variable W in FIG.
[0028]
Next, in a third internal
[0029]
This method has a feature that multi-precision multiplication / division need not be performed. However, the execution speed is slower than that of the Euclidean algorithm. The flowchart shown here is for a case where the value of the modulo is limited to an odd number, but has a feature that only four internal variables are required. That is, in the case of RSA encryption with a single precision of 32 bits and a modulo value of 1024 bits, a work memory of 4 × 32 = 128 words is sufficient.
[0030]
When the modulus value is an even number, the first internal
[0031]
[Problems to be solved by the invention]
Looking at these conventional techniques, in the inverse element operation required for the key pair generation process of RSA encryption, an inverse element operation with an even value of the modulus must be performed, and at least a multi-precision variable as an
[0032]
Therefore, the present invention has been made in view of such a problem, and performs an inverse operation when the modulus value is an even number using a variable-reduced version extended binary Euclidean algorithm when the modulus value is an odd number. For the purpose. That is, an object of the present invention is to perform an inverse element calculation used in RSA encryption key pair generation while keeping the number of multi-precision internal variables at four. Since the multi-precision internal variable is mounted as a normal memory area when creating a hardware circuit, it is also an object to execute RSA encryption key pair generation with a small amount of memory.
[0033]
[Means for Solving the Problems]
In order to solve this problem, an inverse element arithmetic apparatus according to the present invention is an inverse element arithmetic apparatus for obtaining an inverse element on a remainder ring whose modulus value is an even number, Multi-precision storage means for storing four variables having a width of 256 bits or more; The modulus N is an even number, and the operand value to find the inverse A is received, and it is determined whether the operand value A is less than the modulus N. If the operand value A is less than N, the modulus N and the operand value A are stored in the multi-precision storage means. Input means; The value of the modulus N stored in the multi-precision storage means is set as the value of the variable M, the M is stored in the multi-precision storage means, and the M stored in the multi-precision storage means is the least significant bit. Shift t bits to the right so that becomes 1. Legal division means; Using the operand value A and the shifted M stored in the multi-precision storage means, Remainder ring modulo M The inverse element X1 of the operand value A is calculated by calculation, and the X1 is stored in the multi-precision storage means. First inverse element calculation means; The value of t is received from the legal division means, and the operand value A stored in the multi-precision storage means is used. Lower t bits of the operand value A Is set as the value of operand B, 2 t On the remainder ring The inverse element X2 of the operand value B is calculated by calculation A second inverse element calculation means; The X2 calculated from the second inverse element calculation means is received, and the X1 stored in the multi-precision storage means is used. On the remainder ring modulo N The operand value A Calculate the inverse of Calculated by Combining operation means The It is characterized by having.
[0034]
An inverse element calculation apparatus according to the present invention is an inverse element calculation apparatus for obtaining an inverse element on a remainder ring whose modulus value is an even number. When the first inverse element calculation means determines that no inverse element of the operand value A exists, the first inverse element calculation means notifies the synthesis calculation means of an error, and the combination calculation means receives the first inverse element calculation means from the first inverse element calculation means. When an error is notified, the calculation to calculate the inverse element X is not performed. It is characterized by that.
[0036]
DETAILED DESCRIPTION OF THE INVENTION
Hereinafter, embodiments of the present invention will be described with reference to the drawings.
[0037]
(Embodiment 1)
FIG. 8 is a flowchart showing a large flow of the inverse element calculation method for obtaining the inverse element on the remainder ring modulo N that is an even number with respect to the input value A in the present invention.
[0038]
FIG. 9 is a detailed flowchart of the
[0039]
FIG. 10 is a detailed flowchart of the legal division processing 802 in FIG. A division value
[0040]
FIG. 11 is a detailed flowchart of the first inverse
[0041]
FIG. 12 is a detailed flowchart of the second inverse
[0042]
FIG. 13 is a detailed flowchart of the
[0043]
FIG. 14 is a detailed flowchart of the
[0044]
FIG. 15 is an overall configuration diagram of the inverse element calculation apparatus according to the present invention.
[0045]
[0046]
[0047]
In this embodiment, the portion related to error processing is omitted, but error determination by the algorithm of FIGS. 9 to 13 is performed by the
[0048]
FIG. 18 is a table showing the number of variables used in the inverse element calculation method according to the present invention together with the conventional method. A multi-precision variable is a variable that takes a large area, such as 256-bit width, and a single-precision variable is a variable that takes a small area, such as 8-bit width. In the method according to the present invention, the number of variables when the extended binary Euclidean algorithm is used in the first inverse arithmetic processing and the extended Euclidean algorithm is used in the second arithmetic processing is shown. In the method according to the present invention, synthesis is finally performed using the Chinese remainder theorem, but the variables used at that time may be reused in the first inverse element calculation process. Accordingly, what is required as a whole is multi-precision variables (four) in the extended binary Euclidean algorithm and single-precision variables (seven) in the extended Euclidean algorithm.
[0049]
(Embodiment 2)
FIG. 16 is a flowchart showing the flow of the RSA key pair generation method in the present invention.
[0050]
[0051]
[0052]
[0053]
[0054]
FIG. 17 is an overall configuration diagram of an RSA key pair generation device according to the present invention.
[0055]
A public
[0056]
[0057]
1705 is a repetitive control unit, which receives the result of the inverse operation unit, and when the inverse operation unit performs normal output, operates the key pair output unit described later, and when the inverse operation unit performs error output, The public key acquisition unit and the inverse element calculation unit are operated again. In this embodiment, when the inverse element calculation unit outputs an error, the public key acquisition unit and the inverse element calculation unit are operated again, but the prime number acquisition unit, the modulus calculation unit, and the inverse element calculation unit are It may be configured to operate again. Further, when the inverse operation unit outputs an error, control may be performed so that an error is output in a key pair output unit described later.
[0058]
1706 is a key pair output unit which outputs (e, p × q) as the RSA public key value and (d, p, q) as the RSA private key value when the inverse operation unit performs normal output. .
[0059]
(Embodiment 3)
FIG. 19 shows an example of a message transmission / reception system incorporating the RSA key generation apparatus according to the present invention. (A) is a case where an RSA signature is added to a message.
[0060]
With this configuration, the message transmission device performs RSA key generation, performs an RSA signature on the message, and transmits the signature and the RSA public key to the message reception device. The message device restores the message by performing RSA signature verification from the received information, and can authenticate the message transmitted with the sender.
[0061]
(B) is a case where the message is RSA encrypted.
[0062]
With this configuration, the message transmitting apparatus encrypts the message using the received RSA public key, and transmits the encrypted message to the message receiving apparatus. The message device performs RSA key generation, passes the RSA public key to the message transmission device, and can perform confidential communication by decrypting the received encrypted message.
[0063]
【The invention's effect】
As described above, according to the present invention, as shown in FIGS. 11 to 13, the inverse operation is performed using the extended binary Euclidean algorithm when the modulus is odd, the single-precision extended Euclidean algorithm, the Chinese This can be done only with the remainder theorem. Further, as shown in FIG. 15, the inverse element arithmetic unit can be configured to include means for performing the above three arithmetic operations. Therefore, the number of variables compared with the conventional method is as shown in the table shown in FIG. 18, and the inverse element arithmetic unit with a reduced memory amount is obtained only by control suitable for hardware.
[0064]
As shown in FIGS. 16 and 17, the RSA key generation method using the inverse element calculation method can be used, and the RSA key generation apparatus configured by the inverse element calculation device can be used. Therefore, an RSA key generation device with a reduced memory amount only by control suitable for hardware is obtained.
[Brief description of the drawings]
FIG. 1 is a flowchart of inverse element calculation processing by a conventional Euclidean algorithm.
FIG. 2 is a detailed flowchart of Euclidean algorithm calculation processing of a conventional Euclidean algorithm.
FIG. 3 is an overall flowchart of inverse element calculation processing by a conventional reamer method.
FIG. 4 is a detailed flowchart of reaming calculation processing of a conventional reaming method.
FIG. 5 is an overall flowchart of inverse element calculation processing by a conventional binary Euclidean algorithm.
FIG. 6 is a detailed flowchart of binary Euclidean algorithm calculation processing of a conventional binary Euclidean algorithm.
FIG. 7 is a detailed flowchart of arithmetic processing when the value of the modulus input by the conventional binary Euclidean algorithm is an even number;
FIG. 8 is an overall flowchart of inverse element calculation processing according to
FIG. 9 is a detailed flowchart of input processing according to the first embodiment of the present invention.
FIG. 10 is a detailed flowchart of legal division processing according to
FIG. 11 is a detailed flowchart of first inverse element calculation processing according to
FIG. 12 is a detailed flowchart of second inverse element calculation processing according to
FIG. 13 is a detailed flowchart of a synthesis calculation process according to the first embodiment of the present invention.
FIG. 14 is a detailed flowchart of output processing according to the first embodiment of the present invention.
FIG. 15 is an overall configuration diagram of an inverse element computing device according to
FIG. 16 is an overall flowchart of RSA key pair generation processing according to
FIG. 17 is an overall configuration diagram of an RSA key pair generation device according to
FIG. 18 is a comparison diagram showing the number of variables used in the first embodiment of the present invention and the conventional method.
FIG. 19 is an overall configuration diagram of a message transmission / reception system according to a third embodiment of the present invention.
[Explanation of symbols]
1501 Input section
1502 Legal division
1503 First inverse operation unit
1504 Second inverse element calculation unit
1505 Compositing operation unit
1506 Output unit
1701 Prime number acquisition unit
1702 Legal operation part
1703 Public key acquisition unit
1704 Inverse operation unit
1705 Repeat control unit
1706 Key pair output unit
1901 Message sending device
1902 message receiver
1903 RSA signature device
1904 RSA verification system
1905 RSA key generator
1906 Message sending device
1907 Message receiver
1908 RSA encryption device
1909 RSA decoder
1910 RSA key generator
Claims (12)
256ビット幅以上の4つの変数を記憶する多精度記憶手段と、
偶数である法N、及び逆元を求める被演算値Aを受け取り、前記被演算値Aが前記法N未満であるか否かを判定し、前記N未満である場合に、前記法Nと前記被演算値Aを前記多精度記憶手段に格納する入力手段と、
前記多精度記憶手段に記憶された前記法Nの値を変数Mの値として設定し、前記Mを前記多精度記憶手段に格納し、前記多精度記憶手段に記憶された前記Mを最下位ビットが1となるように右へtビットシフトする法分割手段と、
前記多精度記憶手段に記憶された前記被演算値Aとシフト後の前記Mを用いて、前記Mを法とした剰余環上の前記被演算値Aの逆元X1を演算によって算出し、前記X1を前記多精度記憶手段に格納する第1逆元演算手段と、
前記法分割手段から前記tの値を受け取り、前記多精度記憶手段に記憶された前記被演算値Aを用いて、前記被演算値Aの下位tビットの値を被演算値Bの値として設定し、2tを法とした剰余環上の前記被演算値Bの逆元X2を演算によって算出する第2逆元演算手段と、
前記第2逆元演算手段から演算された前記X2を受け取り、前記多精度記憶手段に記憶された前記X1を用いて、前記Nを法とした剰余環上の前記被演算値Aの逆元を演算によって算出する合成演算手段を備えたことを特徴とする逆元演算装置。An inverse element arithmetic unit for obtaining an inverse element on a remainder ring whose modulus value is an even number,
Multi-precision storage means for storing four variables having a width of 256 bits or more;
A modulus N that is an even number and an operand value A for obtaining an inverse element are received, and it is determined whether the operand value A is less than the modulus N. If the operand value A is less than N, the modulus N and the Input means for storing the operand value A in the multi-precision storage means ;
The value of the modulus N stored in the multi-precision storage means is set as the value of the variable M, the M is stored in the multi-precision storage means, and the M stored in the multi-precision storage means is the least significant bit. Normal division means for shifting t bits to the right so that becomes 1 .
Using the operand value A stored in the multi-precision storage means and the shifted M, the inverse element X1 of the operand value A on the remainder ring modulo the M is calculated, First inverse element calculation means for storing X1 in the multi-precision storage means ;
The value t is received from the normal dividing means, and the value of the lower t bits of the operand value A is set as the operand value B using the operand value A stored in the multi-precision storage means. and, a second inverse calculating means for calculating by calculating the inverse element X2 of the operand values B on the remainder ring in which the 2 t modulo,
The X2 calculated from the second inverse element calculation means is received, and the X1 stored in the multi-precision storage means is used to calculate the inverse element of the operand value A on the remainder ring modulo the N. An inverse operation unit comprising a composite operation means for calculating by operation.
前記合成演算手段は、前記第1逆元演算手段からエラーが通知された時、前記逆元Xを算出する演算を行わないことを特徴とする請求項1に記載の逆元演算装置。 When the first inverse element calculation means determines that the inverse element of the operand value A does not exist, the first inverse element calculation means notifies the synthesis calculation means of an error,
2. The inverse element calculation device according to claim 1, wherein the synthesis calculation unit does not perform calculation to calculate the inverse element X when an error is notified from the first inverse element calculation unit.
偶数である法N、及び逆元を求める被演算値Aを受け取り、前記被演算値Aが前記法N未満であるか否かを判定し、前記N未満である場合に、前記法Nと前記被演算値Aを、256ビット幅以上の変数を記憶する多精度記憶部に格納する入力ステップと、
前記多精度記憶部に記憶された前記法Nの値を変数Mの値として設定し、前記Mを前記多精度記憶部に格納し、前記多精度記憶部に記憶された前記Mを最下位ビットが1となるように右へtビットシフトする法分割ステップと、
前記多精度記憶部に記憶された前記被演算値Aとシフト後の前記Mを用いて、前記Mを法とした剰余環上の前記被演算値Aの逆元X1を演算によって算出し、前記X1を前記多精度記憶部に格納する第1逆元演算ステップと、
前記法分割ステップで演算された前記tの値を受け取り、前記多精度記憶部に記憶された前記被演算値Aを用いて、前記被演算値Aの下位tビットの値を被演算値Bの値として設定し、2tを法とした剰余環上の前記被演算値Bの逆元X2を演算によって算出する第2逆元演算ステップと、
前記第2逆元演算ステップで演算された前記X2を受け取り、前記多精度記憶部に記憶された前記X1を用いて、前記Nを法とした剰余環上の前記被演算値Aの逆元Xを演算によって算出する合成演算ステップを備えたことを特徴とする逆元演算方法。An inverse element calculation method for obtaining an inverse element on a remainder ring whose modulus value is an even number,
A modulus N that is an even number and an operand value A for obtaining an inverse element are received, and it is determined whether the operand value A is less than the modulus N. If the operand value A is less than N, the modulus N and the An input step of storing the operand value A in a multi-precision storage unit that stores variables having a width of 256 bits or more ;
The value of the modulus N stored in the multi-precision storage unit is set as the value of the variable M, the M is stored in the multi-precision storage unit, and the M stored in the multi-precision storage unit is the least significant bit A normal division step that shifts t bits to the right so that becomes 1 .
Using the operand value A stored in the multi-precision storage unit and the shifted M, the inverse element X1 of the operand value A on the remainder ring modulo the M is calculated, A first inverse element calculation step of storing X1 in the multi-precision storage unit ;
The value of t calculated in the normal division step is received, and the value of the lower t bits of the operand value A is calculated from the operand value B using the operand value A stored in the multi-precision storage unit . A second inverse element calculation step for calculating the inverse element X2 of the operand B on the remainder ring modulo 2 t by calculation ,
The X2 calculated in the second inverse element calculation step is received, and the inverse element X of the operand value A on the remainder ring modulo the N using the X1 stored in the multi-precision storage unit inverse operation method characterized by comprising a synthesis calculation step of calculating a by calculation.
前記合成演算ステップは、前記第1逆元演算ステップからエラーが出力された時、前記逆元Xを算出する演算を行わないことを特徴とする請求項6に記載の逆元演算方法。 The first inverse element calculation step outputs an error when determining that there is no inverse element of the operand value A,
7. The inverse element calculation method according to claim 6 , wherein the synthesis calculation step does not perform an operation for calculating the inverse element X when an error is output from the first inverse element calculation step . 8.
偶数である法N、及び逆元を求める被演算値Aを受け取り、前記被演算値Aが前記法N未満であるか否かを判定し、前記N未満である場合に、前記法Nと前記被演算値Aを、256ビット幅以上の変数を記憶する多精度記憶部に格納する入力ステップと、
前記多精度記憶部に記憶された前記法Nの値を変数Mの値として設定し、前記Mを前記多精度記憶部に格納し、前記多精度記憶部に記憶された前記Mを最下位ビットが1となるように右へtビットシフトする法分割ステップと、
前記多精度記憶部に記憶された前記被演算値Aとシフト後の前記Mを用いて、前記Mを法とした剰余環上の前記被演算値Aの逆元X1を演算によって算出し、前記X1を前記多精度記憶部に格納する第1逆元演算ステップと、
前記法分割ステップで演算された前記tの値を受け取り、前記多精度記憶部に記憶された前記被演算値Aを用いて、前記被演算値Aの下位tビットの値を被演算値Bの値として設定し、2tを法とした剰余環上の前記被演算値Bの逆元X2を演算によって算出する第2逆元演算ステップと、
前記第2逆元演算ステップで演算された前記X2を受け取り、前記多精度記憶部に記憶された前記X1を用いて、前記Nを法とした剰余環上の前記被演算値Aの逆元Xを演算によって算出する合成演算ステップを備えたことを特徴とする逆元演算プログラム。An inverse element calculation program for causing a computer to calculate an inverse element on a remainder ring whose modulus value is an even number,
A modulus N that is an even number and an operand value A for obtaining an inverse element are received, and it is determined whether the operand value A is less than the modulus N. If the operand value A is less than N, the modulus N and the An input step of storing the operand value A in a multi-precision storage unit that stores variables having a width of 256 bits or more ;
The value of the modulus N stored in the multi-precision storage unit is set as the value of the variable M, the M is stored in the multi-precision storage unit, and the M stored in the multi-precision storage unit is the least significant bit A normal division step that shifts t bits to the right so that becomes 1 .
Using the operand value A stored in the multi-precision storage unit and the shifted M, the inverse element X1 of the operand value A on the remainder ring modulo the M is calculated, A first inverse element calculation step of storing X1 in the multi-precision storage unit ;
The value of t calculated in the normal division step is received, and the value of the lower t bits of the operand value A is calculated from the operand value B using the operand value A stored in the multi-precision storage unit . A second inverse element calculation step for calculating the inverse element X2 of the operand B on the remainder ring modulo 2 t by calculation ,
The X2 calculated in the second inverse element calculation step is received, and the inverse element X of the operand value A on the remainder ring modulo the N using the X1 stored in the multi-precision storage unit An inverse element operation program comprising a composition operation step for calculating the value by calculation .
前記合成演算ステップは、前記第1逆元演算ステップからエラーが出力された時、前記逆元Xを算出する演算を行わないことを特徴とする請求項11に記載の逆元演算プログラム。 The first inverse element calculation step outputs an error when determining that there is no inverse element of the operand value A,
12. The inverse element operation program according to claim 11 , wherein the synthesis operation step does not perform an operation for calculating the inverse element X when an error is output from the first inverse element operation step .
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2002092150A JP4019762B2 (en) | 2002-03-28 | 2002-03-28 | Inverse element operation apparatus, inverse element operation method, RSA key pair generation apparatus, RSA key pair generation method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2002092150A JP4019762B2 (en) | 2002-03-28 | 2002-03-28 | Inverse element operation apparatus, inverse element operation method, RSA key pair generation apparatus, RSA key pair generation method |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2003288015A JP2003288015A (en) | 2003-10-10 |
JP4019762B2 true JP4019762B2 (en) | 2007-12-12 |
Family
ID=29237063
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2002092150A Expired - Fee Related JP4019762B2 (en) | 2002-03-28 | 2002-03-28 | Inverse element operation apparatus, inverse element operation method, RSA key pair generation apparatus, RSA key pair generation method |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP4019762B2 (en) |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP1998491A1 (en) * | 2007-05-31 | 2008-12-03 | Thomson Licensing | Method for calculating compressed RSA moduli |
JP5214317B2 (en) * | 2008-04-25 | 2013-06-19 | 株式会社エヌ・ティ・ティ・データ | Cryptographic processing apparatus, cryptographic processing method, and computer program |
JP2010122246A (en) * | 2008-11-17 | 2010-06-03 | Fujitsu Ltd | Inverse computing device and inverse computing program |
-
2002
- 2002-03-28 JP JP2002092150A patent/JP4019762B2/en not_active Expired - Fee Related
Also Published As
Publication number | Publication date |
---|---|
JP2003288015A (en) | 2003-10-10 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US6396926B1 (en) | Scheme for fast realization of encrytion, decryption and authentication | |
JP4828068B2 (en) | Computer efficient linear feedback shift register | |
Biham et al. | Bug attacks | |
US7564970B2 (en) | Exponential data transform to enhance security | |
JP5572610B2 (en) | Transpose data conversion for security enhancement | |
CN109039640B (en) | Encryption and decryption hardware system and method based on RSA cryptographic algorithm | |
US20080240443A1 (en) | Method and apparatus for securely processing secret data | |
JP2008203548A (en) | Key generating method using quadric hyperbolic curve group, decoding method, signature verification method, key stream generating method and device | |
US8548161B2 (en) | Crytographically transforming data text | |
US20020055962A1 (en) | Automatically solving equations in finite fields | |
WO2013021360A1 (en) | Encryption and decryption method | |
US7248692B2 (en) | Method of and apparatus for determining a key pair and for generating RSA keys | |
JP4019762B2 (en) | Inverse element operation apparatus, inverse element operation method, RSA key pair generation apparatus, RSA key pair generation method | |
Pon et al. | Dynamic reblocking RSA-based multisignatures scheme for computer and communication networks | |
JPH1117673A (en) | Common key encryption communication method and its communication network | |
Hinek | Lattice attacks in cryptography: A partial overview | |
JP3591857B2 (en) | Pseudo random number generation method and device, communication method and device | |
Yadav et al. | Hybrid cryptography approach to secure the data in computing environment | |
JP2000132095A (en) | Encryption method, decryption method, authentication method, encryption apparatus, decryption apparatus, authentication apparatus, authentication text transmitter apparatus, encryption text receiver apparatus, cipher communication system and authentication system | |
Shepherd et al. | The quadratic residue cipher and some notes on implementation | |
JP3894919B2 (en) | Electronic signature method and program and apparatus | |
Sani et al. | RSA cryptography and multi prime RSA cryptography | |
US7480380B2 (en) | Method for efficient generation of modulo inverse for public key cryptosystems | |
Upadhyay | Attack on rsa cryptosystem | |
Al-Tuwaijry et al. | A high speed RSA processor |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20041012 |
|
RD01 | Notification of change of attorney |
Free format text: JAPANESE INTERMEDIATE CODE: A7421 Effective date: 20050706 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20070522 |
|
A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20070711 |
|
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: 20070904 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20070917 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20101005 Year of fee payment: 3 |
|
R151 | Written notification of patent or utility model registration |
Ref document number: 4019762 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R151 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20101005 Year of fee payment: 3 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20111005 Year of fee payment: 4 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20121005 Year of fee payment: 5 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20131005 Year of fee payment: 6 |
|
LAPS | Cancellation because of no payment of annual fees |