JP2012032740A - Encryption device and method thereof - Google Patents

Encryption device and method thereof Download PDF

Info

Publication number
JP2012032740A
JP2012032740A JP2010174299A JP2010174299A JP2012032740A JP 2012032740 A JP2012032740 A JP 2012032740A JP 2010174299 A JP2010174299 A JP 2010174299A JP 2010174299 A JP2010174299 A JP 2010174299A JP 2012032740 A JP2012032740 A JP 2012032740A
Authority
JP
Japan
Prior art keywords
integer
encryption
encrypted
prime
unit
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
JP2010174299A
Other languages
Japanese (ja)
Other versions
JP5247773B2 (en
Inventor
Tatsuya Yoshino
達哉 芳野
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.)
Chugoku Electric Power Co Inc
Original Assignee
Chugoku Electric Power Co Inc
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 Chugoku Electric Power Co Inc filed Critical Chugoku Electric Power Co Inc
Priority to JP2010174299A priority Critical patent/JP5247773B2/en
Publication of JP2012032740A publication Critical patent/JP2012032740A/en
Application granted granted Critical
Publication of JP5247773B2 publication Critical patent/JP5247773B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

PROBLEM TO BE SOLVED: To provide an encryption/decryption method capable of encrypting/decrypting on an integer exceeding a range of an effective number for application/software of personal computers without increasing information giving a hint for deciphering by a third party.SOLUTION: An encryption device 1 has a first encryption section 14 that executes a calculation in which a power having an integer Xsmaller than a predetermined number as a base and an integer E as an index is divided by a product N to obtain a remainder and determines the same as an encryption number Yof the integer X. A second encryption section 15 executes substitution decryption on the encryption number Yto obtain an integer Y'. The first encryption section 14 converts the integer Xinto an expansion formula including plural integers, and using the expansion formula, a power which has the integer Xas the base and the integer E as the index is calculated. The second encryption section 15 converts the encryption number Yto obtain an expansion formula including plural integers, and using the expansion formula, substitution decryption is made on the encryption number Y.

Description

本発明は、暗号装置及びその方法に関する。   The present invention relates to an encryption device and a method thereof.

従来、法人組織等において構成員を識別するために、ユニークな整数等を含む識別子を用いることが知られている。例えば、国民健康保険制度等において加入者を識別するために8桁程度の数字が用いられたり、銀行口座を識別するために銀行の支店及び口座のそれぞれに3桁から10桁程度の数字等が用いられたり、クレジットカードの会員を識別するために16桁程度の数字が用いられたりしている。   Conventionally, it is known to use an identifier including a unique integer in order to identify a member in a corporate organization or the like. For example, a number of about 8 digits is used to identify a subscriber in the national health insurance system, or a number of about 3 to 10 digits is used for each bank branch and account to identify a bank account. It is used or a number of about 16 digits is used to identify a credit card member.

また、暗号及びデジタル署名を行う方式として、RSA暗号が知られている(例えば、特許文献1参照)。RSA暗号は、桁数が大きい合成数の素因数分解問題が困難であることを安全性の根拠とした公開鍵暗号方式である。すなわち、RSA暗号では、暗号化の段階において、適当な正の整数によるべき乗と素数2個の積を法数とする剰余演算とを用い、復号において、これら素数2個の積の素因数を要するべき乗根を用いる。このことにより、RSA暗号では、素因数を知らなければ復号が困難になることによって暗号の安全性を確保している。   Also, RSA encryption is known as a method for performing encryption and digital signature (see, for example, Patent Document 1). The RSA cryptography is a public key cryptosystem based on the fact that it is difficult to perform a prime factorization problem of a composite number having a large number of digits. That is, in the RSA encryption, at the encryption stage, a power of an appropriate positive integer and a remainder operation that uses a product of two prime numbers as a modulus are used, and a power that requires a prime factor of these two prime products in the decryption. Use roots. As a result, in the RSA cryptography, it is difficult to decrypt without knowing the prime factor, thereby ensuring the security of the cryptography.

更に、コンピュータ・ネットワークを介する情報の送受信においてセキュリティを確保するために、暗号化、認証、改ざん検出の機能を有するSSLプロトコル等が知られている。例えば、SSLプロトコルに含まれる公開鍵証明書に基づく認証には、RSA暗号を用いられている。   Furthermore, in order to ensure security in transmitting and receiving information via a computer network, an SSL protocol having encryption, authentication, and alteration detection functions is known. For example, RSA encryption is used for authentication based on a public key certificate included in the SSL protocol.

特開平09−107352号公報JP 09-107352 A

しかしながら、従来は、暗号化前の数字等の形式と、復号後の数字等の形式との組み合わせ等を手がかりとして、公開鍵と対をなす秘密鍵が解読されると、同じ公開鍵及び秘密鍵の組み合わせを用いる暗号が、全て解読可能になるという問題があった。また、RSA暗号では、素因数を特定するまでの所用時間の長さを暗号の安全性の根拠としていることから、解読に用いるコンピュータ機器等を高性能化することにより、一定の解読手法であってもより短時間で解読することができるという問題があった。   However, conventionally, when a secret key paired with a public key is decrypted by using a combination of a format such as a number before encryption and a format such as a number after decryption, the same public key and secret key are decrypted. There is a problem that all ciphers using the combination of these can be deciphered. In addition, RSA encryption is based on the length of time required to specify a prime factor as the basis of encryption security. However, there was a problem that it could be decoded in a shorter time.

また、パーソナル・コンピュータ用のアプリケーション・ソフトウェア等においては内部で取り扱える数値の範囲の制約から、例えば、16桁の整数の自然数のべき乗等の計算を実行させるとプロセッサのオーバーフローが発生して、正確な計算結果が得られない場合がある。このため、元の整数を、オーバーフローが発生しない桁の範囲で適宜分割し、分割して得られた整数ごとに独立してべき剰余計算を実施する等の方策が必要であった。これは文章の暗号化において単位バイト数ごとに分割して平文を暗号化及び復号することと同様であるが、こうした手法では、分割した整数又は語句ごとに暗号化及び復号のための鍵が関連づけられるために、第三者により多くの解読の手がかりを与えてしまうという問題があった。   In addition, in application software for personal computers, due to restrictions on the range of numerical values that can be handled internally, for example, when calculation such as a power of a natural number of a 16-digit integer is executed, a processor overflow occurs, and an accurate Calculation results may not be obtained. For this reason, it is necessary to divide the original integer as appropriate within the range of digits where overflow does not occur, and to perform power residue calculation independently for each integer obtained by the division. This is the same as encrypting and decrypting plain text by dividing it by the number of unit bytes in text encryption. However, in this method, a key for encryption and decryption is associated with each divided integer or phrase. As a result, there is a problem that a third party gives more clues for decoding.

例えば、クレジットカードの登録番号及び有効期限の年月は、16桁及び4桁の整数の形式を用いて表されている。これらの整数を組み合わせて、20桁の整数を生成し、この整数を暗号化し復号することが可能な方法が提供できれば、桁を分割して複数の整数を別個に暗号化する従来の技法と比較して、第三者による解読のための手がかりとなる情報を増やすことなく、セキュリティを確保することが可能になる。すなわち、個人情報を秘匿する技術として、多桁の整数を暗号化し復号する方法が求められている。   For example, the credit card registration number and expiration date are expressed using 16-digit and 4-digit integer formats. If these integers can be combined to produce a 20-digit integer and a method capable of encrypting and decrypting the integer can be provided, then it is compared with a conventional technique that separates the digits and encrypts multiple integers separately. Thus, it is possible to ensure security without increasing information that becomes a clue for decryption by a third party. That is, as a technique for concealing personal information, a method for encrypting and decrypting a multi-digit integer is required.

更に、音声による通話又は印刷物等の文書を介する情報の漏洩においては、コンピュータ・ネットワークを用いて伝達される情報に対するSSLプロトコル等のセキュリティ技術では対応できないため、音声又は文書等を含む多様な形態で個人情報を隠蔽しうる方法が必要であった。   Furthermore, information leakage via voice calls or documents such as printed materials cannot be handled by security technology such as SSL protocol for information transmitted using a computer network, and therefore, in various forms including voice or documents. There was a need for a way to conceal personal information.

本発明は、パーソナル・コンピュータ用のアプリケーション・ソフトウェア等の有効数字の範囲を超える整数について、第三者による解読のための手がかりとなる情報を増やすことなく、暗号化及び復号をすることができる暗号化及び復号の方法を提供することを目的とする。   The present invention is an encryption that can encrypt and decrypt integers exceeding the range of significant figures such as application software for personal computers without increasing information that is a key for decryption by a third party. An object of the present invention is to provide an encoding and decoding method.

本発明に係る暗号装置は、整数を暗号化し、復号する暗号装置であって、第1の素数Aと第2の素数Bとの積Nが所定数を超えるように前記A及び前記Bを生成する素数生成手段と、前記第1の素数Aより1少ない整数A’と前記第2の素数Bより1少ない整数B’との積D、又は前記整数A’と前記整数B’との最小公倍数Kと素である整数Eであって、前記所定数を底とし、前記整数Eを指数としたべき乗が所定桁数を超えるように前記整数Eを生成し、前記整数Eを暗号鍵とする暗号鍵生成手段と、任意の整数mとした場合に次式を満たすように整数Fを生成し、前記整数Fを前記暗号鍵に対応する復号鍵とする復号鍵生成手段と、

Figure 2012032740
前記所定数より小さい整数Xを底とし、前記整数Eを指数としたべき乗を前記積Nで除算した場合の剰余を算出して前記整数Xの暗号化数Yとする第1暗号化手段と、前記暗号化数Yの換字式暗号化により整数Y’を算出する第2暗号化手段と、前記Y’から換字式復号により前記暗号化数Yを復号する第2復号手段と、前記暗号化数Yを底とし、前記整数Fを指数としたべき乗を前記整数Nで除算した場合の剰余を算出して前記整数Xを復号する第1復号手段と、を備え、前記第1暗号化手段は、前記整数Xを、複数の整数により構成される展開式に変換し、当該展開式により、前記整数Xを底とし、前記整数Eを指数としたべき乗を算出し、前記第1復号手段は、前記暗号化数Yを、複数の整数により構成される展開式に変換し、当該展開式により、前記暗号化数Yを底とし、前記整数Fを指数としたべき乗を算出し、前記第2暗号化手段は、前記暗号化数Yを、複数の整数により構成される展開式に変換し、当該展開式により、前記暗号化数Yを換字式暗号し、前記第2復号手段は、前記整数Y’を、複数の整数により構成される展開式に変換し、当該展開式により、前記暗号化数Yを復号する。 An encryption apparatus according to the present invention is an encryption apparatus that encrypts and decrypts an integer, and generates A and B so that a product N of a first prime number A and a second prime number B exceeds a predetermined number. And a product D of an integer A ′ that is 1 less than the first prime A and an integer B ′ that is 1 less than the second prime B, or a least common multiple of the integer A ′ and the integer B ′ An integer E that is prime with K, the integer E is generated such that the power of the integer E as an exponent exceeds the predetermined number of digits, and the integer E is an encryption key A key generation unit, a decryption key generation unit that generates an integer F so as to satisfy the following expression when an arbitrary integer m is set, and uses the integer F as a decryption key corresponding to the encryption key;
Figure 2012032740
First encryption is performed by calculating a remainder when the power of the integer X i smaller than the predetermined number and the integer E as an exponent is divided by the product N to be the encrypted number Y i of the integer X i means a 'second encrypting means for calculating, the Y i' integer Y i by substitution cipher of the encrypted number Y i second decoding for decoding the encrypted number Y i by substitution type decoded from and means, to a base of said encrypted number Y i, and a first decoding means for decoding the integer X i by calculating the remainder when dividing the power that the integer F as index in the integer N The first encryption means converts the integer X i into an expansion equation composed of a plurality of integers, and uses the expansion equation to calculate a power with the integer X i as a base and the integer E as an exponent. The first decryption means calculates the encrypted number Y i by a plurality of integers. Converted into an expansion formula to be formed, and the expansion formula is used to calculate a power with the encryption number Y i as a base and the integer F as an exponent, and the second encryption means uses the encryption number Y i Is converted into an expansion equation composed of a plurality of integers, the encrypted number Y i is substitution-encrypted by the expansion equation, and the second decryption means converts the integer Y i ′ into a plurality of integers. into a composed deployable, by the foldout, decrypts the encrypted number Y i.

また、前記第2暗号化手段は、前記暗号化数Yに対して、前記所定数より小さい正の整数からランダムに選択された整数である鍵Rの値を加算することにより、換字式暗号を行うことが好ましい。 Further, the second encryption means adds a value of a key R i that is an integer randomly selected from a positive integer smaller than the predetermined number to the encrypted number Y i . It is preferable to perform encryption.

