JP3626340B2 - Cryptographic device, cryptographic key generation method, prime number generation device, and prime number generation method - Google Patents

Cryptographic device, cryptographic key generation method, prime number generation device, and prime number generation method Download PDF

Info

Publication number
JP3626340B2
JP3626340B2 JP34509197A JP34509197A JP3626340B2 JP 3626340 B2 JP3626340 B2 JP 3626340B2 JP 34509197 A JP34509197 A JP 34509197A JP 34509197 A JP34509197 A JP 34509197A JP 3626340 B2 JP3626340 B2 JP 3626340B2
Authority
JP
Japan
Prior art keywords
prime number
prime
bits
generating
less
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
JP34509197A
Other languages
Japanese (ja)
Other versions
JPH10240128A (en
Inventor
智美 堀
信一 川村
淳 新保
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Toshiba Corp
Original Assignee
Toshiba Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Toshiba Corp filed Critical Toshiba Corp
Priority to JP34509197A priority Critical patent/JP3626340B2/en
Publication of JPH10240128A publication Critical patent/JPH10240128A/en
Application granted granted Critical
Publication of JP3626340B2 publication Critical patent/JP3626340B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Description

【0001】
【発明の属する技術分野】
本発明は、暗号処理、復号処理、認証処理などに用いる暗号鍵を自装置内で生成する暗号装置及び暗号鍵生成方法並びに素数生成装置及び素数生成方法に関する。
【0002】
【従来の技術】
昨今、情報処理の技術が進歩するにつれて情報を電子化して扱うことが通常行なわれるようになってきた。また、単にデータを電子化するだけでなく、電子貨幣システムや著作権に係る電子化情報の配布システムなど新たなサービスも開発されている。このような電子化情報を扱う場合に、企業秘密やプライベートなデータ、電子貨幣情報、著作権に係る電子化情報など、特定の者だけが閲覧等可能で、それ以外の者には内容を秘匿したい情報の蓄積や通信などにあたっては、暗号技術が使用される。
【0003】
例えば、ホストコンピュータ間で暗号通信を行なう場合、送信側では共通鍵あるいは相手の公開鍵でデータを暗号化し、受信側ではこれを共通鍵あるいは自分の秘密鍵で復号することで、特定の鍵情報を持つ者だけが暗号化データを復号可能とすることができる。また例えば鍵情報を用いた認証処理により情報の正当性の検証を可能としている。
【0004】
ところで、秘密鍵暗号では乱数生成機能が存在するだけで共通鍵の生成を容易に行なうことができる。これに対して、公開鍵暗号の公開鍵及び秘密鍵の生成は、秘密鍵暗号の共通鍵生成ほど簡単な処理ではない。特に、公開鍵及び秘密鍵を生成するためには、大きなビット長の素数が必要になるため、計算量の増加が避けられない。この大きなビット長の素数を高速に生成するための方法として、メモリを利用したテーブル処理が存在するが、この場合、非常に多くの素数を記憶しておく必要があり、メモリ資源の限られた暗号装置(例えば処理機能を有するICカードを暗号装置として用いるもの)においてはこのテーブル処理は適切ではないとされてきた。このような理由から従来では、公開鍵暗号の公開鍵及び秘密鍵は、通常、パーソナルコンピュータ等の高速なCPUと十分なメモリが存在する環境で生成する必要があった。
【0005】
また、各ユーザの公開鍵を管理・公開するセンターが公開鍵及び秘密鍵を生成し、各ユーザに秘密鍵を配送する場合、安全性を考慮した鍵配送メカニズムが必須である。従って、センターが大量の秘密鍵を配送及び管理することは、かなりの負担であった。
【0006】
また、個々のユーザがパーソナルコンピュータ等で公開鍵及び秘密鍵を生成し、秘密鍵を外部記憶装置に転送及び保持する場合、一時的であっても、パーソナルコンピュータのメモリ上に生成された鍵が存在することになり、それがオンラインの状態ならば、鍵が破壊あるいは改ざんされる可能性がある。また、秘密鍵生成機能の誤操作等により既に生成された鍵が破壊あるいは改ざんされる可能性がある。さらに、鍵が破壊あるいは改ざんなどされたことを検出することはできないという問題点もあった。
【0007】
【発明が解決しようとする課題】
従来、素数をもとに暗号鍵(公開鍵、秘密鍵、共通鍵)を生成する場合、大きなビット長の素数を生成する必要があるため、多量のコンピュータ資源を必要とする問題点があった。
【0008】
また、従来、秘密鍵生成機能の再起動により既に生成された鍵が破壊される可能性があるという問題点があった。
また、従来、鍵が破壊あるいは改ざんなどされたことを検出することはできないという問題点があった。
【0009】
本発明は、上記事情を考慮してなされたものであり、自装置内でより少ないコンピュータ資源を利用して、暗号鍵生成のもととなる十分な大きさの素数を生成可能な暗号装置及び暗号鍵生成方法を提供することを目的とする。
【0010】
また、本発明は、暗号鍵を安全に管理可能な暗号装置及び暗号鍵生成方法を提供することを目的とする。また、本発明は、より少ないコンピュータ資源を利用してより大きい素数を生成可能な素数生成装置及び素数生成方法を提供することを目的とする。
【0011】
【課題を解決するための手段】
本発明(請求項1)は、自装置内で素数をもとに暗号鍵を生成する暗号装置であって、予め定められたnビット以下の値のすべての素数をもとに2nビット以下の第1の素数を生成する第1の素数生成手段と、前記nビット以下のすべての素数および前記第1の素数をもとに2nビットより大きい所定のビット長の第2の素数を生成する第2の素数生成手段と、前記所定のビット長の第2の素数を用いて暗号鍵を生成する暗号鍵生成手段とを備え、前記第2の素数生成手段としては、前記第2の素数の候補N i を前記nビット以下のすべての素数で試行割算し、いずれの素数でも割り切れないとき、所定のa i について第1式のフェルマーテストa i i −1 ≡1(mod N i )の関係を満たすか否かを計算し、第1式の関係を満たすとき、第2式の最大公約数gcd(a i ( i −1 ) /F i −1,N i )≠1の関係(但し、F i :第1の素数)を満たすか否かを計算し、第2式の関係を満たすとき、前記素数の候補N i から第2の素数N i を得ることを特徴とする。
【0012】
本発明(請求項2)は、自装置内で暗号鍵を生成する暗号装置であって、予め定められたnビット以下のすべての素数を用いて所定の2nビット以下の乱数を素数判定することにより2nビット以下の第1の素数を生成する第1の素数生成手段と、前記第1の素数をもとに該第1の素数より大きい素数候補を生成し、前記nビット以下のすべての素数を少なくとも用いた素数判定により該素数候補が合成数でないと判定された場合には該素数候補を新たな第1の素数とし該新たな第1の素数をもとに該素数候補より大きい新たな素数候補を生成する処理を再帰的に繰り返すとともに、素数候補が合成数であると判定された場合には前記合成数と判定された時点での第1の素数をもとに素数候補を生成し直しあらためて該処理を再帰的に繰り返すことにより、2nビットより大きい所定のビット長の第2の素数を生成する第2の素数生成手段と、前記所定のビット長の素数を用いて暗号鍵を生成する暗号鍵生成手段とを備え、前記第2の素数生成手段による素数判定としては、前記素数候補N i を前記nビット以下のすべての素数で試行割算し、いずれの素数でも割り切れないとき、所定のa i について第1式のフェルマーテストa i i −1 ≡1(mod N i )の関係を満たすか否かを計算し、第1式の関係を満たすとき、第2式の最大公約数gcd(a i ( i −1 ) /F i −1,N i )≠1の関係(但し、F i :第1の素数)を満たすか否かを計算し、第2式の関係を満たすとき、該素数候補N i を合成数でないと判定することを特徴とする。
【0013】
本発明(請求項3)は、自装置内で暗号鍵を生成する暗号装置であって、予め定められたnビット以下のすべての素数を用いて所定の2nビット以下の乱数を素数判定することにより2nビット以下の第1の素数を生成する第1の素数生成手段と、前記第1の素数生成手段により生成された2nビット以下の第1の素数および前記nビット以下のすべての素数をもとに2nビットより大きい所定のビット長の第2の素数を生成する第2の素数生成手段と、前記第1および第2の素数生成手段を用いて生成された0.4mビットの第2の素数および前記第2の素数をもとに0.5mビットの第3の素数を生成する第3の素数生成手段と、前記第1および第2の素数生成手段を用いて生成された他の0.4mビットの第2の素数、前記第3の素数生成手段により生成された0.5mビットの第3の素数および前記nビット以下のすべての素数をもとにmビットの第4の素数を生成する第4の素数生成手段と、前記第4の素数生成手段により生成された前記mビットの第4の素数を用いて暗号鍵を生成する暗号鍵生成手段とを備え、前記第2の素数生成手段としては、前記第2の素数の候補N i を前記nビット以下のすべての素数で試行割算し、いずれの素数でも割り切れないとき、所定のa i について第1式のフェルマーテストa i i −1 ≡1(mod N i )の関係を満たすか否かを計算し、第1式の関係を満たすとき、第2式の最大公約数gcd(a i ( i −1 ) /F i −1,N i )≠1の関係(但し、F i :第1の素数)を満たすか否かを計算し、第2式の関係を満たすとき、前記素数の候補N i から第2の素数N i を得ることを特徴とする。
【0016】
本発明(請求項)は、暗号装置内で素数をもとに暗号鍵を生成する暗号鍵生成方法であって、前記暗号装置内でランダムアクセス可能な不揮発性メモリに格納された素数テーブルに格納された予め定められたnビット以下の値のすべての素数をもとに2nビット以下の第1の素数を生成し、前記不揮発性メモリに格納された素数テーブルに格納されたnビット以下のすべての素数および前記第1の素数をもとに2nビットより大きい所定のビット長の第2の素数を生成し、この第2の素数を生成する際に、前記第2の素数の候補N i を前記nビット以下のすべての素数で試行割算し、いずれの素数でも割り切れないとき、所定のa i について第1式のフェルマーテストa i i −1 ≡1(mod N i )の関係を満たすか否かを計算し、第1式の関係を満たすとき、第2式の最大公約数gcd(a i ( i −1 ) /F i −1,N i )≠1の関係(但し、F i :第1の素数)を満たすか否かを計算し、第2式の関係を満たすとき、前記素数の候補N i から第2の素数N i を生成し、前記所定のビット長の第2の素数を用いて前記暗号装置内のコプロセッサにより暗号鍵を生成することを特徴とする。
【0017】
本発明(請求項)は、暗号装置内で素数をもとに暗号鍵を生成する暗号鍵生成方法であって、前記暗号装置内でランダムアクセス可能な不揮発性メモリに格納された素数テーブルに格納された予め定められたnビット以下のすべての素数を用いて所定の2nビット以下の乱数を素数判定することにより2nビット以下の第1の素数を生成する第1の素数生成ステップと、前記第1の素数をもとに該第1の素数より大きい素数候補を生成し、前記不揮発性メモリに格納された素数テーブルに格納されたnビット以下のすべての素数を少なくとも用いた素数判定により該素数候補が合成数でないと判定された場合には該素数候補を新たな第1の素数とし該新たな第1の素数をもとに該素数候補より大きい新たな素数候補を生成する処理を再帰的に繰り返すとともに、素数候補が合成数であると判定された場合には前記第1の素数生成ステップにて合成数と判定された時点での第1の素数をもとに素数候補を生成し直しあらためて該処理を再帰的に繰り返すことにより、2nビットより大きい所定のビット長の第2の素数を生成する第2の素数生成ステップと、前記所定のビット長の素数を用いて前記暗号装置内のコプロセッサにより暗号鍵を生成する暗号鍵生成ステップとを有し、前記第2の素数生成ステップによる素数判定としては、前記素数候補N i を前記nビット以下のすべての素数で試行割算し、いずれの素数でも割り切れないとき、所定のa i について第1式のフェルマーテストa i i −1 ≡1(mod N i )の関係を満たすか否かを計算し、第1式の関係を満たすとき、第2式の最大公約数gcd(a i ( i −1 ) /F i −1,N i )≠1の関係(但し、F i :第1の素数)を満たすか否かを計算し、第2式の関係を満たすとき、該素数候補N i を合成数でないと判定することを特徴とする。
【0018】
本発明(請求項)は、暗号装置内で素数をもとに暗号鍵を生成する暗号鍵生成方法であって、前記暗号装置内でランダムアクセス可能な不揮発性メモリに格納された素数テーブルに格納された予め定められたnビット以下のすべての素数を用いて所定の2nビット以下の乱数を素数判定することにより2nビット以下の第1の素数を生成する第1の素数生成ステップと、前記第1の素数生成ステップにて生成された2nビット以下の第1の素数および前記不揮発性メモリに格納された素数テーブルに格納されたnビット以下のすべての素数をもとに2nビットより大きい所定のビット長の第2の素数を生成する第2の素数生成ステップと、前記第1および第2の素数生成ステップにより生成された0.4mビットの第2の素数および前記第2の素数をもとに前記暗号装置内のコプロセッサにより0.5mビットの第3の素数を生成する第3の素数生成ステップと、前記第1および第2の素数生成ステップにより生成された他の0.4mビットの第2の素数、前記第3の素数生成ステップにより生成された0.5mビットの第3の素数および前記不揮発性メモリに格納された素数テーブルに格納されたnビット以下のすべての素数をもとにmビットの第4の素数を生成する第4の素数生成ステップと、前記第4の素数生成ステップにて生成された前記mビットの第4の素数を用いて前記コプロセッサにより暗号鍵を生成する暗号鍵生成ステップとを有し、前記第2の素数生成ステップとしては、前記第2の素数の候補N i を前記nビット以下のすべての素数で試行割算し、いずれの素数でも割り切れないとき、所定のa i について第1式のフェルマーテストa i i −1 ≡1(mod N i )の関係を満たすか否かを計算し、第1式の関係を満たすとき、第2式の最大公約数gcd(a i ( i −1 ) /F i −1,N i )≠1の関係(但し、F i :第1の素数)を満たすか否かを計算し、第2式の関係を満たすとき、前記素数の候補N i から第2の素数N i を得ることを特徴とする。
【0021】
本発明(請求項)は、予め定められたnビット以下の値のすべての素数をもとに2nビット以下の素数を生成する第1の素数生成手段と、前記nビット以下のすべての素数および前記2nビット以下の素数をもとに2nビットより大きい前記所定のビット長の素数を生成する第2の素数生成手段とを備え、前記第2の素数生成手段としては、前記第2の素数の候補N i を前記nビット以下のすべての素数で試行割算し、いずれの素数でも割り切れないとき、所定のa i について第1式のフェルマーテストa i i −1 ≡1(mod N i )の関係を満たすか否かを計算し、第1式の関係を満たすとき、第2式の最大公約数gcd(a i ( i −1 ) /F i −1,N i )≠1の関係(但し、F i :第1の素数)を満たすか否かを計算し、第2式の関係を満たすとき、前記素数の候補N i から第2の素数N i を得ることを特徴とする。
【0022】
本発明(請求項)は、予め定められたnビット以下のすべての素数を用いて所定の2nビット以下の乱数を素数判定することにより2nビット以下の第1の素数を生成する第1の素数生成手段と、前記第1の素数をもとに該第1の素数より大きい素数候補を生成し、前記nビット以下のすべての素数を少なくとも用いた素数判定により該素数候補が合成数でないと判定された場合には該素数候補を新たな第1の素数とし該新たな第1の素数をもとに該素数候補より大きい新たな素数候補を生成する処理を再帰的に繰り返すとともに、素数候補が合成数であると判定された場合には前記合成数と判定された時点での第1の素数をもとに素数候補を生成し直しあらためて該処理を再帰的に繰り返すことにより、2nビットより大きい所定のビット長の第2の素数を生成する第2の素数生成手段とを備え、前記第2の素数生成手段による素数判定としては、前記素数候補N i を前記nビット以下のすべての素数で試行割算し、いずれの素数でも割り切れないとき、所定のa i について第1式のフェルマーテストa i i −1 ≡1(mod N i )の関係を満たすか否かを計算し、第1式の関係を満たすとき、第2式の最大公約数gcd(a i ( i −1 ) /F i −1,N i )≠1の関係(但し、F i :第1の素数)を満たすか否かを計算し、第2式の関係を満たすとき、該素数候補N i を合成数でないと判定することを特徴とする。
【0023】
本発明(請求項)は、予め定められたnビット以下のすべての素数を用いて所定の2nビット以下の乱数を素数判定することにより2nビット以下の第1の素数を生成する第1の素数生成手段と、前記第1の素数生成手段により生成された2nビット以下の第1の素数および前記nビット以下のすべての素数をもとに2nビットより大きい所定のビット長の第2の素数を生成する第2の素数生成手段と、前記第1および第2の素数生成手段を用いて生成された0.4mビットの第2の素数および前記第2の素数をもとに0.5mビットの第3の素数を生成する第3の素数生成手段と、前記第1および第2の素数生成手段を用いて生成された他の0.4mビットの第2の素数、前記第3の素数生成手段により生成された0.5mビットの第3の素数および前記nビット以下のすべての素数をもとにmビットの第4の素数を生成する第4の素数生成手段とを備え、前記第2の素数生成手段としては、前記第2の素数の候補N i を前記nビット以下のすべての素数で試行割算し、いずれの素数でも割り切れないとき、所定のa i について第1式のフェルマーテストa i i −1 ≡1(mod N i )の関係を満たすか否かを計算し、第1式の関係を満たすとき、第2式の最大公約数gcd(a i ( i −1 ) /F i −1,N i )≠1の関係(但し、F i :第1の素数)を満たすか否かを計算し、第2式の関係を満たすとき、前記素数の候補N i から第2の素数N i を得ることを特徴とする。
【0024】
本発明(請求項10)は、暗号装置内でランダムアクセス可能な不揮発性メモリに格納された素数テーブルに格納された予め定められたnビット以下の値のすべての素数をもとに2nビット以下の第1の素数を生成し、前記不揮発性メモリに格納された素数テーブルに格納されたnビット以下のすべての素数および前記2nビット以下の素数をもとに2nビットより大きい前記所定のビット長の素数を生成し、この第2の素数を生成する際に、前記第2の素数の候補N i を前記nビット以下のすべての素数で試行割算し、いずれの素数でも割り切れないとき、所定のa i について第1式のフェルマーテストa i i −1 ≡1(mod N i )の関係を満たすか否かを計算し、第1式の関係を満たすとき、第2式の最大公約数gcd(a i ( i −1 ) /F i −1,N i )≠1の関係(但し、F i :第1の素数)を満たすか否かを計算し、第2式の関係を満たすとき、前記素数の候補N i から第2の素数N i を生成することを特徴とする。
【0025】
本発明(請求項11)は、暗号装置内でランダムアクセス可能な不揮発性メモリに格納された素数テーブルに格納された予め定められたnビット以下のすべての素数を用いて所定の2nビット以下の乱数を素数判定することにより2nビット以下の第1の素数を生成する第1の素数生成ステップと、前記第1の素数をもとに該第1の素数より大きい素数候補を生成し、前記不揮発性メモリに格納された素数テーブルに格納されたnビット以下のすべての素数を少なくとも用いた素数判定により該素数候補が合成数でないと判定された場合には該素数候補を新たな第1の素数とし該新たな第1の素数をもとに該素数候補より大きい新たな素数候補を生成する処理を再帰的に繰り返すとともに、素数候補が合成数であると判定された場合には前記第1の素数生成ステップにて合成数と判定された時点での第1の素数をもとに素数候補を生成し直しあらためて該処理を再帰的に繰り返すことにより、2nビットより大きい所定のビット長の第2の素数を生成する第2の素数生成ステップとを有し、前記第2の素数生成ステップによる素数判定としては、前記素数候補N i を前記nビット以下のすべての素数で試行割算し、いずれの素数でも割り切れないとき、所定のa i について第1式のフェルマーテストa i i −1 ≡1(mod N i )の関係を満たすか否かを計算し、第1式の関係を満たすとき、第2式の最大公約数gcd(a i ( i −1 ) /F i −1,N i )≠1の関係(但し、F i :第1の素数)を満たすか否かを計算し、第2式の関係を満たすとき、該素数候補N i を合成数でないと判定することを特徴とする。
【0026】
本発明(請求項12)は、暗号装置内でランダムアクセス可能な不揮発性メモリに格納された素数テーブルに格納された予め定められたnビット以下のすべての素数を用いて所定の2nビット以下の乱数を素数判定することにより2nビット以下の第1の素数を生成する第1の素数生成ステップと、前記第1の素数生成ステップにて生成された2nビット以下の第1の素数および前記不揮発性メモリに格納された素数テーブルに格納されたnビット以下のすべての素数をもとに2nビットより大きい所定のビット長の第2の素数を生成する第2の素数生成ステップと、前記第1および第2の素数生成ステップにより生成された0.4mビットの第2の素数および前記第2の素数をもとに前記暗号装置内のコプロセッサにより0.5mビットの第3の素数を生成する第3の素数生成ステップと、前記第1および第2の素数生成ステップにより生成された他の0.4mビットの第2の素数、前記第3の素数生成ステップにより生成された0.5mビットの第3の素数および前記不揮発性メモリに格納された素数テーブルに格納されたnビット以下のすべての素数をもとにmビットの第4の素数を生成する第4の素数生成ステップとを有し、前記第2の素数生成ステップとしては、前記第2の素数の候補N i を前記nビット以下のすべての素数で試行割算し、いずれの素数でも割り切れないとき、所定のa i について第1式のフェルマーテストa i i −1 ≡1(mod N i )の関係を満たすか否かを計算し、第1式の関係を満たすとき、第2式の最大公約数gcd(a i ( i −1 ) /F i −1,N i )≠1の関係(但し、F i :第1の素数)を満たすか否かを計算し、第2式の関係を満たすとき、前記素数の候補N i から第2の素数N i を得ることを特徴とする。
【0027】
本発明(請求項13)は、暗号装置のコンピュータに、前記暗号装置内でランダムアクセス可能な不揮発性メモリに格納された素数テーブルに格納された予め定められたnビット以下の値のすべての素数をもとに2nビット以下の第1の素数を生成する手順と、前記不揮発性メモリに格納された素数テーブルに格納されたnビット以下のすべての素数および前記第1の素数をもとに2nビットより大きい所定のビット長の第2の素数を生成する手順を実行させるためのプログラムであって、前記第2の素数を生成する手順としては、前記第2の素数の候補N i を前記nビット以下のすべての素数で試行割算し、いずれの素数でも割り切れないとき、所定のa i について第1式のフェルマーテストa i i −1 ≡1(mod N i )の関係を満たすか否かを計算し、第1式の関係を満たすとき、第2式の最大公約数gcd(a i ( i −1 ) /F i −1,N i )≠1の関係(但し、F i :第1の素数)を満たすか否かを計算し、第2式の関係を満たすとき、前記素数の候補N i から第2の素数N i を得る手順を含むプログラムを記録したコンピュータ読取り可能な記録媒体を要旨とする。
【0028】
本発明(請求項14)は、暗号装置のコンピュータに、前記暗号装置内でランダムアクセス可能な不揮発性メモリに格納された素数テーブルに格納された予め定められたnビット以下のすべての素数を用いて所定の2nビット以下の乱数を素数判定することにより2nビット以下の第1の素数を生成する第1の素数生成ステップと、前記第1の素数をもとに該第1の素数より大きい素数候補を生成し、前記不揮発性メモリに格納された素数テーブルに格納されたnビット以下のすべての素数を少なくとも用いた素数判定により該素数候補が合成数でないと判定された場合には該素数候補を新たな第1の素数とし該新たな第1の素数をもとに該素数候補より大きい新たな素数候補を生成する処理を再帰的に繰り返すとともに、素数候補が合成数であると判定された場合には前記第1の素数生成ステップにて合成数と判定された時点での第1の素数をもとに素数候補を生成し直しあらためて該処理を再帰的に繰り返すことにより、2nビットより大きい所定のビット長の第2の素数を生成する第2の素数生成ステップとを実行させるためのプログラムであって、前記第2の素数生成ステップとしては、前記素数候補N i を前記nビット以下のすべての素数で試行割算し、いずれの素数でも割り切れないとき、所定のa i について第1式のフェルマーテストa i i −1 ≡1(mod N i )の関係を満たすか否かを計算し、第1式の関係を満たすとき、第2式の最大公約数gcd(a i ( i −1 ) /F i −1,N i )≠1の関係(但し、F i :第1の素数)を満たすか否かを計算し、第2式の関係を満たすとき、前記素数の候補N i から第2の素数N i を得るステップを含むプログラムを実行させるためのプログラムを記録したコンピュータ読取り可能な記録媒体を要旨とする。
【0029】
本発明(請求項15)は、暗号装置のコンピュータに、前記暗号装置内でランダムアクセス可能な不揮発性メモリに格納された素数テーブルに格納された予め定められたnビット以下のすべての素数を用いて所定の2nビット以下の乱数を素数判定することにより2nビット以下の第1の素数を生成する第1の素数生成ステップと、前記第1の素数生成ステップにて生成された2nビット以下の第1の素数および前記不揮発性メモリに格納された素数テーブルに格納されたnビット以下のすべての素数をもとに2nビットより大きい所定のビット長の第2の素数を生成する第2の素数生成ステップと、前記第1および第2の素数生成ステップにより生成された0.4mビットの第2の素数および前記第2の素数をもとに前記暗号装置内のコプロセッサにより0.5mビットの第3の素数を生成する第3の素数生成ステップと、前記第1および第2の素数生成ステップにより生成された他の0.4mビットの第2の素数、前記第3の素数生成ステップにより生成された0.5mビットの第3の素数および前記不揮発性メモリに格納された素数テーブルに格納されたnビット以下のすべての素数をもとにmビットの第4の素数を生成する第4の素数生成ステップとを実行させるためのプログラムであって、前記第2の素数生成ステップとしては、前記第2の素数の候補N i を前記nビット以下のすべての素数で試行割算し、いずれの素数でも割り切れないとき、所定のa i について第1式のフェルマーテストa i i −1 ≡1(mod N i )の関係を満たすか否かを計算し、第1式の関係を満たすとき、第2式の最大公約数gcd(a i ( i −1 ) /F i −1,N i )≠1の関係(但し、F i :第1の素数)を満たすか否かを計算し、第2式の関係を満たすとき、前記素数の候補N i から第2の素数N i を得るステップを含むプログラムを記録したコンピュータ読取り可能な記録媒体を要旨とする、好ましくは、前記プログラムはコンピュータに生成された前記素数を用いて暗号鍵を生成させる手順を含むものであるようにしてもよい。
【0030】
好ましくは、前記プログラムはコンピュータに生成された前記暗号鍵を用いて暗号化対象となるデータを暗号化させる手順を含むものであるようにしてもよい。
【0033】
なお、以上の装置に係る発明は方法に係る発明としても成立し、方法に係る発明は装置に係る発明としても成立する。
また、装置または方法に係る本発明は、コンピュータに当該発明に相当する手順を実行させるための(あるいはコンピュータを当該発明に相当する手段として機能させるための、あるいはコンピュータに当該発明に相当する機能を実現させるための)プログラムを記録したコンピュータ読取り可能な記録媒体としても成立する。
【0034】
本発明(請求項1、2、3、4、5、6、7〜12)において、nビットは好ましくは2の倍数である。例えばnビット=256=28 の場合、256以下の素数は全部で53個である。また、所定のビット長は、例えば256ビットあるいは384ビットである。また、mは、例えば256あるいは384である。
【0035】
また、第2〜第4の素数生成では、前記nビット以下のすべての素数を用いる素数判定(エラトステネスのふるい)の次に少なくともフェルマーテストを行なうのが好ましい。
【0036】
また、好ましくは、前記暗号装置や前記素数生成装置は、プログラム記憶手段、プログラムを実行する演算手段、データの読み出し及び書き込み可能なメモリ手段及び外部との通信を行なう手段を備えても良い。
【0037】
また、前記暗号装置や前記素数生成装置は、例えばパーソナルコンピュータで実現することができる。あるいはICカードで実現することもできる。本発明(請求項1、2、3、)によれば、確定的素数判定方法と、第1の素数を素数判定するときに用いる(第1の素数)1/2 以下の素数を格納した素数テーブルとを組合わせることによって、暗号装置のメモリ容量に対応したサイズのテーブルを利用することが可能になる。
【0038】
したがって、豊富なメモリを持つパーソナルコンピュータのような暗号装置でなく、メモリ容量が限定されている暗号装置(例えばICカード)であっても装置上に容易に鍵(例えば公開鍵暗号における公開鍵及び秘密鍵)の生成機能を実装することが可能になる。
【0039】
また、扱うデータ量が少ないので、高速に鍵を生成することができる。
また、確定的素数判定方法を用いるので、確実に素数を得ることができ、安全な鍵を得ることができる。
【0040】
また、装置に鍵生成機能を持たせることにより、鍵に対する安全性を向上させ、鍵の管理を容易にすることができる。
また、個々の暗号装置内で鍵を生成し、暗号装置内で暗号処理及び復号処理を行なうならば、鍵は決して暗号装置外に出ることがないので、鍵に対する高い安全性を保つことができる。
【0041】
また、公開鍵暗号において、個々の暗号装置が秘密鍵および公開鍵を生成することにより、鍵を管理するセンターは、個々の暗号装置に対し鍵生成及び配送をする必要がなくなり、鍵生成及び管理に伴う処理の負担が軽減される。
【0042】
本発明(請求項7〜12)によれば、確定的素数判定方法と、第1の素数を素数判定するときに用いる(第1の素数)1/2 以下の素数を格納した素数テーブルとを組合わせることによって、装置のメモリ容量に対応したサイズのテーブルを利用することが可能になる。
【0043】
したがって、豊富なメモリを持つパーソナルコンピュータのような装置でなく、メモリ容量が限定されている装置(例えばICカード)であっても装置上に容易に素数生成機能を実装することが可能になる。
【0044】
また、扱うデータ量が少ないので、高速に素数を生成することができる。また、確定的素数判定方法を用いるので、確実に素数を得ることができる
【0047】
【発明の実施の形態】
以下、図面を参照しながら発明の実施の形態を説明する。
図1は、本発明の一実施形態に係る暗号装置の構成を示す図である。
本実施形態の暗号装置1は、CPU2、プログラム記憶部3、演算部4、乱数生成部5、ランダムアクセス可能な不揮発メモリ6、不揮発性メモリ7、アドレス及びデータバス8を備えている。
【0048】
本実施形態では、プログラム記憶部3に格納されたプログラムをCPU2で実行する形で各機能を実現するものとしている。このプログラムは、素数生成のためのサブプログラムと鍵生成のためのサブプログラムとを少なくとも含む。なお、素数生成のためのサブプログラムと、鍵生成のためのサブプログラムとを独立実施することも可能である。
【0049】
また、本実施形態では、処理速度を上げるために所定の演算については演算部4を利用する。演算部4には、例えばコプロセッサを用いる。ただし、演算部4を設けなくても構わない。
【0050】
また、図1では、乱数生成部5を明に示しているが、乱数生成部5は独立のハードウェアで実現しても良いし、プログラムとCPU2で実現しても良い。本実施形態では、後者であるとする。なお、乱数は外部の装置から入力するようにしても構わない。
【0051】
プログラム記憶部3は、例えばROMである。
なお、プログラム(本実施形態を実現するための手順を含むプログラム)を外部から(例えば、記録媒体から読み込んでもしくはネットワークを介して取得して)インストールする構成を採用することも可能である。このような場合、プログラム記憶部3には、例えばEEPROMもしくはRAMもしくはハードディスク装置などを用いることができる。
【0052】
ランダムアクセス可能な不揮発性メモリ6は、例えばRAMである。このメモリ6には、計算に必要なデータや計算途中のデータなどを格納する。
不揮発性メモリ7は、例えばEEPROMである。このメモリ7には、生成された鍵などを格納する。
【0053】
また、暗号装置1は、図示しない所望のインタフェースを介して外部からデータを入力し、また外部にデータを出力する。このインタフェースは、例えば、ユーザインタフェース、通信インタフェースなど、種々のものが考えられる。例えば、暗号装置1がICカードである場合、所定の通信インタフェースを介して外部の計算機とデータの受け渡しを行なう。
【0054】
そして、暗号装置1、所望の暗号機能、すなわち例えばこのインタフェースを介して入力されたデータに対して暗号化あるいは復号化などの処理を行ない、あるいはデータの認証処理を行ない、また外部の表示装置、通信回線あるいは記憶装置に対して、入力されたデータあるいは処理したデータなどを出力する機能を有するものとする。この機能は、例えばプログラムにより実現する。また、この機能をサブプログラムとして上記の素数生成のためのサブプログラムと鍵生成のためのサブプログラムとを含むプログラムに組み込んで実施することも可能である。
【0055】
ところで、本実施形態では、素数判定に用いる素数を格納した素数テーブルを用いる。この素数テーブルは、ランダムアクセス可能な不揮発性メモリ6に格納する。ここでは、始めにワードサイズの2倍のビット長の素数を生成し、その素数を基にそれより大きい所定のサイズの素数を生成することを前提として、素数テーブルにはワードサイズ以下の素数を格納しておくものとする。例えば、ワードサイズが8ビットである場合、256以下のすべての素数(53個の素数)を格納しておく。
【0056】
図2に、公開鍵及び秘密鍵生成に用いる素数を生成する素数生成処理のフローチャートを示す。
処理1:まず、乱数生成部5においてワードサイズの2倍のビット長の奇数をランダムに生成する(ステップS1)。
【0057】
処理2:生成された奇数について、素数テーブルに格納されているワードサイズ以下の素数を用いて演算部4において試行割算(エラトステネスのふるい)を行なう(ステップS2)。
【0058】
処理3:生成された奇数が素数テーブル内の全ての素数で割り切れない場合、この奇数を素数と判定し、F に代入する。素数テーブル内のいずれかの素数で割り切れた場合、処理1に戻る(ステップS3)。
【0059】
処理4:以下の処理ループのためのパラメータi=0とする(ステップS4)。
処理5:素数F を基に、乱数生成部5において、R <F を満たす乱数R を生成し(ステップS5)、N =2R +1で表される素数候補N を作る(ステップS6)。
【0060】
処理6:素数候補N に対し、素数判定の前処理として、素数テーブルに格納されている素数を用いて演算部4において試行割算を行なう(ステップS7)。処理7:素数候補N が、素数テーブル内のいずれかの素数で割り切れた場合、素数候補N は合成数であると判定し、処理5に戻る(ステップS8)。そして、F の値はそのままで、乱数生成部5においてR (R <F )を生成し直し、新しい素数候補N を生成する。
【0061】
処理8:素数候補N について、所定のa について、式(1)を満たすかどうか演算部4において計算する(フェルマーテスト)(ステップS9)。満たさない場合、処理5に戻る(ステップS10)。
【0062】
【数1】

Figure 0003626340
【0063】
処理9:素数候補N について、所定のa について、式(2)を満たすかどうか演算部4において計算する(ステップS11)。満たさない場合、処理5に戻る(ステップS12)。
【0064】
【数2】
Figure 0003626340
【0065】
処理10:素数候補N が所定のビットサイズに達していないならば、F =N 、i+=1(iを1増加)とし(ステップS13,S14)、処理5に戻る。素数候補N が所定のビット長に達するように、R のビット長を増加(R <F )させることで調整する。
【0066】
処理11:以上のようにして、素数候補N が所定のビットサイズに達したならば、素数N を得る。
上記の処理8と処理9においては、a =2を用いるのが好ましい。上記の試行割算では、ワードサイズ以下の素数を含む前記素数テーブルを使用するが、F 以下の素数による試行割算を前処理として施すことで、殆どの合成数を除去することが可能である。よって、素数判定にかける素数候補が絞られることにより、効率良く素数判定を行なうことができる。
【0067】
また、上記の判定式では、a =2という小さな底の計算で処理するので計算が容易となる。通常、底a は、2だけではなく、小さな素数から順に用いて素数判定処理を行なうが、a をこのように変化させなくても支障はない。それは、a =2のときに、素数候補が素数であるにもかかわらず、素数ではないと判定されるケースは非常に小さいからである。
【0068】
よって、効率性と実用性を備えた底として、a =2を用いる。上記の処理11までの実行で、求められた素数のビットサイズがnビットとすると、(素数−1)にn/2ビット程度の素数を持たせることができる。これにより、素因数分解法の一手法であるp−1法を回避できる。
【0069】
さらにp+1法に対処するためには、(素数+1)にも大きなビットサイズの素数を持たせる必要がある。図2の処理を用いて素数を生成し、図3の処理でp±1法に対処できる素数を生成する。
【0070】
処理12:まず、図2の処理を用いて0.4nビットの素数(s,t)を生成する(ステップS21,S22)。
処理13:0.5nビットの素数候補を、r=2at+1となるように生成する(ステップS23)。
【0071】
処理14:素数候補に対し、素数判定の前処理として、素数テーブルに格納されている素数を用いて演算部4において試行割算を行なう(ステップS24)。素数候補が、素数テーブル内のいずれかの素数で割り切れた場合、素数候補Nは合成数であると判定し、a+=1のようにaの値を調整し、処理13に戻る(ステップS25)。
【0072】
処理15:素数候補について、式(3)を満たすかどうか演算部4において計算する(ステップS26)。満たさない場合、a+=1のようにaの値を調整し、処理13に戻る(ステップS27)。
【0073】
【数3】
Figure 0003626340
【0074】
処理16:素数候補について、式(4)を満たすかどうか演算部4において計算する(ステップS28)。満たさない場合、a+=1のようにaの値を調整し、処理14に戻る(ステップS29)。
【0075】
【数4】
Figure 0003626340
【0076】
処理17:nビットの素数Nを、N=1+2(bs−r−1 (mod s))rとなるように生成し(ステップS30)、上記の処理14の試行割算および判定、処理15の計算および判断、処理16の計算および判断と同じ処理を行なう(ステップS31〜S36)。この試行割算で素数候補Nが合成数と判定された場合およびいずれかの計算で素数判定式が成立しない場合、b+=1のようにbの値を調整し、再度、上記一連の処理を行なう。
【0077】
処理18:生成した素数Nが所定のビット長を持つならば終了する(ステップS37)。所定のビット長に達していないならば処理17に戻り、素数候補Nが所定のビット長を持つようにb+=1のようにbの値を調整し素数判定を行なう。
【0078】
さて、以上のようにして素数を生成したら、次に、これら素数をもとに公開鍵及び秘密鍵を生成する。以下、各暗号方式における公開鍵及び秘密鍵の生成について説明する。
【0079】
RSA暗号における公開鍵及び秘密鍵の生成に際しては、上記の処理を用いて2個の素数p、qを生成し、n=pqを公開除数とし、ed=1 (mod lcm(p−1,q−1))なるe、dをそれぞれ、秘密べき指数、公開べき指数として用いる(lcmは最小公倍数を表す)。
【0080】
ラビン暗号における公開鍵及び秘密鍵で用いる素数p、qは、式(5)、式(6)の制限があるので、p、q各々について、上記処理16まで処理した後、処理17の代わりに次の処理17´を行なう。
【0081】
【数5】
Figure 0003626340
【0082】
処理17´:p=2F +1、q=2F +1、(p、qはnビットの素数候補)、F 、F は0.5nビットの素数、R 、R は0.4nビットの乱数である。F 、R は、処理17の各々(bs−r−1 (mod s))、rに相当する。F とF について、4|F −1、4|F −3を満たすものを探す。そして、p、qについて、上記の処理14の試行割算および判定、処理15の計算および判断、処理16の計算および判断と同じ処理を行なう(ステップS31〜S36)。
【0083】
処理17´で生成されたp、qを用いて、n=pqを公開除数とし、ed=1(mod (1/2)・lcm(p−1,q−1))なるe、dをそれぞれ、秘密べき指数、公開べき指数として用いる。
【0084】
公開鍵暗号系で用いられるプラム整数m=pqは、素数p、qは、式(7)、式(8)の制限があるので、上記の処理17´におけるF とF について、2|F −1、2|F −1を満たすものを探す。そして、p、qについて、上記の処理14の試行割算および判定、処理15の計算および判断、処理16の計算および判断と同じ処理を行なう(ステップS31〜S36)。
【0085】
【数6】
Figure 0003626340
【0086】
DSAの鍵に必要な素数は、上記の処理17´において、素数候補がp=2R qq´+1となるように素数q´を生成し、p−1に2個の素数を持たせ、素数判定を行なう。これにより、q|p−1を満たすp、qから、g=h(p−1)/q (mod p)>1なるgと乱数xを用いて、y=g (mod p)を算出し、p、q、g、yを公開鍵、xを秘密鍵として用いる。
【0087】
以上のように本実施形態によれば、確定的素数判定方法と、素数F を素数判定するときに用いる(F1/2 以下の素数を格納した素数テーブルとを組合わせることによって、暗号装置のメモリ容量に対応したサイズのテーブルを利用することが可能になる。
【0088】
したがって、豊富なメモリを持つパーソナルコンピュータのような暗号装置でなく、メモリ容量が限定されている暗号装置(例えばICカード)であっても装置上に容易に公開鍵暗号における公開鍵及び秘密鍵の生成機能を実装することが可能になる。
【0089】
また、扱うデータ量が少ないので、高速に鍵を生成することができる。
また、確定的素数判定方法を用いるので、確実に素数を得ることができ、安全な鍵を得ることができる。
【0090】
また、素因数分解による攻撃に強い鍵を得ることができる。
また、装置に鍵生成機能を持たせることにより、鍵に対する安全性を向上させ、鍵の管理を容易にすることができる。
【0091】
また、個々の暗号装置内で鍵を生成し、暗号装置内で暗号処理及び復号処理を行なうならば、鍵は決して暗号装置外に出ることがないので、鍵に対する高い安全性を保つことができる。
【0092】
なお、前述したように素数テーブルをメモリ6内に設ける代わりに、素数テーブルに相当するものをプログラムの中に作り込むようにしても良い。
また、本実施形態では、素数をもとに公開鍵暗号における秘密鍵と公開鍵を生成するものについて説明したが、前述した方法で生成した素数をもとに共通鍵を生成しても構わない。
【0093】
次に、鍵生成プログラムの実行制御について説明する。
暗号装置1において、鍵生成プログラムが起動され、一旦、鍵が生成されたならば、その鍵は不揮発性メモリ7に格納される。本実施形態では、それと同時に、同じく不揮発性メモリ7に存在する鍵生成制御ビットを立てるようにする。
【0094】
この鍵生成制御ビットにより、鍵生成プログラムの実行を制御する。つまり、鍵生成プログラムを実行するのに先だって、鍵生成制御ビットを調べ、鍵生成制御ビットがオフの状態ならば、鍵生成プログラムを実行させ、オンの状態ならば鍵生成プログラムを起動しない。
【0095】
これによって、暗号装置1が生成した鍵に対し、鍵生成プログラムの再起動等により、既に生成された鍵が破壊されることを防ぐことができる。
その他の鍵生成プログラムの実行制御方法として、予め、暗号装置1内に保存されている秘密の認証コードと同一コードが入力されたときのみ鍵生成プログラムを起動する方法も考えられる。この方法は、認証コードをマスクに書き込んでおくかまたは発行時の初期段階で書き込み、後の鍵生成時に同一コードを入力し鍵生成プログラムを起動するものである。この鍵生成プログラムの実行制御方法は、既に生成された暗号鍵を変更する場合にも用いることもできる。つまり、正しい認証コードを入力した場合にのみ、鍵生成プログラムが実行可能であり、生成された暗号鍵を不揮発性メモリ7に格納することができる。
【0096】
次に、図4を参照しながら暗号装置9内に格納されている鍵の検証について説明する。
まず、鍵が生成されたならば、直ちに、生成された鍵のハッシュ値を計算し、生成された鍵(図中11)と、そのハッシュ値(図中10)とを対応付けて不揮発性メモリ7に保存しておく。
【0097】
しかして、暗号処理や復号処理あるいは認証処理にて鍵を使用する前に、不揮発性メモリ7に格納されている鍵(図中11)のハッシュ値を計算し(図中12)、予め不揮発性メモリ7に保存されていたハッシュ値(図中10)と一致判定部13において比較する。一致したならば成功を示す制御信号を出力して暗号処理や復号処理の実行を可能とし、一致しないならば、失敗を示す制御信号を出力して暗号処理や復号処理の実行を不可とする。
【0098】
そして、制御信号が成功、すなわちハッシュ値の一致を示している場合にのみ、暗号処理を起動し、制御信号が失敗、すなわちハッシュ値の不一致を示している場合には、暗号処理を起動させない。
【0099】
このように暗号装置9で生成された鍵を用いて暗号処理や復号処理を行なう際に、格納されている鍵の検証を行なうことによって、何らかの原因で破壊された鍵による暗号処理や復号処理を回避することができる。
【0100】
次に、図5を参照しながらユーザ側と公開鍵を管理・公開するセンター側との間でのユーザの鍵の正当性の確認について説明する。
暗号装置19で生成された公開鍵及び秘密鍵については、センター17がそれらの正当性を確認する手段が必要である。その一手法として、図5に示す方法がある。
【0101】
まず、センター17は、情報処理装置18から、暗号装置19により生成された公開鍵kを受け取る。
次に、センター17は、乱数Rを生成し(図中20)、その乱数Rを暗号装置19により生成された公開鍵kを用いて暗号化し(図中21)、情報処理装置18へ送信する(図中22)。
【0102】
情報処理装置18は、外部インタフェース30を介して暗号装置19に公開鍵kで暗号化された乱数Rを送信する。
暗号装置19は、その公開鍵kで暗号化された乱数Rを、公開鍵とペアである秘密鍵を用いて復号化する(図中23)。
【0103】
復号化された乱数Rは、暗号装置19から情報処理装置18を介してセンターに送信する(図中25)。
そして、センター17では、一致判定部26により自ら生成した乱数と暗号装置19から送信された乱数について検証を行なう。
【0104】
一致したならば、暗号装置19はセンター17が所有する公開鍵に対して正当な秘密鍵を保持しているので、センター17は暗号装置19に公開鍵証明書を発行する。
【0105】
このように、個々の暗号装置が秘密鍵および公開鍵を生成することにより、鍵を管理するセンターは、個々の暗号装置に対し鍵生成及び配送をする必要がなくなり、鍵生成及び管理に伴う処理の負担が軽減される。
【0106】
なお、本発明は、コンピュータに所定の手順を実行させるための(あるいはコンピュータを所定の手段として機能させるための、あるいはコンピュータに所定の機能を実現させるための)プログラムを記録したコンピュータ読取り可能な記録媒体として実施することもできる。
本発明は、上述した実施の形態に限定されるものではなく、その技術的範囲において種々変形して実施することができる。
【0107】
【発明の効果】
本発明によれば、予め定められたnビット以下の値のすべての素数をもとに2nビット以下の素数を生成し、この生成された素数をもとに順次大きな素数を生成して所定のビット長の第2の素数生成するので、必要なメモリ容量を少なく済ませることができる。
【0108】
したがって、メモリ容量が限定されている暗号装置に鍵生成機能を実装することが可能になる。また、扱うデータ量が少ないので、高速に鍵を生成することができる。
【0109】
また、外部とのやり取りなしに暗号装置内で鍵を生成するので、鍵に対する安全性を向上させることができるとともに、鍵の管理を容易にすることができる。また、本発明によれば、暗号装置内で既に鍵が生成されている場合、再度鍵が生成されないようにするので、既に生成された鍵が新たに生成された鍵で破壊されるようなことを防ぐことができる。
【0110】
また、本発明によれば、暗号装置内で生成された鍵を用いて暗号処理や復号処理を行なう際に、格納されている鍵の検証を行なうことによって、何らかの原因で破壊された鍵による暗号処理や復号処理を回避することができる。
【図面の簡単な説明】
【図1】本発明の一実施形態に係る暗号化装置の構成を示す図
【図2】同実施形態に係る素数生成手順を示すフローチャート
【図3】同実施形態に係る素数生成手順を示すフローチャート
【図4】同実施形態に係る暗号装置における鍵検証の一例を示す図
【図5】同実施形態に係る鍵の正当性検証の一例を示す図
【符号の説明】
1…暗号装置
2…CPU
3…プログラム記憶部
4…演算部
5…乱数生成部
6…ランダムアクセス可能な不揮発メモリ
7…不揮発メモリ
8…バス
9…暗号装置
12…ハッシュ値算出部
13,26…一致判定部
17…センター
18…方法処理装置
19…暗号装置[0001]
BACKGROUND OF THE INVENTION
The present invention relates to an encryption device that generates an encryption key used for encryption processing, decryption processing, authentication processing, and the like in its own device.as well asEncryption key generation method,The present invention also relates to a prime number generation device and a prime number generation method.
[0002]
[Prior art]
In recent years, as information processing technology has advanced, it has become common to handle information electronically. In addition to digitizing data, new services such as an electronic money system and a distribution system for digitized information related to copyright have been developed. When dealing with such electronic information, only certain persons can view such as trade secrets, private data, electronic money information, and electronic information related to copyrights, etc. Cryptographic techniques are used for storing and communicating information that is desired.
[0003]
For example, when performing encrypted communication between host computers, specific data can be obtained by encrypting data with the common key or the other party's public key on the sending side and decrypting it with the common key or one's own private key on the receiving side. Only those who have can decrypt the encrypted data. For example, the validity of information can be verified by an authentication process using key information.
[0004]
By the way, in secret key cryptography, a common key can be easily generated simply by having a random number generation function. On the other hand, generation of a public key and a secret key for public key cryptography is not as simple as a common key generation for secret key cryptography. In particular, in order to generate a public key and a secret key, a prime number with a large bit length is required, and thus an increase in the amount of calculation is inevitable. There is table processing using memory as a method for generating prime numbers with large bit lengths at high speed, but in this case, it is necessary to store a very large number of prime numbers, and memory resources are limited. In an encryption device (for example, an IC card having a processing function is used as an encryption device), this table processing has not been appropriate. For these reasons, conventionally, public keys and private keys for public key cryptography usually have to be generated in an environment where a high-speed CPU such as a personal computer and sufficient memory exist.
[0005]
In addition, when a center that manages and publicizes each user's public key generates a public key and a secret key and distributes the secret key to each user, a key distribution mechanism in consideration of security is essential. Therefore, it was a considerable burden for the center to distribute and manage a large number of secret keys.
[0006]
In addition, when each user generates a public key and a secret key with a personal computer or the like, and transfers and holds the secret key to an external storage device, the key generated on the memory of the personal computer is temporarily stored. If it does exist and it is online, the key can be destroyed or tampered with. In addition, there is a possibility that a key already generated may be destroyed or tampered with due to an erroneous operation of the secret key generation function. Furthermore, there is a problem that it is impossible to detect that the key has been destroyed or altered.
[0007]
[Problems to be solved by the invention]
Conventionally, when generating an encryption key (public key, secret key, common key) based on a prime number, it has been necessary to generate a prime number with a large bit length, which has required a large amount of computer resources. .
[0008]
Conventionally, there is a problem that a key already generated may be destroyed by restarting the secret key generation function.
Further, conventionally, there has been a problem that it is impossible to detect that the key has been destroyed or altered.
[0009]
The present invention has been made in consideration of the above circumstances, and an encryption device capable of generating a sufficiently large prime number for generating an encryption key using less computer resources in the device itself, and An object of the present invention is to provide an encryption key generation method.
[0010]
The present invention also provides an encryption device capable of securely managing encryption keys.as well asEncryption key generation methodThe lawThe purpose is to provide. It is another object of the present invention to provide a prime number generating apparatus and a prime number generating method capable of generating a larger prime number using fewer computer resources.
[0011]
[Means for Solving the Problems]
The present invention (Claim 1) is an encryption device that generates an encryption key based on a prime number within the device itself, and that is less than or equal to 2n bits based on all prime numbers having a predetermined value of n bits or less. First prime number generating means for generating a first prime number, and a second prime number having a predetermined bit length greater than 2n bits based on all the prime numbers less than n bits and the first prime number. 2 prime number generating means, and an encryption key generating means for generating an encryption key using the second prime number having the predetermined bit length.As the second prime number generation means, the second prime number candidate N i Is divided by all prime numbers of n bits or less, and when any prime number is not divisible, a given a i About Fermat test a i N i −1 ≡1 (mod N i ) Is satisfied, and when the relationship of the first equation is satisfied, the greatest common divisor gcd (a i ( N i -1 ) / F i  -1, N i ) ≠ 1 relationship (however, F i : The first prime number) is satisfied, and when the relationship of the second formula is satisfied, the prime number candidate N i To the second prime number N i GetIt is characterized by that.
[0012]
The present invention (Claim 2) is an encryption device that generates an encryption key in its own device, and uses all prime numbers of n bits or less determined in advance to determine a prime number of a predetermined random number of 2n bits or less. First prime number generating means for generating a first prime number of 2n bits or less, and generating prime candidates larger than the first prime number based on the first prime number, and all prime numbers of n bits or less If it is determined that the prime candidate is not a composite number by the prime judgment using at least a new prime number that is a new first prime number and is larger than the prime candidate based on the new first prime number. In addition to recursively repeating the process of generating a prime number candidate, if it is determined that the prime number candidate is a composite number, a prime number candidate is generated based on the first prime number at the time when it is determined to be the composite number. Repeat the process recursively again By, a cryptographic key generating means for generating a cipher key using the second prime number generating means for generating a second prime predetermined bit length greater than 2n bits, the prime of the predetermined bit lengthAs the prime number determination by the second prime number generation means, the prime number candidate N i Is divided by all prime numbers of n bits or less, and when any prime number is not divisible, a given a i About Fermat test a i N i -1 ≡1 (mod N i ) Is satisfied, and when the relationship of the first equation is satisfied, the greatest common divisor gcd (a i ( N i -1 ) / F i -1, N i ) ≠ 1 relationship (however, F i : First prime number) is satisfied, and when the relationship of the second formula is satisfied, the prime candidate N i Is not a composite numberIt is characterized by that.
[0013]
The present invention (Claim 3) is an encryption device that generates an encryption key in its own device, and determines a prime number of a random number of 2n bits or less using a predetermined prime number of n bits or less. A first prime number generating means for generating a first prime number of 2n bits or less, a first prime number of 2n bits or less generated by the first prime number generation means, and all the prime numbers of n bits or less. And a second prime number generating means for generating a second prime number having a predetermined bit length greater than 2n bits, and a 0.4 mbit second generated by using the first and second prime number generating means. A third prime number generating means for generating a third prime number of 0.5 m bits based on the prime number and the second prime number; and another 0 generated using the first and second prime number generating means. .4m-bit second prime number, said third prime number A fourth prime number generating means for generating a fourth prime number of m bits based on the third prime number of 0.5 m bits generated by the generating means and all the prime numbers of n bits or less; Encryption key generation means for generating an encryption key using the m-bit fourth prime number generated by the prime number generation meansAs the second prime number generation means, the second prime number candidate N i Is divided by all prime numbers of n bits or less, and when any prime number is not divisible, a given a i About Fermat test a i N i −1 ≡1 (mod N i ) Is satisfied, and when the relationship of the first equation is satisfied, the greatest common divisor gcd (a i ( N i -1 ) / F i  -1, N i ) ≠ 1 relationship (however, F i : The first prime number) is satisfied, and when the relationship of the second formula is satisfied, the prime number candidate N i To the second prime number N i GetIt is characterized by that.
[0016]
The present invention (claims)4) Is an encryption key generation method for generating an encryption key based on a prime number in an encryption device,Stored in a prime number table stored in a non-volatile memory that is randomly accessible in the encryption deviceGenerating a first prime number of 2n bits or less based on all prime numbers of a predetermined value of n bits or less;Stored in a prime table stored in non-volatile memorygenerating a second prime number having a predetermined bit length greater than 2n bits based on all the prime numbers of n bits or less and the first prime number;When generating the second prime number, the second prime number candidate N i Is divided by all prime numbers of n bits or less, and when any prime number is not divisible, a given a i About Fermat test a i N i -1 ≡1 (mod N i ) Is satisfied, and when the relationship of the first equation is satisfied, the greatest common divisor gcd (a i ( N i -1 ) / F i -1, N i ) ≠ 1 relationship (however, F i : The first prime number) is satisfied, and when the relationship of the second formula is satisfied, the prime number candidate N i To the second prime number N i ProducesUsing the second prime number of the predetermined bit lengthBy a coprocessor in the cryptographic deviceAn encryption key is generated.
[0017]
The present invention (claims)5) Is an encryption key generation method for generating an encryption key based on a prime number in an encryption device,Stored in a prime number table stored in a non-volatile memory that is randomly accessible in the encryption deviceA first prime number generating step of generating a first prime number of 2n bits or less by determining a prime number of a predetermined random number of 2n bits or less using all prime numbers of n bits or less determined in advance; Generating a prime candidate larger than the first prime number based on the prime number;Stored in a prime table stored in non-volatile memoryIf it is determined that the prime candidate is not a composite number by the prime judgment using at least all prime numbers of n bits or less, the prime candidate is set as a new first prime number and the new first prime number is used as a basis. The process of generating a new prime number candidate larger than the prime number candidate is recursively repeated, and when it is determined that the prime number candidate is a composite number, the time when the first prime number generation step determines the composite number A second prime number generating step of generating a second prime number having a predetermined bit length larger than 2n bits by regenerating a prime number candidate based on the first prime number in step ii and recursively repeating the process; , Using a prime number of the predetermined bit lengthBy a coprocessor in the cryptographic deviceAn encryption key generation step for generating an encryption key.As the prime number determination in the second prime number generation step, the prime number candidate N i Is divided by all prime numbers of n bits or less, and when any prime number is not divisible, a given a i About Fermat test a i N i -1 ≡1 (mod N i ) Is satisfied, and when the relationship of the first equation is satisfied, the greatest common divisor gcd (a i ( N i -1 ) / F i -1, N i ) ≠ 1 relationship (however, F i : First prime number) is satisfied, and when the relationship of the second formula is satisfied, the prime candidate N i Is not a composite numberIt is characterized by that.
[0018]
The present invention (claims)6) Is an encryption key generation method for generating an encryption key based on a prime number in an encryption device,Stored in a prime number table stored in a non-volatile memory that is randomly accessible in the encryption deviceA first prime number generating step of generating a first prime number of 2n bits or less by determining a prime number of a predetermined random number of 2n bits or less using all prime numbers of n bits or less determined in advance; A first prime number of 2n bits or less generated in the prime number generation step;Stored in a prime table stored in non-volatile memorya second prime number generating step for generating a second prime number having a predetermined bit length greater than 2n bits based on all the prime numbers of n bits or less, and 0 generated by the first and second prime number generation steps. Based on the second prime number of 4 m bits and the second prime numberBy a coprocessor in the cryptographic deviceA third prime number generating step for generating a third prime number of 0.5 m bits; another 0.4 m bit second prime number generated by the first and second prime number generating steps; A 0.5 m-bit third prime number generated by the prime number generation step;Stored in a prime table stored in non-volatile memorya fourth prime number generating step for generating a fourth prime number of m bits based on all the prime numbers of n bits or less; and the fourth prime number of m bits generated in the fourth prime number generation step. make use ofBy the coprocessorAn encryption key generation step for generating an encryption key.In the second prime number generation step, the second prime number candidate N i Is divided by all prime numbers of n bits or less, and when any prime number is not divisible, a given a i About Fermat test a i N i -1 ≡1 (mod N i ) Is satisfied, and when the relationship of the first equation is satisfied, the greatest common divisor gcd (a i ( N i -1 ) / F i  -1, N i ) ≠ 1 relationship (however, F i : The first prime number) is satisfied, and when the relationship of the second formula is satisfied, the prime number candidate N i To the second prime number N i GetIt is characterized by that.
[0021]
The present invention (claims)7) Is a first prime number generating means for generating a prime number of 2n bits or less based on all prime numbers having a predetermined value of n bits or less, and all the prime numbers of n bits or less and the 2n bits or less Second prime number generating means for generating a prime number having the predetermined bit length larger than 2n bits based on the prime number.As the second prime number generation means, the second prime number candidate N i Is divided by all prime numbers of n bits or less, and when any prime number is not divisible, a given a i About Fermat test a i N i -1 ≡1 (mod N i ) Is satisfied, and when the relationship of the first equation is satisfied, the greatest common divisor gcd (a i ( N i -1 ) / F i  -1, N i ) ≠ 1 relationship (however, F i : The first prime number) is satisfied, and when the relationship of the second formula is satisfied, the prime number candidate N i To the second prime number N i GetIt is characterized by that.
[0022]
The present invention (claims)8) Is a first prime number generating means for generating a first prime number of 2n bits or less by determining a prime number of a predetermined random number of 2n bits or less using all prime numbers of n bits or less determined in advance; If a prime candidate larger than the first prime number is generated based on the first prime number, and the prime number judgment using at least all the prime numbers less than or equal to n bits determines that the prime number candidate is not a composite number When the prime number candidate is a new first prime number and the process of generating a new prime number candidate larger than the prime number candidate based on the new first prime number is recursively repeated, and the prime number candidate is a composite number If it is determined, a prime number candidate is generated again based on the first prime number at the time when it is determined to be the composite number, and the process is recursively repeated so that a predetermined bit length larger than 2n bits is obtained. Second prime number And a second prime number generating means for generatingAs the prime number determination by the second prime number generation means, the prime number candidate N i Is divided by all prime numbers of n bits or less, and when any prime number is not divisible, a given a i About Fermat test a i N i -1 ≡1 (mod N i ) Is satisfied, and when the relationship of the first equation is satisfied, the greatest common divisor gcd (a i ( N i -1 ) / F i  -1, N i ) ≠ 1 relationship (however, F i : First prime number) is satisfied, and when the relationship of the second formula is satisfied, the prime candidate N i Is not a composite numberIt is characterized by that.
[0023]
The present invention (claims)9) Is a first prime number generating means for generating a first prime number of 2n bits or less by determining a prime number of a predetermined random number of 2n bits or less using all prime numbers of n bits or less determined in advance; A second prime number having a predetermined bit length greater than 2n bits based on the first prime number of 2n bits or less generated by the first prime number generation means and all the prime numbers of n bits or less; A 0.4 m-bit second prime number generated by using the prime number generation means and the first and second prime number generation means and a third prime number of 0.5 m bits based on the second prime number Third prime number generating means to be generated, another 0.4 m-bit second prime number generated using the first and second prime number generating means, and 0 generated by the third prime number generating means A third prime number of 5 mbits and the And a fourth prime number generating means for generating a fourth prime number of m bits on the basis of all primes bit lessAs the second prime number generation means, the second prime number candidate N i Is divided by all prime numbers of n bits or less, and when any prime number is not divisible, a given a i About Fermat test a i N i -1 ≡1 (mod N i ) Is satisfied, and when the relationship of the first equation is satisfied, the greatest common divisor gcd (a i ( N i -1 ) / F i  -1, N i ) ≠ 1 relationship (however, F i : The first prime number) is satisfied, and when the relationship of the second formula is satisfied, the prime number candidate N i To the second prime number N i GetIt is characterized by that.
[0024]
The present invention (claims)10)Stored in a prime table stored in a non-volatile memory that can be randomly accessed in the cryptographic deviceGenerating a first prime number of 2n bits or less based on all prime numbers of a predetermined value of n bits or less;Stored in a prime table stored in non-volatile memoryGenerates a prime number with a predetermined bit length greater than 2n bits based on all prime numbers less than n bits and prime numbers less than 2n bitsWhen generating the second prime number, the second prime number candidate N i Is divided by all prime numbers of n bits or less, and when any prime number is not divisible, a given a i About Fermat test a i N i -1 ≡1 (mod N i ) Is satisfied, and when the relationship of the first equation is satisfied, the greatest common divisor gcd (a i ( N i -1 ) / F i -1, N i ) ≠ 1 relationship (however, F i : The first prime number) is satisfied, and when the relationship of the second formula is satisfied, the prime number candidate N i To the second prime number N i Generate aIt is characterized by doing.
[0025]
The present invention (claims)11)Stored in a prime table stored in a non-volatile memory that can be randomly accessed in the cryptographic deviceA first prime number generating step of generating a first prime number of 2n bits or less by determining a prime number of a predetermined random number of 2n bits or less using all prime numbers of n bits or less determined in advance; Generating a prime candidate larger than the first prime number based on the prime number;Stored in a prime table stored in non-volatile memoryWhen it is determined that the prime candidate is not a composite number by the prime judgment using at least all primes of n bits or less, the prime candidate is set as a new first prime number and the new first prime number is used as a basis. The process of generating a new prime number candidate larger than the prime number candidate is recursively repeated, and when it is determined that the prime number candidate is a composite number, the time when the first prime number generation step determines the composite number A second prime number generating step of generating a second prime number having a predetermined bit length larger than 2n bits by regenerating a prime number candidate based on the first prime number in step ii and recursively repeating the process; HaveAs the prime number determination in the second prime number generation step, the prime number candidate N i Is divided by all prime numbers of n bits or less, and when any prime number is not divisible, a given a i About Fermat test a i N i -1 ≡1 (mod N i ) Is satisfied, and when the relationship of the first equation is satisfied, the greatest common divisor gcd (a i ( N i -1 ) / F i -1, N i ) ≠ 1 relationship (however, F i : First prime number) is satisfied, and when the relationship of the second formula is satisfied, the prime candidate N i Is not a composite numberIt is characterized by that.
[0026]
The present invention (claims)12)Stored in a prime table stored in a non-volatile memory that can be randomly accessed in the cryptographic deviceA first prime number generating step of generating a first prime number of 2n bits or less by determining a prime number of a predetermined random number of 2n bits or less using all prime numbers of n bits or less determined in advance; A first prime number of 2n bits or less generated in the prime number generation step;Stored in a prime table stored in non-volatile memorya second prime number generating step for generating a second prime number having a predetermined bit length greater than 2n bits based on all the prime numbers of n bits or less, and 0 generated by the first and second prime number generation steps. Based on the second prime number of 4 m bits and the second prime numberBy a coprocessor in the cryptographic deviceA third prime number generating step for generating a third prime number of 0.5 m bits; another 0.4 m bit second prime number generated by the first and second prime number generating steps; A 0.5 m-bit third prime number generated by the prime number generation step;Stored in a prime table stored in non-volatile memoryand a fourth prime number generation step for generating a fourth prime number of m bits based on all prime numbers of n bits or less.In the second prime number generation step, the second prime number candidate N i Is divided by all prime numbers of n bits or less, and when any prime number is not divisible, a given a i About Fermat test a i N i -1 ≡1 (mod N i ) Is satisfied, and when the relationship of the first equation is satisfied, the greatest common divisor gcd (a i ( N i -1 ) / F i  -1, N i ) ≠ 1 relationship (however, F i : The first prime number) is satisfied, and when the relationship of the second formula is satisfied, the prime number candidate N i To the second prime number N i GetIt is characterized by that.
[0027]
The present invention (claims)13)Cryptographic deviceOn the computer,Stored in a prime number table stored in a non-volatile memory that is randomly accessible in the encryption deviceGenerating a first prime number of 2n bits or less based on all prime numbers of a predetermined value of n bits or less;Stored in a prime table stored in non-volatile memoryA program for executing a procedure for generating all prime numbers of n bits or less and a second prime number having a predetermined bit length larger than 2n bits based on the first prime numberAnd, as a procedure for generating the second prime number, the second prime number candidate N i Is divided by all prime numbers of n bits or less, and when any prime number is not divisible, a given a i About Fermat test a i N i -1 ≡1 (mod N i ) Is satisfied, and when the relationship of the first equation is satisfied, the greatest common divisor gcd (a i ( N i -1 ) / F i  -1, N i ) ≠ 1 relationship (however, F i : The first prime number) is satisfied, and when the relationship of the second formula is satisfied, the prime number candidate N i To the second prime number N i Program with steps to getThe gist is a computer-readable recording medium on which is recorded.
[0028]
The present invention (claims)14)Cryptographic deviceOn the computer,Stored in a prime number table stored in a non-volatile memory that is randomly accessible in the encryption deviceA first prime number generating step of generating a first prime number of 2n bits or less by determining a prime number of a predetermined random number of 2n bits or less using all prime numbers of n bits or less determined in advance; Generating a prime candidate larger than the first prime number based on the prime number;Stored in a prime table stored in non-volatile memoryIf it is determined that the prime candidate is not a composite number by the prime judgment using at least all prime numbers of n bits or less, the prime candidate is set as a new first prime number and the new first prime number is used as a basis. The process of generating a new prime number candidate larger than the prime number candidate is recursively repeated, and when it is determined that the prime number candidate is a composite number, the time when the first prime number generation step determines the composite number A second prime number generating step of generating a second prime number having a predetermined bit length larger than 2n bits by regenerating a prime number candidate based on the first prime number in step ii and recursively repeating the process; Program to executeIn the second prime number generation step, the prime number candidate N i Is divided by all prime numbers of n bits or less, and when any prime number is not divisible, a given a i About Fermat test a i N i -1 ≡1 (mod N i ) Is satisfied, and when the relationship of the first equation is satisfied, the greatest common divisor gcd (a i ( N i -1 ) / F i  -1, N i ) ≠ 1 relationship (however, F i : The first prime number) is satisfied, and when the relationship of the second formula is satisfied, the prime number candidate N i To the second prime number N i Program including the steps ofA gist is a computer-readable recording medium on which a program for executing the above is recorded.
[0029]
The present invention (claims)15)Cryptographic deviceOn the computer,Stored in a prime number table stored in a non-volatile memory that is randomly accessible in the encryption deviceA first prime number generating step of generating a first prime number of 2n bits or less by determining a prime number of a predetermined random number of 2n bits or less using all prime numbers of n bits or less determined in advance; A first prime number of 2n bits or less generated in the prime number generation step;Stored in a prime table stored in non-volatile memorya second prime number generating step for generating a second prime number having a predetermined bit length greater than 2n bits based on all the prime numbers of n bits or less, and 0 generated by the first and second prime number generation steps. Based on the second prime number of 4 m bits and the second prime numberBy a coprocessor in the cryptographic deviceA third prime number generating step for generating a third prime number of 0.5 m bits; another 0.4 m bit second prime number generated by the first and second prime number generating steps; A 0.5 m-bit third prime number generated by the prime number generation step;Stored in a prime table stored in non-volatile memoryA program for executing a fourth prime number generating step for generating a fourth prime number of m bits based on all prime numbers of n bits or lessIn the second prime number generation step, the second prime number candidate N i Is divided by all prime numbers of n bits or less, and when any prime number is not divisible, a given a i About Fermat test a i N i -1 ≡1 (mod N i ) Is satisfied, and when the relationship of the first equation is satisfied, the greatest common divisor gcd (a i ( N i -1 ) / F i  -1, N i ) ≠ 1 relationship (however, F i : The first prime number) is satisfied, and when the relationship of the second formula is satisfied, the prime number candidate N i To the second prime number N i Program including the steps ofThe program may include a procedure for generating a cryptographic key using the prime number generated by a computer.
[0030]
Preferably, the program may include a procedure for encrypting data to be encrypted using the encryption key generated by a computer.
[0033]
The invention relating to the above apparatus is also established as the invention relating to the method, and the invention relating to the method is also established as the invention relating to the apparatus.
Further, the present invention relating to an apparatus or a method has a function for causing a computer to execute a procedure corresponding to the invention (or for causing a computer to function as a means corresponding to the invention, or for a computer to have a function corresponding to the invention. It can also be realized as a computer-readable recording medium on which a program (for realizing) is recorded.
[0034]
The present invention (Claims 1, 2, 3,4, 5, 6, 7-12), N bits are preferably a multiple of two. For example, n bits = 256 = 28 In this case, the number of prime numbers of 256 or less is 53 in total. The predetermined bit length is, for example, 256 bits or 384 bits. M is, for example, 256 or 384.
[0035]
In the second to fourth prime generations, it is preferable to perform at least a Fermat test next to the prime number determination (sieving of eratosthenes) using all the prime numbers of n bits or less.
[0036]
Preferably, the encryption device or the prime number generation device may include a program storage unit, a calculation unit that executes a program, a memory unit that can read and write data, and a unit that communicates with the outside.
[0037]
Further, the encryption device and the prime number generation device can be realized by a personal computer, for example. Alternatively, it can be realized by an IC card. The present invention (Claims 1, 2, 3,4) And a deterministic prime number determination method and a first prime number used for prime number determination (first prime number)1/2A table having a size corresponding to the memory capacity of the encryption device can be used by combining the following prime numbers table storing prime numbers.
[0038]
Therefore, even if an encryption device (for example, an IC card) having a limited memory capacity is used instead of an encryption device such as a personal computer having abundant memory, a key (for example, a public key in public key cryptography and (Secret key) generation function can be implemented.
[0039]
Also, since the amount of data handled is small, a key can be generated at high speed.
Moreover, since the deterministic prime number determination method is used, a prime number can be obtained reliably and a safe key can be obtained.
[0040]
Also, by providing the device with a key generation function, it is possible to improve the security for the key and facilitate the management of the key.
In addition, if a key is generated in an individual encryption device and encryption processing and decryption processing are performed in the encryption device, the key never goes out of the encryption device, so that high security for the key can be maintained. .
[0041]
Also, in public key cryptography, each cryptographic device generates a private key and a public key, so that the center that manages the keys does not need to generate and distribute the key to each cryptographic device. The processing burden associated with is reduced.
[0042]
The present invention (claims)7-12) And a deterministic prime number determination method and a first prime number used for prime number determination (first prime number)1/2 By combining with a prime number table storing the following prime numbers, a table having a size corresponding to the memory capacity of the apparatus can be used.
[0043]
Therefore, it is possible to easily implement a prime number generation function on a device even if the device has a limited memory capacity (for example, an IC card), not a device such as a personal computer having abundant memories.
[0044]
In addition, since the amount of data handled is small, prime numbers can be generated at high speed. In addition, since a deterministic prime number determination method is used, a prime number can be obtained reliably..
[0047]
DETAILED DESCRIPTION OF THE INVENTION
Hereinafter, embodiments of the invention will be described with reference to the drawings.
FIG. 1 is a diagram showing a configuration of an encryption apparatus according to an embodiment of the present invention.
The encryption device 1 of the present embodiment includes a CPU 2, a program storage unit 3, a calculation unit 4, a random number generation unit 5, a random accessible nonvolatile memory 6, a nonvolatile memory 7, and an address and data bus 8.
[0048]
In the present embodiment, each function is realized by the CPU 2 executing a program stored in the program storage unit 3. This program includes at least a subprogram for generating prime numbers and a subprogram for generating keys. It should be noted that the subprogram for generating a prime number and the subprogram for generating a key can be implemented independently.
[0049]
In the present embodiment, the calculation unit 4 is used for a predetermined calculation in order to increase the processing speed. For the calculation unit 4, for example, a coprocessor is used. However, the calculation unit 4 may not be provided.
[0050]
In FIG. 1, the random number generation unit 5 is clearly shown, but the random number generation unit 5 may be realized by independent hardware, or may be realized by a program and the CPU 2. In the present embodiment, the latter is assumed. The random number may be input from an external device.
[0051]
The program storage unit 3 is, for example, a ROM.
It is also possible to adopt a configuration in which a program (a program including a procedure for realizing the present embodiment) is installed from the outside (for example, read from a recording medium or acquired via a network). In such a case, for example, an EEPROM, a RAM, or a hard disk device can be used as the program storage unit 3.
[0052]
The random accessible nonvolatile memory 6 is, for example, a RAM. The memory 6 stores data necessary for calculation and data being calculated.
The nonvolatile memory 7 is, for example, an EEPROM. This memory 7 stores the generated key and the like.
[0053]
Also, the encryption device 1 inputs data from the outside via a desired interface (not shown) and outputs the data to the outside. For example, various interfaces such as a user interface and a communication interface are conceivable. For example, when the encryption device 1 is an IC card, data is exchanged with an external computer via a predetermined communication interface.
[0054]
The encryption device 1, a desired encryption function, that is, for example, performs processing such as encryption or decryption on the data input through this interface, or performs data authentication processing, and an external display device, It is assumed that it has a function of outputting input data or processed data to a communication line or a storage device. This function is realized by a program, for example. It is also possible to implement this function by incorporating this function as a subprogram into a program including the subprogram for generating prime numbers and the subprogram for generating keys.
[0055]
By the way, in the present embodiment, a prime number table storing prime numbers used for prime number determination is used. This prime number table is stored in a random accessible nonvolatile memory 6. Here, it is assumed that a prime number having a bit length twice as large as the word size is first generated, and a prime number having a predetermined size larger than that is generated based on the prime number. It shall be stored. For example, when the word size is 8 bits, all prime numbers less than 256 (53 prime numbers) are stored.
[0056]
FIG. 2 shows a flowchart of prime number generation processing for generating a prime number used for public key and secret key generation.
Process 1: First, the random number generation unit 5 randomly generates an odd number having a bit length twice the word size (step S1).
[0057]
Process 2: For the generated odd number, trial division (sieving of eratostainness) is performed in the arithmetic unit 4 using a prime number not larger than the word size stored in the prime number table (step S2).
[0058]
Process 3: If the generated odd number is not divisible by all the prime numbers in the prime table, this odd number is determined to be a prime number, and F0  Assign to. If it is divisible by any prime number in the prime number table, the process returns to process 1 (step S3).
[0059]
Process 4: Parameter i = 0 for the following process loop is set (step S4).
Process 5: Prime number Fi  Random number generator 5i  <Fi  Random number R satisfyingi  (Step S5), Ni  = 2Ri  Fi  Prime candidate N represented by +1i  (Step S6).
[0060]
Process 6: Prime number candidate Ni  On the other hand, as a preprocessing for determining the prime number, trial division is performed in the arithmetic unit 4 using the prime numbers stored in the prime number table (step S7). Process 7: Prime number candidate Ni  Is divisible by any prime in the prime table, the prime candidate Ni  Is determined to be a composite number, and the process returns to process 5 (step S8). And Fi  The random number generator 5 keeps the value of R unchanged.i  (Ri  <Fi  ) To generate new prime candidate Ni  Is generated.
[0061]
Process 8: Prime number candidate Ni  For a given ai  Is calculated in the calculation unit 4 (Fermer test) (step S9). If not, the process returns to process 5 (step S10).
[0062]
[Expression 1]
Figure 0003626340
[0063]
Process 9: Prime number candidate Ni  For a given ai  Is calculated by the calculation unit 4 as to whether the expression (2) is satisfied (step S11). If not, the process returns to process 5 (step S12).
[0064]
[Expression 2]
Figure 0003626340
[0065]
Process 10: Prime number candidate Ni  If F does not reach the predetermined bit size, Fi  = Ni  , I + = 1 (i is incremented by 1) (steps S13 and S14), and the process returns to step 5. Prime number candidate Ni  R to reach a predetermined bit lengthi  Increase bit length (Ri  <Fi  ) To adjust.
[0066]
Process 11: Prime number candidate N as described abovei  If N reaches a predetermined bit size, the prime number Ni  Get.
In the above processing 8 and processing 9, ai  It is preferable to use = 2. In the above trial division, the prime table including prime numbers less than or equal to the word size is used.0  By performing trial division using the following prime numbers as preprocessing, most of the combined numbers can be removed. Therefore, the prime number determination can be performed efficiently by narrowing down the prime number candidates to be subjected to the prime number determination.
[0067]
In the above judgment formula, ai  Since calculation is performed with a small bottom calculation of = 2, the calculation is easy. Usually bottom ai  Performs the prime number determination process using not only 2 but also from the smallest prime number in order.i  There is no problem even if it is not changed in this way. It is ai  This is because the case where it is determined that the prime candidate is not a prime number is very small when = 2.
[0068]
Therefore, as a bottom with efficiency and practicality, ai  = 2 is used. Assuming that the bit size of the prime number obtained in the execution up to the processing 11 is n bits, (prime number-1) can have a prime number of about n / 2 bits. Thereby, the p-1 method which is one method of the prime factorization method can be avoided.
[0069]
Furthermore, in order to cope with the p + 1 method, it is necessary to give a prime number with a large bit size to (prime number + 1). A prime number is generated using the process of FIG. 2, and a prime number that can cope with the p ± 1 method is generated by the process of FIG.
[0070]
Process 12: First, a 0.4n-bit prime number (s, t) is generated using the process of FIG. 2 (steps S21 and S22).
Process 13: A 0.5n-bit prime number candidate is generated so that r = 2at + 1 (step S23).
[0071]
Process 14: Trial division is performed on the prime number candidate by the arithmetic unit 4 using the prime numbers stored in the prime number table as preprocessing for prime number determination (step S24). If the prime candidate is divisible by any prime number in the prime table, the prime candidate N is determined to be a composite number, the value of a is adjusted such that a + = 1, and the process returns to step 13 (step S25). .
[0072]
Process 15: The arithmetic unit 4 calculates whether the prime number candidate satisfies the expression (3) (step S26). If not, the value of a is adjusted such that a + = 1, and the process returns to step 13 (step S27).
[0073]
[Equation 3]
Figure 0003626340
[0074]
Process 16: The arithmetic unit 4 calculates whether the prime number candidate satisfies Expression (4) (step S28). If not, the value of a is adjusted such that a + = 1, and the process returns to the process 14 (step S29).
[0075]
[Expression 4]
Figure 0003626340
[0076]
Process 17: N-bit prime number N is changed to N = 1 + 2 (bs-r-1  (Mod s)) r (step S30), and the same processing as the trial division and determination of the process 14, the calculation and determination of the process 15, and the calculation and determination of the process 16 is performed (steps S31 to S31). S36). When the prime number candidate N is determined to be a composite number by this trial division and when the prime number determination formula is not satisfied by any calculation, the value of b is adjusted as b + = 1, and the above series of processing is performed again. Do.
[0077]
Process 18: If the generated prime number N has a predetermined bit length, the process is terminated (step S37). If the predetermined bit length has not been reached, the processing returns to step 17, and the prime number is determined by adjusting the value of b such that b + = 1 so that the prime candidate N has a predetermined bit length.
[0078]
Now, after generating prime numbers as described above, next, a public key and a secret key are generated based on these prime numbers. Hereinafter, generation of a public key and a secret key in each encryption method will be described.
[0079]
When generating the public key and the secret key in the RSA cipher, two prime numbers p and q are generated using the above processing, and n = pq is a public divisor, and ed = 1 (mod lcm (p−1, q -1)) e and d are used as a secret exponent and a public exponent, respectively (1 cm represents the least common multiple).
[0080]
Since the prime numbers p and q used in the public key and the secret key in the Rabin cipher are limited by the formulas (5) and (6), after processing up to the processing 16 for each of p and q, instead of the processing 17 Next processing 17 'is performed.
[0081]
[Equation 5]
Figure 0003626340
[0082]
Process 17 ': p = 2Fp  Rp  +1, q = 2Fq  Rq  +1, (p and q are n-bit prime candidate), Fp  , Fq  Is a 0.5n-bit prime, Rp  , Rq  Is a random number of 0.4n bits. Fp  , Rp  Each of processing 17 (bs-r-1  (Mod s)), r. Fp  Rp  And Fq  Rq  About 4 | Fp  Rp  -1,4 | Fq  Rq  Search for items that satisfy -3. Then, for p and q, the same processing as the above-described trial division and determination of the processing 14, the calculation and determination of the processing 15, and the calculation and determination of the processing 16 is performed (steps S31 to S36).
[0083]
Using p and q generated in the processing 17 ′, n = pq is a public divisor, and ed = 1 (mod (1/2) · lcm (p−1, q−1)) is set to e and d. Used as a secret index and a public index.
[0084]
The plum integer m = pq used in the public key cryptosystem is a prime number p, q is limited by the equations (7) and (8).p  Rp  And Fq  Rq  2 | Fp  Rp  -1,2 | Fq  Rq  Search for one that satisfies -1. Then, for p and q, the same processing as the above-described trial division and determination of the processing 14, the calculation and determination of the processing 15, and the calculation and determination of the processing 16 is performed (steps S31 to S36).
[0085]
[Formula 6]
Figure 0003626340
[0086]
The prime number necessary for the DSA key is determined as follows.p  A prime number q ′ is generated so as to be qq ′ + 1, two prime numbers are given to p−1, and a prime number determination is performed. Thus, from p and q satisfying q | p−1, g = h(P-1) / q  Using g of (mod p)> 1 and a random number x, y = gx    (Mod p) is calculated, and p, q, g, and y are used as public keys and x is used as a secret key.
[0087]
As described above, according to the present embodiment, the deterministic prime number determination method and the prime number F0  Is used when determining the prime number (F0  )1/2  A table having a size corresponding to the memory capacity of the encryption device can be used by combining the following prime numbers table storing prime numbers.
[0088]
Therefore, even if an encryption device (for example, an IC card) having a limited memory capacity is used instead of an encryption device such as a personal computer having abundant memory, the public key and the secret key in the public key encryption can be easily stored on the device. The generation function can be implemented.
[0089]
Also, since the amount of data handled is small, a key can be generated at high speed.
Moreover, since the deterministic prime number determination method is used, a prime number can be obtained reliably and a safe key can be obtained.
[0090]
In addition, a key that is strong against attacks by prime factorization can be obtained.
Also, by providing the device with a key generation function, it is possible to improve the security for the key and facilitate the management of the key.
[0091]
In addition, if a key is generated in an individual encryption device and encryption processing and decryption processing are performed in the encryption device, the key never goes out of the encryption device, so that high security for the key can be maintained. .
[0092]
As described above, instead of providing the prime table in the memory 6, a program corresponding to the prime table may be created in the program.
In the present embodiment, the secret key and the public key in public key cryptography are generated based on the prime numbers. However, the common key may be generated based on the prime numbers generated by the method described above. .
[0093]
Next, execution control of the key generation program will be described.
In the encryption device 1, once the key generation program is activated and a key is generated, the key is stored in the nonvolatile memory 7. In the present embodiment, at the same time, the key generation control bit that is also present in the nonvolatile memory 7 is set.
[0094]
The execution of the key generation program is controlled by this key generation control bit. That is, prior to executing the key generation program, the key generation control bit is examined. If the key generation control bit is off, the key generation program is executed, and if it is on, the key generation program is not started.
[0095]
As a result, it is possible to prevent the already generated key from being destroyed by restarting the key generation program with respect to the key generated by the encryption device 1.
As another key generation program execution control method, a method of starting the key generation program only when the same code as the secret authentication code stored in the encryption device 1 is input in advance can be considered. In this method, an authentication code is written on a mask or written at an initial stage at the time of issuance, and the same code is input at a later key generation to start a key generation program. This execution control method of the key generation program can also be used when an already generated encryption key is changed. That is, the key generation program can be executed only when the correct authentication code is input, and the generated encryption key can be stored in the nonvolatile memory 7.
[0096]
Next, verification of the key stored in the encryption device 9 will be described with reference to FIG.
First, when a key is generated, the hash value of the generated key is immediately calculated, and the generated key (11 in the figure) and the hash value (10 in the figure) are associated with each other in the nonvolatile memory. Save to 7.
[0097]
Therefore, before using the key in encryption processing, decryption processing, or authentication processing, the hash value of the key (11 in the figure) stored in the nonvolatile memory 7 is calculated (12 in the figure), and the nonvolatile value is stored in advance. The hash value (10 in the figure) stored in the memory 7 is compared with the match determination unit 13. If they match, a control signal indicating success is output to enable execution of encryption processing and decryption processing. If they do not match, a control signal indicating failure is output to disable execution of encryption processing and decryption processing.
[0098]
Then, the cryptographic process is activated only when the control signal is successful, that is, indicates that the hash values match, and when the control signal is unsuccessful, that is, indicates that the hash values do not match, the cryptographic process is not activated.
[0099]
In this way, when performing encryption processing and decryption processing using the key generated by the encryption device 9, by performing verification of the stored key, encryption processing and decryption processing using a key destroyed for some reason is performed. It can be avoided.
[0100]
Next, confirmation of the validity of the user's key between the user side and the center side that manages and discloses the public key will be described with reference to FIG.
The public key and the private key generated by the encryption device 19 need a means for the center 17 to confirm their validity. One method is shown in FIG.
[0101]
First, the center 17 receives the public key k generated by the encryption device 19 from the information processing device 18.
Next, the center 17 generates a random number R (20 in the figure), encrypts the random number R using the public key k generated by the encryption device 19 (21 in the figure), and transmits it to the information processing apparatus 18. (22 in the figure).
[0102]
The information processing device 18 transmits the random number R encrypted with the public key k to the encryption device 19 via the external interface 30.
The encryption device 19 decrypts the random number R encrypted with the public key k using a secret key that is paired with the public key (23 in the figure).
[0103]
The decrypted random number R is transmitted from the encryption device 19 to the center via the information processing device 18 (25 in the figure).
The center 17 verifies the random number generated by the coincidence determination unit 26 and the random number transmitted from the encryption device 19.
[0104]
If they match, the encryption device 19 holds a valid private key with respect to the public key owned by the center 17, so the center 17 issues a public key certificate to the encryption device 19.
[0105]
In this way, each encryption device generates a secret key and a public key, so that the center that manages the keys does not need to generate and distribute the key to each encryption device, and processing associated with key generation and management The burden of is reduced.
[0106]
The present invention is a computer-readable recording recording a program for causing a computer to execute a predetermined procedure (or for causing a computer to function as a predetermined means or for causing a computer to realize a predetermined function). It can also be implemented as a medium.
The present invention is not limited to the embodiment described above, and can be implemented with various modifications within the technical scope thereof.
[0107]
【The invention's effect】
According to the present invention, a prime number of 2n bits or less is generated based on all prime numbers having a predetermined value of n bits or less, and a large prime number is sequentially generated based on the generated prime numbers. Since the second prime number having a bit length is generated, the required memory capacity can be reduced.
[0108]
Therefore, it is possible to implement a key generation function in a cryptographic device having a limited memory capacity. Also, since the amount of data handled is small, a key can be generated at high speed.
[0109]
In addition, since the key is generated in the encryption device without exchange with the outside, the security for the key can be improved and the management of the key can be facilitated. Further, according to the present invention, when a key has already been generated in the encryption apparatus, the key is not generated again, so that the already generated key is destroyed by the newly generated key. Can be prevented.
[0110]
In addition, according to the present invention, when performing encryption processing or decryption processing using a key generated in the encryption device, the stored key is verified to verify the encryption with the key destroyed for some reason. Processing and decoding processing can be avoided.
[Brief description of the drawings]
FIG. 1 is a diagram showing a configuration of an encryption apparatus according to an embodiment of the present invention.
FIG. 2 is a flowchart showing a prime number generation procedure according to the embodiment;
FIG. 3 is a flowchart showing a prime number generation procedure according to the embodiment;
FIG. 4 is a view showing an example of key verification in the encryption device according to the embodiment;
FIG. 5 is a view showing an example of key validity verification according to the embodiment;
[Explanation of symbols]
1. Cryptographic device
2 ... CPU
3 ... Program memory
4. Calculation unit
5 ... Random number generator
6 ... Randomly accessible non-volatile memory
7 ... Non-volatile memory
8 ... Bus
9 ... Cryptographic device
12 ... Hash value calculation unit
13, 26 ... coincidence determination unit
17 ... Center
18. Method processing apparatus
19 ... Cryptographic device