また、前記第1暗号化手段は、前記整数Xに対して、オフセット数Tを加算して、当該整数Xを更新し、当該更新された整数Xを底とし、前記整数Eを指数としたべき乗を前記積Nで除算した場合の剰余を算出して当該整数Xの暗号化数Yとし、当該暗号化数Yに対して、前記オフセット数Tを減算して当該暗号化数Yを更新し、前記第2暗号化手段は、前記暗号化数Yに対して、前記オフセット数Tを加算して、当該暗号化数Yを更新し、前記更新された暗号化数Yを底とし、前記整数Fを指数としたべき乗を前記整数Nで除算した場合の剰余を算出して前記整数Xを復号し、当該整数Xに対して、前記オフセット数Tを減算して整数Xを更新することが好ましい。 Further, the first encryption means, to the integer X i, by adding an offset number T, and updates the integer X i, and the bottom of the integer X i, which is the updated index the integer E The remainder when the power is divided by the product N is calculated as the encrypted number Y i of the integer X i , and the encryption is performed by subtracting the offset number T from the encrypted number Y i update the number Y i, the second encryption unit, to the encrypted number Y i, by adding the number of offset T, encryption update the encrypted number Y i, are the updated The remainder when the number Y i is the base and the power of the integer F as an exponent is divided by the integer N is calculated to decode the integer X i , and the offset number T is calculated for the integer X i Preferably, the integer X i is updated by subtraction.

また、前記オフセット数Tは、複数の前記整数Xが存在する場合、当該オフセット数Tを当該整数Xそれぞれに加算した場合に、当該整数Xそれぞれが0以上かつ前記所定数以下になるように設定されることが好ましい。 In addition, when there are a plurality of the integers X i and the offset number T is added to each of the integers X i, each of the integers X i is greater than or equal to 0 and less than or equal to the predetermined number. It is preferable to set as follows.

また、暗号装置は、前記素数生成手段と、前記暗号鍵生成手段と、前記復号鍵生成手段と、前記第1暗号化手段と、前記第2暗号化手段とを、前記素数生成手段、前記暗号鍵生成手段、前記復号鍵生成手段、前記第1暗号化手段、前記第2暗号化手段の順に所定回数実行する暗号化制御手段と、前記第2復号手段と、前記第1復号手段とを、前記第2復号手段、前記第1復号手段の順に前記所定回数実行する復号制御手段と、を更に備えることが好ましい。   In addition, the encryption apparatus includes the prime number generation unit, the encryption key generation unit, the decryption key generation unit, the first encryption unit, and the second encryption unit. An encryption control unit that executes a predetermined number of times in the order of a key generation unit, the decryption key generation unit, the first encryption unit, and the second encryption unit, the second decryption unit, and the first decryption unit. It is preferable to further comprise decoding control means for executing the predetermined number of times in the order of the second decoding means and the first decoding means.

また、前記素数生成手段は、前記暗号化制御手段により繰り返し実行される場合、それぞれの繰り返し実行において前記A及び前記Bが異なるように前記A及び前記Bを生成することが好ましい。   Further, when the prime number generating unit is repeatedly executed by the encryption control unit, it is preferable that the A and B are generated so that the A and the B are different in each repeated execution.

本発明に係る暗号装置は、整数を暗号化し、復号する暗号装置であって、第1の素数Aと第2の素数Bとの積Nが所定数を超えるように前記A及び前記Bを生成する素数生成手段と、前記第1の素数Aより1少ない整数A’と前記第2の素数Bより1少ない整数B’との積D、又は前記整数A’と前記整数B’との最小公倍数Kと素である整数Eであって、前記所定数を底とし、前記整数Eを指数としたべき乗が所定桁数を超えるように前記整数Eを生成し、前記整数Eを暗号鍵とする暗号鍵生成手段と、任意の整数mとした場合に次式を満たすように整数Fを生成し、前記整数Fを前記暗号鍵に対応する復号鍵とする復号鍵生成手段と、

Figure 2012032740
前記所定数より小さい整数Xに対して、オフセット数Tを加算して、当該整数Xを更新し、当該更新された整数Xを底とし、前記整数Eを指数としたべき乗を前記積Nで除算した場合の剰余を算出して前記整数Xの暗号化数Yとし、当該暗号化数Yに対して、前記オフセット数Tを減算して当該暗号化数Yを更新する第1暗号化手段と、前記暗号化数Yに対して、前記オフセット数Tを加算して、当該暗号化数Yを更新し、前記更新された暗号化数Yを底とし、前記整数Fを指数としたべき乗を前記整数Nで除算した場合の剰余を算出して前記整数Xを復号し、当該整数Xに対して、前記オフセット数Tを減算して整数Xを更新する第1復号手段と、前記素数生成手段と、前記暗号鍵生成手段と、前記復号鍵生成手段と、前記第1暗号化手段とを、前記素数生成手段、前記暗号鍵生成手段、前記復号鍵生成手段、前記第1暗号化手段の順に所定回数実行する暗号化制御手段と、前記第1復号手段を、前記所定回数実行する復号制御手段と、を備え、前記第1暗号化手段は、前記整数Xを、複数の整数により構成される展開式に変換し、当該展開式により、前記整数Xを底とし、前記整数Eを指数としたべき乗を算出し、前記第1復号手段は、前記暗号化数Yを、複数の整数により構成される展開式に変換し、当該展開式により、前記暗号化数Yを底とし、前記整数Fを指数としたべき乗を算出する。 An encryption apparatus according to the present invention is an encryption apparatus that encrypts and decrypts an integer, and generates A and B so that a product N of a first prime number A and a second prime number B exceeds a predetermined number. And a product D of an integer A ′ that is 1 less than the first prime A and an integer B ′ that is 1 less than the second prime B, or a least common multiple of the integer A ′ and the integer B ′ An integer E that is prime with K, the integer E is generated such that the power of the integer E as an exponent exceeds the predetermined number of digits, and the integer E is an encryption key A key generation unit, a decryption key generation unit that generates an integer F so as to satisfy the following expression when an arbitrary integer m is set, and uses the integer F as a decryption key corresponding to the encryption key;
Figure 2012032740
For small integer X i than the predetermined number, by adding an offset number T, and updates the integer X i, the updated integer X i and a bottom, said power was the integer E and exponent product calculates a remainder when divided by N and the encryption number Y i of the integer X i, with respect to the encrypted number Y i, and updates the encryption number Y i by subtracting the offset number T a first encryption unit, to the encrypted number Y i, by adding the number of offset T, and updates the encrypted number Y i, and the bottom of the updated encrypted number Y i, the the power that the integer F as index by calculating the remainder when divided by the integer N decoding the integer X i, update the integer X i with respect to the integer X i, by subtracting the offset number T First decryption means, prime number generation means, encryption key generation means, and decryption An encryption control unit that executes a predetermined number of times in the order of the prime number generation unit, the encryption key generation unit, the decryption key generation unit, and the first encryption unit; Decryption control means for executing the first decryption means a predetermined number of times, wherein the first encryption means converts the integer X i into an expansion expression composed of a plurality of integers, and the expansion expression To calculate the power with the integer X i as the base and the integer E as the exponent, and the first decryption means converts the encrypted number Y i into an expansion formula composed of a plurality of integers, According to the expansion formula, a power is calculated with the encryption number Y i as a base and the integer F as an exponent.

本発明に係る暗号装置が整数を暗号化し、復号する方法は、暗号装置が整数を暗号化し、復号する方法であって、第1の素数Aと第2の素数Bとの積Nが所定数を超えるように前記A及び前記Bを生成する素数生成ステップと、前記第1の素数Aより1少ない整数A’と前記第2の素数Bより1少ない整数B’との積D、又は前記整数A’と前記整数B’との最小公倍数Kと素である整数Eであって、前記所定数を底とし、前記整数Eを指数としたべき乗が所定桁数を超えるように前記整数Eを生成し、前記整数Eを暗号鍵とする暗号鍵生成ステップと、任意の整数mとした場合に次式を満たすように整数Fを生成し、前記整数Fを前記暗号鍵に対応する復号鍵とする復号鍵生成ステップと、

Figure 2012032740
前記所定数より小さい整数Xを底とし、前記整数Eを指数としたべき乗を前記積Nで除算した場合の剰余を算出して前記整数Xの暗号化数Yとする第1暗号化ステップと、前記暗号化数Yを換字式暗号化により整数Y’を算出する第2暗号化ステップと、前記整数Y’から換字式復号により前記暗号化数Yを復号する第2復号ステップと、前記暗号化数Yを底とし、前記整数Fを指数としたべき乗を前記積Nで除算した場合の剰余を算出して前記整数Xを復号する第1復号ステップと、を含み、前記第1暗号化ステップは、前記整数Xを、複数の整数により構成される展開式に変換し、当該展開式により、前記整数Xを底とし、前記整数Eを指数としたべき乗を算出し、前記第1復号ステップは、前記暗号化数Yを、複数の整数により構成される展開式に変換し、当該展開式により、前記暗号化数Yを底とし、前記整数Fを指数としたべき乗を算出し、前記第2暗号化ステップは、前記暗号化数Yを、複数の整数により構成される展開式に変換し、当該展開式により、前記暗号化数Yを換字式暗号し、前記第2復号ステップは、前記整数Y’を、複数の整数により構成される展開式に変換し、当該展開式により、前記暗号化数Yを復号する。 The encryption device according to the present invention encrypts and decrypts an integer by the encryption device encrypting and decrypting the integer, and the product N of the first prime number A and the second prime number B is a predetermined number. A prime number generating step for generating A and B so as to exceed, and a product D of an integer A ′ that is 1 less than the first prime number A and an integer B ′ that is 1 less than the second prime number B, or the integer A least common multiple K of A ′ and the integer B ′ and an integer E that is a prime, and the integer E is generated such that the power of the integer E as an exponent exceeds the predetermined number of digits. Then, an encryption key generation step using the integer E as an encryption key, and an integer F is generated so as to satisfy the following expression when an arbitrary integer m is set, and the integer F is set as a decryption key corresponding to the encryption key A decryption key generation step;
Figure 2012032740
First encryption is performed by calculating a remainder when the power of the integer X i smaller than the predetermined number and the integer E as an exponent is divided by the product N to be the encrypted number Y i of the integer X i step a, 'a second encryption step of calculating, the integer Y i' integer Y i by substitution cipher of the encrypted number Y i second decrypting the encrypted number Y i by substitution type decoded from a decoding step, the bottom of the encrypted number Y i, a first decoding step of the power that the integer F as index by calculating the remainder when divided by the product N to decode the integer X i, the And the first encryption step converts the integer X i into an expansion equation composed of a plurality of integers, and the expansion equation is a power that uses the integer X i as a base and the integer E as an exponent. The first decryption step calculates the number of encryptions. The i, into a deployable composed of a plurality of integers, by the foldout, a bottom said encrypted number Y i, and calculates the power that the integer F as index, the second encryption step The encrypted number Y i is converted into an expansion formula composed of a plurality of integers, the encrypted number Y i is substitution-encrypted by the expansion formula, and the second decryption step includes the integer Y i 'Is converted into an expansion expression composed of a plurality of integers, and the encrypted number Y i is decrypted by the expansion expression.

本発明によれば、パーソナル・コンピュータ用のアプリケーション・ソフトウェア等の有効数字の範囲を超える整数について、第三者による解読のための手がかりとなる情報を増やすことなく、暗号化及び復号をすることができる。   According to the present invention, it is possible to encrypt and decrypt integers that exceed the range of significant figures such as application software for personal computers without increasing information that is a clue for decryption by a third party. it can.

第1実施形態に係る暗号装置の機能構成を示す図である。It is a figure which shows the function structure of the encryption apparatus which concerns on 1st Embodiment. 第1実施形態に係る暗号装置により暗号化を行う場合の処理の流れを示すフローチャートである。It is a flowchart which shows the flow of a process in the case of encrypting with the encryption apparatus which concerns on 1st Embodiment. 第1実施形態に係る暗号装置により復号を行う場合の処理の流れを示すフローチャートである。It is a flowchart which shows the flow of a process in the case of decoding by the encryption apparatus which concerns on 1st Embodiment. 第2実施形態に係る暗号装置の機能構成を示す図である。It is a figure which shows the function structure of the encryption apparatus which concerns on 2nd Embodiment. 第2実施形態に係る暗号装置により暗号化を行う場合の処理の流れを示すフローチャートである。It is a flowchart which shows the flow of a process in the case of encrypting by the encryption apparatus which concerns on 2nd Embodiment. 第2実施形態に係る暗号装置により復号を行う場合の処理の流れを示すフローチャートである。It is a flowchart which shows the flow of a process in the case of performing decoding with the encryption device which concerns on 2nd Embodiment.

<第1実施形態>
以下、本発明の実施形態について図を参照しながら説明する。
<First Embodiment>
Hereinafter, embodiments of the present invention will be described with reference to the drawings.

[機能構成]
図1は、第1実施形態に係る暗号装置1の機能構成を示す図である。暗号装置1は、所定範囲の任意の数値を暗号化し、復号する装置である。この暗号装置1は、他の暗号装置1とLAN(Local Area Network)やインターネット等のコンピュータ・ネットワークにより構成される通信ネットワークNにより、通信可能に接続されている。
[Function configuration]
FIG. 1 is a diagram illustrating a functional configuration of the encryption device 1 according to the first embodiment. The encryption device 1 is a device that encrypts and decrypts an arbitrary numerical value within a predetermined range. The encryption device 1 is communicably connected to another encryption device 1 via a communication network N configured by a computer network such as a LAN (Local Area Network) or the Internet.

第1実施形態は、パーソナル・コンピュータ(暗号装置1)及びその周辺装置に適用される。第1実施形態における各部は、パーソナル・コンピュータ及びその周辺装置が備えるハードウェア並びにこのハードウェアを制御するソフトウェアによって構成される。   The first embodiment is applied to a personal computer (encryption device 1) and its peripheral devices. Each unit in the first embodiment is configured by hardware included in a personal computer and its peripheral devices, and software that controls the hardware.

上記ハードウェアには、制御部としてのCPUの他、記憶部、通信部、表示部及び入力部が含まれる。記憶部としては、例えば、メモリ(RAM、ROM等)、ハードディスクドライブ(HDD)及び光ディスク(CD、DVD等)ドライブが挙げられる。通信部としては、例えば、各種有線及び無線インターフェース装置が挙げられる。表示部としては、例えば、液晶ディスプレイ、プラズマディスプレイ等の各種ディスプレイが挙げられる。入力部としては、例えば、キーボード及びマウス等が挙げられる。   The hardware includes a CPU as a control unit, a storage unit, a communication unit, a display unit, and an input unit. Examples of the storage unit include a memory (RAM, ROM, etc.), a hard disk drive (HDD), and an optical disk (CD, DVD, etc.) drive. Examples of the communication unit include various wired and wireless interface devices. Examples of the display unit include various displays such as a liquid crystal display and a plasma display. Examples of the input unit include a keyboard and a mouse.

上記ソフトウェアには、上記ハードウェアを制御するコンピュータ・プログラムやアプリケーション・ソフトウェアやデータが含まれる。コンピュータ・プログラムやアプリケーション・ソフトウェアやデータは、記憶部により記憶され、制御部により適宜実行、参照される。また、コンピュータ・プログラムやアプリケーション・ソフトウェアやデータは、通信回線を介して配布することも可能であり、CD−ROM等のコンピュータ可読媒体に記録して配布することも可能である。   The software includes a computer program, application software, and data for controlling the hardware. The computer program, application software, and data are stored in the storage unit, and are appropriately executed and referenced by the control unit. Further, the computer program, application software, and data can be distributed via a communication line, and can be recorded and distributed on a computer-readable medium such as a CD-ROM.

暗号装置1の制御部は、素数生成部11と、暗号鍵生成部12と、復号鍵生成部13と、第1暗号化部14と、第2暗号化部15と、暗号化制御部16と、第2復号部17と、第1復号部18と、復号制御部19と、を備える。
を備える。
The control unit of the encryption device 1 includes a prime number generation unit 11, an encryption key generation unit 12, a decryption key generation unit 13, a first encryption unit 14, a second encryption unit 15, and an encryption control unit 16. The 2nd decoding part 17, the 1st decoding part 18, and the decoding control part 19 are provided.
Is provided.

素数生成部11は、第1の素数Aと第2の素数Bとの積Nが所定数Xを超えるように、第1の素数A及び第2の素数Bを生成する。所定数Xとは、例えば、20桁の整数であり、乗算結果がレジスタで一度に表現できる範囲を超える整数である。また、所定数Xとは、一度に暗号化したい情報が整数で表現できる場合、この整数よりも大きい値である。   The prime number generation unit 11 generates the first prime number A and the second prime number B so that the product N of the first prime number A and the second prime number B exceeds a predetermined number X. The predetermined number X is, for example, a 20-digit integer, and is an integer exceeding the range in which the multiplication result can be expressed at once by the register. Further, the predetermined number X is a value larger than this integer when the information to be encrypted at a time can be expressed as an integer.

暗号鍵生成部12は、第1の素数Aより1少ない整数A’と第2の素数Bより1少ない整数B’との積D、又は整数A’と整数B’との最小公倍数Kと、素である整数Eであって、所定数Xを底とし整数Eを指数としたべき乗が、レジスタの表現できる桁数よりも大きい桁数としての所定桁数を超える(桁あふれが発生する)ように整数Eを生成し、この整数Eを暗号鍵とする。すなわち、暗号鍵生成部12は、積D又は最小公倍数Kと素である整数Eであって、整数XのE乗の演算結果が所定桁数を超える整数Eをランダムに生成し、この整数Eを暗号鍵とする。   The encryption key generation unit 12 includes a product D of an integer A ′ that is 1 less than the first prime number A and an integer B ′ that is 1 less than the second prime number B, or a least common multiple K of the integer A ′ and the integer B ′, It is a prime integer E, and the power of the predetermined number X as the base and the integer E as the exponent exceeds the predetermined number of digits larger than the number of digits that can be represented by the register (overflow occurs) An integer E is generated in, and this integer E is used as an encryption key. In other words, the encryption key generation unit 12 randomly generates an integer E that is an integer E that is prime with the product D or the least common multiple K, and whose operation result of the power of the integer X exceeds the predetermined number of digits. Is the encryption key.

復号鍵生成部13は、任意の整数mとした場合に以下の(1)式を満たすように整数Fを生成し、この整数Fを、暗号化鍵Eに対応する復号鍵として算出する。生成された整数Fは、後述の第1復号部18に通知される。整数Fは、(1)式を満たすものであれば、任意の数でよく、復号鍵生成部13は、ランダムに整数Fを生成してもよい。   The decryption key generation unit 13 generates an integer F so as to satisfy the following expression (1) when an arbitrary integer m is set, and calculates the integer F as a decryption key corresponding to the encryption key E. The generated integer F is notified to the first decoding unit 18 described later. The integer F may be any number as long as the expression (1) is satisfied, and the decryption key generation unit 13 may randomly generate the integer F.

Figure 2012032740
Figure 2012032740

第1暗号化部14は、所定数Xより小さい任意の正の整数、すなわち、暗号化される整数Xを底とし整数Eを指数としたべき乗を、第1の素数Aと第2の素数Bとの積Nで除算した場合の剰余を算出することにより、整数Xの暗号化数Yを算出する。すなわち、第1暗号化部14は、以下の(2)式で表される、整数Xの暗号化数Yを算出する。(2)式に示される「mod」は、剰余を算出する関数である。 The first encryption unit 14 calculates an arbitrary positive integer smaller than the predetermined number X, that is, a power that has the integer X i to be encrypted as a base and the integer E as an exponent, as a first prime number A and a second prime number. by calculating the remainder when divided by the product N with B, and calculates the number of encryption Y i an integer X i. That is, the first encryption unit 14 calculates the encryption number Y i of the integer X i expressed by the following equation (2). “Mod” shown in the equation (2) is a function for calculating a remainder.

Figure 2012032740
Figure 2012032740

具体的には、第1暗号化部14は、繰り返し二乗法(高速冪乗法)を用いて整数Xの暗号化数Yを算出する。以下に、処理手順について以下に説明する。 Specifically, the first encryption unit 14 calculates the encrypted number Y i of the integer X i using an iterative square method (fast power method). The processing procedure will be described below.

まず、第1暗号化部14は、整数Eの2進数展開を行い、整数XのE乗を、この整数Xの2のべき乗の積に展開する。ここで、kは、0からnまでの整数をとるものとし、nは、2のn乗が整数Eを超えないnのうち、もっとも大きい数に対応するものとする。例えば、整数Eが287である場合、整数Xは、以下の(3)式で表される。また、2の8乗が整数Eを超えない最も大きい数となるので、nは8となる。 First, the first encryption unit 14 performs the binary expansion of an integer E, the multiplication E integers X i, to expand the power of the product of the 2 k of the integer X i. Here, k is assumed to be an integer from 0 to n, and n corresponds to the largest number among n whose 2 n powers do not exceed the integer E. For example, when the integer E is 287, the integer X i is expressed by the following equation (3). In addition, since the power of 2 is the largest number that does not exceed the integer E, n is 8.

Figure 2012032740
Figure 2012032740

続いて、第1暗号化部14は、以下の(4)式に示すように、整数Xの2乗を積Nで除算した場合の剰余から順に、整数Xの2乗を積Nで除算した場合の剰余を算出する。 Subsequently, the first encryption unit 14, as shown in the following equation (4), the 2 0 square of an integer X i from the remainder when divided by the product N in order, the product of multiplication 2 k integers X i The remainder when dividing by N is calculated.

Figure 2012032740
Figure 2012032740

ここで、整数Eは、所定数XのE乗の演算結果がレジスタの表現できる桁数よりも大きい桁数となるように生成しているので、整数Xの2乗を算出する場合に、桁あふれが生じる場合がある。そこで、第1暗号化部14は、整数Xについて、以下の(5)式を用いて、上位の桁X及び下位の桁Xに分割された整数に展開し、上位の桁X及び下位の桁Xに基づいて、整数Xの2乗まで算出する。 Here, since the integer E is generated so that the operation result of the predetermined number X raised to the E power is larger than the number of digits that can be expressed by the register, the integer X i is calculated to the 2k power. , Digit overflow may occur. Accordingly, the first encryption unit 14, the integers X i, using the following equation (5), expanded to an integer, which is divided into digit X u and lower digit X d of the upper, the upper digit X u and based on the lower digit X d, it is calculated up to 2 n square of an integer X i.

Figure 2012032740
Figure 2012032740

式中、Mは底であり、Cdは整数Xにおける下位の桁の数である。また、Cdは、1以上の整数である。 Where M is the base and Cd is the number of the lower digits in the integer X i . Cd is an integer of 1 or more.

例えば、底であるMを2とし、整数Xの桁数を16桁、下位の桁数Cdを8桁とする場合、(5)式は、以下の(6)式のように表される。 For example, when the base M is 2, the number of digits of the integer X i is 16 digits, and the number of lower digits Cd is 8 digits, the expression (5) is expressed as the following expression (6). .

Figure 2012032740
Figure 2012032740

例えば、第1実施形態に係る暗号装置1が16ビット幅のレジスタのCPUを備える場合に、整数Xの値が10進数の65532であるとすると、この整数Xに対するべき乗の計算において、指数として、2を用いた時点で、16ビット幅のレジスタを用いて表現できる整数の上限値65535を超えてしまう。すなわち、単に整数Xをべき乗する通常の計算方法に従って(2)式の右辺に含まれる整数XのE乗の計算を実施すると、正確なべき乗の値が得られない場合がある。 For example, when the cryptographic apparatus 1 according to the first embodiment includes a 16-bit register CPU, and the value of the integer X i is a decimal number 65532, the exponent is calculated in the calculation of the power of the integer X i . As such, when 2 is used, the integer upper limit value 65535 that can be expressed using a 16-bit register is exceeded. That is, simply when implementing the E-th power of the calculation of the integer X i included in equation (2) on the right side according to conventional calculation method of a power integers X i, there is a case where the value of an accurate power may not be obtained.

これに対して、式(6)により表される桁の分割を用いて上位の桁と下位の桁をそれぞれ整数部分として分割すると、例えば、整数Xが10進数の65532、すなわち、2進数の1111111111111100(2)は、上位8桁に含まれる整数11111111(2)(10進数の255)と、下位8桁に含まれる整数11111100(2)(10進数の252)とに分割される。この場合、分割された2つの数は、255の2乗よりも小さい値となるので、16ビット幅のレジスタが表現できる整数の範囲内となる。よって、桁あふれによる誤りを避けることが可能である。 On the other hand, when the upper digit and the lower digit are divided as integer parts using the digit division represented by the equation (6), for example, the integer X i is a decimal number 65532, that is, a binary number. 1111111111111100 (2) is divided into an integer 11111111 (2) (decimal 255) included in the upper 8 digits and an integer 11111100 (2) (decimal 252) included in the lower 8 digits. In this case, the two divided numbers are smaller than the square of 255, and therefore fall within an integer range that can be expressed by a 16-bit register. Therefore, it is possible to avoid errors due to overflowing digits.

また、第1実施形態では、(5)式のように、2つの整数に分割することとしたが、例えば、整数Xが20桁の場合に、以下の(7)式に示されるように、4つの整数に分割することとしてもよい。 In the first embodiment, as shown in the equation (5), it is divided into two integers. For example, when the integer X i is 20 digits, as shown in the following equation (7): It is good also as dividing | segmenting into four integers.

Figure 2012032740
Figure 2012032740

式中、X15は整数Xの16桁目から20桁目、X10は整数Xの11桁目から15桁目、Xは整数Xの6桁目から10桁目、Xは整数Xの1桁目から5桁目である。また、整数Xが20桁に満たない場合に、上位の桁に対してゼロ詰めを行ってもよい。このようにすることで、暗号装置1は、桁あふれを発生する条件で整数Eを生成した後に、(3)〜(5)式を用いて整数Xを展開して暗号化数Yを算出することにより、桁あふれを避けて、暗号化数Yを正確に算出することができる。
なお、整数Xは、(6)式や(7)式のように、分割後の整数の桁数が等しくなるように分割されることが好ましい。
Wherein, X 15 is 20 digit column 16 integer X i, X 10 is 15 digit from 11 digit integer X i, X 5 is 10 digit from 6 digit integer X i, X 0 is the fifth digit from the first digit of the integer X i. In addition, when the integer X i is less than 20 digits, the upper digits may be zero-padded. By doing in this way, the encryption device 1 generates the integer E under the condition that overflow occurs, and then expands the integer X i using the equations (3) to (5) to obtain the encrypted number Y i . By calculating, it is possible to accurately calculate the encryption number Y i while avoiding overflow.
Note that the integer X i is preferably divided so that the number of digits of the integer after division is equal, as in the equations (6) and (7).

続いて、第1暗号化部14は、2のべき乗の積に展開された整数XのE乗の剰余を算出する。例えば、整数Eが287である場合、整数XのE乗の剰余は、以下の(8)式で示されるので、(4)式に示すように予め求められている整数Xの2乗を積Nで除算した場合の剰余から容易に算出することが可能となる。なお、この計算において、桁あふれを回避するように、被乗数を、(5)式と同様に上位の桁と下位の桁に分割して、剰余を算出するようにしてもよい。 Subsequently, the first encryption unit 14 calculates a remainder of the power of the integer X i expanded to the product of the power of 2 as the E power. For example, when the integer E is 287, the remainder of the integer X i raised to the E power is represented by the following equation (8). Therefore, as shown in the equation (4), 2 k of the integer X i obtained in advance. It is possible to easily calculate from the remainder when the power is divided by the product N. In this calculation, the remainder may be calculated by dividing the multiplicand into an upper digit and a lower digit in the same manner as equation (5) so as to avoid overflow.