Claims (15)

自装置内で素数をもとに暗号鍵を生成する暗号装置であって、
予め定められたnビット以下の値のすべての素数をもとに2nビット以下の第1の素数を生成する第1の素数生成手段と、
前記nビット以下のすべての素数および前記第1の素数をもとに2nビットより大きい所定のビット長の第2の素数を生成する第2の素数生成手段と、
前記所定のビット長の第2の素数を用いて暗号鍵を生成する暗号鍵生成手段とを備え
前記第2の素数生成手段は、
前記第2の素数の候補N i を前記nビット以下のすべての素数で試行割算し、いずれの素数でも割り切れないとき、所定のa i について第1式のフェルマーテストa i i −1 ≡1(mod N i )の関係を満たすか否かを計算し、第1式の関係を満たすとき、第2式の最大公約数gcd(a i ( i −1 ) /F i −1,N i )≠1の関係(但し、F i :第1の素数)を満たすか否かを計算し、第2式の関係を満たすとき、前記素数の候補N i から第2の素数N i を得ることを特徴とする暗号装置。
An encryption device that generates an encryption key based on a prime number in its own device,
First prime number generating means for generating a first prime number of 2n bits or less based on all prime numbers having a predetermined value of n bits or less;
Second prime number generation means for generating a second prime number having a predetermined bit length greater than 2n bits based on all the prime numbers less than n bits and the first prime number;
Encryption key generation means for generating an encryption key using the second prime number of the predetermined bit length ,
The second prime number generating means is
Said candidate N i of the second prime attempts divided by all primes less than the n bits when not divisible in any prime, first equation Fermat test a i N i -1 for a given a i If the relationship of 1 (mod N i ) is satisfied and the relationship of the first equation is satisfied, the greatest common divisor gcd (a i ( N i −1 ) / F i −1, N of the second equation is satisfied. i) ≠ 1 relationship (although, F i: whether the calculated satisfies a first prime number), when satisfying the second equation relation, obtaining a second prime number N i of candidates N i of the prime number A cryptographic device characterized by the above.
自装置内で暗号鍵を生成する暗号装置であって、
予め定められたnビット以下のすべての素数を用いて所定の2nビット以下の乱数を素数判定することにより2nビット以下の第1の素数を生成する第1の素数生成手段と、
前記第1の素数をもとに該第1の素数より大きい素数候補を生成し、前記nビット以下のすべての素数を少なくとも用いた素数判定により該素数候補が合成数でないと判定された場合には該素数候補を新たな第1の素数とし該新たな第1の素数をもとに該素数候補より大きい新たな素数候補を生成する処理を再帰的に繰り返すとともに、素数候補が合成数であると判定された場合には前記合成数と判定された時点での第1の素数をもとに素数候補を生成し直しあらためて該処理を再帰的に繰り返すことにより、2nビットより大きい所定のビット長の第2の素数を生成する第2の素数生成手段と、
前記所定のビット長の素数を用いて暗号鍵を生成する暗号鍵生成手段とを備え
前記第2の素数生成手段による素数判定は、
前記素数候補N i を前記nビット以下のすべての素数で試行割算し、いずれの素数でも割り切れないとき、所定のa i について第1式のフェルマーテストa i i −1 ≡1(mod N i )の関係を満たすか否かを計算し、第1式の関係を満たすとき、第2式の最大公約数gcd(a i ( i −1 ) /F i −1,N i )≠1の関係(但し、F i :第1の素数)を満たすか否かを計算し、第2式の関係を満たすとき、該素数候補N i を合成数でないと判定することを特徴とする暗号装置。
An encryption device that generates an encryption key in its own device,
First prime number generating means for generating a first prime number of 2n bits or less by determining a prime number of a predetermined random number of 2n bits or less using all predetermined prime numbers of n bits or less;
When a prime candidate larger than the first prime number is generated based on the first prime number and it is determined that the prime candidate is not a composite number by a prime number determination using at least all prime numbers of n bits or less. Recursively repeats the process of generating a new prime number larger than the prime candidate based on the new first prime number, and the prime number candidate is a composite number. If it is determined that the composite number, a predetermined bit length larger than 2n bits is generated by regenerating a prime number candidate based on the first prime number at the time when the composite number is determined and recursively repeating the process. Second prime number generating means for generating a second prime number of
Encryption key generating means for generating an encryption key using a prime number of the predetermined bit length ,
The prime number determination by the second prime number generation means is:
The prime candidate N i tried divided by all primes less than the n bits when not divisible in any prime, Fermat test of the first equation for a given a i a i N i -1 ≡1 (mod N i ) is satisfied or not, and when the relationship of the first equation is satisfied, the greatest common divisor gcd (a i ( N i −1 ) / F i of the second equation is satisfied. −1, N i ) ≠ 1 relationship (where F i is the first prime number) is calculated, and when the relationship of the second equation is satisfied, the prime number candidate N i is determined not to be a composite number An encryption device characterized by:
自装置内で暗号鍵を生成する暗号装置であって、
予め定められたnビット以下のすべての素数を用いて所定の2nビット以下の乱数を素数判定することにより2nビット以下の第1の素数を生成する第1の素数生成手段と、
前記第1の素数生成手段により生成された2nビット以下の第1の素数および前記nビット以下のすべての素数をもとに2nビットより大きい所定のビット長の第2の素数を生成する第2の素数生成手段と、
前記第1および第2の素数生成手段を用いて生成された0.4mビットの第2の素数および前記第2の素数をもとに0.5mビットの第3の素数を生成する第3の素数生成手段と、
前記第1および第2の素数生成手段を用いて生成された他の0.4mビットの第2の素数、前記第3の素数生成手段により生成された0.5mビットの第3の素数および前記nビット以下のすべての素数をもとにmビットの第4の素数を生成する第4の素数生成手段と、
前記第4の素数生成手段により生成された前記mビットの第4の素数を用いて暗号鍵を生成する暗号鍵生成手段とを備え
前記第2の素数生成手段は、
前記第2の素数の候補N i を前記nビット以下のすべての素数で試行割算し、いずれの素数でも割り切れないとき、所定のa i について第1式のフェルマーテストa i i −1 ≡1(mod N i )の関係を満たすか否かを計算し、第1式の関係を満たすとき、第2式の最大公約数gcd(a i ( i −1 ) /F i −1,N i )≠1の関係(但し、F i :第1の素数)を満たすか否かを計算し、第2式の関係を満たすとき、前記素数の候補N i から第2の素数N i を得ることを特徴とする暗号装置。
An encryption device that generates an encryption key in its own device,
First prime number generating means for generating a first prime number of 2n bits or less by determining a prime number of a predetermined random number of 2n bits or less using all predetermined prime numbers of n bits or less;
A second prime number having a predetermined bit length greater than 2n bits based on the first prime number of 2n bits or less and all the prime numbers of n bits or less generated by the first prime number generation means; A prime number generating means of
A second 0.4 m-bit prime number generated by using the first and second prime number generation means and a third prime number of 0.5 m-bit based on the second prime number; A prime number generating means;
The other 0.4 m-bit second prime number generated using the first and second prime number generation means, the 0.5 m-bit third prime number generated by the third prime number generation means, and the a fourth prime number generating means for generating a fourth prime number of m bits based on all prime numbers of n bits or less;
Encryption key generation means for generating an encryption key using the m-bit fourth prime number generated by the fourth prime number generation means ,
The second prime number generating means is
Said candidate N i of the second prime attempts divided by all primes less than the n bits when not divisible in any prime, first equation Fermat test a i N i -1 for a given a i If the relationship of 1 (mod N i ) is satisfied and the relationship of the first equation is satisfied, the greatest common divisor gcd (a i ( N i −1 ) / F i −1, N of the second equation is satisfied. i) ≠ 1 relationship (although, F i: whether the calculated satisfies a first prime number), when satisfying the second equation relation, obtaining a second prime number N i of candidates N i of the prime number A cryptographic device characterized by the above.
暗号装置内で素数をもとに暗号鍵を生成する暗号鍵生成方法であって、
前記暗号装置内でランダムアクセス可能な不揮発性メモリに格納された素数テーブルに格納された予め定められたnビット以下の値のすべての素数をもとに2nビット以下の第1の素数を生成し、
前記不揮発性メモリに格納された素数テーブルに格納されたnビット以下のすべての素数および前記第1の素数をもとに2nビットより大きい所定のビット長の第2の素数を生成し、
この第2の素数を生成する際に、前記第2の素数の候補N i を前記nビット以下のすべての素数で試行割算し、いずれの素数でも割り切れないとき、所定のa i について第1式のフェルマーテストa i i −1 ≡1(mod N i )の関係を満たすか否かを計算し、第1式の関係を満たすとき、第2式の最大公約数gcd(a i ( i −1 ) /F i −1,N i )≠1の関係(但し、F i :第1の素数)を満たすか否かを計算し、第2式の関係を満たすとき、前記素数の候補N i から第2の素数N i を生成し、
前記所定のビット長の第2の素数を用いて前記暗号装置内のコプロセッサにより暗号鍵を生成することを特徴とする暗号鍵生成方法。
An encryption key generation method for generating an encryption key based on a prime number in an encryption device,
A first prime number of 2n bits or less is generated based on all prime numbers of a predetermined value of n bits or less stored in a prime number table stored in a non-volatile memory that can be randomly accessed in the encryption device. ,
Generating a second prime number having a predetermined bit length larger than 2n bits based on all the prime numbers less than n bits stored in the prime number table stored in the nonvolatile memory and the first prime number;
When generating the second prime number, the candidate N i of the second prime attempts divided by all primes less than the n bits when not divisible in any prime, for a given a i first The Fermat test a i N i −1 ≡1 (mod N i ) is calculated whether or not the relationship is satisfied. When the relationship of the first equation is satisfied, the greatest common divisor gcd (a i ( N i -1 ) / F i −1, N i ) ≠ 1 relationship (where F i is the first prime number) is calculated, and when the relationship of the second equation is satisfied, the prime number candidate N i to the second prime number Generate N i ,
An encryption key generation method, wherein an encryption key is generated by a coprocessor in the encryption device using the second prime number having the predetermined bit length.
暗号装置内で素数をもとに暗号鍵を生成する暗号鍵生成方法であって、
前記暗号装置内でランダムアクセス可能な不揮発性メモリに格納された素数テーブルに格納された予め定められたnビット以下のすべての素数を用いて所定の2nビット以下の乱数を素数判定することにより2nビット以下の第1の素数を生成する第1の素数生成ステップと、
前記第1の素数をもとに該第1の素数より大きい素数候補を生成し、前記不揮発性メモリに格納された素数テーブルに格納されたnビット以下のすべての素数を少なくとも用いた素数判定により該素数候補が合成数でないと判定された場合には該素数候補を新たな第1の素数とし該新たな第1の素数をもとに該素数候補より大きい新たな素数候補を生成する処理を再帰的に繰り返すとともに、素数候補が合成数であると判定された場合には前記第1の素数生成ステップにて合成数と判定された時点での第1の素数をもとに素数候補を生成し直しあらためて該処理を再帰的に繰り返すことにより、2nビットより大きい所定のビット長の第2の素数を生成する第2の素数生成ステップと、
前記所定のビット長の素数を用いて前記暗号装置内のコプロセッサにより暗号鍵を生成する暗号鍵生成ステップとを有し、
前記第2の素数生成ステップによる素数判定は、
前記素数候補N i を前記nビット以下のすべての素数で試行割算し、いずれの素数でも割り切れないとき、所定のa i について第1式のフェルマーテストa i i −1 ≡1(mod N i )の関係を満たすか否かを計算し、第1式の関係を満たすとき、第2式の最大公約数gcd(a i ( i −1 ) /F i −1,N i )≠1の関係(但し、F i :第1の素数)を満たすか否かを計算し、第2式の関係を満たすとき、該素数候補N i を合成数でないと判定することを特徴とする暗号鍵生成方法。
An encryption key generation method for generating an encryption key based on a prime number in an encryption device,
By determining the prime number of a random number of 2n bits or less using a predetermined prime number of n bits or less stored in a prime table stored in a non-volatile memory that can be randomly accessed in the encryption device, 2n A first prime number generating step for generating a first prime number of bits or less;
A prime candidate larger than the first prime number is generated based on the first prime number, and a prime number determination using at least all prime numbers less than n bits stored in the prime number table stored in the nonvolatile memory is performed. When it is determined that the prime number candidate is not a composite number, the prime number candidate is set as a new first prime number, and a new prime number candidate larger than the prime number candidate is generated based on the new first prime number. In addition to recursively repeating, if it is determined that the prime number candidate is a composite number, a prime number candidate is generated based on the first prime number at the time of the first prime number generation step determined to be a composite number A second prime number generating step for generating a second prime number having a predetermined bit length larger than 2n bits by recursively repeating the process again;
Possess an encryption key generating step of generating an encryption key by coprocessor within the cryptographic device using prime of the predetermined bit length,
The prime number determination by the second prime number generation step is:
The prime candidate N i tried divided by all primes less than the n bits when not divisible in any prime, Fermat test of the first equation for a given a i a i N i -1 ≡1 (mod N i ) is satisfied or not, and when the relationship of the first equation is satisfied, the greatest common divisor gcd (a i ( N i −1 ) / F i of the second equation is satisfied. −1, N i ) ≠ 1 relationship (where F i is the first prime number) is calculated, and when the relationship of the second equation is satisfied, the prime number candidate N i is determined not to be a composite number An encryption key generation method characterized by:
暗号装置内で素数をもとに暗号鍵を生成する暗号鍵生成方法であって、
前記暗号装置内でランダムアクセス可能な不揮発性メモリに格納された素数テーブルに格納された予め定められたnビット以下のすべての素数を用いて所定の2nビット以下の乱数を素数判定することにより2nビット以下の第1の素数を生成する第1の素数生成ステップと、
前記第1の素数生成ステップにて生成された2nビット以下の第1の素数および前記不揮発性メモリに格納された素数テーブルに格納されたnビット以下のすべての素数をもとに2nビットより大きい所定のビット長の第2の素数を生成する第2の素数生成ステップと、
前記第1および第2の素数生成ステップにより生成された0.4mビットの第2の素数および前記第2の素数をもとに前記暗号装置内のコプロセッサにより0.5mビットの第3の素数を生成する第3の素数生成ステップと、
前記第1および第2の素数生成ステップにより生成された他の0.4mビットの第2の素数、前記第3の素数生成ステップにより生成された0.5mビットの第3の素数および前記不揮発性メモリに格納された素数テーブルに格納されたnビット以下のすべての素数をもとにmビットの第4の素数を生成する第4の素数生成ステップと、
前記第4の素数生成ステップにて生成された前記mビットの第4の素数を用いて前記コプロセッサにより暗号鍵を生成する暗号鍵生成ステップとを有し、
前記第2の素数生成ステップは、
前記第2の素数の候補N i を前記nビット以下のすべての素数で試行割算し、いずれの素数でも割り切れないとき、所定のa i について第1式のフェルマーテストa i i −1 ≡1(mod N i )の関係を満たすか否かを計算し、第1式の関係を満たすとき、第2式の最大公約数gcd(a i ( i −1 ) /F i −1,N i )≠1の関係(但し、F i :第1の素数)を満たすか否かを計算し、第2式の関係を満たすとき、前記素数の候補N i から第2の素数N i を得ることを特徴とする暗号鍵生成方法。
An encryption key generation method for generating an encryption key based on a prime number in an encryption device,
By determining the prime number of a random number of 2n bits or less using a predetermined prime number of n bits or less stored in a prime table stored in a non-volatile memory that can be randomly accessed in the encryption device, 2n A first prime number generating step for generating a first prime number of bits or less;
Greater than 2n bits based on the first prime number of 2n bits or less generated in the first prime number generation step and all the prime numbers of n bits or less stored in the prime number table stored in the nonvolatile memory A second prime number generating step for generating a second prime number having a predetermined bit length;
A 0.4 mbit second prime number generated by the first and second prime number generation steps and a third prime number of 0.5 mbit by the coprocessor in the encryption device based on the second prime number. A third prime number generating step for generating
The other 0.4 m-bit second prime number generated by the first and second prime number generation steps, the 0.5 m-bit third prime number generated by the third prime number generation step, and the non-volatile property A fourth prime number generating step for generating a fourth prime number of m bits based on all prime numbers of n bits or less stored in a prime number table stored in the memory ;
Possess an encryption key generating step of generating an encryption key by the coprocessor using a fourth prime number of the m bits generated by the fourth prime number generation step,
The second prime number generation step includes:
Said candidate N i of the second prime attempts divided by all primes less than the n bits when not divisible in any prime, first equation Fermat test a i N i -1 for a given a i If the relationship of 1 (mod N i ) is satisfied and the relationship of the first equation is satisfied, the greatest common divisor gcd (a i ( N i −1 ) / F i −1, N of the second equation is satisfied. i) ≠ 1 relationship (although, F i: whether the calculated satisfies a first prime number), when satisfying the second equation relation, obtaining a second prime number N i of candidates N i of the prime number An encryption key generation method characterized by the above.
予め定められたnビット以下の値のすべての素数をもとに2nビット以下の素数を生成する第1の素数生成手段と、
前記nビット以下のすべての素数および前記2nビット以下の素数をもとに2nビットより大きい前記所定のビット長の素数を生成する第2の素数生成手段とを備え
前記第2の素数生成手段は、
前記第2の素数の候補N i を前記nビット以下のすべての素数で試行割算し、いずれの素数でも割り切れないとき、所定のa i について第1式のフェルマーテストa i i −1 ≡1(mod N i )の関係を満たすか否かを計算し、第1式の関係を満たすとき、第2式の最大公約数gcd(a i ( i −1 ) /F i −1,N i )≠1の関係(但し、F i :第1の素数)を満たすか否かを計算し、第2式の関係を満たすとき、前記素数の候補N i から第2の素数N i を得ることを特徴とする素数生成装置。
First prime number generating means for generating a prime number of 2n bits or less based on all prime numbers having a predetermined value of n bits or less;
Second prime number generating means for generating a prime number having a predetermined bit length larger than 2n bits based on all the prime numbers less than n bits and the prime numbers less than 2n bits ,
The second prime number generating means is
Said candidate N i of the second prime attempts divided by all primes less than the n bits when not divisible in any prime, first equation Fermat test a i N i -1 for a given a i If the relationship of 1 (mod N i ) is satisfied and the relationship of the first equation is satisfied, the greatest common divisor gcd (a i ( N i −1 ) / F i −1, N of the second equation is satisfied. i) ≠ 1 relationship (although, F i: whether the calculated satisfies a first prime number), when satisfying the second equation relation, obtaining a second prime number N i of candidates N i of the prime number A prime number generator characterized by the above.
予め定められたnビット以下のすべての素数を用いて所定の2nビット以下の乱数を素数判定することにより2nビット以下の第1の素数を生成する第1の素数生成手段と、
前記第1の素数をもとに該第1の素数より大きい素数候補を生成し、前記nビット以下のすべての素数を少なくとも用いた素数判定により該素数候補が合成数でないと判定された場合には該素数候補を新たな第1の素数とし該新たな第1の素数をもとに該素数候補より大きい新たな素数候補を生成する処理を再帰的に繰り返すとともに、素数候補が合成数であると判定された場合には前記合成数と判定された時点での第1の素数をもとに素数候補を生成し直しあらためて該処理を再帰的に繰り返すことにより、2nビットより大きい所定のビット長の第2の素数を生成する第2の素数生成手段とを備え
前記第2の素数生成手段による素数判定は、
前記素数候補N i を前記nビット以下のすべての素数で試行割算し、いずれの素数でも割り切れないとき、所定のa i について第1式のフェルマーテストa i i −1 ≡1(mod N i )の関係を満たすか否かを計算し、第1式の関係を満たすとき、第2式の最大公約数gcd(a i ( i −1 ) /F i −1,N i )≠1の関係(但し、F i :第1の素数)を満たすか否かを計算し、第2式の関係を満たすとき、該素数候補N i を合成数でないと判定 することを特徴とする素数生成装置。
First prime number generating means for generating a first prime number of 2n bits or less by determining a prime number of a predetermined random number of 2n bits or less using all predetermined prime numbers of n bits or less;
When a prime candidate larger than the first prime number is generated based on the first prime number and it is determined that the prime candidate is not a composite number by a prime number determination using at least all prime numbers of n bits or less. Recursively repeats the process of generating a new prime number larger than the prime candidate based on the new first prime number, and the prime number candidate is a composite number. If it is determined that the composite number, a predetermined bit length larger than 2n bits is generated by regenerating a prime number candidate based on the first prime number at the time when the composite number is determined and recursively repeating the process. And a second prime number generating means for generating the second prime number of
The prime number determination by the second prime number generation means is:
The prime candidate N i tried divided by all primes less than the n bits when not divisible in any prime, Fermat test of the first equation for a given a i a i N i -1 ≡1 (mod N i ) is satisfied or not, and when the relationship of the first equation is satisfied, the greatest common divisor gcd (a i ( N i −1 ) / F i −1, N i ) ≠ 1 of the second equation Generating a prime number characterized by determining whether or not the prime number candidate N i is not a composite number when the relation (2) (where F i is the first prime number) is satisfied. apparatus.
予め定められたnビット以下のすべての素数を用いて所定の2nビット以下の乱数を素数判定することにより2nビット以下の第1の素数を生成する第1の素数生成手段と、
前記第1の素数生成手段により生成された2nビット以下の第1の素数および前記nビット以下のすべての素数をもとに2nビットより大きい所定のビット長の第2の素数を生成する第2の素数生成手段と、
前記第1および第2の素数生成手段を用いて生成された0.4mビットの第2の素数および前記第2の素数をもとに0.5mビットの第3の素数を生成する第3の素数生成手段と、
前記第1および第2の素数生成手段を用いて生成された他の0.4mビットの第2の素数、前記第3の素数生成手段により生成された0.5mビットの第3の素数および前記nビット以下のすべての素数をもとにmビットの第4の素数を生成する第4の素数生成手段とを備え
前記第2の素数生成手段は、
前記第2の素数の候補N i を前記nビット以下のすべての素数で試行割算し、いずれの素数でも割り切れないとき、所定のa i について第1式のフェルマーテストa i i −1 ≡1(mod N i )の関係を満たすか否かを計算し、第1式の関係を満たすとき、第2式の最大公約数gcd(a i ( i −1 ) /F i −1,N i )≠1の関係(但し、F i :第1の素数)を満たすか否かを計算し、第2式の関係を満たすとき、前記素数の候補N i から第2の素数N i を得ることを特徴とする素数生成装置。
First prime number generating means for generating a first prime number of 2n bits or less by determining a prime number of a predetermined random number of 2n bits or less using all predetermined prime numbers of n bits or less;
A second prime number having a predetermined bit length greater than 2n bits based on the first prime number of 2n bits or less and all the prime numbers of n bits or less generated by the first prime number generation means; A prime number generating means of
A second 0.4 m-bit prime number generated by using the first and second prime number generation means and a third prime number of 0.5 m-bit based on the second prime number; A prime number generating means;
The other 0.4 m-bit second prime number generated using the first and second prime number generation means, the 0.5 m-bit third prime number generated by the third prime number generation means, and the and a fourth prime number generating means for generating a fourth prime number of m bits based on all prime numbers of n bits or less ,
The second prime number generating means is
Said candidate N i of the second prime attempts divided by all primes less than the n bits when not divisible in any prime, first equation Fermat test a i N i -1 for a given a i If the relationship of 1 (mod N i ) is satisfied and the relationship of the first equation is satisfied, the greatest common divisor gcd (a i ( N i −1 ) / F i −1, N of the second equation is satisfied. i) ≠ 1 relationship (although, F i: whether the calculated satisfies a first prime number), when satisfying the second equation relation, obtaining a second prime number N i of candidates N i of the prime number A prime number generator characterized by the above.
暗号装置内でランダムアクセス可能な不揮発性メモリに格納された素数テーブルに格納された予め定められたnビット以下の値のすべての素数をもとに2nビット以下の第1の素数を生成し、
前記不揮発性メモリに格納された素数テーブルに格納されたnビット以下のすべての素数および前記2nビット以下の素数をもとに2nビットより大きい前記所定のビット長の素数を生成し、
この第2の素数を生成する際に、前記第2の素数の候補N i を前記nビット以下のすべての素数で試行割算し、いずれの素数でも割り切れないとき、所定のa i について第1式のフェルマーテストa i i −1 ≡1(mod N i )の関係を満たすか否かを計算し、第1式の関係を満たすとき、第2式の最大公約数gcd(a i ( i −1 ) /F i −1,N i )≠1の関係(但し、F i :第1の素数)を満たすか否かを計算し、第2式の関係を満たすとき、前記素数の候補N i から第2の素数N i を生成することを特徴とする素数生成方法。
Generating a first prime number of 2n bits or less based on all prime numbers of a predetermined n bits or less value stored in a prime number table stored in a non-volatile memory that is randomly accessible in the cryptographic device ;
Generating prime numbers having a predetermined bit length greater than 2n bits based on all prime numbers less than or equal to n bits and prime numbers less than or equal to 2n bits stored in a prime number table stored in the nonvolatile memory ;
When generating the second prime number, the candidate N i of the second prime attempts divided by all primes less than the n bits when not divisible in any prime, for a given a i first The Fermat test a i N i −1 ≡1 (mod N i ) is calculated whether or not the relationship is satisfied. When the relationship of the first equation is satisfied, the greatest common divisor gcd (a i ( N i -1 ) / F i −1, N i ) ≠ 1 relationship (where F i is the first prime number) is calculated, and when the relationship of the second equation is satisfied, the prime number candidate N i to the second prime number prime generation method characterized by generating a N i.
暗号装置内でランダムアクセス可能な不揮発性メモリに格納された素数テーブルに格納された予め定められたnビット以下のすべての素数を用いて所定の2nビット以下の乱数を素数判定することにより2nビット以下の第1の素数を生成する第1の素数生成ステップと、
前記第1の素数をもとに該第1の素数より大きい素数候補を生成し、前記不揮発性メモリに格納された素数テーブルに格納されたnビット以下のすべての素数を少なくとも用いた素数判定により該素数候補が合成数でないと判定された場合には該素数候補を新たな第1の素数とし該新たな第1の素数をもとに該素数候補より大きい新たな素数候補を生成する処理を再帰的に繰り返すとともに、素数候補が合成数であると判定された場合には前記第1の素数生成ステップにて合成数と判定された時点での第1の素数をもとに素数候補を生成し直しあらためて該処理を再帰的に繰り返すことにより、2nビットより大きい所定のビット長の第2の素数を生成する第2の素数生成ステップとを有し、
前記第2の素数生成ステップによる素数判定は、
前記素数候補N i を前記nビット以下のすべての素数で試行割算し、いずれの素数でも割り切れないとき、所定のa i について第1式のフェルマーテストa i i −1 ≡1(mo d N i )の関係を満たすか否かを計算し、第1式の関係を満たすとき、第2式の最大公約数gcd(a i ( i −1 ) /F i −1,N i )≠1の関係(但し、F i :第1の素数)を満たすか否かを計算し、第2式の関係を満たすとき、該素数候補N i を合成数でないと判定することを特徴とする素数生成方法。
2n bits by determining a prime number of a predetermined random number of 2n bits or less using all the prime numbers of n bits or less that are stored in a prime number table stored in a non-volatile memory that can be randomly accessed in the cryptographic device A first prime number generating step for generating the following first prime number;
A prime candidate larger than the first prime number is generated based on the first prime number, and a prime number determination using at least all prime numbers less than n bits stored in the prime number table stored in the nonvolatile memory is performed. When it is determined that the prime number candidate is not a composite number, the prime number candidate is set as a new first prime number, and a new prime number candidate larger than the prime number candidate is generated based on the new first prime number. In addition to recursively repeating, if it is determined that the prime number candidate is a composite number, a prime number candidate is generated based on the first prime number at the time of the first prime number generation step determined to be a composite number by again repeating the process recursively re, have a second prime number generation step of generating a second prime predetermined bit length greater than 2n bits,
The prime number determination by the second prime number generation step is:
The prime candidate N i tried divided by all primes less than the n bits when not divisible in any prime, Fermat test of the first equation for a given a i a i N i -1 ≡1 (mo d N i ) is satisfied, and when the relationship of the first expression is satisfied, the greatest common divisor gcd (a i ( N i −1 ) / F i of the second expression is satisfied. −1, N i ) ≠ 1 relationship (where F i is the first prime number) is calculated, and when the relationship of the second equation is satisfied, the prime number candidate N i is determined not to be a composite number A prime number generation method characterized by:
暗号装置内でランダムアクセス可能な不揮発性メモリに格納された素数テーブルに格納された予め定められたnビット以下のすべての素数を用いて所定の2nビット以下の乱数を素数判定することにより2nビット以下の第1の素数を生成する第1の素数生成ステップと、
前記第1の素数生成ステップにて生成された2nビット以下の第1の素数および前記不揮発性メモリに格納された素数テーブルに格納されたnビット以下のすべての素数をもとに2nビットより大きい所定のビット長の第2の素数を生成する第2の素数生成ステップと、
前記第1および第2の素数生成ステップにより生成された0.4mビットの第2の素数および前記第2の素数をもとに前記暗号装置内のコプロセッサにより0.5mビットの第3の素数を生成する第3の素数生成ステップと、
前記第1および第2の素数生成ステップにより生成された他の0.4mビットの第2の素数、前記第3の素数生成ステップにより生成された0.5mビットの第3の素数および前記不揮発性メモリに格納された素数テーブルに格納されたnビット以下のすべての素数をもとにmビットの第4の素数を生成する第4の素数生成ステップとを有し、
前記第2の素数生成ステップは、
前記第2の素数の候補N i を前記nビット以下のすべての素数で試行割算し、いずれの素数でも割り切れないとき、所定のa i について第1式のフェルマーテストa i i −1 ≡1(mod N i )の関係を満たすか否かを計算し、第1式の関係を満たすとき、第2式の最大公約数gcd(a i ( i −1 ) /F i −1,N i )≠1の関係(但し、F i :第1の素数)を満たすか否かを計算し、第2式の関係を満たすとき、前記素数の候補N i から第2の素数N i を得ることを特徴とする素数生成方法。
2n bits by determining a prime number of a predetermined random number of 2n bits or less using all the prime numbers of n bits or less that are stored in a prime number table stored in a non-volatile memory that can be randomly accessed in the cryptographic device A first prime number generating step for generating the following first prime number;
Greater than 2n bits based on the first prime number of 2n bits or less generated in the first prime number generation step and all the prime numbers of n bits or less stored in the prime number table stored in the nonvolatile memory A second prime number generating step for generating a second prime number having a predetermined bit length;
A 0.4 mbit second prime number generated by the first and second prime number generation steps and a third prime number of 0.5 mbit by the coprocessor in the encryption device based on the second prime number. A third prime number generating step for generating
The other 0.4 m-bit second prime number generated by the first and second prime number generation steps, the 0.5 m-bit third prime number generated by the third prime number generation step, and the non-volatile property possess a fourth prime number generation step of generating a fourth prime number of m bits on the basis of all primes have been the n bits following storage prime table stored in the memory,
The second prime number generation step includes:
Said candidate N i of the second prime attempts divided by all primes less than the n bits when not divisible in any prime, first equation Fermat test a i N i -1 for a given a i If the relationship of 1 (mod N i ) is satisfied and the relationship of the first equation is satisfied, the greatest common divisor gcd (a i ( N i −1 ) / F i −1, N of the second equation is satisfied. i) ≠ 1 relationship (although, F i: whether the calculated satisfies a first prime number), when satisfying the second equation relation, obtaining a second prime number N i of candidates N i of the prime number A prime number generation method characterized by that.
暗号装置のコンピュータに、前記暗号装置内でランダムアクセス可能な不揮発性メモリに格納された素数テーブルに格納された予め定められたnビット以下の値のすべての素数をもとに2nビット以下の第1の素数を生成する手順と、前記不揮発性メモリに格納された素数テーブルに格納されたnビット以下のすべての素数および前記第1の素数をもとに2nビットより大きい所定のビット長の第2の素数を生成する手順を実行させるためのプログラムであって、前記第2の素数を生成する手順としては、前記第2の素数の候補N i を前記nビット以下のすべての素数で試行割算し、いずれの素数でも割り切れないとき、所定のa i について第1式のフェルマーテストa i i −1 ≡1(mod N i )の関係を満たすか否かを計算し、第1式の関係を満たすとき、第2式の最大公約数gcd(a i ( i −1 ) /F i −1,N i )≠1の関係(但し、F i :第1の素数)を満たすか否かを計算し、第2式の関係を満たすとき、前記素数の候補N i から第2の素数N i を得る手順を含むプログラムを記録したコンピュータ読取り可能な記録媒体。Based on all prime numbers of a predetermined value of n bits or less stored in a prime number table stored in a non-volatile memory that can be randomly accessed in the encryption device, the computer of the encryption device has a number of bits of 2n bits or less. A procedure for generating a prime number of 1 and a predetermined bit length greater than 2n bits based on all the prime numbers less than n bits stored in the prime number table stored in the nonvolatile memory and the first prime number A program for executing a procedure for generating a prime number of 2 , wherein the second prime number is generated by assigning trial candidates N i of the second prime number to all the prime numbers of n bits or less. calculated and, when not divisible in any prime, calculate whether satisfying the relationship for a given a i first equation Fermat test a i N i -1 ≡1 (mod N i), the first equation When satisfying the relation, the second expression of the greatest common divisor gcd (a i (N i -1 ) / F i -1, N i) ≠ 1 relationship (although, F i: a first prime number) or not meet A computer-readable recording medium on which a program including a procedure for obtaining the second prime number N i from the prime candidate N i is calculated when the relationship of the second equation is satisfied . 暗号装置のコンピュータに、前記暗号装置内でランダムアクセス可能な不揮発性メモリに格納された素数テーブルに格納された予め定められたnビット以下のすべての素数を用いて所定の2nビット以下の乱数を素数判定することにより2nビット以下の第1の素数を生成する第1の素数生成ステップと、前記第1の素数をもとに該第1の素数より大きい素数候補を生成し、前記不揮発性メモリに格納された素数テーブルに格納されたnビット以下のすべての素数を少なくとも用いた素数判定により該素数候補が合成数でないと判定された場合には該素数候補を新たな第1の素数とし該新たな第1の素数をもとに該素数候補より大きい新たな素数候補を生成する処理を再帰的に繰り返すとともに、素数候補が合成数であると判定された場合には前記第1の素数生成ステップにて合成数と判定された時点での第1の素数をもとに素数候補を生成し直しあらためて該処理を再帰的に繰り返すことにより、2nビットより大きい所定のビット長の第2の素数を生成する第2の素数生成ステップとを実行させるためのプログラムであって、前記第2の素数生成ステップとしては、前記素数候補N i を前記nビット以下のすべての素数で試行割算し、いずれの素数でも割り切れないとき、所定のa i について第1式のフェルマーテストa i i −1 ≡1(mod N i )の関係を満たすか否かを計算し、第1式の関係を満たすとき、第2式の最大公約数gcd(a i ( i −1 ) /F i −1,N i )≠1の関係(但し、F i :第1の素数)を満たすか否かを計算し、第2式の関係を満たすとき、前記素数の候補N i から第2の素数N i を得るステップを含むプログラムを実行させるためのプログラムを記録したコンピュータ読取り可能な記録媒体。A random number of 2n bits or less using a predetermined prime number of n bits or less stored in a prime number table stored in a non-volatile memory that can be randomly accessed in the cryptographic apparatus is transmitted to the computer of the cryptographic apparatus. A first prime number generating step for generating a first prime number of 2n bits or less by determining a prime number; generating a prime candidate larger than the first prime number based on the first prime number; and the nonvolatile memory If the prime number determination using at least all prime numbers less than or equal to n bits stored in the prime number table stored in is determined not to be a composite number, the prime number candidate is set as a new first prime number. When the process of generating a new prime candidate larger than the prime candidate based on the new first prime is recursively repeated and the prime candidate is determined to be a composite number A predetermined bit larger than 2n bits is generated by regenerating a prime candidate based on the first prime number at the time when the first prime number is determined to be a composite number in the first prime number generation step. a program for executing a second prime number generation step of generating a second prime number length, as the second prime number generation step, all prime the prime candidate n i follows the n bits And if any prime number is not divisible , calculate whether the relationship of Fermat test a i N i −1 ≡1 (mod N i ) of the first equation is satisfied for a given a i , When the relationship of Formula 1 is satisfied, the relationship of the greatest common divisor gcd (a i ( N i −1 ) / F i −1, N i ) ≠ 1 in Formula 2 (where F i is the first prime number) When satisfying the relation of the second formula, Computer-readable recording medium storing a program for executing a program including a step of obtaining a second prime number N i of candidates N i of the serial primes. 暗号装置のコンピュータに、前記暗号装置内でランダムアクセス可能な不揮発性メモリに格納された素数テーブルに格納された予め定められたnビット以下のすべての素数を用いて所定の2nビット以下の乱数を素数判定することにより2nビット以下の第1の素数を生成する第1の素数生成ステップと、前記第1の素数生成ステップにて生成された2nビット以下の第1の素数および前記不揮発性メモリに格納された素数テーブルに格納されたnビット以下のすべての素数をもとに2nビットより大きい所定のビット長の第2の素数を生成する第2の素数生成ステップと、前記第1および第2の素数生成ステップにより生成された0.4mビットの第2の素数および前記第2の素数をもとに前記暗号装置内のコプロセッサにより0.5mビットの第3の素数を生成する第3の素数生成ステップと、前記第1および第2の素数生成ステップにより生成された他の0.4mビットの第2の素数、前記第3の素数生成ステップにより生成された0.5mビットの第3の素数および前記不揮発性メモリに格納された素数テーブルに格納されたnビット以下のすべての素数をもとにmビットの第4の素数を生成する第4の素数生成ステップとを実行させるためのプログラムであって、前記第2の素数生成ステップとしては、前記第2の素数の候補N i を前記nビット以下のすべての素数で試行割算し、いずれの素数でも割り切れないとき、所定のa i について第1式のフェルマーテストa i i −1 ≡1(mod N i )の関係を満たすか否かを計算し、第1式の関係を満たすとき、第2式の最大公約数gcd(a i ( i −1 ) /F i −1,N i )≠1の関係(但し、F i :第1の素数)を満たすか否かを計算し、第2式の関係を満たすとき、前記素数の候補N i から第2の素数N i を得るステップを含むプログラムを記録したコンピュータ読取り可能な記録媒体。A random number of 2n bits or less using a predetermined prime number of n bits or less stored in a prime number table stored in a non-volatile memory that can be randomly accessed in the cryptographic apparatus is transmitted to the computer of the cryptographic apparatus. A first prime number generation step for generating a first prime number of 2n bits or less by determining a prime number, a first prime number of 2n bits or less generated in the first prime number generation step, and the nonvolatile memory A second prime number generating step for generating a second prime number having a predetermined bit length larger than 2n bits based on all prime numbers less than n bits stored in the stored prime number table; 0.5m bi by the 0.4m bits generated by the prime number generation step second prime number and the second co-processor in the encryption apparatus on the basis of primes A third prime number generating step for generating a third prime number of the second prime number, another 0.4 m-bit second prime number generated by the first and second prime number generating steps, and the third prime number generating step. The fourth prime number of m bits is generated based on the third prime number of 0.5 m bits generated by the above and all prime numbers less than n bits stored in the prime number table stored in the nonvolatile memory . a 4 program for executing a prime number generation step of, as the second prime number generation step, attempts dividing the candidate n i of the second prime at all primes following the n bits, When any prime number is not divisible, it is calculated whether or not the relationship of the Fermat test a i N i −1 ≡1 (mod N i ) of the first equation is satisfied for a given a i , and the relationship of the first equation is satisfied When the second equation Large common divisor gcd (a i (N i -1 ) / F i -1, N i) ≠ 1 relationship (although, F i: a first prime number) whether the calculated meet, the second equation when satisfying the relationship, computer-readable recording medium a program including a step of obtaining a second prime number N i of candidates N i of the prime number.
JP34509197A 1996-12-26 1997-12-15 Cryptographic device, cryptographic key generation method, prime number generation device, and prime number generation method Expired - Fee Related JP3626340B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP34509197A JP3626340B2 (en) 1996-12-26 1997-12-15 Cryptographic device, cryptographic key generation method, prime number generation device, and prime number generation method