Figure 2012032740
Figure 2012032740

第2暗号化部15は、所定数Xより小さい正の整数をランダムに選択し、この整数を鍵Rとする。続いて、第2暗号化部15は、この鍵Rを使用して、以下の(9)式を基づいて、暗号化数Yの換字式暗号を行い、整数Y’を算出する。 The second encryption unit 15 randomly selects a predetermined number X is smaller than a positive integer, and the integer key R i. Subsequently, using the key R i , the second encryption unit 15 performs a substitution encryption of the encrypted number Y based on the following equation (9), and calculates an integer Y i ′.

Figure 2012032740
Figure 2012032740

式中、Rot()は、鍵Rを秘密鍵として用いて、暗号化数Yを換字式暗号する関数である。具体的には、Rot()は、暗号化数Yを、所定数Xの範囲で鍵Rの値だけ加算する。また、暗号化数Yに鍵Rを加算した結果が所定数Xを超える場合、Rot()は、整数Y’として、YにRを加算したことにより所定数Xを超えた分、すなわち、Y+R−Xを返す。なお、この鍵Rは、第2復号部17に通知される。 In the equation, Rot () is a function for substituting the encrypted number Y i using the key R i as a secret key. Specifically, Rot () adds the encrypted number Y i by the value of the key R i within the range of the predetermined number X. Also, if the result of adding the key R i to the encrypted number Y i exceeds the predetermined number X, Rot () exceeds the predetermined number X by adding R i to Y i as an integer Y i ′ min, i.e., returns the Y i + R i -X. The key R i is notified to the second decryption unit 17.

また、Rot()は、暗号化数Yに鍵Rを加算する場合に、暗号化数Yについて、以下の(10)式を用いて、上位の桁Y及び下位の桁Yに分割された整数部分を生成し、この上位の桁Y及び下位の桁Yを用いて、整数Y’を算出する。 Further, Rot (), when adding the key R i to encrypt the number Y i, the encryption number Y i, using the following equation (10), the upper digit Y u and lower digit Y d It generates a divided integer portion, with the digit Y u and lower digit Y d of the upper, and calculates the integer Y i '.

Figure 2012032740
Figure 2012032740

(5)式と同様に、(10)式中、Mは底であり、Cdは暗号化数Yにおける下位の桁の数である。また、Cdは、少なくとも1である。 Similar to equation (5), in equation (10), M is the bottom, and Cd is the number of lower digits in the encrypted number Y i . Cd is at least 1.

暗号化制御部16は、素数生成部11と、暗号鍵生成部12と、復号鍵生成部13と、第1暗号化部14と、第2暗号化部15との実行を制御する。具体的には、暗号化制御部16は、素数生成部11と、暗号鍵生成部12と、第1暗号化部14と、第2暗号化部15とを、素数生成部11、暗号鍵生成部12、第1暗号化部14、及び第2暗号化部15の順に所定回数実行する。この所定回数は、予め定められている回数でもよいし、暗号化制御部16によりランダムに生成される整数でもよい。なお、この所定回数は、復号制御部19に通知される。   The encryption control unit 16 controls the execution of the prime number generation unit 11, the encryption key generation unit 12, the decryption key generation unit 13, the first encryption unit 14, and the second encryption unit 15. Specifically, the encryption control unit 16 includes a prime number generation unit 11, an encryption key generation unit 12, a first encryption unit 14, and a second encryption unit 15, a prime number generation unit 11, and an encryption key generation. The unit 12, the first encryption unit 14, and the second encryption unit 15 are executed a predetermined number of times in this order. This predetermined number of times may be a predetermined number of times or an integer randomly generated by the encryption control unit 16. The predetermined number of times is notified to the decoding control unit 19.

第2復号部17は、第2暗号化部15により換字式暗号された整数Y’から、換字式復号により暗号化数Yを算出する。具体的には、第2復号部17は、以下の(11)式を用いた換字式復号を行い、暗号化数Yを算出する。 The second decryption unit 17 calculates the encryption number Y i by substitution decryption from the integer Y i ′ substituted by the second encryption unit 15. Specifically, the second decryption unit 17 performs substitution-type decryption using the following formula (11), and calculates the encryption number Y.

Figure 2012032740
Figure 2012032740

式中、鍵Rは、換字式暗号化の秘密鍵として用いられる整数であり、第2暗号化部15により生成された整数である。なお、鍵Rは、第2暗号化部15により暗号化されたデータとは別に通知される。 In the equation, the key R i is an integer used as a secret key for substitution encryption, and is an integer generated by the second encryption unit 15. The key Ri is notified separately from the data encrypted by the second encryption unit 15.

Rot−1()は、整数Y’を、所定数Xの範囲で鍵Rの値だけ減算した値である。整数Y’に鍵Rを減算した結果が0未満となる場合、Rot−1()は、暗号化数Yとして、整数Y’にRを減算したことにより0より小さい分を所定数Xから減算した値、すなわち、Y−R+Xを返す。 Rot −1 () is a value obtained by subtracting the integer Y i ′ by the value of the key R i within a predetermined number X. 'If the result of the key R i by subtracting the is less than 0, Rot -1 () is the number of encryption Y i, the integer Y i' Integer Y i less than 0 min by subtracting the R i in A value obtained by subtracting from the predetermined number X, that is, Y i −R i + X is returned.

また、Rot−1()は、整数Y’にRを減算する場合に、整数Y’について、(10)式と同様に、上位の桁及び下位の桁に分割された整数部分を生成し、この上位の桁及び下位の桁を用いて、暗号化数Yを算出する。 Further, Rot -1 () is 'when subtracting the R i, the integer Y i' Integer Y i for, the expression (10) as well as, divided integer part to the higher digit and lower digit And the encryption number Y i is calculated using the upper and lower digits.

第1復号部18は、復号鍵生成部13から通知された復号鍵としての整数Fを用いて、暗号化数Yを底とし整数Fを指数としたべき乗を、積Nで除算した場合の剰余を算出することにより、暗号化数Yの元の数、すなわち整数Xを算出する。すなわち、第1復号部18は、以下の(12)式で表される、暗号化数Yの元の整数Xを算出する。第1復号部18は、第1暗号化部14と同様に、繰り返し二乗法(高速冪乗法)を用いることにより、暗号化数Yの元の整数Xを算出する。第1復号部18の詳細な処理は、第1暗号化部14と同様であるので、説明を省略する。 The first decryption unit 18 uses the integer F as the decryption key notified from the decryption key generation unit 13, and divides the power with the encryption number Y i as the base and the integer F as the exponent by the product N By calculating the remainder, the original number of the encrypted number Y i , that is, the integer X i is calculated. That is, the first decryption unit 18 calculates the original integer X i of the encrypted number Y i represented by the following equation (12). Similar to the first encryption unit 14, the first decryption unit 18 calculates the original integer X i of the encrypted number Y i by using an iterative square method (fast power method). Detailed processing of the first decryption unit 18 is the same as that of the first encryption unit 14, and thus description thereof is omitted.

Figure 2012032740
Figure 2012032740

復号制御部19は、第2復号部17と第1復号部18との実行を制御する。具体的には、復号制御部19は、第2復号部17と第1復号部18とを、第2復号部17、第1復号部18の順に所定回数実行する。   The decoding control unit 19 controls the execution of the second decoding unit 17 and the first decoding unit 18. Specifically, the decoding control unit 19 executes the second decoding unit 17 and the first decoding unit 18 a predetermined number of times in the order of the second decoding unit 17 and the first decoding unit 18.

[フローチャート]
続いて、第1実施形態に係る暗号装置1を使用して、暗号化及び復号を行う処理の流れについて説明する。
図2は、第1実施形態に係る暗号装置1により暗号化を行う場合の処理の流れを示すフローチャートである。なお、このフローチャートでは、暗号化制御部16により、所定回数としてA回、暗号化が行なわれるものとする。
[flowchart]
Next, the flow of processing for performing encryption and decryption using the encryption device 1 according to the first embodiment will be described.
FIG. 2 is a flowchart illustrating a processing flow when encryption is performed by the encryption device 1 according to the first embodiment. In this flowchart, it is assumed that encryption is performed A times as the predetermined number of times by the encryption control unit 16.

ステップS1において、制御部(暗号化制御部16)は、所定回数か否かを判定するために記憶部に設けられているカウンタc1の値を1とする。   In step S1, the control unit (encryption control unit 16) sets the value of the counter c1 provided in the storage unit to 1 to determine whether or not the predetermined number of times.

ステップS2において、制御部(素数生成部11)は、第1の素数Aと第2の素数Bとの積Nが所定数Xを超えるように、第1の素数A及び第2の素数Bを生成する。   In step S2, the control unit (prime generation unit 11) sets the first prime number A and the second prime number B so that the product N of the first prime number A and the second prime number B exceeds a predetermined number X. Generate.

ステップS3において、制御部(暗号鍵生成部12)は、第1の素数A及び第2の素数Bに基づいて、暗号鍵としての整数Eを生成する。具体的には、制御部(暗号鍵生成部12)は、(A−1)と(B−1)の積D、又は(A−1)と(B−1)の最小公倍数Kと、素である整数Eであって、所定数Xを底とし、整数Eを指数としたべき乗が、レジスタの表現できる桁数よりも大きい桁数としての所定桁数を超えるように整数Eを生成し、この整数Eを暗号鍵とする。   In step S3, the control unit (encryption key generation unit 12) generates an integer E as an encryption key based on the first prime number A and the second prime number B. Specifically, the control unit (encryption key generation unit 12) calculates the product D of (A-1) and (B-1) or the least common multiple K of (A-1) and (B-1) and the prime. An integer E is generated such that the power of the predetermined number X as the base and the integer E as the exponent exceeds the predetermined number of digits larger than the number of digits that can be represented by the register, This integer E is an encryption key.

ステップS4において、制御部(復号鍵生成部13)は、暗号鍵(整数E)に対応する復号鍵(整数F)を生成する。具体的には、任意の整数mとした場合に上述の(1)式を満たすように、整数Fを生成し、この整数Fを復号鍵とする。この整数Fは、例えば制御部により、何回目の第1暗号化部14の暗号に係る復号鍵であるかを示す情報と関連付けられて、復号を行う暗号装置1に通知される。   In step S4, the control unit (decryption key generation unit 13) generates a decryption key (integer F) corresponding to the encryption key (integer E). Specifically, an integer F is generated so as to satisfy the above equation (1) when an arbitrary integer m is set, and this integer F is used as a decryption key. For example, the control unit notifies the integer F to the encryption device 1 that performs decryption in association with information indicating the number of times the first encryption unit 14 is associated with the decryption key.

ステップS5において、制御部(第1暗号化部14)は、整数Eの2進数展開を行い、この展開式に基づいて、整数XのE乗を、この整数Xの2のべき乗の積に展開する。 In step S5, the control unit (the first encryption unit 14) performs the binary expansion of an integer E, on the basis of the deployable, the multiplication E integers X i, a power of 2 k of the integer X i Expand to product.

ステップS6において、制御部(第1暗号化部14)は、kを0に設定する。
ステップS7において、制御部(第1暗号化部14)は、整数Xの2乗を、積Nで除算した場合の剰余を算出する。具体的には、制御部(第1暗号化部14)は、直前に算出した整数Xの2k−1乗を積Nで除算した場合の剰余を2乗し、更にこの値を積Nで除算した場合の剰余を算出する。また、制御部(第1暗号化部14)は、整数Xを、桁あふれが生じないように上述の(5)式に基づいて、複数の整数の和に変換し、変換された整数に基づいて、整数Xの2乗を積Nで除算した場合の剰余を算出する。
In step S6, the control unit (first encryption unit 14) sets k to 0.
In step S < b> 7, the control unit (first encryption unit 14) calculates the remainder when the integer X i to the 2k power is divided by the product N. Specifically, the control unit (first encryption unit 14) squares the remainder when the 2k -1 power of the integer X i calculated immediately before is divided by the product N, and further adds this value to the product N Calculate the remainder when dividing by. In addition, the control unit (first encryption unit 14) converts the integer X i into a sum of a plurality of integers based on the above equation (5) so that overflow does not occur, and converts the integer X i into the converted integer. Based on this, the remainder when the integer X i to the 2k power is divided by the product N is calculated.

ステップS8において、制御部(第1暗号化部14)は、kに1を加算する。
ステップS9において、制御部(第1暗号化部14)は、kがnより大きいか否かを判定する。制御部(第1暗号化部14)は、この判定がYESの場合、処理をステップS10に移し、この判定がNOの場合、処理をステップS7に移す。
In step S8, the control unit (first encryption unit 14) adds 1 to k.
In step S9, the control unit (first encryption unit 14) determines whether k is larger than n. When this determination is YES, the control unit (first encryption unit 14) moves the process to step S10, and when this determination is NO, the control unit (first encryption unit 14) moves the process to step S7.

ステップS10において、制御部(第1暗号化部14)は、ステップS7で算出した剰余に基づいて、整数XのE乗を、積Nで除算した場合の剰余を暗号化数Yとして算出する。 In step S10, the control unit (first encryption unit 14) calculates, as the encryption number Y i , the remainder when the integer X i is divided by the product N based on the residue calculated in step S7. To do.

ステップS11において、制御部(第2暗号化部15)は、鍵Rを生成し、(9)式に基づいて、暗号化数Yの換字式暗号を行い、整数Y’を算出する。この鍵Rは、例えば制御部により、何回目の換字式暗号に係る鍵であるかを示す情報と関連付けられて、復号を行う暗号装置1に通知される。 In step S <b> 11, the control unit (second encryption unit 15) generates a key R i , performs substitution encryption of the encrypted number Y based on the equation (9), and calculates an integer Y i ′. This key R i is, for example, by the control unit, associated with the information indicating whether the key according to many times the substitution cipher is notified to the encryption apparatus 1 for decoding.

ステップS12において、制御部(暗号化制御部16)は、カウンタc1が、所定回数Aと等しいか否かを判定する。制御部(暗号化制御部16)は、この判定がYESの場合、処理を終了し、この判定がNOの場合、処理をステップS13に移す。
ステップS13において、制御部(暗号化制御部16)は、カウンタc1に1を加算するとともに、整数Xに、整数Y’を代入する。その後、制御部(暗号化制御部16)は、処理をステップS2に移す。
In step S12, the control unit (encryption control unit 16) determines whether or not the counter c1 is equal to the predetermined number of times A. The control unit (encryption control unit 16) ends the process if this determination is YES, and moves the process to step S13 if this determination is NO.
In step S13, the control unit (encryption control unit 16) adds 1 to the counter c1 and substitutes an integer Y i ′ for the integer X i . Thereafter, the control unit (encryption control unit 16) moves the process to step S2.

図3は、第1実施形態に係る暗号装置1により復号を行う場合の処理の流れを示すフローチャートである。なお、暗号装置1には、暗号化されたデータと、暗号化に用いられた鍵R、及び復号鍵(整数F)が通知され、暗号化されたデータの復号が可能な状態であることとする。また、暗号化の繰り返し数、すなわち所定回数は、Aであることとする。 FIG. 3 is a flowchart showing the flow of processing when decryption is performed by the encryption device 1 according to the first embodiment. The encryption device 1 is notified of the encrypted data, the key R i used for encryption, and the decryption key (integer F), and is in a state where the encrypted data can be decrypted. And The number of encryption repetitions, that is, the predetermined number is A.

ステップS21において、制御部(復号制御部19)は、所定回数か否かを判定するために記憶部に設けられているカウンタc2の値を1とする。   In step S21, the control unit (decoding control unit 19) sets the value of the counter c2 provided in the storage unit to 1 in order to determine whether or not the predetermined number of times.

ステップS22において、制御部(第2復号部17)は、上述の(11)式に基づいて、第2暗号化部15により換字式暗号された整数Y’から、暗号化数Yを算出する。復号に用いられる、鍵Rには、何回目の換字式復号であるかを示す情報が関連付けられており、所定回数Aに対応する鍵Rから順に復号が行われる。 In step S <b> 22, the control unit (second decryption unit 17) calculates the encryption number Y i from the integer Y i ′ that is substitution-encrypted by the second encryption unit 15 based on the above-described equation (11). To do. Used for decoding, the key R i, is associated information indicating how many times the substitution type decoding, decoding in order from the key R i corresponding to a predetermined number of times A is performed.

ステップS23において、制御部(第1復号部18)は、暗号化数Yの2進数展開を行い、この展開式に基づいて、暗号化数YのF乗を、この暗号化数Yの2のべき乗の積に展開する。 In step S23, the control unit (first decoding unit 18) performs the binary expansion of the encrypted number Y i, on the basis of the deployable, the multiplication F encryption number Y i, the encrypted number Y i to expand the power of the product of the 2 k of.

ステップS24において、制御部(第1復号部18)は、kを0に設定する。
ステップS25において、制御部(第1復号部18)は、暗号化数Yの2乗を、積Nで除算した場合の剰余を算出する。具体的には、制御部(第1復号部18)は、直前に算出した暗号化数Yの2k−1乗を積Nで除算した場合の剰余を2乗し、更にこの値を積Nで除算した場合の剰余を算出する。また、制御部(第1復号部18)は、暗号化数Yを、桁あふれが生じないように上述の(10)式に基づいて複数の整数の和に変換し、変換された整数に基づいて、暗号化数Yの2乗を積Nで除算した場合の剰余を算出する。
In step S24, the control unit (first decoding unit 18) sets k to 0.
In step S25, the control unit (first decoding unit 18), the multiplication 2 k encryption number Y i, and calculates a remainder when divided by the product N. Specifically, the control unit (first decryption unit 18) squares the remainder obtained by dividing the 2k -1 power of the encrypted number Y i calculated immediately before by the product N, and further multiplies this value. The remainder when dividing by N is calculated. Further, the control unit (first decryption unit 18) converts the encrypted number Y i into a sum of a plurality of integers based on the above-described equation (10) so as not to cause overflow, and converts it into the converted integer. based on, calculates a remainder when the multiplication 2 k encryption number Y i divided by the product N.

ステップS26において、制御部(第1復号部18)は、kに1を加算する。
ステップS27において、制御部(第1復号部18)は、kがnより大きいか否かを判定する。制御部(第1復号部18)は、この判定がYESの場合、処理をステップS28に移し、この判定がNOの場合、処理をステップS25に移す。
In step S26, the control unit (first decoding unit 18) adds 1 to k.
In step S27, the control unit (first decoding unit 18) determines whether k is larger than n. The control unit (first decoding unit 18) moves the process to step S28 when this determination is YES, and moves the process to step S25 when this determination is NO.

ステップS28において、制御部(第1復号部18)は、ステップS25で算出した剰余に基づいて、暗号化数YのF乗を、積Nで除算した場合の剰余を整数Xとして算出(復号)する。 In step S28, the control unit (first decryption unit 18) calculates the remainder when the encrypted number Y i is divided by the product N as the integer X i based on the remainder calculated in step S25 ( Decrypt).

ステップS29において、制御部(復号制御部19)は、カウンタc2が、所定回数Aと等しいか否かを判定する。制御部(復号制御部19)は、この判定がYESの場合、処理を終了し、この判定がNOの場合、処理をステップS30に移す。
ステップS30において、制御部(復号制御部19)は、カウンタc2に1を加算するとともに、暗号化数Yに、整数Xを代入する。その後、制御部(復号制御部19)は、処理をステップS22に移す。
In step S29, the control unit (decoding control unit 19) determines whether or not the counter c2 is equal to the predetermined number A. When this determination is YES, the control unit (decoding control unit 19) ends the process, and when this determination is NO, the process proceeds to step S30.
In step S30, the control unit (decryption control unit 19) adds 1 to the counter c2 and substitutes an integer X i for the encrypted number Y i . Thereafter, the control unit (decoding control unit 19) moves the process to step S22.

以上、第1実施形態によれば、暗号装置1は、第1暗号化部14により、整数Xを、複数の整数により構成される展開式に変換し、当該展開式により、整数Xを底とし、整数Eを指数としたべき乗を算出し、第1復号部18により、暗号化数Yを、複数の整数により構成される展開式に変換し、当該展開式により、暗号化数Yを底とし、整数Fを指数としたべき乗を算出し、第2暗号化部15により、暗号化数Yを、複数の整数により構成される展開式に変換し、当該展開式により、暗号化数Yを換字式暗号し、第2復号部17により、整数Y’を、複数の整数により構成される展開式に変換し、当該展開式により、暗号化数Yを復号する。 As described above, according to the first embodiment, the encryption device 1 converts the integer X i into an expansion expression composed of a plurality of integers by the first encryption unit 14, and the integer X i is converted into the expansion expression by the expansion expression. The power of the base E and the integer E as an exponent is calculated, and the first decryption unit 18 converts the encrypted number Y i into an expansion expression composed of a plurality of integers. The power with i as the base and the integer F as the exponent is calculated, and the second encryption unit 15 converts the encrypted number Y i into an expansion expression composed of a plurality of integers. The conversion number Y i is subjected to substitution encryption, and the second decryption unit 17 converts the integer Y i ′ into an expansion expression composed of a plurality of integers, and decrypts the encryption number Y i by the expansion expression.

すなわち、暗号装置1は、整数X、暗号化数Y、整数Y’について演算する場合に、演算対象の整数を、桁あふれが生じない桁数の整数に分割して計算するので、整数X、暗号化数Y、整数Y’を正確に算出することができる。更に、整数Xは、この整数Xを構成する数字それぞれについて、別個に暗号化を行わずに、整数Xそのものを暗号化し、暗号化数Yを算出する。つまり、暗号装置1は、整数Xを暗号化する場合に、例えば、複数バイトずつにわけて、それぞれについて暗号化を行うといったように、暗号化による結果を複数算出することがない。よって、パーソナル・コンピュータ用のアプリケーション・ソフトウェア等の有効数字の範囲を超える整数について、第三者による解読のための手がかりとなる情報を増やすことなく、暗号化及び復号をすることができる。 That is, when the cryptographic apparatus 1 performs computation on the integer X i , the encrypted number Y i , and the integer Y i ′, the computation target integer is divided into integers having the number of digits that do not cause overflow. The integer X i , the encrypted number Y i , and the integer Y i ′ can be accurately calculated. Furthermore, the integer X i, for each digit constituting the integer X i, without separate encryption, encrypts the integer X i itself, and calculates the number of encryption Y i. That is, when encrypting the integer X i , the encryption device 1 does not calculate a plurality of results of encryption, for example, by performing encryption for each of a plurality of bytes. Therefore, it is possible to encrypt and decrypt integers exceeding the range of significant figures such as application software for personal computers without increasing information that becomes a clue for decryption by a third party.

また、暗号装置1は、所定数Xより小さい正の整数をランダムに選択し、この整数を鍵Rとし、この鍵Rの値を暗号化数Yに対して加算することにより、換字式暗号を行う。従来の換字式暗号では、数字を他の数字(例えば、0を1、1を2、・・・)に置き換える方法であり、この方法で20桁の整数を、換字式暗号を行った場合、暗号化のパターンが10通りに限定されてしまう。本実施形態では、鍵Rは、所定数X以下の正の整数であるので、所定数Xが大きければ大きいほど、暗号化のパターンが多くなる。よって、従来の換字式暗号に比べて、セキュリティを、より強固なものとすることができる。 Also, the cryptographic device 1 randomly selects a positive integer smaller than the predetermined number X, sets this integer as the key R i, and adds the value of this key R i to the encrypted number Y i . Formula encryption. In the conventional substitution cipher, the number is replaced with another number (for example, 0 is 1, 1 is 2,...), And when a 20-digit integer is substituted by this method, The number of encryption patterns is limited to ten. In the present embodiment, the key R i is a positive integer equal to or less than the predetermined number X. Therefore, the larger the predetermined number X, the greater the number of encryption patterns. Therefore, the security can be made stronger than that of the conventional substitution encryption.

また、暗号装置1は、暗号化制御部16により、暗号化制御部16は、素数生成部11と、暗号鍵生成部12と、第1暗号化部14と、第2暗号化部15とを、素数生成部11、暗号鍵生成部12、第1暗号化部14、及び第2暗号化部15の順に所定回数実行するので、暗号化を単に1回行う場合に比べて、セキュリティをより強固なものとすることができる。   In addition, the encryption device 1 includes an encryption control unit 16, and the encryption control unit 16 includes a prime number generation unit 11, an encryption key generation unit 12, a first encryption unit 14, and a second encryption unit 15. Since the prime number generation unit 11, the encryption key generation unit 12, the first encryption unit 14, and the second encryption unit 15 are executed a predetermined number of times in this order, security is further enhanced compared to the case where encryption is performed only once. Can be.

また、暗号装置1は、整数X、暗号化数Yを、上述の(5)式、(10)式を用いて、べき乗の計算を行う。例えば、整数Xが2乗の場合に、(5)式の右辺の2乗から、整数Xの2乗、整数X・整数X、及び整数Xの2乗が生成され、これらはいずれも元の整数Xの桁数以下の整数となるので、桁あふれを避けられる。このように、暗号装置1は、整数X、暗号化数Yの任意のべき乗において、(5)式、(10)式の手順を繰り返すことにより、べき乗の計算過程での桁あふれを避けることが可能になる。 Also, the cryptographic device 1 calculates the power of the integer X i and the encrypted number Y i using the above-described equations (5) and (10). For example, if the integer X i is the square, the square of the right side of Formula (5), the square of an integer X u, integer X u · integer X d, and the square of an integer X d are generated, these Since both are integers less than the number of digits of the original integer X i , overflow is avoided. In this way, the cryptographic apparatus 1 avoids overflow in the power calculation process by repeating the procedures of the equations (5) and (10) at any power of the integer X i and the encrypted number Y i. It becomes possible.

<第2実施形態>
以下、本発明の第2実施形態について図を参照しながら説明する。なお、第1実施形態と同様の構成には同一の符号を付し、説明を省略又は簡略化する。
<Second Embodiment>
Hereinafter, a second embodiment of the present invention will be described with reference to the drawings. In addition, the same code | symbol is attached | subjected to the structure similar to 1st Embodiment, and description is abbreviate | omitted or simplified.