Applications Claiming Priority (3)

Application Number Priority Date Filing Date Title
JP8-348059 1996-12-26
JP34805996 1996-12-26
JP34509197A JP3626340B2 (en) 1996-12-26 1997-12-15 Cryptographic device, cryptographic key generation method, prime number generation device, and prime number generation method

Related Child Applications (1)

Application Number Title Priority Date Filing Date
JP2004162531A Division JP2004248330A (en) 1996-12-26 2004-05-31 Encryption apparatus, encryption key generating method, and encryption key management method

Publications (2)

Publication Number Publication Date
JPH10240128A JPH10240128A (en) 1998-09-11
JP3626340B2 true JP3626340B2 (en) 2005-03-09

Family

ID=26577962

Family Applications (1)

Application Number Title Priority Date Filing Date
JP34509197A Expired - Fee Related JP3626340B2 (en) 1996-12-26 1997-12-15 Cryptographic device, cryptographic key generation method, prime number generation device, and prime number generation method

Country Status (1)

Country Link
JP (1) JP3626340B2 (en)

Families Citing this family (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4678968B2 (en) * 2001-03-13 2011-04-27 株式会社東芝 Prime number determination apparatus, method, and program
JP4664514B2 (en) * 2001-03-14 2011-04-06 株式会社東芝 Prime number generating apparatus and program
TWI244610B (en) * 2001-04-17 2005-12-01 Matsushita Electric Ind Co Ltd Information security device, prime number generation device, and prime number generation method
JP2003051817A (en) * 2001-08-08 2003-02-21 Toshiba Corp Encryption/decryption device, digital signature generating/verifying device, method and program
US6718536B2 (en) * 2002-06-21 2004-04-06 Atmel Corporation Computer-implemented method for fast generation and testing of probable prime numbers for cryptographic applications
JP2005167870A (en) * 2003-12-05 2005-06-23 Sony Corp Method and apparatus for processing data
JP2005303676A (en) * 2004-04-12 2005-10-27 Canon Inc Image forming device, paired key generating method, and computer program
US8015393B2 (en) 2004-04-12 2011-09-06 Canon Kabushiki Kaisha Data processing device, encryption communication method, key generation method, and computer program
US7792303B2 (en) * 2004-07-14 2010-09-07 Intel Corporation Method of delivering direct proof private keys to devices using a distribution CD
JP5328186B2 (en) * 2008-03-21 2013-10-30 ルネサスエレクトロニクス株式会社 Data processing system and data processing method
JP5179933B2 (en) * 2008-04-18 2013-04-10 ルネサスエレクトロニクス株式会社 Data processing device
JP4802228B2 (en) * 2008-08-14 2011-10-26 株式会社東芝 Key generation apparatus and program
SG171730A1 (en) 2008-11-24 2011-07-28 Certicom Corp System and method for hardware based security
TW201201041A (en) * 2010-06-21 2012-01-01 Zhe-Yang Zhou Data security method and system

Also Published As

Publication number Publication date
JPH10240128A (en) 1998-09-11

Similar Documents

Publication Publication Date Title
US7472276B2 (en) Data card verification system
US7707430B2 (en) Digital content protection system
EP0202768B1 (en) Technique for reducing rsa crypto variable storage
JP3626340B2 (en) Cryptographic device, cryptographic key generation method, prime number generation device, and prime number generation method
JP4137385B2 (en) Encryption method using public and private keys
US20140006806A1 (en) Effective data protection for mobile devices
EP0823802A2 (en) Secret communication and authentication scheme based on public key cryptosystem using N-adic expansion
US7000110B1 (en) One-way function generation method, one-way function value generation device, proving device, authentication method, and authentication device
US7912216B2 (en) Elliptic curve cryptosystem optimization using two phase key generation
US7020776B2 (en) Cryptosystem based on a Jacobian of a curve
JPH10511778A (en) Method of executing a communication protocol between two processing devices using a secret key
JPH07505270A (en) Encrypted communication method and system
JP2008252299A (en) Encryption processing system and encryption processing method
JP3794457B2 (en) Data encryption / decryption method
CN111325535A (en) Block chain private key management method, system and storage medium based on elliptic curve migration
US7103775B2 (en) Signature calculation system by use of mobile agent
JP2000115154A (en) Storage device and method, decoding device and method, provision medium and information storage medium
JP2004512570A (en) Method and apparatus using an insecure cryptographic accelerator
JP2003098962A (en) Method and device for calculating elliptic curve scalar multiple, and recording medium
JPH10500502A (en) Public key encryption method based on discrete logarithm
JP2011091517A (en) Signcryption system and signcryption generation method
JP2011040932A (en) Authenticated encryption device, authenticated encryption method, verified decryption device, verified decryption method, encryption system, program, recording medium
JP2004248330A (en) Encryption apparatus, encryption key generating method, and encryption key management method
Casanova-Marqués et al. Implementation of Revocable Keyed-Verification Anonymous Credentials on Java Card
JPH09106445A (en) Key changing method for information recording medium and information recording medium

Legal Events

Date Code Title Description
A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20040330

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20040531

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20041202

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

Free format text: PAYMENT UNTIL: 20071210

Year of fee payment: 3

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

Free format text: PAYMENT UNTIL: 20081210

Year of fee payment: 4

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

Free format text: PAYMENT UNTIL: 20091210

Year of fee payment: 5

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

Free format text: PAYMENT UNTIL: 20091210

Year of fee payment: 5

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

Free format text: PAYMENT UNTIL: 20101210

Year of fee payment: 6

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

Free format text: PAYMENT UNTIL: 20101210

Year of fee payment: 6

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

Free format text: PAYMENT UNTIL: 20111210

Year of fee payment: 7

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

Free format text: PAYMENT UNTIL: 20121210

Year of fee payment: 8

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

Free format text: PAYMENT UNTIL: 20131210

Year of fee payment: 9

LAPS Cancellation because of no payment of annual fees