[機能構成]
図4は、第2実施形態に係る暗号装置100の機能構成を示す図である。
暗号装置100の制御部は、第1実施形態の制御部が備える第1暗号化部14及び第1復号部18に換えて、第1暗号化部114及び第1復号部118を備える。
[Function configuration]
FIG. 4 is a diagram illustrating a functional configuration of the encryption device 100 according to the second embodiment.
The control unit of the encryption device 100 includes a first encryption unit 114 and a first decryption unit 118 instead of the first encryption unit 14 and the first decryption unit 18 included in the control unit of the first embodiment.

第1暗号化部114は、暗号化したい整数の集合Sが、0から所定数Xの範囲外にある場合に、オフセット数Tを、集合Sに含まれる暗号化したい整数それぞれに対して加算して、この暗号化したい整数それぞれが、0から所定数Xの範囲に含まれるように調整し、集合S’とする。   The first encryption unit 114 adds the offset number T to each of the integers to be encrypted included in the set S when the integer set S to be encrypted is outside the range of 0 to the predetermined number X. Thus, each integer to be encrypted is adjusted to be included in the range of 0 to a predetermined number X, and set as a set S ′.

具体的には、第1暗号化部114は、暗号化を行う直前に、整数Xに対して、オフセット数Tを加算して当該整数Xを更新し、暗号化を行った直後に、暗号化数Yに対して、オフセット数Tを減算して、当該暗号化数Yを更新する。
また、第1復号部118は、復号を行う直前に、暗号化数Yに対して、オフセット数Tを加算して当該暗号化数Yを更新し、復号を行った直後に、整数Xに対して、オフセット数Tを減算して、当該整数Xを更新する。
なお、ここでは、第1暗号化部114により、整数Xに対してオフセット数Tを加算してから暗号化を行い、暗号化数Yに対してオフセット数Tを減算することとしているが、整数Xに対してオフセット数Tを減算してから暗号化を行い、暗号化した後に暗号化数Yに対してオフセット数Tを加算することとしてもよい。また、この場合、第1復号部118は、暗号化数Yに対して、オフセット数Tを減算して当該暗号化数Yを更新し、復号を行った直後に、整数Xに対して、オフセット数Tを加算して、当該整数Xを更新する。
More specifically, the first encryption unit 114, immediately before the encryption, for integer X i, immediately after updating the integer X i by adding an offset number T, was encrypted, the encrypted number Y i, by subtracting the offset number T, and updates the encryption number Y i.
The first decoding unit 118, immediately before the decoding, the encrypted number Y i, immediately after updating the encrypted number Y i by adding an offset number T, was decoded, integer X The integer X i is updated by subtracting the offset number T from i .
Here, the first encryption unit 114 performs encryption after adding the offset number T to the integer X i , and subtracts the offset number T from the encryption number Y i . It is also possible to perform encryption after subtracting the offset number T from the integer X i and add the offset number T to the encrypted number Y i after encryption. In this case, the first decoding unit 118, the encrypted number Y i, immediately after updating the encrypted number Y i by subtracting the offset number T, was decoded, with respect to the integer X i Then, the offset number T is added to update the integer X i .

[フローチャート]
続いて、第2実施形態に係る暗号装置100を使用して、暗号化及び復号を行う処理の流れについて説明する。
図5は、第2実施形態に係る暗号装置100により暗号化を行う場合の処理の流れを示すフローチャートである。なお、ここでは、第1実施形態と同様に、暗号化制御部16により、所定回数としてA回、暗号化が行なわれるものとする。また、このフローチャートでは、集合Sに含まれる整数Xの暗号化が行われるものとする。
[flowchart]
Next, the flow of processing for performing encryption and decryption using the encryption device 100 according to the second embodiment will be described.
FIG. 5 is a flowchart showing a processing flow when encryption is performed by the encryption device 100 according to the second embodiment. Here, as in the first embodiment, it is assumed that encryption is performed A times as the predetermined number of times by the encryption control unit 16. In this flowchart, it is assumed that the integer X i included in the set S is encrypted.

ステップS101からステップS104までの処理は、第1実施形態のステップS1からステップS4までの処理と同一であるので、説明を省略する。   Since the processing from step S101 to step S104 is the same as the processing from step S1 to step S4 of the first embodiment, description thereof will be omitted.

ステップS105において、制御部(第1暗号化部114)は、整数Xに対して、オフセット数Tを加算して、整数Xを更新する。オフセット数Tは、このオフセット数Tを、集合Sに含まれる全ての整数それぞれに対して加算した場合に、0から所定数Xの範囲内となるように設定されるものとする。 In step S105, the control unit (the first encryption unit 114), for integer X i, by adding an offset number T, and updates the integer X i. The offset number T is set to be within a range from 0 to a predetermined number X when the offset number T is added to all integers included in the set S.

ステップS106からステップS111までの処理は、第1実施形態のステップS5からステップS10までの処理と同一であるので、説明を省略する。   Since the processing from step S106 to step S111 is the same as the processing from step S5 to step S10 of the first embodiment, description thereof will be omitted.

ステップS112において、制御部(第1暗号化部114)は、暗号化数Yに対して、オフセット数Tを減算する。このオフセット数Tは、ステップS105において使用されたオフセット数Tと同じ値である。 In step S112, the control unit (first encryption unit 114) subtracts the offset number T from the encrypted number Y i . This offset number T is the same value as the offset number T used in step S105.

ステップS113からステップS115までの処理は、第1実施形態のステップS11からステップS13までの処理と同一であるので、説明を省略する。   Since the processing from step S113 to step S115 is the same as the processing from step S11 to step S13 of the first embodiment, description thereof will be omitted.

図6は、第2実施形態に係る暗号装置1により復号を行う場合の処理の流れを示すフローチャートである。なお、ここでは、第1実施形態と同様に、暗号化されたデータと、暗号化に用いられた鍵R、及び復号鍵(整数F)が通知され、暗号化されたデータの復号が可能な状態であることとする。また、暗号化の繰り返し数、すなわち所定回数は、Aであることとする。また、オフセット数Tは、図5のステップS105において使用されたオフセット数Tと同じ値である。 FIG. 6 is a flowchart showing a flow of processing when decryption is performed by the encryption device 1 according to the second embodiment. Here, as in the first embodiment, the encrypted data, the key R i used for encryption, and the decryption key (integer F) are notified, and the encrypted data can be decrypted. It is assumed that it is in a state. The number of encryption repetitions, that is, the predetermined number is A. The offset number T is the same value as the offset number T used in step S105 in FIG.

ステップS121及びステップS122の処理は、第1実施形態のステップS21及びステップS22の処理と同一であるので、説明を省略する。   Since the process of step S121 and step S122 is the same as the process of step S21 and step S22 of 1st Embodiment, description is abbreviate | omitted.

ステップS123において、制御部(第1復号部118)は、暗号化数Yに対して、オフセット数Tを加算して、暗号化数Yを更新する。 In step S123, the control unit (first decoding unit 118), the encrypted number Y i, by adding an offset number T, and updates the encryption number Y i.

ステップS124からステップS129までの処理は、第1実施形態のステップS23からステップS28までの処理と同一であるので、説明を省略する。   Since the processing from step S124 to step S129 is the same as the processing from step S23 to step S28 of the first embodiment, description thereof will be omitted.

ステップS130において、制御部(第1復号部118)は、整数Xに対して、オフセット数Tを減算して、整数Xを更新する。 In step S130, the control unit (first decoding unit 118), for integer X i, by subtracting the offset number T, and updates the integer X i.

ステップS131及びステップS132の処理は、第1実施形態のステップS29及びステップS30の処理と同一であるので、説明を省略する。   Since the process of step S131 and step S132 is the same as the process of step S29 and step S30 of 1st Embodiment, description is abbreviate | omitted.

以上、第2実施形態によれば、暗号装置100は、第1暗号化部114により、暗号化を行う直前に、整数Xに対して、オフセット数Tを加算して当該整数Xを更新し、暗号化を行った直後に、暗号化数Yに対して、オフセット数Tを減算して、当該暗号化数Yを更新する。よって、暗号装置100は、オフセット数Tを加減算して暗号化することにより、暗号化の手順を更に複雑なものとすることができるので、セキュリティをより強固なものとすることができる。 As described above, according to the second embodiment, the encryption device 100 updates the integer X i by adding the offset number T to the integer X i by the first encryption unit 114 immediately before encryption. and, immediately after performing encryption, the encrypted number Y i, by subtracting the offset number T, and updates the encryption number Y i. Therefore, the encryption apparatus 100 can further increase the complexity of the encryption procedure by adding and subtracting the offset number T to perform encryption, thereby further strengthening the security.

また、オフセット数Tは、複数の整数Xが存在する場合、当該オフセット数Tを当該整数Xそれぞれに加算した場合に、当該整数Xそれぞれが0以上かつ所定数X以下になるように設定されるので、複数の整数Xが0以上かつ所定数X以下に含まれない場合であっても、0以上かつ所定数X以下に含まれるように調整することができるので、複数の整数Xの暗号化を正常に行うことができる。 Further, the offset number T, when the plurality of integer X i is present, the offset number T when added to each the integer X i, as respectively the integer X i is 0 or more and less than a predetermined number X Since it is set, even if the plurality of integers X i are not included in the range of 0 or more and the predetermined number X or less, they can be adjusted to be included in the range of 0 or more and the predetermined number X or less. the encryption of X i can be carried out successfully.

また、暗号装置100は、オフセット数Tによる加減算により、任意の範囲の複数の整数Xを暗号化し、更に、暗号化制御部16により、暗号化に係る処理を繰り返し実行する。よって、繰り返し実行時に、素数生成部11による素数の組合せをランダムに生成し、暗号鍵(整数E)を生成しても、この複数の整数Xを暗号化することができる。 Further, the encryption device 100 encrypts a plurality of integers X i in an arbitrary range by addition / subtraction with the offset number T, and the encryption control unit 16 repeatedly executes encryption processing. Therefore, even when the combination of prime numbers by the prime number generation unit 11 is randomly generated and the encryption key (integer E) is generated during repeated execution, the plurality of integers X i can be encrypted.

簡単のため、桁あふれを考慮しないこととし、例えば、整数Xの集合Sが0〜31までの数字である場合に、暗号装置100により、1回目の暗号化において、素数3と素数11の組合せに基づいた暗号化を行い、2回目の暗号化において、素数2と素数17の組合せに基づいた暗号化を行い、3回目の暗号化において、素数5と素数7の組合せに基づいた暗号化を行うとする。 For the sake of simplicity, it is assumed that overflow is not considered. For example, when the set S of integers X i is a number from 0 to 31, the cryptographic device 100 uses the prime number 3 and the prime number 11 in the first encryption. Encryption based on the combination, encryption based on the combination of prime 2 and prime 17 in the second encryption, and encryption based on the combination of prime 5 and prime 7 in the third encryption Suppose that

ここで、素数3と素数11の組合せでは、基本的に0〜32の33個の数字、素数2と素数17の組合せでは、基本的に0〜33の34個の数字、素数5と素数7の組合せでは、基本的に0〜34の35個の数字をRSA暗号化することができる。よって、素数3と素数11の組合せの場合には、0を省略させた1〜32の範囲(32個)と、32を省略させた0〜32の範囲(32個)に対してオフセット数Tを用いて、集合Sを生成し、RSA暗号を行うことができる。また、素数2と素数17の組合せの場合には、0、1を省略させた2〜33の範囲(32個)と0、32を省略させた1〜32の範囲(32個)に対してオフセット数Tを用いて、集合Sを生成し、RSA暗号を行うことができる。また、素数5と素数7の組合せの場合には、0、1、34を省略させた2〜33の範囲(32個)に対してオフセット数Tを用いて、集合Sを生成し、RSA暗号を行うことができる。   Here, in the combination of prime number 3 and prime number 11, basically 33 numbers from 0 to 32, and in the combination of prime number 2 and prime number 17, basically 34 numbers from 0 to 33, prime number 5 and prime number 7. In this combination, 35 numbers from 0 to 34 can be basically RSA encrypted. Therefore, in the case of the combination of the prime number 3 and the prime number 11, the offset number T with respect to the range of 1 to 32 (32 pieces) in which 0 is omitted and the range of 0 to 32 (32 pieces) in which 32 is omitted. Can be used to generate the set S and perform RSA encryption. Further, in the case of the combination of prime number 2 and prime number 17, the range of 2 to 33 (32 pieces) in which 0 and 1 are omitted and the range of 1 to 32 (32 pieces) in which 0 and 32 are omitted. The set S can be generated using the offset number T, and RSA encryption can be performed. Further, in the case of the combination of prime number 5 and prime number 7, a set S is generated using the offset number T for a range of 2 to 33 (32 pieces) in which 0, 1 and 34 are omitted, and RSA encryption It can be performed.

なお、この場合、オフセット数Tは−2から0の範囲に設定される。すなわち、上述のように、3つの素数の組合せにおける積Nが連続する3つ整数である場合、暗号化範囲の個数を同一として0〜2でスライド(加減算)させたものを暗号化させその後0〜−2でスライド(加減算)させて元に戻すことで、集合Sに含まれる複数の整数Xは、暗号化した後も、集合Sが取り得る範囲の整数に暗号化されるので、複数の整数Xの暗号化を正常に行うことができるとともに、暗号化することにより得られるパターンを多様化することができる。 In this case, the offset number T is set in the range of −2 to 0. That is, as described above, when the product N in the combination of the three prime numbers is three consecutive integers, the number of encrypted ranges is made the same and the one slided (added or subtracted) by 0 to 2 is encrypted, and then 0 Since the plurality of integers X i included in the set S are encrypted into integers within the range that the set S can take after being encrypted by sliding (adding / subtracting) at −2 to return to the original, it is possible to perform encryption integer X i normally, it is possible to diversify the pattern obtained by encrypting.

なお、上述の例では、連続する3つ整数の場合について説明したが、連続する4つの整数(差が3以内)から得られる素数の組合せであれば、複数の整数Xの暗号化を正常に行うことができる。例えば、9985(素数5と素数1997の組合せ)と、9986(素数2と素数4993の組合せ)と、9987(素数3と素数3329の組合せ)や、9986(素数2と素数4993の組合せ)と、9987(素数3と素数3329の組合せ)と、9989(素数7と素数1427の組合せ)についても、オフセット数Tを−2から0の範囲に設定することで、複数の整数Xの暗号化を正常に行うことができる。 In the above example, the case of three consecutive integers has been described. However, if a combination of prime numbers obtained from four consecutive integers (difference is within 3), the encryption of a plurality of integers X i is normally performed. Can be done. For example, 9985 (combination of prime 5 and prime 1997), 9986 (combination of prime 2 and prime 4993), 9987 (combination of prime 3 and prime 3329), 9986 (combination of prime 2 and prime 4993), For 9987 (combination of prime number 3 and prime number 3329) and 9989 (combination of prime number 7 and prime number 1427), by setting the offset number T in the range of −2 to 0, the encryption of a plurality of integers X i is performed. Can be done normally.

これに対して、連続する4つの整数から得られない素数の組合せにより暗号化すると、暗号化した後に、集合Sが取り得る範囲の整数に暗号化されなくなり、正しく暗号化を行うことができない。例えば、集合Sに含まれる複数の整数Xを0〜34として、この35個の整数を暗号化する場合、素数5と素数7の組合せでは、素数5と素数7の組合せでは、基本的に0〜34の35個の数字をRSA暗号化することができる。これに対して、素数3と素数13の組合せでは、例えば、集合Sに含まれる複数の整数Xを2〜36とすると、この35個の整数に対して暗号化をした場合に、暗号化した結果に、37等の集合Sの範囲を超える整数が発生するように、どのように35個の数字を選択しても、暗号化した後に、選択された数字以外に変換される整数が発生してしまい、複数の整数Xの暗号化を正常に行うことができない。 On the other hand, if encryption is performed using a combination of prime numbers that cannot be obtained from four consecutive integers, encryption is not performed to an integer in a range that can be taken by the set S, and encryption cannot be performed correctly. For example, when a plurality of integers X i included in the set S are set to 0 to 34, and the 35 integers are encrypted, the combination of the prime numbers 5 and 7 is basically the combination of the prime numbers 5 and 7. 35 numbers from 0 to 34 can be RSA encrypted. On the other hand, in the combination of the prime number 3 and the prime number 13, for example, if a plurality of integers X i included in the set S are 2 to 36, the encryption is performed when the 35 integers are encrypted. As a result, an integer that is converted to something other than the selected number after encryption is generated no matter how 35 numbers are selected so that an integer exceeding the range of the set S such as 37 is generated. to cause, can not be performed normally encryption of a plurality of integers X i.

つまり、上述のように、RSAにより繰り返し暗号化を行う場合に、2つの素数の組合せが、連続する4つの整数(N、N+1、N+2、N+3)から得られる異なる素数の組合せに、オフセット数Tとして、−2から0(又は0から2)を用いてスライド(加減算)して集合Sとしての複数の整数XのRSA暗号を行うことで、この複数の整数Xの暗号化数Yを集合Sの範囲に収めて、暗号化を正常に行うことができるとともに、暗号化することにより得られるパターンを、素数の組合せを同一のまま繰り返しRSA暗号を行う場合に比べて多様化することができ、セキュリティをより強固にすることができる。更に、換字式暗号と組合せて暗号化を行うことで、暗号化することにより得られるパターンを更に多様化することができ、多様性を更に増加させることができる。 That is, as described above, when RSA is used for repeated encryption, the combination of two prime numbers is changed to the combination of different prime numbers obtained from four consecutive integers (N, N + 1, N + 2, N + 3) by the offset number T. as, by performing a plurality of integers X i of RSA cryptography as a set S slides (addition and subtraction) with 0 (or 0 to 2) -2, number encryption of the plurality of integer X i Y i In the set S, and the encryption can be performed normally, and the pattern obtained by the encryption can be diversified as compared with the case where RSA encryption is repeatedly performed with the same combination of prime numbers. And security can be further strengthened. Furthermore, by performing encryption in combination with substitutional encryption, patterns obtained by encryption can be further diversified, and diversity can be further increased.

なお、このように、異なる素数の組合せによりRSA暗号を繰り返し行う場合、第2暗号化部15の鍵Rの値を0としてもよい。すなわち、第2暗号化部15及び第2復号部17による換字式暗号化を行わないこととしてもよい。このようにすることで、第2暗号化部15の機能が無効にして処理速度を向上させるとともに、異なる素数の組合せにより、RSA暗号を行うことで、暗号化することにより得られるパターンを多様化することができる。 As described above, when the RSA encryption is repeatedly performed by a combination of different prime numbers, the value of the key R i of the second encryption unit 15 may be set to 0. That is, the substitution encryption by the second encryption unit 15 and the second decryption unit 17 may not be performed. In this way, the function of the second encryption unit 15 is disabled to improve the processing speed, and the pattern obtained by encryption is diversified by performing RSA encryption with a combination of different prime numbers. can do.

以上、本発明の実施形態について説明したが、本発明は本実施形態に限定されるものではなく、本発明の目的を達成できる範囲での変形、改良等は本発明に含まれるものである。   The embodiment of the present invention has been described above, but the present invention is not limited to the present embodiment, and modifications, improvements, and the like within the scope that can achieve the object of the present invention are included in the present invention.

1 暗号装置
11 素数生成部
12 暗号鍵生成部
13 復号鍵生成部
14、114 第1暗号化部
15 第2暗号化部
16 暗号化制御部
17 第2復号部
18、118 第1復号部
19 復号制御部
DESCRIPTION OF SYMBOLS 1 Encryption apparatus 11 Prime number generation part 12 Encryption key generation part 13 Decryption key generation part 14, 114 1st encryption part 15 2nd encryption part 16 Encryption control part 17 2nd decryption part 18, 118 1st decryption part 19 Decryption Control unit

Claims (8)

整数を暗号化し、復号する暗号装置であって、
第1の素数Aと第2の素数Bとの積Nが所定数を超えるように前記A及び前記Bを生成する素数生成手段と、
前記第1の素数Aより1少ない整数A’と前記第2の素数Bより1少ない整数B’との積D、又は前記整数A’と前記整数B’との最小公倍数Kと素である整数Eであって、前記所定数を底とし、前記整数Eを指数としたべき乗が所定桁数を超えるように前記整数Eを生成し、前記整数Eを暗号鍵とする暗号鍵生成手段と、
任意の整数mとした場合に次式を満たすように整数Fを生成し、前記整数Fを前記暗号鍵に対応する復号鍵とする復号鍵生成手段と、
Figure 2012032740
前記所定数より小さい整数Xを底とし、前記整数Eを指数としたべき乗を前記積Nで除算した場合の剰余を算出して前記整数Xの暗号化数Yとする第1暗号化手段と、
前記暗号化数Yの換字式暗号化により整数Y’を算出する第2暗号化手段と、
前記Y’から換字式復号により前記暗号化数Yを復号する第2復号手段と、
前記暗号化数Yを底とし、前記整数Fを指数としたべき乗を前記整数Nで除算した場合の剰余を算出して前記整数Xを復号する第1復号手段と、を備え、
前記第1暗号化手段は、前記整数Xを、複数の整数により構成される展開式に変換し、当該展開式により、前記整数Xを底とし、前記整数Eを指数としたべき乗を算出し、
前記第1復号手段は、前記暗号化数Yを、複数の整数により構成される展開式に変換し、当該展開式により、前記暗号化数Yを底とし、前記整数Fを指数としたべき乗を算出し、
前記第2暗号化手段は、前記暗号化数Yを、複数の整数により構成される展開式に変換し、当該展開式により、前記暗号化数Yを換字式暗号し、
前記第2復号手段は、前記整数Y’を、複数の整数により構成される展開式に変換し、当該展開式により、前記暗号化数Yを復号する暗号装置。
An encryption device for encrypting and decrypting an integer,
Prime number generating means for generating A and B so that the product N of the first prime number A and the second prime number B exceeds a predetermined number;
A product D of an integer A ′ that is 1 less than the first prime number A and an integer B ′ that is 1 less than the second prime number B, or a least common multiple K of the integer A ′ and the integer B ′ and an integer that is prime E, wherein the integer E is generated so that a power of the predetermined number as a base and the integer E as an exponent exceeds a predetermined number of digits, and an encryption key generating means using the integer E as an encryption key;
Decryption key generation means for generating an integer F so as to satisfy the following expression when an arbitrary integer m is set, and using the integer F as a decryption key corresponding to the encryption key;
Figure 2012032740
First encryption is performed by calculating a remainder when the power of the integer X i smaller than the predetermined number and the integer E as an exponent is divided by the product N to be the encrypted number Y i of the integer X i Means,
Second encryption means for calculating an integer Y i ′ by substitutional encryption of the encrypted number Y i ;
Second decryption means for decrypting the encrypted number Y i from the Y i ′ by substitutional decryption;
The encrypted number Y i and a bottom, and a first decoding means for decoding the integer X i by calculating the remainder when the power that the integer F as index divided by the integer N,
The first encryption means converts the integer X i into an expansion equation composed of a plurality of integers, and calculates a power that uses the integer X i as a base and the integer E as an exponent by the expansion equation. And
The first decryption means converts the encrypted number Y i into an expansion equation composed of a plurality of integers, and based on the expansion equation, the encrypted number Y i is a base and the integer F is an exponent. Calculate the power,
The second encryption means converts the encrypted number Y i into an expansion formula composed of a plurality of integers, and subtracts the encrypted number Y i by the expansion formula,
The second decryption unit is an encryption device that converts the integer Y i ′ into an expansion equation composed of a plurality of integers, and decrypts the encrypted number Y i by the expansion equation.
前記第2暗号化手段は、前記暗号化数Yに対して、前記所定数より小さい正の整数からランダムに選択された整数である鍵Rの値を加算することにより、換字式暗号を行う請求項1に記載の暗号装置。 The second encryption means adds a value of a key R i that is an integer randomly selected from a positive integer smaller than the predetermined number to the encrypted number Y i , thereby performing a substitution cipher. The encryption device according to claim 1, wherein the encryption device is performed. 前記第1暗号化手段は、前記整数Xに対して、オフセット数Tを加算して、当該整数Xを更新し、当該更新された整数Xを底とし、前記整数Eを指数としたべき乗を前記積Nで除算した場合の剰余を算出して当該整数Xの暗号化数Yとし、当該暗号化数Yに対して、前記オフセット数Tを減算して当該暗号化数Yを更新し、
前記第2暗号化手段は、前記暗号化数Yに対して、前記オフセット数Tを加算して、当該暗号化数Yを更新し、前記更新された暗号化数Yを底とし、前記整数Fを指数としたべき乗を前記整数Nで除算した場合の剰余を算出して前記整数Xを復号し、当該整数Xに対して、前記オフセット数Tを減算して整数Xを更新する請求項1又は2に記載の暗号装置。
Wherein the first encryption means, to the integer X i, by adding an offset number T, and updates the integer X i, and the bottom of the integer X i, which is the updated, was exponential the integer E The remainder when the power is divided by the product N is calculated to obtain the encrypted number Y i of the integer X i , and the encrypted number Y i by subtracting the offset number T from the encrypted number Y i update i ,
The second encryption unit, to the encrypted number Y i, by adding the number of offset T, and updates the encrypted number Y i, and the bottom of the updated encrypted number Y i, the power of that the exponent integer F by calculating the remainder when divided by the integer N decoding the integer X i, with respect to the integer X i, the integer X i by subtracting the offset number T The encryption device according to claim 1 or 2, which is updated.
前記オフセット数Tは、複数の前記整数Xが存在する場合、当該オフセット数Tを当該整数Xそれぞれに加算した場合に、当該整数Xそれぞれが0以上かつ前記所定数以下になるように設定される請求項3に記載の暗号装置。 The offset number T is such that, when there are a plurality of the integers X i, when the offset number T is added to each of the integers X i, each of the integers X i is greater than or equal to 0 and less than or equal to the predetermined number. The encryption apparatus according to claim 3, which is set. 前記素数生成手段と、前記暗号鍵生成手段と、前記復号鍵生成手段と、前記第1暗号化手段と、前記第2暗号化手段とを、前記素数生成手段、前記暗号鍵生成手段、前記復号鍵生成手段、前記第1暗号化手段、前記第2暗号化手段の順に所定回数実行する暗号化制御手段と、
前記第2復号手段と、前記第1復号手段とを、前記第2復号手段、前記第1復号手段の順に前記所定回数実行する復号制御手段と、を更に備える請求項1から4のいずれかに記載の暗号装置。
The prime number generation unit, the encryption key generation unit, the decryption key generation unit, the first encryption unit, and the second encryption unit are combined with the prime number generation unit, the encryption key generation unit, and the decryption unit. An encryption control unit that executes a predetermined number of times in the order of a key generation unit, the first encryption unit, and the second encryption unit;
5. The decoding control unit according to claim 1, further comprising: a decoding control unit that executes the second decoding unit and the first decoding unit a predetermined number of times in the order of the second decoding unit and the first decoding unit. The encryption device described.
前記素数生成手段は、前記暗号化制御手段により繰り返し実行される場合、それぞれの繰り返し実行において前記A及び前記Bが異なるように前記A及び前記Bを生成する請求項5に記載の暗号装置。   6. The encryption apparatus according to claim 5, wherein when the prime number generation unit is repeatedly executed by the encryption control unit, the A and the B are generated so that the A and the B are different in each repeated execution. 整数を暗号化し、復号する暗号装置であって、
第1の素数Aと第2の素数Bとの積Nが所定数を超えるように前記A及び前記Bを生成する素数生成手段と、
前記第1の素数Aより1少ない整数A’と前記第2の素数Bより1少ない整数B’との積D、又は前記整数A’と前記整数B’との最小公倍数Kと素である整数Eであって、前記所定数を底とし、前記整数Eを指数としたべき乗が所定桁数を超えるように前記整数Eを生成し、前記整数Eを暗号鍵とする暗号鍵生成手段と、
任意の整数mとした場合に次式を満たすように整数Fを生成し、前記整数Fを前記暗号鍵に対応する復号鍵とする復号鍵生成手段と、
Figure 2012032740
前記所定数より小さい整数Xに対して、オフセット数Tを加算して、当該整数Xを更新し、当該更新された整数Xを底とし、前記整数Eを指数としたべき乗を前記積Nで除算した場合の剰余を算出して前記整数Xの暗号化数Yとし、当該暗号化数Yに対して、前記オフセット数Tを減算して当該暗号化数Yを更新する第1暗号化手段と、
前記暗号化数Yに対して、前記オフセット数Tを加算して、当該暗号化数Yを更新し、前記更新された暗号化数Yを底とし、前記整数Fを指数としたべき乗を前記整数Nで除算した場合の剰余を算出して前記整数Xを復号し、当該整数Xに対して、前記オフセット数Tを減算して整数Xを更新する第1復号手段と、
前記素数生成手段と、前記暗号鍵生成手段と、前記復号鍵生成手段と、前記第1暗号化手段とを、前記素数生成手段、前記暗号鍵生成手段、前記復号鍵生成手段、前記第1暗号化手段の順に所定回数実行する暗号化制御手段と、
前記第1復号手段を、前記所定回数実行する復号制御手段と、を備え、
前記第1暗号化手段は、前記整数Xを、複数の整数により構成される展開式に変換し、当該展開式により、前記整数Xを底とし、前記整数Eを指数としたべき乗を算出し、
前記第1復号手段は、前記暗号化数Yを、複数の整数により構成される展開式に変換し、当該展開式により、前記暗号化数Yを底とし、前記整数Fを指数としたべき乗を算出する暗号装置。
An encryption device for encrypting and decrypting an integer,
Prime number generating means for generating A and B so that the product N of the first prime number A and the second prime number B exceeds a predetermined number;
A product D of an integer A ′ that is 1 less than the first prime number A and an integer B ′ that is 1 less than the second prime number B, or a least common multiple K of the integer A ′ and the integer B ′ and an integer that is prime E, wherein the integer E is generated so that a power of the predetermined number as a base and the integer E as an exponent exceeds a predetermined number of digits, and an encryption key generating means using the integer E as an encryption key;
Decryption key generation means for generating an integer F so as to satisfy the following expression when an arbitrary integer m is set, and using the integer F as a decryption key corresponding to the encryption key;
Figure 2012032740
For small integer X i than the predetermined number, by adding an offset number T, and updates the integer X i, the updated integer X i and a bottom, said power was the integer E and exponent product calculates a remainder when divided by N and the encryption number Y i of the integer X i, with respect to the encrypted number Y i, and updates the encryption number Y i by subtracting the offset number T First encryption means;
The encrypted number Y i is added to the offset number T to update the encrypted number Y i , the updated encrypted number Y i is a base, and the integer F is an exponent the by calculating the remainder when divided by the integer N decoding the integer X i, a first decoding means for updating the integer X i with respect to the integer X i, by subtracting the offset number T,
The prime number generation means, the encryption key generation means, the decryption key generation means, and the first encryption means are connected to the prime number generation means, the encryption key generation means, the decryption key generation means, and the first encryption key. Encryption control means for executing a predetermined number of times in the order of encryption means;
Decoding control means for executing the first decoding means a predetermined number of times,
The first encryption means converts the integer X i into an expansion equation composed of a plurality of integers, and calculates a power that uses the integer X i as a base and the integer E as an exponent by the expansion equation. And
The first decryption means converts the encrypted number Y i into an expansion equation composed of a plurality of integers, and based on the expansion equation, the encrypted number Y i is a base and the integer F is an exponent. A cryptographic device that calculates a power.
暗号装置が整数を暗号化し、復号する方法であって、
第1の素数Aと第2の素数Bとの積Nが所定数を超えるように前記A及び前記Bを生成する素数生成ステップと、
前記第1の素数Aより1少ない整数A’と前記第2の素数Bより1少ない整数B’との積D、又は前記整数A’と前記整数B’との最小公倍数Kと素である整数Eであって、前記所定数を底とし、前記整数Eを指数としたべき乗が所定桁数を超えるように前記整数Eを生成し、前記整数Eを暗号鍵とする暗号鍵生成ステップと、
任意の整数mとした場合に次式を満たすように整数Fを生成し、前記整数Fを前記暗号鍵に対応する復号鍵とする復号鍵生成ステップと、
Figure 2012032740
前記所定数より小さい整数Xを底とし、前記整数Eを指数としたべき乗を前記積Nで除算した場合の剰余を算出して前記整数Xの暗号化数Yとする第1暗号化ステップと、
前記暗号化数Yを換字式暗号化により整数Y’を算出する第2暗号化ステップと、
前記整数Y’から換字式復号により前記暗号化数Yを復号する第2復号ステップと、
前記暗号化数Yを底とし、前記整数Fを指数としたべき乗を前記積Nで除算した場合の剰余を算出して前記整数Xを復号する第1復号ステップと、を含み、
前記第1暗号化ステップは、前記整数Xを、複数の整数により構成される展開式に変換し、当該展開式により、前記整数Xを底とし、前記整数Eを指数としたべき乗を算出し、
前記第1復号ステップは、前記暗号化数Yを、複数の整数により構成される展開式に変換し、当該展開式により、前記暗号化数Yを底とし、前記整数Fを指数としたべき乗を算出し、
前記第2暗号化ステップは、前記暗号化数Yを、複数の整数により構成される展開式に変換し、当該展開式により、前記暗号化数Yを換字式暗号し、
前記第2復号ステップは、前記整数Y’を、複数の整数により構成される展開式に変換し、当該展開式により、前記暗号化数Yを復号する方法。
An encryption device encrypts and decrypts an integer,
A prime number generating step of generating the A and the B so that a product N of the first prime number A and the second prime number B exceeds a predetermined number;
A product D of an integer A ′ that is 1 less than the first prime number A and an integer B ′ that is 1 less than the second prime number B, or a least common multiple K of the integer A ′ and the integer B ′ and an integer that is prime E, generating the integer E such that a power of the predetermined number as a base and the integer E as an exponent exceeds a predetermined number of digits, and an encryption key generating step using the integer E as an encryption key;
A decryption key generation step of generating an integer F so as to satisfy the following expression when an arbitrary integer m is satisfied, and using the integer F as a decryption key corresponding to the encryption key;
Figure 2012032740
First encryption is performed by calculating a remainder when the power of the integer X i smaller than the predetermined number and the integer E as an exponent is divided by the product N to be the encrypted number Y i of the integer X i Steps,
A second encryption step of calculating an integer Y i ′ by substitutional encryption of the encrypted number Y i ;
A second decryption step of decrypting the encrypted number Y i by substituting decryption from the integer Y i ′;
A first decryption step of decrypting the integer X i by calculating a remainder when the power of the integer F as an exponent is divided by the product N with the encrypted number Y i as a base,
In the first encryption step, the integer X i is converted into an expansion equation composed of a plurality of integers, and the expansion equation is used to calculate a power with the integer X i as a base and the integer E as an exponent. And
In the first decryption step, the encrypted number Y i is converted into an expansion equation composed of a plurality of integers, and the expansion number Y i is used as a base and the integer F is an exponent according to the expansion equation. Calculate the power,
In the second encryption step, the encrypted number Y i is converted into an expansion formula composed of a plurality of integers, and the encryption number Y i is substitutively encrypted by the expansion formula,
The second decryption step is a method of converting the integer Y i ′ into an expansion equation composed of a plurality of integers, and decrypting the encrypted number Y i by the expansion equation.
JP2010174299A 2010-08-03 2010-08-03 Cryptographic device and method thereof Expired - Fee Related JP5247773B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2010174299A JP5247773B2 (en) 2010-08-03 2010-08-03 Cryptographic device and method thereof

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2010174299A JP5247773B2 (en) 2010-08-03 2010-08-03 Cryptographic device and method thereof

Publications (2)

Publication Number Publication Date
JP2012032740A true JP2012032740A (en) 2012-02-16
JP5247773B2 JP5247773B2 (en) 2013-07-24

Family

ID=45846182

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2010174299A Expired - Fee Related JP5247773B2 (en) 2010-08-03 2010-08-03 Cryptographic device and method thereof

Country Status (1)

Country Link
JP (1) JP5247773B2 (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS63147185A (en) * 1986-12-10 1988-06-20 松下電器産業株式会社 Decoder for open key code
JPS63163485A (en) * 1986-12-26 1988-07-06 松下電器産業株式会社 Power residue circuit
JPH06138820A (en) * 1992-10-30 1994-05-20 Nippon Telegr & Teleph Corp <Ntt> Ciphering device and deciphering device
JP2002229445A (en) * 2001-01-30 2002-08-14 Mitsubishi Electric Corp Modulator exponent device
JP2010078713A (en) * 2008-09-24 2010-04-08 Chugoku Electric Power Co Inc:The Method of encrypting and decrypting integer
JP2010152012A (en) * 2008-12-24 2010-07-08 Chugoku Electric Power Co Inc:The Method for encrypting and decrypting integer

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS63147185A (en) * 1986-12-10 1988-06-20 松下電器産業株式会社 Decoder for open key code
JPS63163485A (en) * 1986-12-26 1988-07-06 松下電器産業株式会社 Power residue circuit
JPH06138820A (en) * 1992-10-30 1994-05-20 Nippon Telegr & Teleph Corp <Ntt> Ciphering device and deciphering device
JP2002229445A (en) * 2001-01-30 2002-08-14 Mitsubishi Electric Corp Modulator exponent device
JP2010078713A (en) * 2008-09-24 2010-04-08 Chugoku Electric Power Co Inc:The Method of encrypting and decrypting integer
JP2010152012A (en) * 2008-12-24 2010-07-08 Chugoku Electric Power Co Inc:The Method for encrypting and decrypting integer

Also Published As

Publication number Publication date
JP5247773B2 (en) 2013-07-24

Similar Documents

Publication Publication Date Title
JP6964688B2 (en) Devices and methods for performing approximation operations on ciphertext
JP7370402B2 (en) Encryption method and terminal in terminal device
KR101965628B1 (en) Terminal device for performing homomorphic encryption, server device for calculating encrypted messages, and methods thereof
CA2780980C (en) Data security enhancement using secure hash function
US20130028419A1 (en) System and a method for use in a symmetric key cryptographic communications
KR20070102959A (en) Message authentication code producing apparatus, message authentication code verifying apparatus, and message authentication system
KR20080113277A (en) System for making program difficult to read, device for making program difficult to read, and method for making program difficult to read
KR102143525B1 (en) Method for function encryption supporting set intersection operation and apparatus using the same
JP5324813B2 (en) Key generation apparatus, certificate generation apparatus, service provision system, key generation method, certificate generation method, service provision method, and program
JP5171787B2 (en) Sign-encryption system and sign-encryption generation method
KR101440680B1 (en) Homomorphic Encryption and Decryption Method using Chinese Remainder Theorem and apparatus using the same
JP5247773B2 (en) Cryptographic device and method thereof
JP5208796B2 (en) Integer encryption and decryption methods
KR102284877B1 (en) Efficient functional encryption for set intersection
JP4914381B2 (en) Message authenticator generation device, message authenticator verification device, message authenticator generation method, message authenticator verification method, program, and recording medium
KR101472800B1 (en) Altering the size of windows in public key cryptographic computations
KR20090004625A (en) Changing the order of public key cryptographic computations
JP2022077754A (en) Encryption device, decryption device, cipher method, decryption method, encryption program, and decryption program
JP2008286964A (en) Encryption apparatus, decryption apparatus, encryption method, decryption method and program for stream encryption
CN115668334A (en) Secret information processing system, encryption device, encryption method, and encryption program
JP5208982B2 (en) Method, apparatus and system for encrypting and decrypting integers
WO2024028961A1 (en) Cryptosystem, method, and program
JP5208717B2 (en) Integer encryption and decryption methods
KR102593179B1 (en) Efficient decentralized functional encryption for set intersection
CN112989386B (en) Blacklist sharing method and system based on careless transmission

Legal Events

Date Code Title Description
A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20130115

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20130307

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20130409

R150 Certificate of patent or registration of utility model

Ref document number: 5247773

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

Free format text: JAPANESE INTERMEDIATE CODE: R150

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

Free format text: PAYMENT UNTIL: 20160419

Year of fee payment: 3

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

LAPS Cancellation because of no payment of annual fees