WO2022201791A1 - 暗号処理装置、暗号処理方法、及び暗号処理プログラム - Google Patents

暗号処理装置、暗号処理方法、及び暗号処理プログラム Download PDF

Info

Publication number
WO2022201791A1
WO2022201791A1 PCT/JP2022/001829 JP2022001829W WO2022201791A1 WO 2022201791 A1 WO2022201791 A1 WO 2022201791A1 JP 2022001829 W JP2022001829 W JP 2022001829W WO 2022201791 A1 WO2022201791 A1 WO 2022201791A1
Authority
WO
WIPO (PCT)
Prior art keywords
ciphertext
plaintext
processing device
cryptographic processing
value
Prior art date
Application number
PCT/JP2022/001829
Other languages
English (en)
French (fr)
Inventor
優佑 星月
航太郎 松岡
Original Assignee
株式会社アクセル
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 株式会社アクセル filed Critical 株式会社アクセル
Publication of WO2022201791A1 publication Critical patent/WO2022201791A1/ja
Priority to US18/473,876 priority Critical patent/US20240022395A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/008Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols involving homomorphic encryption
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • GPHYSICS
    • G09EDUCATION; CRYPTOGRAPHY; DISPLAY; ADVERTISING; SEALS
    • G09CCIPHERING OR DECIPHERING APPARATUS FOR CRYPTOGRAPHIC OR OTHER PURPOSES INVOLVING THE NEED FOR SECRECY
    • G09C1/00Apparatus or methods whereby a given sequence of signs, e.g. an intelligible text, is transformed into an unintelligible sequence of signs by transposing the signs or groups of signs or by replacing them by others according to a predetermined system
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/30Public key, i.e. encryption algorithm being computationally infeasible to invert or user's encryption keys not requiring secrecy
    • H04L9/3093Public key, i.e. encryption algorithm being computationally infeasible to invert or user's encryption keys not requiring secrecy involving Lattices or polynomial equations, e.g. NTRU scheme

Definitions

  • the present invention relates to a cryptographic processing device, a cryptographic processing method, and a cryptographic processing program for processing ciphertext.
  • Homomorphic encryption is an encryption method that allows data processing to be performed in the encrypted state without decrypting the encrypted data.
  • Additive homomorphic encryption is a cipher in which operations between ciphertexts correspond to additions between plaintexts
  • multiplicative homomorphic encryption is ciphers in which operations between ciphertexts corresponding to multiplication between plaintexts exist.
  • Additive homomorphic encryption and multiplicative homomorphic encryption have been known for some time, in which finite cyclic groups are regarded as integers and only additive operations (addition, subtraction) and multiplicative operations (multiplication) are performed. A finite cyclic group can be multiplied by an integer by repeated addition, so it can be multiplied by an integer in "plaintext".
  • Fully Homomorphic Encryption processes both additive operations (addition and subtraction) and multiplicative operations (multiplication) while they are encrypted.
  • FHE Fully Homomorphic Encryption
  • LWE Low-Edielectric
  • a somewhat homomorphic cipher consists of adding an error to the plaintext during encryption that is small enough to cause decryption.
  • the somewhat homomorphic encryption is not limited to the LWE encryption.
  • Homomorphic encryption such as TFHE is also attracting attention as a cipher for realizing an encrypted database in which stored values and data are encrypted.
  • homomorphic encryption is an encryption method that allows data processing without decrypting encrypted data. Indexes cannot be created in an encrypted database, but operations such as searches can be performed while keeping the contents confidential without decrypting any data by encrypting not only the values in the database but also the queries with homomorphic encryption. It can be performed. Further, as an operation on the encrypted database, an operation of aggregating the values in the database for each category and rearranging the aggregation results in ascending or descending order is also conceivable.
  • An object of the present invention is to improve the efficiency of replacement processing for an encrypted database.
  • the present invention is a cryptographic processing apparatus for processing a ciphertext, wherein the ciphertext has a binary value in which a value obtained by adding an error having a predetermined variance to a predetermined value corresponding to a symbol 0 or 1 is a plaintext.
  • a cryptographic processing device is characterized by reducing the number of calculations required for the processing by using a multi-valued logic operation that outputs a temporary cryptogram based on a text.
  • FIG. 4 is a diagram illustrating the configuration of a cryptographic operation processing unit for performing conditional replacement of ciphertexts; It is a figure explaining the functional structure of the cryptographic processing apparatus of this embodiment. It is a figure explaining in detail the calculation process of the cryptographic processing apparatus of this embodiment.
  • FIG. 3 is an image diagram explaining a circle group that a TLWE cipher has as a plaintext;
  • FIG. 10 is an operation image diagram of binary Gate Bootstrapping;
  • FIG. 4 is a diagram showing an example of an encrypted database;
  • FIG. FIG. 11 shows an example of a table as an empty response; It is a figure which shows an example of an aggregation result table.
  • FIG. 3 is an image diagram explaining a circle group that a TLWE cipher has as a plaintext
  • FIG. 10 is an operation image diagram of binary Gate Bootstrapping
  • FIG. 4 is a diagram showing an example of an encrypted database
  • FIG. 11 shows an example of a table as an empty response; It
  • FIG. 10 is a flowchart for explaining the flow of encrypted database aggregation processing by the cryptographic processing device;
  • FIG. FIG. 10 is a diagram for explaining the operation of Gate Bootstrapping in the first step;
  • FIG. 10 is a diagram for explaining the operation of Gate Bootstrapping in the second step;
  • FIG. 13 is a diagram for explaining the operation of Gate Bootstrapping in the third step; It is a figure which shows the value which a ciphertext can take in the conditional exchange process of this embodiment.
  • FIG. 11 is a flowchart for explaining the flow of aggregation result sorting processing by the cryptographic processing device;
  • FIG. FIG. 10 is a diagram illustrating an example of an aggregation result table after completion of sort processing;
  • FIG. 11 is a diagram illustrating a functional configuration of a cryptographic processing device according to a modification; It is a figure explaining in detail the calculation process of the cryptographic processing apparatus based on a modification.
  • FIG. 11 is a flowchart for explaining the flow of aggregation result sorting processing according to a modification;
  • FIG. 4 is a diagram showing ciphertexts input and output to Gate Bootstrapping of the present embodiment;
  • 1 is a block diagram illustrating one embodiment of a computing device; FIG.
  • This embodiment relates to a cryptographic processing device that operates on an encrypted database (encrypted database), as will be described in detail below.
  • the cryptographic processing apparatus replaces the results of aggregating an encrypted database storing encrypted values in ascending or descending order without decrypting ciphertexts, based on a specific reference value. conduct.
  • database values are exchanged as they are in ciphertext, unlike when exchanging plaintext database values or when exchanging encrypted database values after decryption, it is not possible to easily exchange values due to the magnitude relationship.
  • the cryptographic processing device obtains the ciphertext cz by subtracting the ciphertext av and the ciphertext bv, which are the criteria for the conditional exchange, as described below.
  • the ciphertext cz is a borrow bit indicating the magnitude relationship between the ciphertext av and the ciphertext bv.
  • the cryptographic processing device uses the multiplexer (MUX) operation statement shown in FIG. ciphertext az' and new ciphertext bz' are obtained. Then, the cryptographic processing device replaces the ciphertext az and the ciphertext bz with the ciphertext az' and the ciphertext bz', respectively.
  • MUX multiplexer
  • FIG. 1 is a diagram illustrating an example of a cryptographic operation processing unit for performing conditional replacement of ciphertexts.
  • FIG. 1 illustrates the cryptographic processing unit as a hardware circuit using logical operation elements, but it may be considered that the cryptographic processing unit is a replacement program executed by a CPU implemented with software.
  • the cryptographic operation processing unit is implemented by software, operations are performed with the image of designing a logic circuit (logic gate) for the ciphertext.
  • the cryptographic computation processing unit 50 has two MUX computation units 51 and 52 .
  • the MUX operation units 51 and 52 perform logical operations for selecting two ciphertexts az and bx from one ciphertext cz.
  • Ciphertexts az, bx, and cx are input to the first MUX operation unit 51 and the second MUX operation unit 52, respectively.
  • the ciphertext az is input to the input 0
  • the ciphertext bz is input to the input 1
  • the ciphertext az' is obtained as the output.
  • the ciphertext bz is input to the input 0
  • the ciphertext az is input to the input 1
  • the ciphertext bz' is obtained as the output.
  • one multiplexer is composed of two AND circuits 53 and 54, one NOT circuit section 55, and one OR circuit .
  • the first AND circuit section 53 and the second AND circuit section 54 are arithmetic processing sections for obtaining AND.
  • the NOT circuit section 55 is an arithmetic processing section for obtaining NOT.
  • the OR circuit section 56 is an arithmetic processing section for obtaining OR.
  • the two multiplexers in FIG. 1 have the same configuration.
  • the MUX operation section 51 the ciphertext az and the ciphertext cz are input to the first AND circuit section 53 .
  • the ciphertext cz is also input to the NOT circuit unit 55 , and its output and the ciphertext bz are input to the second AND circuit unit 54 .
  • the output of the first AND circuit section 53 and the output of the second AND circuit section 54 are input to the OR circuit section 56, and the output of the OR circuit section 56 is output as the output of the multiplexer.
  • the ciphertext bz and the ciphertext cz are input to the first AND circuit section 53 .
  • the ciphertext cz is also input to the NOT circuit section 55 , and its output and the ciphertext az are input to the second AND circuit section 54 .
  • the output of the first AND circuit section 53 and the output of the second AND circuit section 54 are input to the OR circuit section 56, and the output of the OR circuit section 56 is output as the output of the multiplexer.
  • the MUX operation units 51 and 52 execute logical operations of (cz AND az) OR ((NOT cz) AND bz) and (cz AND bz) OR ((NOT cz) AND az), respectively.
  • Each of the MUX operation units 51 and 52 includes two AND circuit units, one OR circuit unit, and one NOT circuit unit, that is, four logic operation elements (processing units corresponding to the logic operation elements). I have. Therefore, an operation time for four logic operation elements is required for one operation of the multiplexer.
  • the processing of the MUX calculation unit 51 is executed in one calculation processing for calculating a new ciphertext, and the processing of the MUX calculation unit 52 is performed for another new ciphertext.
  • HomMUX THFE multiplexer
  • the cryptographic processing apparatus of this embodiment reduces the processing time required for operating such an encrypted database and makes it practical. Before explaining the operation on the encrypted database, the operation of fully homomorphic encryption performed by the cryptographic processing apparatus of the present embodiment will be explained.
  • FIG. 2 is a diagram for explaining the functional configuration of the cryptographic processing device of this embodiment.
  • the cryptographic processing device 1 includes a control unit 10 , a storage unit 20 , a communication unit 25 and an input unit 26 .
  • the control unit 10 includes a reception unit 11, a first calculation unit 12, a second calculation unit 13, a third calculation unit 14, a first bootstrapping unit (first calculation unit) 15, and a second bootstrapping unit (second calculation unit). section) 16 , a third bootstrapping section (third calculation section) 17 , and an output section 18 .
  • the control unit 10 also includes an aggregating unit 21 , a comparing unit 22 , and a replacing unit 23 .
  • the accepting unit 11 accepts an input of a ciphertext to be operated through the communication unit 25 and the input unit 26 .
  • the receiving unit 11 receives input of ciphertext from another process executed by the cryptographic processing device 1 .
  • the first computation unit 12 performs a first homomorphic computation on the input cipher accepted by the acceptance unit 11 .
  • the second calculation unit 13 performs a second homomorphic calculation on the ciphertext output from the first bootstrapping unit 15 .
  • the third computing unit 14 performs a third homomorphic computation on the ciphertext output from the second bootstrapping unit 16 .
  • the first calculation unit 12, the second calculation unit 13, and the third calculation unit 14 are calculation processing units that implement, by software, homomorphic calculations for aggregation/replacement operations on the encrypted database described below. At least one of the first arithmetic unit 12, the second arithmetic unit 13, and the third arithmetic unit 14 may be realized by hardware.
  • the first bootstrapping unit 15 performs gate bootstrapping processing described below on the calculation result of the first calculation unit 12, and outputs a new ciphertext.
  • the second bootstrapping unit 16 performs gate bootstrapping processing described below on the calculation result of the second calculation unit 13, and outputs a new ciphertext.
  • the third bootstrapping unit 17 performs gate bootstrapping processing described below on the calculation result of the third calculation unit 14, and outputs a new ciphertext.
  • the aggregating unit 21 performs processing for aggregating encrypted databases.
  • the comparison unit 22 compares adjacent ciphertexts for sorting (conditional replacement) of aggregation results.
  • the replacement unit 23 performs the processes of the first to third calculation units 12 to 14 and the first to third calculation units 15 to 17 based on the comparison results of the comparison unit 22.
  • the output unit 18 outputs the final calculation result to the outside of the cryptographic processing device 1 or to another processing process executed by the cryptographic processing device 1 .
  • the storage unit 20 can store input ciphertexts, temporary files and temporary data used in conditional replacement calculations, and output ciphertexts.
  • the storage unit 20 can also store an encrypted database 60 .
  • the communication unit 25 connects the cryptographic processing device 1 to a network and enables communication with external devices. By storing the encrypted database 60 in the storage unit 20 and including the communication unit 25, the cryptographic processing apparatus 1 can function as a database server. In this case, the cryptographic processing device 1 receives an encrypted query from a terminal device as an external device, searches the encrypted encrypted database 60, and responds with the encrypted search result to the terminal device. be able to.
  • the input unit 26 inputs a ciphertext to be processed and a query to the encrypted database 60 to the cryptographic processing device 1 .
  • FIG. 3 is a diagram explaining in detail the calculation process of the cryptographic processing device of this embodiment.
  • the ciphertexts az, bz, and cz input to the cryptographic processing device 1 are all TLWE ciphertexts shown in the above paper.
  • the TLWE cipher is a bit-wise fully homomorphic cipher having a value of 0 or ⁇ (non-zero) as plaintext.
  • Various operations can be performed by logic operations using logic gates.
  • the TLWE ciphertext has two values as plaintext, which is obtained by adding an error having a predetermined variance to a predetermined value corresponding to a binary symbol 0 or 1. is possible.
  • the input ciphertexts az and cz are input to the first computation unit 12 to perform homomorphic computation (ciphertext az+cz ⁇ (0, 1/8)), and the ciphertext ct, which is the computation result, is subjected to binary gate bootstrapping. is input to the first Bootstrapping unit 15 that performs The output of the first bootstrapping unit 15 is a temporary ciphertext tz that can take any binary value (0, ⁇ ) as a plaintext.
  • the ciphertext tz and the ciphertext bz are input to the second calculation unit 13 to perform homomorphic calculation (tz+bz-(0, 1/8)), the output result is input to the second calculation unit 16, and the binary Gate Bootstrapping is performed and a temporary ciphertext uz is output.
  • the ciphertext uz and the ciphertext cz are input to the third computing unit 14 to perform homomorphic computation ((0, 1/4)-uz+cz), and the output result is input to the third computing unit for binary gate bootstrapping. is performed to output a new ciphertext az' and a new ciphertext bz'.
  • the AND circuit units 53 and 54 and the OR circuit unit 56 in the MUX operation units 51 and 52, respectively, are followed by It is necessary to execute Gate Bootstrapping 3 times in total, 6 times in total.
  • one MUX operation unit can perform processing for two gates (the number of stages of bootstrapping is two). Therefore, the entire MUX calculation units 51 and 52 can be processed by four gates (the number of stages of bootstrapping is two).
  • Gate Bootstrapping is a technique to make fully homomorphic encryption practical, which was not practical due to the enormous amount of data and the computation time.
  • TFHE uses a cipher called ⁇ TLWE cipher'', which is an LWE (Learning with Errors) cipher constructed on a circle group. It realizes various homomorphic logic operations (and arbitrary operations such as addition and multiplication).
  • the input for Gate Bootstrapping in TFHE is TLWE ciphertext encrypted with a private key.
  • TFHE implements fully homomorphic encryption (FHE) based on TLWE ciphertext.
  • the TLWE cipher is a variation of the LWE cipher, which is a kind of lattice cipher (the LWE cipher defined on the circle group).
  • the TLWE cipher is an additive homomorphism, and it is known that an additive operation between TLWE-encrypted plaintexts can be performed without decrypting the ciphertext.
  • FIG. 4 is an image diagram explaining a circle group that the TLWE cipher has as plaintext.
  • the TLWE cipher proceeds from 0 with real precision and back to 0 at 1, the point 0 of the circle group ⁇ T ⁇ shown in FIG. 4, or any non-zero (non-zero) We have the real numbers ⁇ corresponding to the points as plaintext.
  • the TLWE cipher itself treats any point on the circle group as plaintext, and uses the neighborhood of 0 (including error) and the neighborhood of ⁇ (including error) as plaintext.
  • a point on the circle group ⁇ T ⁇ is also referred to herein as an "element".
  • a cryptographic processing unit that handles TFHE performs general homomorphic operations such as addition operations as operations between TLWE ciphertexts, and gate bootstrapping is used to keep the error of the operation results within an appropriate range.
  • FHE fully homomorphic encryption
  • [TLWE encryption] Explain the TLWE cipher.
  • a vector [a] of N uniformly distributed random numbers is prepared as an element on the circle group ⁇ T ⁇ .
  • a private key [s] which is a collection of N binary values of 0 and 1, is prepared.
  • a set of ([a], [s] ⁇ [a] + e), where e is a random number of Gaussian distribution (normal distribution) whose mean value is plaintext ⁇ and whose variance is ⁇ predetermined is an example of a TLWE ciphertext.
  • the plaintext ⁇ is the average value of e when an infinite number of TLWE ciphertexts are generated for the same plaintext ⁇ , where ⁇ is plaintext without error and e is plaintext with error.
  • represents an inner product of vectors.
  • the TLWE ciphertext can be expressed as ([a], b).
  • This TLWE cipher is an additive homomorphism, and an additive operation between plaintexts of TLWE ciphertexts can be performed without decrypting the ciphertexts.
  • a polynomial of degree n is generally represented as a n x n +a n ⁇ 1 x n ⁇ 1 + . . . +a 0 . All these sets form a commutative group with respect to the sum f(x)+g(x) of polynomials.
  • the product f(x)g(x) of polynomials has the same properties as the commutative group, except that the inverse does not necessarily exist. Such things are called monoids.
  • TFHE uses a polynomial ring whose coefficients are the circle group ⁇ T ⁇ , which is a finite cyclic group, and such a polynomial ring is denoted by T[X]. If the polynomial T(X), which is a polynomial ring, is decomposed into the form of T[X](X n +1)+T[X], and only the residual parts are taken out and collected, this is also a "ring", so the "polynomial ring is obtained. In TFHE, the "remainder ring of the polynomial ring" is represented as T[X]/( Xn +1).
  • the cryptographic processing device implements fully homomorphic encryption by utilizing the properties of the polynomial F(X) based on such a "residue ring of polynomial rings".
  • TRLWE cipher Gate Bootstrapping uses a cipher called "TRLWE cipher" in addition to the TLWE cipher.
  • the TRLWE cipher will be explained.
  • the “R” in the TRLWE cipher stands for “ring”, and the TRLWE cipher is an LWE cipher made up of “rings”.
  • TRLWE is also an additive homomorphic cipher.
  • the "ring” in the TRLWE cipher is the above-described "residue ring of polynomial ring" T[X]/(X n +1).
  • the elements of the "residue ring of polynomial rings" T[X]/(X n +1) are randomly selected.
  • n coefficients of the n ⁇ 1 degree polynomial are selected from the circle group ⁇ T ⁇ by uniformly distributed random numbers. If the degree of the polynomial is n ⁇ 1, it will not be divided by X n +1 and there is no need to consider the remainder.
  • n random numbers e i be random numbers of Gaussian distribution (normal distribution) having an average value of plain text ⁇ i and a variance of ⁇ , and construct the following polynomial e(X) from these random numbers.
  • TRLWE ciphertext (a(X), b(X)) is obtained as TRLWE ciphertext.
  • the TRLWE cipher uses random numbers to perform encryption, so an infinite number of ciphertexts can correspond to the same secret key and plaintext.
  • ⁇ s ((a(X), b(X)) b(X) ⁇ s(X) ⁇ a(X)+g(X)(X n +1) , g(X) defined such that ⁇ s is an element of T[X]/(X n +1) functions as a decoding function.
  • Gadget Decomposition Gadget Decomposition is explained.
  • the polynomial coefficients used in the TRLWE ciphertext are real numbers greater than or equal to 0 and less than 1, which are elements of the circle group ⁇ T ⁇ in FIG. 4, and have only fractional parts.
  • Gadget Decomposition is an operation for obtaining [v] that minimizes
  • is the norm (length) of the vector.
  • Generate 2l ciphertexts Zi (a(X), b(X)) made up of polynomials in which all the coefficients of e(X) have an average value of 0 and the variance is ⁇ .
  • the plaintext ⁇ is encrypted as follows to obtain the following ciphertext k.
  • This ciphertext k is defined as TRGSW ciphertext BK.
  • the TRGSW ciphertext BK constitutes the Bootstrapping Key used below.
  • Bootstrapping Key is used to encrypt the private key for Gate Bootstrapping. Separate from the secret key [s] (Nth order) used for TLWE ciphertext, each element of the secret key [s'] for encrypting the secret key [s] is set to 0 or 1 in order to be used for Gate Bootstrapping. Select with two values. The degree of the secret key [s'] must match the degree n of the polynomial used in the TRLWE cipher. Create a TRGSW ciphertext BK for each element of the private key [s].
  • the CMux function outputs the ciphertext of plaintext ⁇ 0 without decryption, and when s i is 1, outputs the ciphertext of plaintext ⁇ 1 without decryption.
  • the CMux function can compute the ciphertext of plaintext ⁇ 0 or plaintext ⁇ 1, but it does not know which one was chosen.
  • Binary Gate Bootstrapping of TFHE is performed using various information described above.
  • Binary Gate Bootstrapping consists of the following three steps: (1) BlindRotate, (2) SampleExtract, and (3) Key switching.
  • FIG. 5 is an operation image diagram of binary gate bootstrapping.
  • Binary gate bootstrapping reduces the errors in the plaintext of the results of homomorphic operations between TLWE ciphertexts through the following three steps.
  • "plaintext” means the result of computation between plaintexts resulting from computation between TLWE ciphertexts. Convert the plaintext in the interval from 0 to 0.25 (1/4) and 0.75 (3/4) to 1 in the circle group ⁇ T ⁇ in FIG. /4) to 0.75 (3/4) is converted into ciphertext of 0.25 (1/4). During this conversion, the error added to the plaintext is anywhere in the range of ⁇ 1/16.
  • Blind Rotate BlindRotate is done as the first step in Gate Bootstrapping.
  • BlindRotate is the process of creating the TRLWE ciphertext.
  • T(X) trivial TRLWE ciphertext
  • T(X) polynomial T(X)
  • the TRLWE ciphertext multiplied by X ⁇ s(c′) is obtained without decryption.
  • "0" indicates a polynomial 0 of degree zero.
  • ⁇ s(c') is a plaintext obtained by multiplying the following LWE ciphertext c' by a decryption function.
  • ⁇ s'(A n ) is polynomial ciphertext obtained by multiplying polynomial T(X) by X ⁇ 1 ⁇ 1′ times.
  • TRLWE ciphertext A n (A(X), B(X)) obtained by BlindRotate in (1)
  • a new TLWE ciphertext ([a”], b 1 ) is obtained, whose plaintext is the same value as the constant term of the plaintext polynomial corresponding to the original TRLWE ciphertext An.
  • This new TLWE ciphertext is , has two types of plaintext - ⁇ or ⁇ .
  • the TLWE ciphertext cs obtained by SampleExtract in (2) is encrypted not with the secret key [s] but with the secret key [s']. Therefore, decrypt the TLWE ciphertext cs. Instead, it is necessary to replace the key of the TLWE ciphertext cs with the private key [s] to restore the encrypted state with the private key [s]. Therefore, the method of key switching will be explained.
  • the secret key [s] of the TLWE ciphertext used for the NAND operation was an N-order vector. This is used to encrypt the secret key [s'] of the n-th order vector when the Bootstrapping Key was created. i.e.
  • the elements of the circle group ⁇ T ⁇ the real numbers from 0 to 1, are encoded as values shifted to each digit when expressed in binary.
  • the private key is [s].
  • “Number of digits” t is a system parameter. Decrypting with the private key [s] yields becomes. This is the "key switching key”.
  • the number of elements of [a] is n, like the secret key [s']. Converting these one by one to t-bit fixed decimal numbers, can be written in the form The error is increased at this stage, but a system parameter can constrain the maximum absolute value.
  • TLWE ciphertext cx is calculated as the main processing of the key switching. Since the term ([0], b) is a trivial ciphertext, the decrypted result is b, and the result of decrypting the TLWE ciphertext cx is calculated as follows: is. Since s' i is a constant with respect to j, , and substitute the expression when decomposing into fixed decimals in the above. as a result, This means that the key switching has been successful.
  • the TLWE ciphertext cx obtained here is encrypted with the same secret key [s] as the TLWE ciphertext c used as input for Gate Bootstrapping. By performing the key switching process, it returns to the TLWE ciphertext encrypted with the secret key [ s ]. If ⁇ s (c) is in the range of 1/2 ⁇ 1/4, the plaintext ⁇ s (cx) is 1/4. As a result of the above processing, a TLWE ciphertext having either binary value of 0 or 1/4 and an error within ⁇ 1/16 is obtained as a result of Gate Bootstrapping. The maximum value of the error does not depend on the input TLWE ciphertext c and is a value fixed by system parameters. Therefore, system parameters are set so that the maximum error value is within ⁇ 1/16 of the TLWE ciphertext that is the input. As a result, NAND operation can be performed any number of times, and all operations such as addition and multiplication are possible.
  • Errors in the "plaintext" of the TLWE ciphertext output from Gate Bootstrapping include the error added by converting the TLWE ciphertext into an integer, the error added by CMux, and the error when converting to a fixed decimal number by key switching. All of these errors can be constrained by system parameters, and the system parameters can be adjusted so that the overall error is ⁇ 1/16.
  • the above is the process of Gate Bootstrapping of TFHE.
  • the cryptographic processing device 1 that handles the TFHE cipher described above can be applied to the following embodiments.
  • a database whose fields and records are encrypted with the TLWE encryption hereafter referred to as an encrypted database
  • the cryptographic processing device 1 is a database server that manages an encrypted database, receives queries encrypted with the TLWE encryption from terminal devices connected via a network or the like, and responds to the queries with the TLWE encryption. It is returned to the terminal device in an encrypted state. Since TFHE is not a deterministic cipher, the same plaintext corresponds to an infinite number of ciphertexts in the encryption database.
  • the sorting (replacement) method of aggregation results it is possible to respond to a query after arranging aggregation results in descending order (descending order) or ascending order (ascending order).
  • the sorting method according to this embodiment speeds up the computation used for sorting (replacement), and enables a response with a latency that is about 20% lower than that of an implementation that does not use the sorting method of this embodiment.
  • the cryptographic processing device 1 prepares an empty reply in advance in order to classify and aggregate by category. Then, empty responses are compared while encrypted, and the query column is added only when the category matches, and 0 is added when the category does not match.
  • Bubble sort is used for sorting the aggregation results.
  • Bubble sort is a sorting algorithm that compares the values of two adjacent elements and rearranges the elements in descending order (descending order) or ascending order (ascending order).
  • Bubble sort is not often used for plaintext sorting because the average computation time is O(q 2 ), which is relatively slow.
  • bubble sort has the advantage that sorting is always completed if the process is repeated for the worst case calculation amount O(q 2 ). Unlike quick sort, bubble sort does not change the processing depending on the contents of the data, so it is possible to process the ciphertext as it is.
  • the operation of comparing and changing the order if the magnitude relationship is reversed is repeated the square of the number of data q-1 times ((q-1) 2 ).
  • comparison between adjacent encrypted records can be performed by applying a configuration of full adders capable of fully homomorphic encryption operations.
  • a full adder circuit is composed of two half adders and one OR circuit section (arithmetic processing section for obtaining OR).
  • the first half adder includes an AND circuit section (arithmetic processing section for obtaining AND) and an XOR circuit section (arithmetic processing section for obtaining XOR).
  • the second half adder includes an AND circuit section (arithmetic processing section for obtaining AND) and an XOR circuit section (arithmetic processing section for obtaining XOR).
  • Input A and input B to be added are input to the AND circuit section and the XOR circuit section of the first half adder.
  • the output of the AND circuit section of the first half adder and the output of the AND circuit section of the second half adder are input to the OR circuit section in the subsequent stage, and the OR circuit section outputs a carry out. be done.
  • the output from the XOR circuit portion of the first half adder and the carry-in are input to the AND circuit portion and the XOR circuit portion of the second half adder.
  • the output (Sum) of the full adder circuit is output from the XOR circuit section of the second half adder.
  • bubble sort processing is performed to replace or not replace adjacent records depending on the result of this comparison.
  • a high-speed conditional permutation operation using a homomorphic MUX (HomMUX in the above paper) described in FIG. 1 can also be used for bubble sort processing.
  • FIG. 6 is a diagram showing an example of an encrypted database.
  • the encrypted database 60 shown in FIG. 6 is stored in the storage unit 20 of the information processing device 1, for example.
  • the information processing device 1 can function as a database server that manages the encrypted database 60 and performs operations on the encrypted database 60 in response to queries from external devices.
  • the encrypted database 60 of FIG. 6 has columns 61 , 62 and 63 .
  • Column 61 stores “name”
  • column 62 stores “address”
  • column 63 stores "age”.
  • the head field of the "name” column 61 stores the headline "name”
  • the head field of the "address” column 62 stores the headline "address”
  • the head field of the "age” column 63 stores the headline "age ” is stored.
  • Data is registered in a plurality of fields provided in the "name” column 61, the "address” column 62, and the "age” column 63, respectively.
  • the information processing device 1 executes a query to obtain the "average age” for each "address” with respect to the encrypted database 60, as an example.
  • an empty response (empty table) as shown in FIG. 7 is used for the aggregation processing of the encrypted database 60 .
  • FIG. 7 shows an example of a table as an empty response.
  • Each field of the empty table (TBL) 70 in FIG. 7 stores "address” which is the key of the query, and "total age” and "number of people” to be obtained in the aggregation process.
  • the empty table 70 has columns 71 , 72 and 73 . Column 71 stores “address”, column 72 stores “total age”, and column 73 stores "number of people”.
  • the head field of the "address” column 71 stores the headline "address”
  • the head field of the "total age” column 72 stores the headline "total age”
  • the head field of the "number” column 73 stores , the headline "number of people” is stored.
  • each field of the "address” column 71 stores the same "address” data as the data registered in the "address” column 62 of the encrypted database 60 of FIG.
  • the query of this embodiment is executed on the premise that what kind of data is registered in at least the "address” column 62 storing "address” in the encrypted database 60 is known.
  • the empty table 70 in the initial state all the fields of the "total age” column 72 storing the “total age” to be obtained in the aggregation process and the "number of people” column 73 storing the "number of people” are set to "0". is registered. All data in the empty table 70 are TLWE ciphertexts encrypted with the TFHE technique.
  • the creation of the empty table 70 and the work of encrypting it may be performed on the side of the terminal device that issues the query, ie, the search request, or may be performed on the side of the cryptographic processing device 1 that manages the encrypted database 60. .
  • the cryptographic processing device 1 converts the address data registered in a specific row (record) of the "address" column 62 of the encryption database 60 (FIG. 6) into the "address” column 71 of the empty table 70 (FIG. 7). sequentially compares the address data registered in all the rows of .
  • a comparison of address data is a comparison of character string data.
  • the encryption processing device 1 performs EXNOR between the address data of the encrypted database 60 and the address data of the empty table 70 between the 1st bits, the 2nd bits, the 3rd bits, and so on. In EXNOR, matching bits are “1" and different bits are “0".
  • the cr obtained as a result of the calculation is the result of comparison between the address data in the encrypted database 60 and the address data in the empty table 70.
  • the cryptographic processing device 1 compares the bit value stored in the field of the "age” column 63 of the encrypted database 60 with the above comparison result cr (plaintext is bit “1” or "0") for the corresponding address.
  • ciphertext is subjected to homomorphic AND (HomAND in the above paper) processing.
  • homomorphic AND HomAND in the above paper
  • the cryptographic processing device 1 adds the obtained “age” value (ciphertext) to the field of the "total age” column 72 of the empty table 70 corresponding to the compared address. At this time, the obtained “age” value (encrypted text) is added to the field of the "total age” column 72 of the empty table 70 corresponding to the address that matches the encrypted database 60.
  • FIG. A “0" has been added to the field in the "total age” column 72 corresponding to the address that was not matched in the encrypted database 60.
  • the cryptographic processing device 1 compares the values in the empty table 70 and the values in the encrypted database 60 to obtain the comparison result cr. Then, the cryptographic processing device 1 ANDs the value of the encryption database 60 and the comparison result cr (ciphertext whose plaintext is bit "1" or "0"), and then adds them. At this time, the value of the encrypted database is added to the empty table 70 when the value of the empty table 70 and the value of the encrypted database 60 match, and 0 is added to the empty table 70 when they are different. The cryptographic processing device 1 also adds the obtained "number of people” value (encrypted text) to the field of the "number of people" column 73 of the empty table 70 corresponding to the compared address.
  • the comparison result cr (encrypted text whose plain text is bit “1”) is added to the “number of people” column 73 field of the empty table 70 corresponding to the address that matches the encrypted database 60 . Also, the comparison result cr (ciphertext whose plaintext is bit “0”) is added to the field of the “number of people” column 73 of the empty table 70 corresponding to the address that does not match the encrypted database 60 .
  • an aggregation result table 80 is obtained in which the "total age" and the number of persons are aggregated for each address, as shown in FIG.
  • the cryptographic processing device 1 does not know the plaintext of the comparison result cr. That is, the encryption processing device 1 cannot know whether the address data in the encryption database 60 and the address data in the empty table 70 match.
  • the cryptographic processing device 1 takes a homomorphic AND (HomAND) between the value of the encrypted database 60 and the comparison result cr regardless of whether the plaintext of the comparison result cr is bit "1" or "0". Addition processing is performed.
  • the encryption processing device 1 does not branch the processing depending on whether or not the address data in the encryption database 60 and the address data in the empty table 70 match.
  • the cryptographic processing device 1 stores the address field data of the first row record (name: Taro Suzuki, address: Chiyoda Ward, age: 46) of the encryption database 60 and each data of the address field of the empty table 70 (Chiyoda Ward, Minato Ward, and Taito Ward) are aggregated by bit-by-bit EXNOR and AND.
  • the ciphertext with the bit "1" is obtained as the plaintext as the comparison result.
  • the cryptographic processing device 1 stores "46" obtained by ANDing the value of the age field in the first row record of the encryption database 60 with the comparison result cr (plaintext is bit “1") in the empty table 70. Add to the total age field of the row corresponding to Chiyoda Ward, and add 1 to the number field of the row corresponding to Chiyoda Ward in the empty table 70 (the plaintext as the comparison result is a ciphertext whose bit is "1").
  • the comparison result is that the plain text is encrypted text with bit "0", so 0 is added to the total age field and the number of people field of the corresponding row.
  • the cryptographic processing device 1 converts the address field data of the second row record (name: Takashi Sato, address: Minato Ward, age: 50) of the encryption database 60 and each data of the address field of the empty table 70 to (Chiyoda Ward, Minato Ward, Taito Ward) and are aggregated by bitwise EXNOR and AND.
  • a ciphertext of bit "1" is obtained as a comparison result for "Minato-ku" in the empty table 70.
  • FIG. Therefore, the cryptographic processing device 1 stores "50” obtained by ANDing the value of the age field in the record of the second row of the encryption database 60 with the comparison result cr (plaintext is bit "1") in the empty table 70.
  • the comparison result is a ciphertext whose bit is "1").
  • the comparison result is that the plaintext is encrypted text with bit "0", so 0 is added to the total age field and the number of people field of the corresponding row.
  • the encryption processing device 1 obtains the address field data of the third row record (name: Jiro Tanaka, address: Chiyoda Ward, age: 34) of the encryption database 60 and each data of the address field of the empty table 70. (Chiyoda Ward, Minato Ward, Taito Ward) and are aggregated by bitwise EXNOR and AND. In this case, a ciphertext with bit “1" is obtained as a comparison result for "Chiyoda Ward" in the empty table 70. FIG. Therefore, the cryptographic processing device 1 stores "34" obtained by ANDing the value of the age field in the third row record of the encryption database 60 with the comparison result cr (plaintext is bit "1") in the empty table 70.
  • the comparison result is that the plain text is encrypted text with bit "0", so 0 is added to the total age field and the number of people field of the corresponding row.
  • the cryptographic processing device 1 converts the address field data of the fourth row record (Name: Koji Yoshikawa, Address: Taito Ward, Age: 58) of the encryption database 60 and each data of the address field of the empty table 70 to (Chiyoda Ward, Minato Ward, Taito Ward) and are aggregated by bitwise EXNOR and AND. In this case, a ciphertext with bit “1" is obtained as a comparison result for "Taito Ward" in the empty table 70. FIG. Therefore, the cryptographic processing device 1 stores "58" obtained by ANDing the value of the age field in the record of the fourth row of the encryption database 60 with the comparison result cr (plaintext is bit "1") in the empty table 70.
  • the comparison result is that the plaintext is a ciphertext with bit "0", so 0 is added to the total age field and the number of people field of the corresponding row.
  • the cryptographic processing device 1 converts the address field data of the fifth row record (name: Sadamune Takeda, address: Minato-ku, age: 43) of the encryption database 60 and each data of the address field of the empty table 70 to (Chiyoda Ward, Minato Ward, Taito Ward) and are aggregated by bitwise EXNOR and AND.
  • a ciphertext of bit "1" is obtained as a comparison result for "Minato-ku" in the empty table 70.
  • FIG. Therefore, the cryptographic processing device 1 stores "43” obtained by ANDing the value of the age field in the record on the fifth row of the encryption database 60 with the comparison result cr (plaintext is bit "1") in the empty table 70.
  • the comparison result is that the plaintext is encrypted text with bit "0", so 0 is added to the total age field and the number of people field of the corresponding row.
  • the aggregation result table 80 shown in FIG. 8 can be obtained.
  • the address data in the "address" column 62 and the address data in the empty table 70 are collectively compared, and the row of the encrypted database 60 corresponding to the address record in the empty table 70 is stored, The sum of ages and the total number of persons may be collectively performed later. Conversely, each row of the empty table 70 may be sequentially compared with the address field of the encrypted database 60 . There is no difference in that the age is obtained for addresses that match the address field of the empty table 70 , the number of people and age are added up for each address, and stored in the “total age” column 72 and the “number of people” column 73 .
  • FIG. 8 is a diagram showing an example of an aggregation result table.
  • the empty table 70 has columns 71 , 72 and 73 .
  • Column 81 stores “address”, column 82 stores “total age”, and column 83 stores "number of people”.
  • the head field of the "address” column 81 stores the headline "address”, the head field of the “total age” column 82 stores the headline "total age”, and the head field of the "number” column 83 stores , the headline "number of people" is stored.
  • the corresponding "total age” stored in the “total age” column 82 is stored in the "number of people” column 83.
  • the "average age” for each address can be obtained.
  • Both the “total age” and the “number of persons” stored in the aggregation result table 80 are TLWE ciphertexts in Bit-wise format. Division to determine the "average age” can be accomplished using known methods of binary division (division) using logical operations.
  • an "Average Age” column may be added as part of the aggregation results table 80, and the ciphertext of "Average Age” may be written in the field corresponding to each address in the "Average Age” column. .
  • the "address” is conditionally permuted based on the "average age”
  • the "average age” can also be permuted.
  • FIG. 9 is a flowchart for explaining the flow of encrypted database aggregation processing by the cryptographic processing device.
  • the process shown in FIG. 9 is performed when the cryptographic processing device 1 (receiving unit 11) receives a query for aggregating and sorting encrypted databases from an external device.
  • the cryptographic processing device 1 aggregation unit substitutes the number of rows, ie, the number of records, of the encryption database 60 for the variable m, and substitutes 1 for the variable p for initialization.
  • step S103 the cryptographic processing device 1 (aggregation unit) ANDs the comparison result cr (ciphertext in which the plaintext is bit “1" or "0") with "age” in the encrypted database 60 corresponding to the address data. If the plaintext of the comparison result cr is bit "1", then the age is obtained and added to the total age field of the empty table 70 . If the plaintext of the comparison result cr is bit '0', then 0 is obtained and this is added to the total age field of the empty table 70 . That is, when the age of the encrypted database 60 is ar and the total age of the empty table 70 is br, the cryptographic processing device 1 (aggregation unit) uses the comparison result cr to calculate br+(cr AND ar). . Addition processing can be performed, for example, by a full adder as described above.
  • step S104 the cryptographic processing device 1 (aggregation unit) ANDs the comparison result cr (ciphertext with bit “1" or "0") to "number of persons" in the empty table 70 corresponding to the address data.
  • the plaintext of the comparison result cr is bit “1”, 1 is added to the number field of the empty table 70 .
  • the plaintext of the comparison result cr is bit “0”, 0 is added to the number field of the empty table 70 .
  • the cryptographic processing device (aggregation unit) 1 obtains the number of people by calculating dr+cr using the above cr. Addition processing can be performed, for example, by a full adder as described above.
  • the comparison result cr is added as an encrypted 1-bit wide integer.
  • bubble sort a process is performed in which adjacent data are exchanged or not exchanged depending on the comparison result.
  • the comparison and replacement are repeated (q ⁇ 1 ) times when sorting a table with q rows, the table can always be completely sorted (replaced) in descending or ascending order.
  • (q ⁇ 1) two calculations are called the worst complexity.
  • Bubble sorting is suitable for sorting ciphertexts because the sorting is completed if only the worst case calculation is performed. You may Since the bubble sort only repeats comparison and replacement, it has the advantage of being able to sort without knowing the contents of the ciphertext (plaintext).
  • a HomMUX (homomorphic MUX) operation can be used for sorting.
  • This is the processing explained in FIG.
  • the number of lines does not include the first line displaying the heading in the aggregation result table 80 of FIG.
  • the second row (“Chiyoda Ward” in the address field) of the aggregation result table 80 in which the actual address, total age, and number of people are registered is the first row, and the third row (“Minato Ward” in the name field). ) is the second line, and so on.
  • the average age value (data) based on the value of the "total age” column 82 and the value of the “number of people” column 83 of the i-th row be the ciphertext av.
  • the “average age” based on the value of the “total age” column 82 and the value of the “number of people” column 83 of the i ⁇ 1 row is set as the ciphertext bv.
  • the ciphertext av and the ciphertext bv are ciphertexts indicating the “average age” that is the criteria for conditional replacement.
  • an arbitrary bit of the data in the i-th row is ciphertext az, and the bit at the same position in the i-1th row data is Let the ciphertext be bz.
  • the new i-th row data is assumed to be a ciphertext az', and the new i-1-th row data is assumed to be a ciphertext bz'.
  • the plaintexts of the ciphertext az' and ciphertext az are made the same, and the plaintexts of the ciphertext bz' and ciphertext bz are made the same. Otherwise, the plaintexts of the ciphertext az' and the ciphertext bz, and the ciphertext bz' and the ciphertext az are made the same.
  • Procedure (2) The borrow bit of ciphertext bv-ciphertext av is defined as ciphertext cz.
  • Gate Bootstrapping is not required for NOT, it is a natural implementation to use 3 Gate Bootstrapping with two AND operation units and one OR operation unit. As described with reference to FIG. 1, since the NOT circuit section 55 does not require Gate Bootstrapping, it is necessary to perform Gate Bootstrapping after the homomorphic operations of the AND circuit section and the OR circuit section. Therefore, in the two AND circuit units 53 and 54 and the one OR circuit unit 55 included in the MUX calculation units 51 and 52 for calculating a new ciphertext az' from the ciphertexts az and bz in FIG. Gate Bootstrapping should be done. Gate bootstrapping is performed three times in one multiplexer process, and it is performed twice, so a huge amount of computation time is required to perform the necessary rearrangement.
  • the above paper proposes an improved HomMUX.
  • Gate Bootstrapping of the left side (c 0 AND d 1 ) and the right side ((NOT c 0 ) AND d 0 ) is performed until before key switching (after SampleExtract), and each uses s' as a secret key.
  • the cryptographic processing device performs subtraction once in order to know whether the order of the two lines is correct in procedure (2).
  • the THFE multiplexer (HomMUX) operation is performed twice per comparison in order to perform the necessary permutation. Since one MUX operation requires the same processing time as when Gate Bootstrapping is performed twice, two MUX operations require four BlindRotate operations (four gates). This is small compared to the example above (three Gate Bootstrapping per MUX operation). However, regarding the permutation of all q rows, the subtraction is performed (q ⁇ 1) times twice and the MUX operation expression is performed 2 (q ⁇ 1) times. It will take.
  • procedures (3) and (4) are replaced with other procedures, thereby speeding up processing for two MUX operations. to speed up sorting.
  • 1 You can change times.
  • the basic idea for bubble sort is the same as with the MUX operation above.
  • the method of calculating the ciphertext az' and the ciphertext bz' from the ciphertext az and the ciphertext bz is different.
  • the average age of each row of the aggregation result table 80 (FIG. 8) is calculated based on the values in the "total age” column 82 and the values in the "number of people" column 83.
  • FIG. The calculation of the average age of each row can be performed, for example, by the full adder described above.
  • an arbitrary bit of the i-th row data indicating the "average age” is set as the ciphertext av
  • the bit at the same position of the i-1 row data indicating the "average age” is set as the ciphertext bv.
  • the ciphertext av and the ciphertext bv are ciphertexts indicating the “average age” that is the criteria for conditional replacement.
  • an arbitrary bit of the data in the i-th row is ciphertext az
  • the bit at the same position in the i-1th row data is Let the ciphertext be bz.
  • the new i-th row data is assumed to be a ciphertext az', and the new i-1-th row data is assumed to be a ciphertext bz'. If the "average age" of the i-1 line is greater than the "average age" of the i-th line, the plaintexts of the ciphertext az' and ciphertext az are made the same, and the plaintexts of the ciphertext bz' and ciphertext bz are made the same. Otherwise, the plaintexts of the ciphertext az' and the ciphertext bz, and the ciphertext bz' and the ciphertext az are made the same.
  • TLWE ciphertext az, TLWE ciphertext bz, and the following TLWE ciphertext cz are, as in the above paper, 0 ⁇ 1/16 as plaintext for bit "0" and 1/4 ⁇ 1/16.
  • the second row (“Chiyoda Ward” in the address field) of the aggregation result table 80 in which the actual address, total age, and number of people are registered is the first row, and the third row (“Minato Ward” in the name field). ) is the second line, and so on.
  • steps (11) to (14) are repeated for the number of rows in the aggregation result table 80 (FIG. 8), so that the largest (smallest) value appears at the end of the list. becomes.
  • steps (11) to (14) for the number of records (the number of rows excluding headings) -1, all the records in the aggregation result table 80 are rearranged in descending or ascending order based on the standard "average age". be able to.
  • steps (12) to (14) for the data in each column of "address”, “total age”, and "number of people" to be subject to conditional replacement the entire aggregation result table 80 is sorted.
  • the sorting process in procedure (13) is executed by the following three steps.
  • First step First, the cryptographic processing device 1 calculates az+cz-(0, 1/8) and performs Gate Bootstrapping (first time) described in the above paper.
  • F(X) ⁇ X n-1 + ⁇ X n-2 ...+ ⁇ X+ ⁇
  • 1/8 was used.
  • FIG. 10 is a diagram for explaining the operation of Gate Bootstrapping in the first step.
  • TLWE ciphertext tz which can take two values of 1/2 and 0 as plaintext and has an error of ⁇ 1/16.
  • the plaintext of TLWE ciphertext tz is 1/2, and the value of TLWE ciphertext cz and the value of TLWE ciphertext az are the same (both 0 or 1). then the plaintext of the TLWE ciphertext tz is zero. Obtaining such a temporary ciphertext tz is the first step.
  • the cryptographic processing device 1 calculates tz+bz-(0, 1/8) and performs gate bootstrapping (second time).
  • T1(X) ⁇ 1 X n-1 + ⁇ 1 X n-2 + .. ⁇ 1 X (n/ 2 ) + .mu. 2 X (n/ 2 )-1 + .
  • FIG. 11 is a diagram for explaining the operation of Gate Bootstrapping in the second step.
  • the range from 0 to 0.25 (1/4) becomes 1/8, and the range from 0.25 (1/4) to 0.5 (1/2) becomes 5/8.
  • the range from 0.5 (1/2) to 0.75 (3/4) is 7/8.
  • the range from 0.75 (3/4) to 1 is 3/8.
  • FIG. 12 is a diagram for explaining the operation of Gate Bootstrapping in the third step.
  • the cryptographic processing device 1 performs SampleExtract twice at different sampling positions. First, when SampleExtract(0) is performed at position 0 and key switching is performed, two values of 1/8 and 7/8 are obtained as shown in FIG. 12(a).
  • the range from 0 to 0.25 (1/4) in FIG. 12A is 7/8, and the range from 0.25 (1/4) to 0.5 (1/2) is 1/8.
  • negative values occur in the range from 0 to 0.25 (1/4), so the ciphertext is -7/8.
  • ⁇ 7/8 corresponds to 1/8 on the circle group ⁇ T ⁇ .
  • the ciphertext is -1/8.
  • ⁇ 1/8 corresponds to 7/8 on the circle group ⁇ T ⁇ .
  • the range from 0 to 0.25 (1/4) in FIG. 12B is 7/8, and the range from 0.25 (1/4) to 0.5 (1/2) is 7/8.
  • negative values occur in the range from 0 to 0.25 (1/4), so the ciphertext is -7/8.
  • ⁇ 7/8 corresponds to 1/8 on the circle group ⁇ T ⁇ .
  • the ciphertext is -7/8.
  • ⁇ 7/8 corresponds to 1/8 on the circle group ⁇ T ⁇ .
  • Subtracting the obtained value from (0, 1/8) yields a new ciphertext bz' that can take two values of 0 and 1/4 as plaintext.
  • the value of the ciphertext az' and the value of the ciphertext bz' can be obtained at once.
  • the number of Gate Bootstrapping (BlindRotate) can be set to three.
  • the gate bootstrapping can be reduced by one and sorting can be speeded up.
  • the plaintext of the ciphertext cz is 1/4, that is, the bit is 1 and the (i-1)th row is smaller, that is, if the order is to be changed
  • the plaintext of the ciphertext az the plaintext of the ciphertext bz'
  • ciphertext Plaintext of bz plaintext of ciphertext az'.
  • FIG. 13 is a diagram showing possible values of a ciphertext in the conditional replacement process of this embodiment.
  • (1) to (4) of FIG. 13 show the case where the plaintext of the ciphertext cz indicating the borrow bit is 0.
  • FIG. 1 if the plaintext of the ciphertext az of the i-th row data is 0 and the plaintext of the ciphertext bz of the i-1 row data is 0, the plaintext of the ciphertext tz obtained in the first step is 0.
  • the plaintext of the ciphertext uz obtained in the second step is 3/8, and the plaintext of (0, 1/4)-uz+cz obtained in the third step is 7/8.
  • the ciphertext az' of the new i-th row data obtained by adding (0, 1/8) to the value obtained by SampleExtract(0) is 0.
  • the ciphertext bz' of the new i ⁇ 1 row data obtained by subtracting the value obtained by SampleExtract(n/2) from (0, 1/8) is 0.
  • the plaintext of the ciphertext az the plaintext of the ciphertext az'
  • the plaintext of the ciphertext bz the plaintext of the ciphertext bz'
  • the ciphertext az and the ciphertext bz are respectively new ciphertext az'.
  • (5) to (8) of FIG. 13 show the case where the plaintext of the ciphertext cz indicating the borrow bit is 1/4.
  • the plaintext of the ciphertext az of the i-th row data is 0 and the plaintext of the ciphertext bz of the i-1 row data is 0, the plaintext of the ciphertext tz obtained in the first step is 1/2.
  • the plaintext of the ciphertext uz obtained in the second step is 5/8, and the plaintext of (0, 1/4)-uz+cz obtained in the third step is 7/8.
  • the ciphertext az' of the new i-th row data obtained by adding (0, 1/8) to the value obtained by SampleExtract(0) is 0.
  • the ciphertext bz' of the new i ⁇ 1 row data obtained by subtracting the value obtained by SampleExtract(n/2) from (0, 1/8) is 0.
  • the plaintext of the ciphertext az the plaintext of the ciphertext bz'
  • the plaintext of the ciphertext bz the plaintext of the ciphertext az'
  • the ciphertext az and the ciphertext bz are respectively converted into the ciphertext az' and the ciphertext
  • the i-th row and i-1-th row records are switched from their original order as plaintext.
  • plaintext of ciphertext az plaintext of ciphertext bz'
  • the plaintext of the ciphertext az of the i-th row data is 0, the plaintext of the i-1th row data ciphertext bz is 1/4, and the new i-th row data ciphertext az ' is 1/4, and the ciphertext bz' of the new i-1 row data is 0.
  • the ciphertext az' and the ciphertext bz' are either the same plaintext as the ciphertext az and the ciphertext bz or different from the plaintext of the ciphertext az and the ciphertext bz, depending on the plaintext of the ciphertext cz. Either the plaintext of bz and the ciphertext az is different from the plaintext of the ciphertext az.
  • the decryption function is ⁇
  • ⁇ (cz) 1/4 (when the average age is smaller in the i-1 row and the order is changed)
  • the ciphertext az ⁇ the ciphertext az′ and the ciphertext bz ⁇ the ciphertext bz′, and the ciphertext itself is different between the original ciphertext and the new ciphertext.
  • the ciphertext itself is directly handled by the cryptographic processing device 1, and whether or not ciphertext az' and ciphertext bz' are the same ciphertext as ciphertext az and ciphertext bz, respectively, or whether or not ciphertext bz and ciphertext bz are the same.
  • the plaintext of the ciphertext cz can be guessed. Therefore, the ciphertext itself is always different between the original ciphertext and the new ciphertext. However, the plaintext of the ciphertext az' and the plaintext of the ciphertext bz' become either the plaintext of the ciphertext az or the plaintext of the ciphertext bz depending on the plaintext of the ciphertext cz.
  • the cryptographic processing device 1 of the present embodiment uses the same ciphertext cz obtained from the ciphertexts av and bv of, for example, the “average age” as a reference for conditional replacement, and uses the “address , ⁇ total age'', and ⁇ number of persons''. Then, the cryptographic processing device 1 replaces the ciphertexts az and bz with the ciphertexts az' and bz' for each column subject to conditional replacement such as "address", "total age", and "number of people".
  • the entire aggregation result table 80 can be sorted.
  • FIG. 14 is a flowchart for explaining the flow of aggregation result sorting processing by the cryptographic processing device.
  • the processing shown in FIG. 14 is performed after the cryptographic processing device 1 (aggregation unit 21) aggregates encrypted databases in response to a query for aggregating and sorting encrypted databases.
  • the information processing apparatus 1 substitutes the number of rows (the number of records) of the aggregation result table 80 into the variable q, and substitutes 2 into the variable i.
  • the information processing apparatus 1 (comparing unit 22) calculates the ciphertext bv-the ciphertext av to obtain the borrow bit ciphertext cz.
  • the comparison unit 22 can cause this calculation to be performed by, for example, the full adder described above.
  • the information processing device 1 calculates az+cz ⁇ (0, 1/8) in step S203.
  • the information processing apparatus 1 (first Bootstrapping unit 15) performs the first Gate Bootstrapping in step S204, and as a result, obtains the ciphertext tz in step S205.
  • the information processing device 1 calculates tz+bz ⁇ (0, 1/8) in step S206.
  • the information processing apparatus 1 performs the second Gate Bootstrapping in step S207, and as a result, obtains the ciphertext uz in step S208.
  • the information processing device 1 calculates (0, 1/4)-uz+cz in step S209.
  • the information processing device 1 performs the third gate bootstrapping in steps S210 to S214.
  • the information processing apparatus 1 performs BlindRotate in step S210, performs key switching with SampleExtract(0) in step S211, and obtains ciphertext az' in step S212 as a result.
  • the information processing device 1 performs key switching with SampleExtract(n/2) in step S213, and as a result, obtains ciphertext bz' in step S214.
  • the information processing device 1 replaces the ciphertext az with the ciphertext az' and the ciphertext bz with the ciphertext bz' in the aggregation result table 80 in step S214.
  • FIG. 15 is a diagram illustrating an example of an aggregation result table after completion of sort processing.
  • the aggregation result table 80 of FIG. 8 is replaced as shown in FIG.
  • the average age for Chiyoda Ward was 40 years old
  • the average age for Minato Ward was 46.5 years old
  • the average age for Taito Ward was 58 years old.
  • the records of the aggregation result table 80 are sorted in descending order of average age.
  • the cryptographic processing apparatus 1 of the present embodiment can reduce the number of gate bootstrapping operations to three. Since Gate Bootstrapping, which occupies almost all of the computation time, takes a long processing time, it is expected that the MUX computation can be performed at high speed and in a short time by reducing the number of times. However, as shown in Figure 3, although the number of times of Gate Bootstrapping has been reduced to 3, the number of stages of Bootstrapping has increased to 3, so compared to Figure 1 when multithreading is performed, the processing by the configuration of Figure 3 is It cannot be said that it is decisively fast.
  • the cryptographic processing device 1 of this embodiment reduces the error of the plaintexts of the TLWE ciphertexts az, bz, and cz to, for example, ⁇ 1/40.
  • the MUX operation three binary ciphertexts can be input to the first operation unit 12, and the gate bootstrapping is improved, thereby reducing the total number of homomorphic operation processes to two.
  • the cryptographic processing device 1 the total number of times of gate bootstrapping, which occupies almost all homomorphic arithmetic processing, can be reduced to two.
  • the number of stages of bootstrapping is reduced to 2, and the number of homomorphic operations is reduced to 2.
  • the MUX operation can be performed in 66% of the time of the configuration shown in FIG.
  • FIG. 16 is a diagram illustrating the functional configuration of a cryptographic processing device according to a modification of this embodiment.
  • the cryptographic processing device 1 includes a control unit 10 , a storage unit 20 , a communication unit 25 and an input unit 26 .
  • the control unit 10 includes a reception unit 11, a fourth calculation unit 31, a fifth calculation unit 32, a fourth bootstrapping unit (fourth calculation unit) 33, a fifth bootstrapping unit (fifth calculation unit) 34, and an output unit. 18 and .
  • the control unit 10 also includes an aggregating unit 21 , a comparing unit 22 , and a replacing unit 23 .
  • the fourth computation unit 31 performs a fourth homomorphic computation on the input cipher accepted by the acceptance unit 11 .
  • the fifth computation unit 32 performs a fifth homomorphic computation on the ciphertext output from the fourth bootstrapping unit 33 .
  • the fourth bootstrapping unit 33 performs gate bootstrapping processing described below on the calculation result of the fourth calculation unit 31, and outputs a new ciphertext.
  • the fifth bootstrapping unit 34 performs gate bootstrapping processing described below on the calculation result of the fifth calculation unit 32, and outputs a new ciphertext.
  • FIG. 17 is a diagram explaining in detail the calculation process of the cryptographic processing device according to the modification.
  • the ciphertexts az, cz, and cz input to the cryptographic processing device 1 are all TLWE ciphertexts shown in the above paper.
  • the TLWE cipher is a bit-wise fully homomorphic cipher having a value of 0 or ⁇ (non-zero) as plaintext.
  • Various operations can be performed by logic operations using logic gates.
  • a TLWE ciphertext has a binary value obtained by adding an error having a predetermined variance to a predetermined value corresponding to a binary symbol 0 or 1 as plaintext, and can be logically operated without decryption.
  • TLWE ciphertexts are TLWE ciphertexts with specially set system parameters, generated by Gate Bootstrapping or newly encrypted.
  • Each of the TLWE ciphertexts az, cz, and cz has 0 or 1/4 as plaintext, and the error added to the plaintext is within the range of ⁇ 1/40.
  • 0 corresponds to the binary symbol 0
  • 1/4 corresponds to the binary symbol 1, respectively. Since there is a possibility that the error ranges overlap due to the use of three binary inputs, the error added to the plaintext is set to within ⁇ 1/40, which is smaller than ⁇ 1/16 of the above paper. However, as will be described later, if the problem caused by overlapping errors can be tolerated, the error may be ⁇ 1/40 of the example or ⁇ 1/16 of the above paper.
  • the (binary) Gate Bootstrapping presented in the paper of Non-Patent Document 1 (the above paper) is used.
  • the input ciphertexts az, bz, and cz are input to the fourth computation unit 31 to perform homomorphic computation (2 ⁇ (az+cz)+bz ⁇ (0, 1/8)), and the ciphertext that is the computation result is It is input to the fourth bootstrapping unit 33 that performs binary gate bootstrapping.
  • the output of the fourth bootstrapping unit 33 is a temporary ciphertext uz which can take either binary value (0, ⁇ ) as a plaintext.
  • the ciphertext uz and the ciphertext cz are input to the fifth computation unit 32 to perform homomorphic computation ((0, 1/4)-uz+cz), and the output result is input to the fifth bootstrapping unit 34 for binary gate bootstrapping. is performed to output a new ciphertext az' and a new ciphertext bz'.
  • the processing of the fifth computing unit 32 and the fifth bootstrapping unit 34 is the same as the processing of the third computing unit 14 and the third bootstrapping unit 17 described above.
  • the cryptographic processing device 1 calculates 2(az+cz)+bz ⁇ (0, 1/8) and obtains TLWE ciphertext ct as the calculation result. (0, 1/8) is a trivial ciphertext whose plaintext is 1/8.
  • the plaintext of the operation result of 2(az+cz)+bz-(0, 1/8) is as follows.
  • the TLWE ciphertext ct has any one of 1/8, 3/8, 5/8, and 7/8 as plaintext, and the error added to the plaintext is included in the range of ⁇ 1/8. This is because the sum of the error of ca+cb ⁇ 1/40 ⁇ 2 and the error of cc ⁇ 1/40 are added.
  • the cryptographic processing device 1 (fourth bootstrapping unit) 33 performs Gate Bootstrapping on the TLWE ciphertext ct according to the above paper
  • the plaintext is 1/
  • a temporary ciphertext uz with 8, 3/8, 5/8, 7/8 and an error that the plaintext has ⁇ 1/40 is obtained.
  • the subsequent processing using the temporary ciphertext uz and the ciphertext cz is the same as the above [third step], so the description is omitted.
  • FIG. 18 is a flowchart for explaining the flow of aggregation result sorting processing according to the modification.
  • the process shown in FIG. 18 is performed after the encryption processing device 1 (aggregation unit 21) aggregates encrypted databases for a query for sorting encrypted databases.
  • the information processing apparatus 1 substitutes the number of rows (the number of records) of the aggregation result table 80 into the variable q, and substitutes 2 into the variable i.
  • the information processing device 1 (comparison unit 22) calculates the ciphertext bv-the ciphertext av to obtain the borrow bit ciphertext cz.
  • the comparison unit 22 can cause this calculation to be performed by, for example, the full adder described above.
  • the information processing device 1 calculates 2(az+cz)++bz ⁇ (0, 1/8) in step S203A.
  • the information processing device 1 (fourth bootstrapping unit 33) performs the first Gate Bootstrapping in step S204A, and as a result, obtains the ciphertext uz in step S208.
  • This ciphertext uz is the same as the ciphertext uz obtained in step S208 of FIG. 14 except for the error added to the plaintext.
  • the information processing device 1 calculates (0, 1/4)-uz+cz in step S209A.
  • the information processing device 1 (fifth calculator 33) performs the third Gate Bootstrapping in steps S210A to S214A.
  • the information processing device 1 (fifth Bootstrapping unit 32) performs BlindRotate in step S210A, performs key switching with SampleExtract(0) in step S211, and obtains ciphertext az' as a result in step S212.
  • the information processing device 1 (fifth Bootstrapping unit 32) performs key switching with SampleExtract(n/2) in step S213A, and as a result, obtains the ciphertext bz' in step S214A.
  • steps S210A to S214A by the fifth calculator 33 is the same as the processing of steps S210 to S214 by the third calculator 17 shown in FIG.
  • the information processing device 1 replacement unit 23
  • FIG. 19 is a diagram showing ciphertexts input and output to Gate Bootstrapping of this embodiment.
  • gate bootstrapping is performed in the order of BlindRotate, SampleExtract, and key switching.
  • key switching can be performed first in Gate Bootstrapping, and then BlindRotate and SampleExtract can be performed.
  • TLWE ciphertext has a level concept according to security strength.
  • the TLWE ciphertext used as input/output is LEVEL0.
  • BlindRotate is performed on the TLWE ciphertext of LEVEL0, and the TLWE ciphertext obtained by SampleExtracting the output TRLWE ciphertext is LEVEL1, but as a result of key switching, TLWE ciphertext of LEVEL0 is output.
  • the TLWE ciphertext that is the input and output of Gate Bootstrapping is set to LEVEL1
  • BlindRotate is performed in the state where the key switching is performed first and lowered to LEVEL0
  • the output TRLWE ciphertext is LEVEL1 TLWE ciphertext is output when SampleExtract is performed for .
  • the ciphertext of LEVEL0 consists of the N-order vector [a] of the elements on the circle group ⁇ T ⁇ encrypted with the N-order secret key [s].
  • the ciphertext of LEVEL1 obtained as a result of SampleExtract consists of the nth order vector [a'] of the elements on the circle group ⁇ T ⁇ encrypted with the nth order secret key [s']. Since the ciphertext of LEVEL0 has a smaller number of coefficients (degree of vector), which is the degree of difficulty of the LWE problem, than the ciphertext of LEVEL1, the computational complexity of homomorphic addition is smaller than that of LEVEL1.
  • the ciphertext of LEVEL 0 has the problem that the security strength tends to decrease if the allowable error added to the plaintext is reduced in order to enable the homomorphic operation of binary 3-input as in the above modified example.
  • the security of the LWE-based cipher is guaranteed by the error added to the plaintext.
  • TLWE ciphers are more difficult to calculate (decrypt) as the error added to the plaintext increases and as the number of coefficients (order of the vector) increases. In other words, the smaller the error added to the plaintext and the smaller the number of coefficients (order of the vector), the easier the calculation (decryption) of the TLWE cipher becomes. In order to reduce the error, it is necessary to increase the number of ciphertext coefficients (order of the vector) to ensure security.
  • the error added to the plaintext is reduced to ⁇ 1/40 to reduce the number of times of BlindRotate and speed up the MUX operation by homomorphic operation of two values and three inputs.
  • key switching is moved to the beginning of Gate Bootstrapping, and the number of coefficients (order of vector) is large. It is desirable to use LEVEL1 ciphertext, which tends to reduce the margin of error, as input/output for Gate Bootstrapping. And after converting to LEVEL0 at the beginning of Gate Bootstrapping, do not return to LEVEL0 at the end.
  • the time required for BlindRotate is proportional to the number of coefficients (degree of vector) of the input TLWE ciphertext. Therefore, when the ciphertext of LEVEL1 is input, the time required for BlindRotate becomes longer in proportion to the number of coefficients (degree of vector) than when the ciphertext of LEVEL0 is input. Even if LEVEL1 ciphertext is used as input for Gate Bootstrapping to ensure ciphertext security, an increase in the required time can be avoided by performing BlindRotate using LEVEL0 TLWE ciphertext converted by key switching as input.
  • the method of using Gate Bootstrapping input and output as TLWE ciphertext of LEVEL 1 is not limited to the case of performing a binary 3-input homomorphic operation as in the modified example, but in the case of a binary 2-input homomorphic operation in Fig. 3 is also applicable. By not returning to LEVEL0, it is possible to safely input multiple values and perform high-speed processing in the same manner in the calculation of TLWE ciphertext in the next stage.
  • the plaintext is interpreted as a different plaintext, which may lead to unexpected calculation results. It doesn't make the calculation itself impossible, it just gives different results. The acceptable probability of obtaining different computational results depends on the application to which the homomorphic encryption is applied.
  • the error may be set so as to satisfy particularly important conditions according to the system or device to which the present embodiment is applied.
  • homomorphic calculation such as binary 4-input is possible by setting the error to be added to the plaintext within the range of ⁇ 1/32. If the application can tolerate the possibility of obtaining different calculation results to some extent, the possibility of overlapping error ranges can be tolerated to some extent, and while speeding up the calculation with 2-value 3-input, the error can be set as large as ⁇ 1/16. security can be maintained. For example, even if the parameters of the above paper, which set the error to be added to the plaintext to within ⁇ 1/16, in principle, it is possible to speed up the full adder with a binary three-input homomorphic operation. Configuration is possible. It only increases the probability of obtaining different calculation results because the error is outside the set range.
  • FIG. 20 is a block diagram showing one embodiment of a computer device.
  • the configuration of the computer device 100 will be described with reference to FIG.
  • the computer device 100 is, for example, a cryptographic processing device that processes various types of information.
  • Computer device 100 includes control circuit 101 , storage device 102 , reading device 103 , recording medium 104 , communication interface 105 , input/output interface 106 , input device 107 and display device 108 .
  • Communication interface 105 is also connected to network 200 .
  • Each component is connected by a bus 110 .
  • the cryptographic processing device 1 can be configured by appropriately selecting some or all of the components described in the computer device 100 .
  • the control circuit 101 controls the computer device 100 as a whole.
  • the control circuit 101 is, for example, a processor such as Central Processing Unit (CPU), Field Programmable Gate Array (FPGA), Application Specific Integrated Circuit (ASIC) and Programmable Logic Device (PLD).
  • CPU Central Processing Unit
  • FPGA Field Programmable Gate Array
  • ASIC Application Specific Integrated Circuit
  • PLD Programmable Logic Device
  • the control circuit 101 functions, for example, as the control unit 10 in FIGS. 2 and 16 .
  • the storage device 102 stores various data.
  • the storage device 102 is, for example, a memory such as Read Only Memory (ROM) and Random Access Memory (RAM), or a Hard Disk (HD).
  • the storage device 102 may store an information processing program that causes the control circuit 101 to function as the control unit 10 in FIGS. 2 and 16 .
  • the storage device 102 functions as the storage unit 20 in FIGS. 2 and 16, for example.
  • the program stored in the storage device 102 is read into the RAM.
  • the cryptographic processing device 1 executes the program read out to the RAM in the control circuit 101 to perform the reception processing, the first arithmetic processing, the second arithmetic processing, the third arithmetic processing, the fourth arithmetic processing, and the fifth arithmetic processing.
  • the program may be stored in a storage device of a server on the network 200 as long as the control circuit 101 can access it via the communication interface 105 .
  • the reader/writer 103 is controlled by the control circuit 101 to read/write data from/to the removable recording medium 104 .
  • a recording medium 104 stores various data.
  • the recording medium 104 stores, for example, an information processing program.
  • the recording medium 104 is, for example, a Secure Digital (SD) memory card, a Floppy Disk (FD), a Compact Disc (CD), a Digital Versatile Disk (DVD), a Blu-ray (registered trademark) Disk (BD), a flash memory, or the like. is a non-volatile memory (non-temporary recording medium).
  • the communication interface 105 communicably connects the computer device 100 and other devices via the network 200 .
  • the communication interface 105 functions as the communication unit 25 in FIG. 2, for example.
  • the input/output interface 106 is, for example, an interface detachably connected to various input devices.
  • the input device 107 connected to the input/output interface 106 includes, for example, a keyboard and a mouse.
  • the input/output interface 106 communicably connects various input devices and the computer device 100 .
  • the input/output interface 106 outputs signals input from various connected input devices to the control circuit 101 via the bus 110 .
  • Input/output interface 106 also outputs a signal output from control circuit 101 to an input/output device via bus 110 .
  • the input/output interface 106 functions as the input unit 26 in FIGS. 2 and 16, for example.
  • the display device 108 displays various information.
  • the network 200 is, for example, a LAN, wireless communication, P2P network, or the Internet, and connects the computer device 100 and other devices for communication. It should be noted that the present embodiment is not limited to the embodiments described above, and various configurations or embodiments can be adopted without departing from the gist of the present embodiment.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Theoretical Computer Science (AREA)
  • Signal Processing (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • General Physics & Mathematics (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Mathematical Analysis (AREA)
  • Software Systems (AREA)
  • General Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • Health & Medical Sciences (AREA)
  • Algebra (AREA)
  • Computer Hardware Design (AREA)
  • Mathematical Optimization (AREA)
  • Mathematical Physics (AREA)
  • Pure & Applied Mathematics (AREA)
  • Computing Systems (AREA)
  • Storage Device Security (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

完全準同型暗号を実現する全加算器の演算を高速化する。暗号文は、復号することなく論理演算が可能な完全準同型暗号文であり、所定の順序で配列される暗号文を所定の手法に従って入れ替えるソート処理を行い、ソート処理において、第1暗号文と第2暗号文とに基づく準同型演算を行い、該準同型演算の結果と所定の多項式とに基づいて得られる暗号文から新たな第1暗号文と新たな第2暗号文を算出し、第1暗号文及び第2暗号文と、新たな第1暗号文及び新たな第2暗号文と、が所定条件を満たすときに、第1暗号文及び第2暗号文を入れ替える。

Description

暗号処理装置、暗号処理方法、及び暗号処理プログラム
 本発明は、暗号文を処理する暗号処理装置、暗号処理方法、及び暗号処理プログラムに関する。
 準同型暗号(Homomorphic Encryption)は、暗号化したデータを復号せず、暗号化したままデータ処理を行うことができる暗号方式である。平文同士での加算に対応する暗号文同士の演算が存在する暗号が加法準同型暗号であり、平文同士での乗算に対応する暗号文同士の演算が存在する暗号が乗法準同型暗号である。
 有限巡回群を整数に見立てて、加法演算(加算、減算)、乗法演算(乗算)のみを行う加法準同型暗号、乗法準同型暗号が以前から知られていた。
 有限巡回群は、加算を繰り返せば整数倍ができるので、「平文の」整数倍ができ、乗算を繰り返せば「平文の」のべき乗計算をすることもできる。
 また、加法演算(加算、減算)と乗法演算(乗算)の両方を暗号化したまま処理する完全準同型暗号(Fully Homomorphic Encryption,FHE)がある。
 現在知られている完全準同型暗号では、複数回の加減算、乗算が可能な、例えばLWE問題に基づくsomewhat準同型暗号を用いる。LWE問題に基づく場合、somewhat準同型暗号は、暗号化時に復号には問題ない程度の小さな誤差を平文に加えることで構成される。なお、somewhat準同型暗号はLWE暗号に限定されない。
 LWE問題に基づくsomewhat準同型暗号では演算を行うとともに誤差が蓄積していくので、誤差が大きくなりすぎて復号ができなくなる前に、暗号化したまま誤差成分を縮小するbootstrappingを行う。
 このようなbootstrappingは膨大なデータ量が必要となったり計算量が膨大となったりし、実用的な意味で完全準同型暗号が実現できていたとは言えなかった。
 この問題を劇的に改善した手法が、非特許文献1(以下の説明において、上記論文として参照される)に示されるTFHE(Fast Fully Homomorphic Encryption over the Torus)である。
TFHE:Fast Fully Homomorphic Encryption over the Torus. Journal of Cryptology, 33:34-91, 2020, I.Chillotti, N.Gama, M.Georgieva, and M.Izabachene
 TFHEをはじめとする準同型暗号は、格納される値やデータを暗号化した暗号化データベースを実現するための暗号としても注目されている。
 上記のとおり、準同型暗号は、暗号化したデータを復号せず、暗号化したままデータ処理を行うことができる暗号方式である。
 暗号化されたデータベースではインデックスを作成することはできないが、データベース上の値だけでなくクエリも準同型暗号で暗号化することにより、いずれをも復号することなく内容を秘匿したまま検索などの操作を行うことができる。
 また、暗号化されたデータベースに対する操作としては、データベース上の値をカテゴリごとに集約し、集約結果を昇順や降順に入れ替える操作も考えられる。
 本発明は、一側面として、暗号化されたデータベースに対する入れ替え処理を効率化することを目的とする。
 本発明は、暗号文を処理する暗号処理装置であって、前記暗号文は、シンボル0または1に対応する所定の値に所定の分散を持つ誤差を与えた値を平文として2値を有し、復号することなく論理演算が可能な完全準同型暗号文であり、所定の順序で配列される第1暗号文の平文と第2暗号文の平文の夫々に対応する新たな暗号文を、前記順序と同じ又は逆の順序で得ることができ、前記新たな暗号文の順序を第3暗号文の平文に基づいて選択可能な処理を行い、平文として2値よりも多い多値を有する前記暗号文に基づく一時暗号文を出力とする多値論理演算を用いることにより前記処理に必要な計算の回数を削減する、暗号処理装置を特徴とする。
 本発明によれば、一側面として、暗号化されたデータベースに対する入れ替え処理を効率化することができる。
暗号文の条件付き入れ替えを行うための暗号演算処理部の構成を説明する図である。 本実施形態の暗号処理装置の機能構成を説明する図である。 本実施形態の暗号処理装置の演算プロセスを詳しく説明する図である。 TLWE暗号が平文として有する円周群を説明するイメージ図である。 2値Gate Bootstrappingの動作イメージ図である。 暗号化されたデータベースの一例を示す図である。 空の応答としてのテーブルの一例を示す図である。 集約結果テーブルの一例を示す図である。 暗号処理装置による暗号化データベース集約処理の流れを説明するフローチャートである。 第1のステップのGate Bootstrappingの動作を説明する図である。 第2のステップのGate Bootstrappingの動作を説明する図である。 第3のステップのGate Bootstrappingの動作を説明する図である。 本実施形態の条件付き入れ替え処理において暗号文が取り得る値を示す図である。 暗号処理装置による集約結果ソート処理の流れを説明するフローチャートである。 ソート処理を完了後の集約結果テーブルの一例を示す図である。 変形例に係る暗号処理装置の機能構成を説明する図である。 変形例に係る暗号処理装置の演算プロセスを詳しく説明する図である。 変形例に係る集約結果ソート処理の流れを説明するフローチャートである。 本実施形態のGate Bootstrappingに入出力される暗号文を示す図である。 コンピュータ装置の一実施例を示すブロック図である。
 以下に、図面を参照して本発明の実施の形態を詳細に説明する。
 なお、以下の説明において、[]で囲まれた英数字はそれがベクトルであることを示す。{}で囲まれた英数字はそれが集合であることを示す。
 また、本明細書において、「論理演算」と記す場合は2値もしくは多値の論理演算のことを指すものとする。
 本実施形態は、下記に詳しく説明するように、暗号化されたデータベース(暗号化データベース)に対する操作を行う暗号処理装置に関する。
 本実施形態の暗号処理装置は、暗号化した値を格納した暗号化データベースを、特定の基準値に基づいて集約した集約結果に対して、暗号文を復号することなく、昇順又は降順で入れ替えを行う。
 このようなデータベースの値を暗号文のまま入れ替える場合、平文データベースを入れ替える場合や暗号化データベースの値を復号してから入れ替える場合と異なり、値の大小関係で簡単に入れ替えることはできない。
 その場合、暗号処理装置は、下記に説明するように、条件付き入れ替えの基準となる暗号文avと暗号文bvとの引き算を行って暗号文czを得る。暗号文czは、暗号文avと暗号文bvの大小関係を示すボロービットである。
 暗号処理装置は、条件付き入れ替えの対象となる、暗号文av、bvに夫々対応する暗号文az及び暗号文bzと、上記暗号文czとを、図1に示すマルチプレクサ(MUX)演算文を用いた暗号演算処理部に入力し、新たな暗号文az’、新たな暗号文bz’を得る。そして暗号処理装置は、暗号文az、暗号文bzを夫々、暗号文az’、暗号文bz’で置き換えることによって入れ替えを行う。
 図1は、暗号文の条件付き入れ替えを行うための暗号演算処理部を例示する図である。
 図1は、論理演算素子によるハードウェア回路で暗号演算処理部を説明しているが、暗号演算処理部をソフトウェアで実装したCPUが実行する入れ替えプログラムであると考えてもよい。
 暗号演算処理部をソフトウェアで実装するとき、暗号文に対して論理回路(論理ゲート)を設計するイメージで演算を行う。
 図1(a)に示すように、暗号演算処理部50は2つのMUX演算部51、52を備える。
 MUX演算部51、52は、1つの暗号文czによって、2つの暗号文az、bxを選択する論理演算を行う。
 第1MUX演算部51と第2MUX演算部52に、夫々暗号文az、bx、cxが入力される。
 第1MUX演算部51に対しては、入力0に暗号文azを入力し、入力1に暗号文bzを入力し、出力として暗号文az’を得る。
 第2MUX演算部52に対しては、入力0に暗号文bzを入力し、入力1に暗号文azを入力し、出力として暗号文bz’を得る。
 このようにすると、暗号文czがビット「0」の時には、暗号文az’、暗号文bz’は暗号文az、暗号文bzと同じ並び順となり、暗号文czがビット「1」の時には、az’、暗号文bz’は順序が入れ替わり暗号文bz、暗号文azの並び順で出力される。
 図1(b)に示すように、一つのマルチプレクサは、2つのAND回路53、54と、1つのNOT回路部55と、1つのOR回路56とから構成される。
 第1AND回路部53、第2AND回路部54は、ANDを得るための演算処理部である。
 NOT回路部55は、NOTを得るための演算処理部である。
 OR回路部56は、ORを得るための演算処理部である。
 図1の2つのマルチプレクサは同じ構成を有している。
 MUX演算部51において、暗号文azと暗号文czが第1AND回路部53に入力される。
 暗号文czは、NOT回路部55にも入力され、その出力と、暗号文bzとが第2AND回路部54に入力される。
 第1AND回路部53の出力と第2AND回路部54の出力とがOR回路部56に入力され、OR回路部56の出力がマルチプレクサの出力として出力される。
 また、MUX演算部52において、暗号文bzと暗号文czが第1AND回路部53に入力される。
 暗号文czは、NOT回路部55にも入力され、その出力と、暗号文azとが第2AND回路部54に入力される。
 第1AND回路部53の出力と第2AND回路部54の出力とがOR回路部56に入力され、OR回路部56の出力がマルチプレクサの出力として出力される。
 上記の構成によって、MUX演算部51、52は、夫々(cz AND az)OR((NOT cz) AND bz)、(cz AND bz)OR((NOT cz) AND az)の論理演算を実行する。
 MUX演算部51、52は、夫々2つのAND回路部と、1つのOR回路部と、1つのNOT回路部と、を備え、すなわち4つの論理演算素子(論理演算素子に対応する処理部)を備えている。従って、1回のマルチプレクサの演算につき、論理演算素子4つ分の演算時間が必要である。TFHEによる完全準同型暗号の演算に用いる場合、論理演算素子(AND回路部、OR回路部)の演算(準同型演算)の後段で、夫々Gate Bootstrappingを行う必要がある。なおNOT回路部55にGate Bootstrappingは不要である。従って、MUX演算部51、52における2つのAND回路部53、54と1つのOR回路部55で、3回のGate Bootstrappingを行う。
 条件付き入れ替え処理において新たな暗号文を演算する1回の演算処理において、MUX演算部51の処理を実行し、もう一つの新たな暗号文のためにMUX演算部52の処理を行う。上記のようにMUX演算部51、MUX演算部52によって夫々3回のGate Bootstrappingを行う必要がある。従って、図1の暗号演算処理部50による完全準同型暗号の演算には、膨大なGate Bootstrappingの演算時間を要し、実用的に暗号化データベースを操作できるとは言えない。
 これに対して、上記論文には、図1の構成を用いた改良したHomMUXと呼ばれる手法を提案している。これによれば、THFEのマルチプレクサ(HomMUX)演算を1回の比較につき2回行う点は上記と同じである。
 MUX演算1回につきGate Bootstrappingを2回行う場合と同じだけの処理時間を要するため、MUX演算2回ではBlindRotate4回分(4ゲート分)の計算時間を要する。必要なソートを全て行うためには膨大な処理時間がかかることには違いがない。
 本実施形態の暗号処理装置は、このような暗号化データベースに対する操作に要する処理時間を削減して実用的なものにする。
 暗号化データベースに対する操作の説明に先だって、本実施形態の暗号処理装置が行う完全準同型暗号の演算について説明する。
 図2は、本実施形態の暗号処理装置の機能構成を説明する図である。
 暗号処理装置1は、制御部10と、記憶部20と、通信部25と、入力部26と、を備える。
 制御部10は、受付部11と、第1演算部12と、第2演算部13と、第3演算部14と、第1Bootstrapping部(第1算出部)15と、第2Bootstrapping部(第2算出部)16と、第3Bootstrapping部(第3算出部)17と、出力部18と、を備えている。
 また、制御部10は、集約部21と、比較部22と、置換部23とを備えている。
 受付部11は、通信部25や入力部26を介した、演算の対象となる暗号文の入力を受け付ける。あるいは、受付部11は、暗号処理装置1が実行する他のプロセスから暗号文の入力を受け付ける。
 第1演算部12は、受付部11が受け付けた入力暗号に対して、第1準同型演算を行う。
 第2演算部13は、第1Bootstrapping部15から出力される暗号文に対して、第2準同型演算を行う。
 第3演算部14は、第2Bootstrapping部16から出力される暗号文に対して、第3準同型演算を行う。
 第1演算部12、第2演算部13、及び第3演算部14は、下記に説明する暗号化データベースに対する集約・入れ替え操作のための準同型演算をソフトウェアで実現する演算処理部である。第1演算部12、第2演算部13、及び第3演算部14の少なくとも一つが、ハードウェアで実現されてもよい。
 第1Bootstrapping部15は、第1演算部12の演算結果に対して下記に説明するGate Bootstrapping処理を行って、新たな暗号文を出力する。
 第2Bootstrapping部16は、第2演算部13の演算結果に対して下記に説明するGate Bootstrapping処理を行って、新たな暗号文を出力する。
 第3Bootstrapping部17は、第3演算部14の演算結果に対して下記に説明するGate Bootstrapping処理を行い、新たな暗号文を出力する。
 集約部21は、暗号化データベースを集約するための処理を行う。
 比較部22は、集約結果のソート(条件付き入れ替え)のために、隣接する暗号文同士を比較する。
 置換部23は、暗号化データベースの集約結果をソートするために、比較部22による比較結果に基づいて、第1~第3演算部12~14、第1~第3算出部15~17の処理によって得られた新たな暗号文で、元の暗号文を置き換える。
 出力部18は、最終的な演算結果を暗号処理装置1の外部、あるいは、暗号処理装置1で実行される別の処理プロセスに対して出力する。
 記憶部20は、入力暗号文や、条件付き入れ替えの演算で用いられる一時ファイルや一時データ、出力暗号文を格納することができる。
 また記憶部20には、暗号化された暗号化データベース60を格納することができる。
 通信部25は、暗号処理装置1をネットワークに接続し、外部装置との通信を可能にする。
 記憶部20に暗号化された暗号化データベース60を格納し、通信部25を備えることにより、暗号処理装置1は、データベースサーバとして機能することができる。
 この場合、暗号処理装置1は、外部装置としての端末装置から、暗号化されたクエリを受け付け、暗号化された暗号化データベース60に対する検索を行い、暗号化された検索結果を端末装置に応答することができる。
 入力部26は、暗号処理装置1に対して、演算処理対象の暗号文や、暗号化データベース60に対するクエリを入力する。
 図3は、本実施形態の暗号処理装置の演算プロセスを詳しく説明する図である。
 図3の説明において、暗号処理装置1に入力される暗号文az、bz、czは、いずれも上記論文に示されるTLWE暗号文である。TLWE暗号は、0又はμ(非0)の値を平文として有するBit-wise型の完全準同型暗号である。
 論理ゲートを用いた論理演算によって様々な演算を行うことができる。
 また後述するように、TLWE暗号文は、二進数のシンボル0又は1に対応する所定の値に所定の分散を持つ誤差を与えた値を平文として2値を有し、復号することなく論理演算が可能である。
 図3に示す構成では、非特許文献1の論文(上記論文)で提示された(2値)Gate Bootstrappingを使用する。
 上記論文で提示されているTFHEのGate Bootstrappingについては下記に詳述する。
 入力された暗号文az、czを第1演算部12に入力して準同型演算(暗号文az+cz-(0,1/8))を行い、その演算結果である暗号文ctを2値Gate Bootstrappingを行う第1Bootstrapping部15に入力する。
 第1Bootstrapping部15の出力は、平文として2値(0,μ)の何れかを取り得る一時暗号文tzである。
 暗号文tz、暗号文bzを第2演算部13に入力して準同型演算(tz+bz-(0,1/8))を行い、その出力結果を第2算出部16に入力し、2値Gate Bootstrappingが行われて一時暗号文uzが出力される。
 暗号文uz、暗号文czを第3演算部14に入力して準同型演算((0,1/4)-uz+cz)を行い、その出力結果を第3算出部に入力し、2値Gate Bootstrappingが行われて新たな暗号文az’、新たな暗号文bz’が出力される。
 第1演算部12による準同型演算、第2演算部13による準同型演算、第3演算部14による準同型演算に要する時間は微々たるものである。Gate Bootstrappingは、準同型演算を用いてMUX演算を処理するとき、ほとんど全ての処理時間を消費している。
 図1に示す暗号処理装置50のように、2値Gate Bootstrappingを用いて全加算器の演算を行う場合、MUX演算部51、52夫々におけるAND回路部53、54、OR回路部56の後段で計3回、全体で6回Gate Bootstrappingを実行する必要がある。AND回路部53、54を並列処理することにより1つのMUX演算部は2ゲート分の処理(Bootstrappingの段数は2段階)で行い得る。従って、MUX演算部51、52全体を4ゲート分の処理(Bootstrappingの段数は2段階)で行うことが出来る。
 TFHEで説明されるGate Bootstrappingについて詳述する。
 Gate Bootstrappingは、膨大なデータ量や演算時間のために実用的とは言えなかった完全準同型暗号を実用的にするための手法である。
 上記論文のTFHEでは、LWE(Learning with Errors)暗号を円周群上で構成した「TLWE暗号」と呼ばれる暗号を用い、演算時の誤差を小さくしながら高速かつ小さなデータサイズでTLWE暗号文同士の各種準同型論理演算(ひいては加算・乗算などの任意の演算)を実現する。
 TFHEにおけるGate Bootstrappingの入力は秘密鍵で暗号化されたTLWE暗号文である。
 TFHEでは、TLWE暗号文を基本として完全準同型暗号(FHE)を実現する。
 TLWE暗号は、格子暗号の一種であるLWE暗号の変形(LWE暗号を円周群上で定義したもの)である。
 TLWE暗号は加法準同型であり、TLWE暗号化された平文同士の加法演算を、暗号文を復号することなく行うことができることが知られている。
 図4は、TLWE暗号が平文として有する円周群を説明するイメージ図である。
 TLWE暗号は、0から実数の精度で進み1になると0に戻る、図4に示す円周群{T}の点0、又は円周群{T}上の0以外(非0)の任意の点に対応する実数μを平文として有する。TLWE暗号自体は円周群上の任意の点を平文とし、0近辺(誤差含む)とμ近辺(誤差含む)を平文として使用する。
 円周群{T}上の点は、本明細書において「要素」ともいう。
 TFHEを扱う暗号処理装置は、このようなTLWE暗号文同士の演算として加法演算など一般的な準同型演算を実行し、その演算結果の誤差をGate Bootstrappingによって適切な範囲内に収めることによって、再度(後段での)論理演算が可能な完全準同型暗号(FHE)を実現する。
[TLWE暗号]
 TLWE暗号を説明する。
 円周群{T}上の要素として、一様分布な乱数をN個集めたベクトル[a]を用意する。また、0,1の2値をN個集めた秘密鍵[s]を用意する。
 平均値が平文μであり、分散が事前に定めたαとなるようなガウス分布(正規分布)の乱数をeとしたときに、([a],[s]・[a]+e)の組がTLWE暗号文の一例となる。
 同一の平文μに対して無限個のTLWE暗号文を生成した時のeの平均値が平文μであり、μは誤差なしの平文、eは誤差付きの平文である。
 なお、「・」は、ベクトルの内積を表す。以降についても同様である。
 上記[s]・[a]+eをbとおくと、TLWE暗号文は([a],b)と表すことができる。
 φ(([a],b))=b-[s]・[a]=eは、TLWE暗号文を復号する関数である。TLWE暗号は平文に秘密鍵ベクトルと乱数ベクトルの内積と誤差を付加して暗号化するため、秘密鍵ベクトルと乱数ベクトルの内積を算出することで、TLWE暗号を誤差付きで復号することができる。この時、秘密鍵ベクトルが未知の場合は、内積となる成分が算出できないため、復号することができない。
 このTLWE暗号は加法準同型であり、TLWE暗号文の平文同士の加法演算を、暗号文を復号することなく行うことができる。
 2つのTLWE暗号文([a],b)、([a’],b’)をそのまま足して、([a]+[a’],b+b’)としたものを、上記の復号関数φに入力すると、
φ(([a]+[a’],b+b’))=(b+b’)-[s]・([a]+[a’])=(b-[s]・[a])+(b’-[s]・[a’])=φ([a],b)+φ([a’],b’)
となり、2つの平文の和が得られる。これにより、TLWE暗号文が「加法準同型暗号」であることがわかる。
 上記論文のTFHEでは「平文に誤差を付加したTLWE暗号文に対して加法演算を行い、Gate Bootstrappingで誤差を削減する」ことを繰り返していくことで、様々な演算を実現する。
 なお、下記において、([0],μ)などの「自明な暗号文(trivial)」は、あらゆる秘密鍵で復号が可能なTLWE暗号文であり、すなわち、どのような秘密鍵を用いても同じ平文を復号できる暗号文である。
 ([0],μ)において、[0]は、ゼロベクトルを表す。
 「自明な暗号文」は、TLWE暗号文として扱えるが、実質的に平文がそのまま入っている状態と言える。
 TLWE暗号文([0],μ)は、復号関数φにかけると、φ(([0],μ))=μ-[s]・0=μとなり、秘密鍵[s]がゼロベクトル[0]と掛け合わされて消えるため、容易に平文μが得られる。このような暗号文は、平文μに対して自明な暗号文に他ならない。
 TFHEのGate Bootstrappingで用いる「有限巡回群」を説明する。
 Gate Bootstrappingでは、「多項式環の剰余環」を、有限巡回群として用いる。
 「多項式環の剰余環」が有限巡回群であることを説明する。
 n次の多項式は、一般にa+an-1n-1+…+aと表される。
 これらの全ての集合は、多項式同士の和f(x)+g(x)に対して可換群をなす。
 また、多項式同士の積f(x)g(x)は、逆元が存在するとは限らないことを除き、可換群と同様の性質を持つ。そのようなものをモノイドと呼ぶ。
 多項式同士の和と積に対しては、下記のように分配法則が成り立つ。
f(x){g(x)+g’(x)}=f(x)g(x)+f(x)g’(x)
 従って、多項式を要素として多項式同士の和・積を定義すると「環」をなし、これを多項式環と呼ぶ。
 TFHEでは、有限巡回群である円周群{T}を係数とする多項式環を用い、このような多項式環をT[X]と表記する。
 多項式環である多項式T(X)をT[X](X+1)+T[X]のかたちに分解し、剰余部分だけを取り出して集めると、これもまた「環」であるため「多項式環の剰余環」が得られる。
 TFHEでは、「多項式環の剰余環」をT[X]/(X+1)と表す。
 「多項式環の剰余環」T[X]/(X+1)の要素(元)として、任意の係数μ(μ∈T)を用いて、多項式F(X)=μXn-1+μXn-2+・・・+μX+μ
を取り出す。
 多項式環の剰余環の要素F(X)にXを掛けると、μXn-1+μXn-2+・・・+μX-μとなって、一番上の項の係数がプラスからマイナスに反転して定数項として現れる。
 さらにXを掛けると、μXn-1+μXn-2+・・・+μX-μX-μのように、もう一度同じことが起きる(一番上の項の係数がプラスからマイナスに反転して定数項として現れる)。
 これを全部でn回繰り返すと、
-μXn-1-μXn-2・・・-μX-μとなって全ての項の係数がマイナスとなる。
 さらにXを掛け続けると、
-μXn-1-μXn-2・・・-μX+μ
-μXn-1-μXn-2・・・+μX+μ
と一番上の項の係数がマイナスからプラスに反転して定数項として現れていき、全部で2n回繰り返すと、元の多項式環の剰余環の要素F(X)=μXn-1+μXn-2+・・・+μX+μに戻る。このように、最上位の係数(μ)が最下位の定数項に符号反転して(-μ)現れて、全体的に項が1つ、ずれている。
 すなわち、多項式F(X)=μXn-1+μXn-2+・・・+μX+μは、「多項式環の剰余環」T[X]/(X+1)という環のなかで位数2nの有限巡回群になっている。
 TFHEにおいて、暗号処理装置は、このような「多項式環の剰余環」に基づく多項式F(X)が有する性質を利用して完全準同型暗号を実現する。
[TRLWE暗号]
 Gate Bootstrappingでは、TLWE暗号の他に「TRLWE暗号」と呼ばれる暗号を利用する。
 TRLWE暗号について説明する。
 TRLWE暗号の「R」は「環」を意味し、TRLWE暗号は「環」で構成したLWE暗号である。TLWE暗号がそうであるように、TRLWEもまた加法準同型暗号である。
 TRLWE暗号における「環」は、上記した「多項式環の剰余環」T[X]/(X+1)である。
 TRLWE暗号を得るに当たり、「多項式環の剰余環」T[X]/(X+1)の要素(元)をランダムに選択する。
 実際には、n-1次多項式の係数n個を、円周群{T}から一様分布な乱数で選出する。
 多項式の次数がn-1であれば、X+1で割れることがなく、剰余を考える必要がないため、次数がn-1の多項式を多項式a(X)とする。
 0,1の2値からランダムにn個を集めて、下記の秘密鍵となる多項式s(X)を組み立てる。
s(X)=sn-1n-1+sn-2n-2+・・・sX+s
 n個の乱数eを、平均値が平文μになり分散がαとなるガウス分布(正規分布)の乱数とし、これらから下記の多項式e(X)を組み立てる。
e(X)=en-1n-1+en-2n-2+・・・eX+e
 s(X)・a(X)+e(X)を、f(X)(X+1)+b(X)と分解して、b(X)を得る。
 その結果、TRLWE暗号文として、(a(X),b(X))が得られる。
 TRLWE暗号は、TLWE暗号と同様に乱数を用いて暗号化を行うため、同一の秘密鍵、平文に対して、無数の暗号文が対応しうる。
 また、TRLWE暗号は、TLWE暗号と同様に、φ((a(X),b(X))=b(X)-s(X)・a(X)+g(X)(X+1)として、φがT[X]/(X+1)の元となるようにg(X)を定めたものが、復号関数として機能する。
[Gadget Decomposition]
 Gadget Decompositionについて説明する。
 TRLWE暗号文で用いている多項式の係数は、図4の円周群{T}の要素である0以上1未満の実数であり小数部分のみを有する。
 これを二進数表記で何ビットずつかに分解する操作を、上記論文のTFHEではGadget Decomposition(Dec)と定義している。
 例えば、TRLWE暗号文の多項式F(X)の次数nがn=2として、分割の1単位をBg=2で、l=3要素に分解する。このとき、各要素は-Bg/2からBg/2の間に入るようにする。
 TRLWE暗号文は、上記の(a(X),b(X))のように、2つの多項式の組み合わせである。従って、TRLWE暗号文dを、多項式環の剰余環の元となる多項式を要素とする2次元のベクトルと見なして、例えば、
d=[0.75X+0.125X+0.5,0.25X+0.5X+0.375]
と書くことができる。そのため、以下では各要素をBg-1=0.25のべき乗の和の形に分解する。
 円周群{T}上では、0.75=-0.25であるので、
d=[0.75X+0.125X+0.5,0.25X+0.5X+0.375]
=[-0.25X+0.125X+0.5,0.25X+0.5X+0.25+0.125]
=[0.25×(-X+2)+0.25×2X+0.25×0,0.25×(X+2X+1)9+0.25X×2+0.25×0]
と分解できる。
 従って、Gadget Decompositionを行うと、
 Dec(d)=[-X+2,2X,0,X+2X+1,2,0]
というベクトルになる。
 ベクトルから暗号文に逆変換する作用素Hも定義する。
 上記の例に基づいて説明すると、
Figure JPOXMLDOC01-appb-I000001
 という行列が、逆変換の作用素Hとなる。Dec(d)・Hを演算することで、TRLWE暗号文d’が得られる。下位ビットは四捨五入をしてまるめられている。
 TRLWE暗号文dに対して、||d-[v]・H||が最小値となる[v]を得る操作が、Gadget Decompositionであるとも言える。ここで||はベクトルのノルム(長さ)である。
 e(X)の係数全てが平均値0となり、分散はαとなる多項式でできた暗号文Zi=(a(X),b(X))を2l(エル)個生成する。
 そして、平文μを以下のように暗号化し、以下の暗号文kを得る。
Figure JPOXMLDOC01-appb-I000002
 この暗号文kをTRGSW暗号文BKとして定義する。
 TRGSW暗号文BKは、下記に用いるBootstrapping Keyを構成する。
 Bootstrapping Keyを説明する。
 Bootstrapping Keyは、Gate Bootstrappingに用いるために、秘密鍵を暗号化しておくために利用する。
 TLWE暗号文に用いる秘密鍵[s](N次)とは別に、Gate Bootstrappingに使うために、秘密鍵[s]を暗号化するための秘密鍵[s’]の各要素を0か1の2値で選択する。
 秘密鍵[s’]の次数は、TRLWE暗号で使用する多項式の次数nとそろえる必要がある。
 秘密鍵[s]の要素ごとにTRGSW暗号文BKを作成する。
 秘密鍵[s’]で復号するとφs’(Zj)=0となるTRLWE暗号文Zjを2l(エル)個作成する。
 そして、上記したTRGSW暗号文の構成どおり、
Figure JPOXMLDOC01-appb-I000003
とする。
 このTRGSW暗号文を、秘密鍵[s]の次数と同じN個用意したセットを、Bootstrapping Keyと呼ぶ。
 TRGSW暗号文BKiとTRLWE暗号文dの外積を、
BKi×d=Dec(d)・BKi
と定義する。
 Gadget Decompositionは、TRLWE暗号文dに対して||d-[v]・H||が最小値となる[v]を得る操作であった。
 従って、[v]=Dec(d)と誤差(ε(X),ε(X))を用いて、
[v]・H=d+(ε(X),ε(X))と書ける。
 その結果、BKi×d=Dec(d)・BKi
Figure JPOXMLDOC01-appb-I000004
となる。
 左半分は内積を計算し、右半分には[v]・H=d+(ε(X),ε(X))を代入すると、

Figure JPOXMLDOC01-appb-I000005
となり、下記の3つの暗号文c1、c2、c3の和の計算と同じとなる。
Figure JPOXMLDOC01-appb-I000006
 TRLWE暗号は加法準同型暗号であるため、暗号文同士の和をとると平文同士の和をとったことと同じである。
 Cは、Zを何倍かして足したものなので、平文φs’(c)の期待値は0となる。
 また復号したφs’(c)は、平文の絶対値の大きさをシステムパラメータで制約することができるので、この後の演算も含めて十分小さくなるように設定する。
 そうするとφs’(BKi×d)=φs’(s×d)となるが、sが0であっても1であっても計算結果は上記3つの暗号文c1、c2、c3の和になる。単純な比較でsが0と1の何れであるかを判別することができない。
 2つの平文μ、μに対応するTRLWE暗号文d、dがあるとして、d=d-dと代入して、最後にdを加算すると、下記のようなCMux関数が完成する。
 CMux(BK,d,d)=BKi×(d-d)+d=Dec(d-d)・BK+d
 CMux関数は、sが0であると平文μの暗号文を復号することなく出力し、sが1であると平文μの暗号文を復号することなく出力する。
 CMux関数は、平文μもしくは平文μの暗号文を計算することができるが、どちらを選択したかは分からない。
 TFHEの2値Gate Bootstrappingは、上記に説明した様々な情報を用いて行われる。
 2値Gate Bootstrappingは、以下に説明する3つのステップ、(1)BlindRotate、(2)SampleExtract、(3)キースイッチングから構成される。
 図5は、2値Gate Bootstrappingの動作イメージ図である。
 2値Gate Bootstrappingは、下記に説明する3つのステップによってTLWE暗号文同士の準同型演算結果が有する平文に対する誤差の削減を行う。
 以下の説明で、特に説明をしない場合、「平文」とは、TLWE暗号文同士で演算した結果の平文同士の演算結果を意味するものとする。
 図4の円周群{T}における0~0.25(1/4)、0.75(3/4)~1の区間の平文を0のTLWE暗号文に変換し、0.25(1/4)~0.75(3/4)の区間の平文を0.25(1/4)の暗号文に変換する。
 この変換の際、平文に付加される誤差は±1/16の範囲のいずれかである。
(1)BlindRotate
 Gate Bootstrappingの最初のステップとしてBlindRotateが行われる。
 BlindRotateは、TRLWE暗号文を作成する工程である。
 BlindRotateでは、多項式T(X)を平文とする自明なTRLWE暗号文(0,T(X))から、X-φs(c’)を乗算したTRLWE暗号文を復号することなく得る。「0」は、0次の多項式0を示す。
 ここでφs(c’)は、下記のLWE暗号文c’を復号関数にかけた平文である。
 BlindRotateでは、上記した有限巡回群をなす、テストベクタとしての下記の多項式F(X)
F(X)=μXn-1+μXn-2+…μX+μ
ただし、μ=1/8
にXn/2を掛けて得た下記の多項式T(X)
T(X)=F(X)・Xn/2
を用意する。
 平文μ1を秘密鍵[s]で暗号化したTLWE暗号文cがあるとする。
 このTLWE暗号文c=([a],b)の各要素を2n倍して四捨五入したLWE暗号文c’=([a’],b’)を得る。
 LWE暗号文c’=([a’],b’)を復号すると、μ1’=φ(c’)≒2n×φ(c)=2nμ1となる。nが大きくなるほど相対的に誤差は小さくなる。
 多項式T(X)を平文とする自明なTRLWE暗号文(0,T(X))を用意して、
=X-b’×(0,T(X))=(0,X-b’×T(X))とする。0は、0次の多項式0を示す。この時、b’は整数であるため、累乗が自然に定義できる。
 以降、上記に説明したBootstrapping KeyであるBKを用いて、順番にA=CMux(BK,Ai-1,Xa’ii-1)を計算する。ここでも、a’iが整数になっているため、Xの累乗が自然に定義できる。
 そうすると、sが0の時は、平文はそのまま変わらず、sが1の時は、Xa’iが順番に乗算されていく。
 従って、
Figure JPOXMLDOC01-appb-I000007
と繰り返すと、
Figure JPOXMLDOC01-appb-I000008
となる。
 ここで、
Figure JPOXMLDOC01-appb-I000009
は、復号関数φs(c’)の符号を反転したものに等しいので、
Figure JPOXMLDOC01-appb-I000010
となる。ここでφs’(A)は、多項式T(X)にX-1をμ1’回乗算した多項式の暗号文である。
(2)SampleExtract
 (1)のBlindRotateで得たTRLWE暗号文Anを復号して得られる平文多項式φs’(A)を見ると、下位の項から数えてn/2-φ(c’)個分の項は係数が-μとなり、負になった場合、逆に上の項から順に係数が-μとなる。
 TRLWE暗号文Aを復号して得られる平文多項式φs’(A)の定数項だけを見ると、φ(c’)がn/2以上3n/2未満、すなわちφ(c)が1/2±1/4の場合、定数項はμとなる。それ以外、すなわちφs(c)が±1/4の場合、定数項は-μとなる。
 SampleExtractは、(1)のBlindRotateで得たTRLWE暗号文Aから、これを復号することなく平文多項式φs’(A)の定数項の係数だけを取り出して、その結果、TLWE暗号文csを得るための処理である。
 TLWE暗号文csを得るための処理を説明する。
 全てのTRLWE暗号文は、次数をnとして、
Figure JPOXMLDOC01-appb-I000011
と多項式をおいて、(A(X),B(X))と表現することができる。
 これを秘密鍵[s’]で復号したとき、秘密鍵の多項式を
Figure JPOXMLDOC01-appb-I000012
とおいて、
Figure JPOXMLDOC01-appb-I000013
と展開することができる。
 これに対して下記の演算を行い、
Figure JPOXMLDOC01-appb-I000014

を得る。
 「多項式環の剰余環」であるので(X+1)で割った余りを求めると、
Figure JPOXMLDOC01-appb-I000015
が得られる。
 さらに、
Figure JPOXMLDOC01-appb-I000016
とおくと、
Figure JPOXMLDOC01-appb-I000017
となり、
Figure JPOXMLDOC01-appb-I000018
から、平文多項式の各項の係数が求まる。
 そのうち必要なのは定数項の係数であるので、j=0の場合の係数を取り出すと、
Figure JPOXMLDOC01-appb-I000019
が得られる。
Figure JPOXMLDOC01-appb-I000020
とおくと、
Figure JPOXMLDOC01-appb-I000021
のように、TLWE暗号の復号関数に変形することができる。
 つまり、(1)のBlindRotateで得たTRLWE暗号文A=(A(X),B(X))から、係数を
Figure JPOXMLDOC01-appb-I000022
として取り出すと、元のTRLWE暗号文Aに対応する平文多項式の定数項と同じ値を平文とする、新しいTLWE暗号([a”],b)が得られた。この新しいTLWE暗号文は、平文として-μ又はμの2種類を有する。
 得られたTLWE暗号文に対して、平文がμとなる自明な暗号文([0],μ)を加えたTLWE暗号文cs=([a”],b)+([0],μ)がSampleExtractの出力である。
 具体的には、テストベクタとしての多項式F(X)ではμ=1/8であるので、この段階では、-1/8、1/8の暗号文が得られている。
 これに、平文がμ=1/8となる自明なTLWE暗号文([0],1/8)を加えると、
-1/8+1/8=0
1/8+1/8=1/4
から、0、1/4の2値のうちいずれかの値を平文として持つ新たなTLWE暗号文csが得られた。以上の操作を、TFHEではSampleExtractと呼ぶ。
(3)キースイッチング
 (2)のSampleExtractで得られたTLWE暗号文csは、秘密鍵[s]ではなく、秘密鍵[s']で暗号化されている
 従って、TLWE暗号文csを復号することなく、TLWE暗号文csの鍵を秘密鍵[s]に差し替え、秘密鍵[s]で暗号化された状態に戻す必要がある。
 そのためキースイッチングの手法を説明する。
 NAND演算に用いるTLWE暗号文の秘密鍵[s]はN次のベクトルであった。
 これを用い、Bootstrapping Keyを作成したときのn次のベクトルの秘密鍵[s’]を暗号化する。
 すなわち、
Figure JPOXMLDOC01-appb-I000023
と、円周群{T}の要素、0から1の実数を二進数で表現したときの各桁にずらした値として暗号化する。秘密鍵は[s]である。「桁数」tはシステムパラメータである。
 秘密鍵[s]で復号すると、
Figure JPOXMLDOC01-appb-I000024
となる。これが「キースイッチングキー」である。
 上記したように(2)で得られたTLWE暗号文cs=([a],b)は秘密鍵[s’]で暗号化された0又は1/4の値である。[a]の要素数は、秘密鍵[s’]と同じくn個である。
 これを一つずつ、夫々tビットの固定小数に変換すると、
Figure JPOXMLDOC01-appb-I000025
の形式で書くことができる。
 この段階で誤差が増えるが、システムパラメータで絶対値の最大値を制約することができる。
 キースイッチング本体の処理として、以下のTLWE暗号文cxを計算する。
Figure JPOXMLDOC01-appb-I000026
 ([0],b)の項は自明な暗号文なので、復号するとbであり、TLWE暗号文cxを復号した結果を計算すると、
Figure JPOXMLDOC01-appb-I000027
である。
 s’は、jに対して定数なのでくくりだして
Figure JPOXMLDOC01-appb-I000028
とし、上記で固定小数に分解したときの式を代入する。
Figure JPOXMLDOC01-appb-I000029
 その結果、
Figure JPOXMLDOC01-appb-I000030
となって鍵の切り替えが成功したことになる。
 ここで得られたTLWE暗号文cxは、Gate Bootstrappingの入力としたTLWE暗号文cと同じ秘密鍵[s]で暗号化されている。
 キースイッチングの処理を行うことにより、秘密鍵[s]で暗号化されたTLWE暗号文に戻っており、φ(c)が±1/4の範囲なら平文φ(cx)は0に、φ(c)が1/2±1/4の範囲なら、平文φ(cx)は1/4になっている。
 以上の処理により、Gate Bootstrappingの結果として、0、1/4の2値のうちのいずれかであって誤差が±1/16以内のいずれかになるTLWE暗号文が得られた。
 誤差の最大値は、入力となるTLWE暗号文cに依存せず、システムパラメータによって固定された値となる。
 従って、誤差の最大値が入力となるTLWE暗号文と同じ±1/16以内のいずれかの値となるように、システムパラメータを設定する。
 これにより、何度でもNAND演算ができるようになり、加算、乗算をはじめとしてあらゆる演算が可能となる。
 Gate Bootstrappingから出力されるTLWE暗号の「平文」に乗っている誤差は、TLWE暗号文の整数化で加わる誤差、CMuxで加わる誤差、キースイッチングで固定小数化した時の誤差等である。これらの誤差は全てシステムパラメータで制約でき、全てを考慮した誤差が±1/16となるようにシステムパラメータを調整することができる。
 以上が、TFHEのGate Bootstrappingの処理である。
 上記に説明したTFHE暗号を扱う暗号処理装置1は、以下のような実施例に適用することができる。
 例えば、フィールドやレコードがTLWE暗号で暗号化されているデータベース(以下、暗号データベース)に対して、カテゴリ(地区ごとの平均年齢など)ごとに集約したい場合がある。
 このとき暗号処理装置1は、暗号化データベースを管理するデータベースサーバであり、ネットワーク等を介して接続された端末装置から、TLWE暗号で暗号化されたクエリを受け付け、クエリに対する応答を、TLWE暗号で暗号化した状態で端末装置に返却する。
 TFHEは決定性暗号ではないため、暗号化データベースでは、同一の平文に対して無数の暗号文が対応している。
 そのため、暗号化データベースをカテゴリごとに集約したい場合に、レコードをどのカテゴリとして集約すればよいのかわからない。
 下記に説明する手法によれば、暗号化データベースをカテゴリごとに分類した上で集約を行い、集約結果を高速にソート(入れ替え)することができる。
 本実施形態による集約結果のソート(入れ替え)手法により、値の大きい順(降順)や小さい順(昇順)に集約結果を並べた上で、クエリに応答することができる。
 本実施形態によるソート方法では、ソート(入れ替え)に用いる演算を高速化し、本実施形態のソート方法を用いない実装と比較して約20%低いレイテンシでの応答が可能となる。
 本実施形態において、カテゴリごとに分類して集計(集約)を行うために、暗号処理装置1は、空の返答を予め作成する。
 そして、空の返答に対して暗号化したまま比較を行い、カテゴリが一致した場合にのみクエリのカラムを加え、一致しない場合には0を加える処理を繰り返すことでデータベースの集約を行う。
 集約結果のソートには、バブルソートを用いる。
 バブルソートは、隣り合うふたつの要素の値を比較し、値の大きい順(降順)、あるいは値の小さい順(昇順)に、要素を入れ替える整列アルゴリズムである。
 バブルソートは、平均計算時間がO(q)と比較的遅いため、平文でソートを行う際にはあまり用いられない。
 しかしバブルソートは、最悪計算量O(q)だけ処理を繰り返せば、必ずソートが完了する利点がある。またバブルソートは、クイックソートのようにデータの中身によって処理を変えることがないため、暗号文を暗号化したままの処理が可能である。
 さらに、バブルソートでは、比較を行い大小関係が逆であれば順序を入れ替える、という操作をデータ数q-1の二乗回((q-1))繰り返すが、比較は、引き算を行った際のボロービットで判断できる。
 暗号化されたレコードのバブルソートにおいて、隣り合う暗号化されたレコード同士の比較に関しては、完全準同型暗号の演算が可能な全加算器の構成を適用して実行することができる。
 完全準同型暗号の演算が可能な全加算器をソフトウェアで実装するとき、暗号文に対して論理回路(論理ゲート)を設計するイメージで演算を行う。
 全加算器回路は、2つの半加算器と1つのOR回路部(ORを得るための演算処理部)から構成される。
 第1半加算器は、AND回路部(ANDを得るための演算処理部)とXOR回路部(XORを得るための演算処理部)を備える。
 第2半加算器は、AND回路部(ANDを得るための演算処理部)とXOR回路部(XORを得るための演算処理部)を備える。
 加算される入力Aと入力Bが第1半加算器のAND回路部とXOR回路部に入力される。
 第1半加算器のAND回路部の出力と、第2半加算器のAND回路部の出力と、が後段のOR回路部に入力され、OR回路部からは桁上げ出力(Carry out)が出力される。
 第1半加算器のXOR回路部からの出力と、桁上げ入力(Carry in)が第2半加算器のAND回路部とXOR回路部に入力される。
 第2半加算器のXOR回路部からは、全加算器回路の出力(Sum)が出力される。
 バブルソートでは、この比較結果によって隣り合うレコードを入れ替えたり、あるいは入れ替えなかったりする処理を行う。
 TFHEの場合、図1でも説明した準同型MUX(上記論文ではHomMUX)を用いた高速な条件付き入れ替え演算をバブルソートの処理に利用することもできる。
 本実施形態の暗号処理装置1による、暗合化されたデータベースの集約処理をより具体的に説明していく。
 図6は、暗号化データベースの一例を示す図である。
 図6に示す暗号化データベース60は、例えば、情報処理装置1の記憶部20に格納される。情報処理装置1は、暗号化データベース60を管理し、外部装置からのクエリに応じて暗号化データベース60に対する操作を行うデータベースサーバとして機能し得る。
 図6の暗号化データベース60は、カラム61、カラム62、カラム63を備えている。
 カラム61には「名前」、カラム62には「住所」、カラム63には「年齢」が格納される。
 「名前」カラム61の先頭フィールドには見出し「名前」が格納され、「住所」カラム62の先頭フィールドには見出し「住所」が格納され、「年齢」カラム63の先頭フィールドには、見出し「年齢」が格納されている。
 「名前」カラム61、「住所」カラム62、「年齢」カラム63が備える夫々備える複数のフィールドに、データが登録されている。
 なお、図6に示す暗号化データベース60には、説明の便宜上平文が表示されているが、実際には、暗号化データベース60の全てのデータは全てTFHEで利用可能なTLWE暗号文である。
 また、下記の説明では、図6の暗号化データベース60における見出しを表示する先頭行は行数に含めないものとする。実際に名前や住所、年齢を登録している暗号化データベース60の2番目の行(名前フィールドに「鈴木太郎」)を1行目とし、3番目の行(名前フィールドに「佐藤たかし」)を2行目とし、以下同様とする。
 本実施形態において、情報処理装置1は、一例として、暗号化データベース60に対して「住所」ごとの「平均年齢」を得るクエリを実行する。
 暗号化データベース60の集約処理に当たって、本実施形態では、図7に示すような空の応答(空テーブル)を利用する。
 図7は、空の応答としてのテーブルの一例を示す図である。
 図7の空テーブル(TBL)70の各フィールドには、クエリのキーである「住所」と、集約処理で求めるべき「年齢の合計」、「人数」が格納される。
 空テーブル70は、カラム71、カラム72、カラム73を備えている。
 カラム71には「住所」、カラム72には「年齢の合計」、カラム73には「人数」が格納される。
 「住所」カラム71の先頭フィールドには見出し「住所」が格納され、「年齢の合計」カラム72の先頭フィールドには見出し「年齢の合計」が格納され、「人数」カラム73の先頭フィールドには、見出し「人数」が格納されている。
 上記のように、「住所」カラム71の各フィールドには、図6の暗号化データベース60の「住所」カラム62に登録されるデータと同じ「住所」のデータが格納されている。本実施形態のクエリは、暗号化データベース60において、少なくとも「住所」を格納する「住所」カラム62にどのようなデータが登録されているかが既知であることを前提に実行されるのである。
 初期状態の空テーブル70には、集約処理で求めるべき「年齢の合計」を格納する「年齢の合計」カラム72と「人数」を格納する「人数」カラム73の全てのフィールドに、「0」が登録されている。
 空テーブル70の全てのデータは、TFHEの手法で暗号化されたTLWE暗号文である。
 なお、空テーブル70の作成とその暗号化の作業は、クエリを投げるすなわち検索要求を行う端末装置側で行ってもよいし、暗号化データベース60を管理する暗号処理装置1側で行ってもよい。
 暗号処理装置1は、暗号化データベース60(図6)の「住所」カラム62の特定の行(レコード)に登録される住所データに対して、空テーブル70(図7)の「住所」カラム71の全ての行に登録される住所データを順次比較する。
 住所データの同士の比較は、文字列データの比較である。暗号化データベース60の住所データと空テーブル70の一の住所データとを比較する際、暗号処理装置1は、暗号化データベース60及び空テーブル70の住所データの同じ位置のビット同士に対し、TFHEによるビット演算のEXNORを実行する。
 詳しくは、暗号処理装置1は、暗号化データベース60の住所データと空テーブル70の住所データの1ビット目同士、2ビット目同士、3ビット目同士・・のEXNORを行う。
 EXNORでは、一致するビットは「1」となり異なるビットは「0」となる。暗号処理装置1は、EXNORの結果同士をANDで集約する。
 暗号化データベース60と空テーブル70の住所データが完全に一致していれば集約結果として「1」の暗号文が得られ、一部でも一致していなければ「0」の暗号文が得られる。
 すなわち、暗号処理装置1は、暗号化データベース60の住所データと空テーブル70の住所データとを夫々ai,bi(iは文字列データのビット単位での位置)としたときに、cr=(a0 EXNOR b0)AND(a1 EXNOR b1)AND・・・を計算する。
 計算の結果得られるcrは暗号化データベース60の住所データと空テーブル70の住所データの比較結果である。
 両データが完全に一致、すなわち同じ住所であれば、比較結果crの平文はビットとして「1」となり、一致していなければ比較結果crの平文はビット「0」である。
 次に暗号処理装置1は、暗号化データベース60の「年齢」カラム63のフィールドに格納されるビット値に対して、対応する住所に関する上記比較結果cr(平文がビットとして「1」又は「0」の暗号文)を準同型AND(上記論文ではHomAND)処理する。
 その結果、住所が一致している場合(比較結果crの平文がビットとして「1」の場合)には、対応する「年齢」が得られ、住所が異なる場合(比較結果crの平文がビット「0」の場合)には、「0」が得られる。
 暗号処理装置1は、空テーブル70の「住所」カラム71の全ての住所フィールドのデータに対して同様の演算を行う。
 暗号処理装置1は、比較を行った住所に対応する空テーブル70の「年齢の合計」カラム72のフィールドに、得られた「年齢」の値(暗号文)を加算する。
 このとき暗号化データベース60と一致していた住所に対応する空テーブル70の「年齢の合計」カラム72のフィールドには、得られた「年齢」の値(暗号文)が加算されている。暗号化データベース60と一致していなかった住所に対応する「年齢の合計」カラム72のフィールドに「0」が加算されている。
 すなわち、暗号処理装置1は、空テーブル70の値と暗号化データベース60の値を比較し、比較結果crを得る。そして暗号処理装置1は、暗号化データベース60の値と比較結果cr(平文がビット「1」又は「0」の暗号文)のANDをとってから加算する。このとき、空テーブル70の値と暗号化データベース60の値が一致していた場合には暗号化データベースの値が、異なっていた場合には0が、空テーブル70に加算されている。
 また暗号処理装置1は、比較を行った住所に対応する空テーブル70の「人数」カラム73のフィールドに、得られた「人数」の値(暗号文)を加算する。
 このとき暗号化データベース60と一致していた住所に対応する空テーブル70の「人数」カラム73のフィールドに、比較結果cr(平文がビット「1」の暗号文)が加算されている。また暗号化データベース60と一致していなかった住所に対応する空テーブル70の「人数」カラム73のフィールドには、比較結果cr(平文がビット「0」の暗号文)が加算されている。
 以上の処理を、暗号化データベース60の全ての行に対して行うと、最終的に、図8に示す、「年齢の合計」と人数とを住所ごとに集計した集約結果テーブル80が得られる。
 なお、上記の比較結果crは、暗号化された状態で得られており、暗号処理装置1は、比較結果crの平文を知ることはない。すなわち、暗号処理装置1は、暗号化データベース60の住所データと空テーブル70の住所データとが一致しているか否かが分からない。
 上記のように暗号処理装置1は、比較結果crの平文がビット「1」と「0」の何れであっても、暗号化データベース60の値と比較結果crの準同型AND(HomAND)をとることによる加算処理を行う。
 暗号処理装置1は、暗号化データベース60の住所データと空テーブル70の住所データが一致しているか否かによって処理を分岐することはない。
 より具体的に、暗号化データベースの集約処理を説明する。
 例えば暗号処理装置1は、暗号化データベース60の1行目のレコード(名前:鈴木太郎、住所:千代田区、年齢:46)の住所フィールドのデータと、空テーブル70の住所フィールドの各データ(千代田区、港区、台東区)と、に対してビットごとのEXNORとANDによる集計を行う。
 この場合、空テーブル70の「千代田区」について、比較結果としての平文がビット「1」の暗号文が得られる。
 従って、暗号処理装置1は、暗号化データベース60の1行目のレコードにおける年齢フィールドの値に比較結果cr(平文がビット「1」)をANDして得た「46」を、空テーブル70の千代田区に該当する行の年齢の合計フィールドに加算し、空テーブル70の千代田区に該当する行の人数フィールドに1(比較結果としての平文がビット「1」の暗号文)を加算する。「千代田区」以外の他の住所は、比較結果が、平文がビット「0」の暗号文となるので、該当する行の年齢の合計フィールド、人数フィールドには0が加算される。
 次に、暗号処理装置1は、暗号化データベース60の2行目のレコード(名前:佐藤たかし、住所:港区、年齢:50)の住所フィールドのデータと、空テーブル70の住所フィールドの各データ(千代田区、港区、台東区)と、に対してビットごとのEXNORとANDによる集計を行う。
 この場合、空テーブル70の「港区」について比較結果としてビット「1」の暗号文が得られる。
 従って、暗号処理装置1は、暗号化データベース60の2行目のレコードにおける年齢フィールドの値に比較結果cr(平文がビット「1」)をANDして得た「50」を、空テーブル70の港区に該当する行の年齢の合計フィールドに加算し、空テーブル70の港区に該当する行の人数フィールドに1(比較結果としての平文がビット「1」の暗号文)を加算する。「港区」以外の他の住所は、比較結果が、平文がビット「0」の暗号文となるので、該当する行の年齢の合計フィールド、人数フィールドには0が加算される。
 次に、暗号処理装置1は、暗号化データベース60の3行目のレコード(名前:田中次郎、住所:千代田区、年齢:34)の住所フィールドのデータと、空テーブル70の住所フィールドの各データ(千代田区、港区、台東区)と、に対してビットごとのEXNORとANDによる集計を行う。
 この場合、空テーブル70の「千代田区」について比較結果としてビット「1」の暗号文が得られる。
 従って、暗号処理装置1は、暗号化データベース60の3行目のレコードにおける年齢フィールドの値に比較結果cr(平文がビット「1」)をANDして得た「34」を、空テーブル70の千代田区に該当する行の年齢の合計フィールドに加算し、空テーブル70の千代田区に該当する行の人数フィールドに1(比較結果としての平文がビット「1」の暗号文)を加算する。「千代田区」以外の他の住所は、比較結果が、平文がビット「0」の暗号文となるので、該当する行の年齢の合計フィールド、人数フィールドには0が加算される。
 次に、暗号処理装置1は、暗号化データベース60の4行目のレコード(名前:吉川幸次、住所:台東区、年齢:58)の住所フィールドのデータと、空テーブル70の住所フィールドの各データ(千代田区、港区、台東区)と、に対してビットごとのEXNORとANDによる集計を行う。
 この場合、空テーブル70の「台東区」について比較結果としてビット「1」の暗号文が得られる。
 従って、暗号処理装置1は、暗号化データベース60の4行目のレコードにおける年齢フィールドの値に比較結果cr(平文がビット「1」)をANDして得た「58」を、空テーブル70の台東区に該当する行の年齢の合計フィールドに加算し、空テーブル70の台東区に該当する行の人数フィールドに1(比較結果としての平文がビット「1」の暗号文)を加算する。
 「台東区」以外の他の住所は、比較結果が、平文がビット「0」の暗号文となるので、該当する行の年齢の合計フィールド、人数フィールドには0が加算される。
 次に、暗号処理装置1は、暗号化データベース60の5行目のレコード(名前:武田定宗、住所:港区、年齢:43)の住所フィールドのデータと、空テーブル70の住所フィールドの各データ(千代田区、港区、台東区)と、に対してビットごとのEXNORとANDによる集計を行う。
 この場合、空テーブル70の「港区」について比較結果としてビット「1」の暗号文が得られる。
 従って、暗号処理装置1は、暗号化データベース60の5行目のレコードにおける年齢フィールドの値に比較結果cr(平文がビット「1」)をANDして得た「43」を、空テーブル70の港区に該当する行の年齢の合計フィールドに加算し、空テーブル70の港区に該当する行の人数フィールドに1(比較結果としての平文がビット「1」の暗号文)を加算する。
 「港区」以外の他の住所は、比較結果が、平文がビット「0」の暗号文となるので、該当する行の年齢の合計フィールド、人数フィールドには0が加算される。
 これを全てのレコードについて実行することで、図8に示す集約結果テーブル80を得ることができる。
 上記の説明では、空テーブル70の住所フィールドとの比較と年齢の合計及び人数の集計は、暗号化データベース60の行ごとに順次行っている。
 それに限らず、「住所」カラム62の住所データと空テーブル70の住所データとの比較をまとめて実行して、空テーブル70の住所レコードに対応する暗号化データベース60の行を記憶しておき、年齢の合計及び人数の集計はあとで一括して行っても良い。逆に、空テーブル70の行ごとに、順次暗号化データベース60の住所フィールドとの比較を行ってもよい。
 空テーブル70の住所フィールドと一致した住所について年齢を得て、住所ごとに人数と年齢を合算して、「年齢の合計」カラム72、「人数」カラム73に格納する点で違いはない。
 図8は、集約結果テーブルの一例を示す図である。
 図8に示す集約結果テーブル80の各フィールドには、「住所」と、集約処理結果としての「年齢の合計」、集約処理結果としての「人数」が格納される。
 空テーブル70は、カラム71、カラム72、カラム73を備えている。
 カラム81には「住所」、カラム82には「年齢の合計」、カラム83には「人数」が格納される。
 「住所」カラム81の先頭フィールドには見出し「住所」が格納され、「年齢の合計」カラム82の先頭フィールドには見出し「年齢の合計」が格納され、「人数」カラム83の先頭フィールドには、見出し「人数」が格納されている。
 図8の集約結果テーブル80に基づいて、「住所」カラム81に格納される各住所について、「年齢の合計」カラム82に格納される対応する「年齢の合計」を「人数」カラム83に格納される対応する「人数」で割ることにより、住所ごとの「平均年齢」を得ることができる。
 集約結果テーブル80に格納される「年齢の合計」と「人数」は何れもBit-wise形式のTLWE暗号文である。
 「平均年齢」を求めるための割り算は、論理演算を用いた2進数の割算(除算)を行う既知の方法を用いて実現することができる。
 暗号化データベース60の集約後、「平均年齢」カラムを集約結果テーブル80の一部として追加して、「平均年齢」カラムにおける各住所との対応フィールドに「平均年齢」の暗号文を書き込んでもよい。
 その場合、「平均年齢」に基づいて「住所」を条件付き入れ替えするときに、「平均年齢」も入れ替えることができる。
 図9は、暗号処理装置による暗号化データベース集約処理の流れを説明するフローチャートである。
 図9に示す処理は、暗号処理装置1(受付部11)が、外部装置から暗号化データベースを集約してソートをするクエリを受け付けたときに行われる処理である。
 暗号処理装置1(集約部)は、ステップS101において、変数mに暗号化データベース60の行数、すなわちレコード数を代入し、変数pに1を代入して初期化する。
 暗号処理装置1(集約部)は、ステップS102において、暗号化データベース60のp行目の住所データと、空テーブル70の全ての住所データと、を夫々比較する。すなわち、上記に説明したように、暗号化データベース60の住所データと、空テーブル70の住所データをai,bi(iは文字列データのビット単位での位置)としたときに、比較結果cr=(a0 EXNOR b0)AND(a1 EXNOR b1)AND…を計算する。
 住所データが完全に一致すると比較結果crはビット「1」の暗号文となり、住所データが異なると比較結果crはビット「0」の暗号文となる。
 暗号処理装置1(集約部)は、ステップS103において、比較結果cr(平文がビット「1」又は「0」の暗号文)を住所データに対応する暗号化データベース60における「年齢」にANDする。
 比較結果crの平文がビット「1」の場合年齢が得られ、これが空テーブル70の年齢の合計フィールドに加算される。
 比較結果crの平文がビット「0」の場合は0が得られ、これが空テーブル70の年齢の合計フィールドに加算される。
 すなわち、暗号処理装置1(集約部)は、暗号化データベース60の年齢をar、空テーブル70の年齢の合計をbrとしたとき、比較結果crを用いて、br+(cr AND ar)を計算する。加算処理は、例えば、上記に説明した全加算器によって行うことができる。
 そして、暗号処理装置1(集約部)は、ステップS104において、比較結果cr(ビット「1」又は「0」の暗号文)を住所データに対応する空テーブル70における「人数」にANDする。
 比較結果crの平文がビット「1」の場合、空テーブル70の人数フィールドに1が加算される。
 比較結果crの平文がビット「0」の場合、空テーブル70の人数フィールドに0が加算される。
 暗号処理装置(集約部)1は、空テーブル70の人数をdrとしたとき、上記crを用いてdr+crを計算して人数を得る。加算処理は、例えば、上記に説明した全加算器によって行うことができる。比較結果crは1bit幅の整数を暗号化したものとして加算される。
 暗号処理装置1(集約部)は、ステップS105において、p=mであるか、すなわち暗号化データベース60の全ての行(レコード)について集約を終えたか否かを判定する。
 p=mでない場合(ステップS105でNo)、暗号処理装置1は、ステップS107において、変数pにp+1を代入してインクリメントし、ステップS102に処理を戻す。
 p=mである場合(ステップS105でYes)、暗号処理装置1(集約部)は、図8の集約結果テーブル80を完成し、暗号化データベース集約処理を終了する。
 この集約結果を、平均年齢が高い方から低い方にソートすることを考える。上記のようにバブルソートを用いると、暗号化したままのソート処理が可能である。
 バブルソートでは、比較結果によって隣り合うデータを入れ替えたり入れ替えなかったりする処理を行う。
 バブルソートの性質として、q行のテーブルをソートする際に(q-1)回比較と入れ替えを繰り返すと、必ず完全にテーブルを降順又は昇順にソートする(入れ替える)ことができる。ここでの(q-1)回の計算を最悪計算量と呼ぶ。
 バブルソートは最悪計算量だけ計算を行えばソートが完了するので、暗号文のソートに好適であるが、同様の性質を有する方法であればバブルソートに限定することなく、別のソート方法を採用してもよい。
 バブルソートは、比較をして入れ替えることを繰り返すのみであるので、暗号文の中身(平文)が分からずともソート処理ができることが利点である。
 一例として、HomMUX(準同型MUX)演算を利用してソート処理を行うことができる。これは、図1で説明した処理である。
 以下の手順(1)~(5)からなる処理を集約結果テーブル80(図8)の行数分繰り返すことで、平均年齢を基準にした集約結果テーブル80の行のソートが可能である。
 下記の説明において、図8の集約結果テーブル80における見出しを表示する先頭行は行数に含めないものとする。実際に住所、年齢の合計、人数を登録している集約結果テーブル80の2番目の行(住所フィールドに「千代田区」)を1行目とし、3番目の行(名前フィールドに「港区」)を2行目とし、以下同様とする。
 i行目の「年齢の合計」カラム82の値と「人数」カラム83の値に基づく平均年齢の値(データ)を暗号文avとする。またi-1行目の「年齢の合計」カラム82の値と「人数」カラム83の値に基づく「平均年齢」を暗号文bvとする。
 暗号文av、暗号文bvは、条件付き入れ替えの基準となる「平均年齢」を示す暗号文である。
 条件付き入れ替えの対象となる「住所」、「年齢の合計」、「人数」に関して、i行目のデータの任意のビットを暗号文azとし、i-1行目のデータの同じ位置のビットを暗号文bzとする。
 新しいi行目のデータを暗号文az’とし、新しいi-1行目のデータを暗号文bz’とする。
 i-1行目の「平均年齢」がi行目の「平均年齢」より大きければ暗号文az’と暗号文azの平文を同じくし、暗号文bz’と暗号文bzの平文を同じくする。そうでなければ暗号文az’と暗号文bz、暗号文bz’と暗号文azの平文を同じくする。
 図8の集約結果テーブル80では、データ行数が3行(q=3)のみであるが、より行数が多い場合でも同じ処理方法で対応することができる。
 本実施形態のバブルソートでは、隣接するi行目のデータとi-1行目のデータを比較して大小によって入れ替える。
 i行目のデータとi-1行目との比較を行うので、i=2行目を初期値として比較を行っていく。
 まず、2行目の港区(i=2)の平均年齢46.5(暗号文av)と、1行目の千代田区(i-1=1)の平均年齢40(暗号文bv)と、を比較する。
 このとき、2行目(i=2)の暗号文av、1行目(i-1=1)の暗号文bvについて減算を行って得たボロービットczと、暗号文az及び暗号文bzとによってMUX演算2回を行い、新たな暗号文az’、暗号文bz’を算出する。
 図8の場合、千代田区の平均年齢(40)<港区の平均年齢(46.5)であり、i行目とi-1行目のレコードが入れ替わり、下記に示すように港区が1行目、千代田区が2行目となる。
Figure JPOXMLDOC01-appb-I000031
 次に、3行目の台東区(i=3)の平均年齢58(暗号文av)と、2行目の千代田区(i-1=2)の平均年齢40(暗号文bv)と、を比較する。
 このとき、3行目(i=3)の暗号文az、2行目(i-1=2)の暗号文bzについて減算を行って得たボロービットcz、暗号文az及び暗号文bzによってMUX演算2回を行い、新たな暗号文az’、暗号文bz’を算出する。
 図8の場合、千代田区の平均年齢(40)<台東区の平均年齢(58)であり、i行目とi-1行目のレコードが入れ替わり、下記に示すように、台東区が2行目、千代田区が3行目となる。

Figure JPOXMLDOC01-appb-I000032
 全ての行数(q行目)まで比較と入れ替えが済んだ結果、最も平均年齢が少ない千代田区が集約結果テーブル80の最も下に位置している。
 上記と同じ処理を、行数分繰り返す。
 なお上記は「住所」についてのソートであり、「年齢の合計」、「人数」についても、ボロービットczを用いて同様の処理を行うことで、集約結果テーブル80全体をソートすることが出来る。
 上記をまとめると、以下の処理を行う。
手順(1):i=2として初期化する。
手順(2):暗号文bv-暗号文avのボロービットを暗号文czとする。
手順(3):暗号文az’を、全ビットに対する後述するHomMUX(cz,az,bz)とする。
手順(4):暗号文bz’を、全ビットに対するHomMUX(cz,bz,az)とする。
 すなわち、手順(3)、手順(4)では、
暗号文az’=HomMUX(cz,az,bz)
暗号文bz’=HomMUX(cz,bz,az)
を、演算する。
 暗号文czの平文が1の場合は暗号文azの平文=暗号文bz’の平文、暗号文bzの平文=暗号文az’の平文であり、平文として、i行目とi-1行目のレコードは元の順序から入れ替わっている。
 暗号文czの平文が0の場合は暗号文azの平文=暗号文az’の平文、暗号文bz=暗号文bz’であり、平文として、i行目とi-1行目のレコードは元の順序から入れ替わっていない。
手順(5):iの値を1増やし、手順(2)に戻る。
 以上の手順を、iの値が集約結果テーブル80の行数qと等しくなるまで繰り返す。
 これによって、最も大きな(小さな)レコードが集約結果テーブル80の最終行に浮かび上がってくる。
 手順(1)~(5)を行数q-1分繰り返し、バブルソートが終了する。
 これによって、暗号化したまま、平均年齢を基準にした集約結果テーブル80のソート(バブルソート)が可能である。
 条件付き入れ替えの対象となる「住所」、「年齢の合計」、「人数」の各カラムのデータについて、手順(1)~(5)を繰り返す処理を行うことにより、集約結果テーブル80全体をソートすることが出来る。
 手順(2)~(4)の処理は、例えば、上記に説明した全加算器と、上記論文に記載のHomMUXによって行うことができる。
 HomMUXについて簡単に解説する。図1で説明したMUX演算では、1つのビットcによって、2つのビットd/dを選択する論理演算は(c AND d)OR((NOT c) AND d)である。ビットcは図1における暗号文cz、2つのビットd/dは暗号文az/bzまたは暗号文bz/azである。
 NOTにGate Bootstrappingは不要なため、AND演算部2つとOR演算部1つで、3Gate Bootstrappingを使用するのが、自然な実装である。図1について説明したように、NOT回路部55にGate Bootstrappingは不要であるので、AND回路部、OR回路部の準同型演算の後段で、夫々Gate Bootstrappingを行う必要がある。
 従って、図1における暗号文az、bzから新たな暗号文az’を演算するためのMUX演算部51、52が備える2つのAND回路部53、54と1つのOR回路部55において、夫々3回のGate Bootstrappingを行う必要がある。
 1回のマルチプレクサの処理で3回のGate Bootstrappingを行い、それを2回行うので、必要な並び替えを行うためには膨大な演算時間を要する。
 上記論文では、これを改良したHomMUXを提案している。
 このHomMUXでは、左辺(c AND d)と右辺((NOT c) AND d)のGate Bootstrappingを、キースイッチングの手前(SampleExtractの後)まで行い、それぞれがs’を秘密鍵とするTLWE暗号文となっている状態で加算する。
 ORの左辺と右辺は同時に1/4になることがないため、左辺のTLWE暗号文(秘密鍵はs’)と右辺のTLWE暗号文(秘密鍵はs’)の和は、0もしくは1/4であり、秘密鍵はs’のTLWE暗号文となる。それからキースイッチングを行うことでsを秘密鍵とするTLWE暗号文にする。
 これは、SampleExtractまでで付与される誤差は、キースイッチングで付与される誤差に比べてはるかに(1桁以上)小さいために可能なことである。キースイッチングの前の加算で誤差が2倍になるが、それでもキースイッチングによる誤差よりもはるかに小さいため無視することができる。
 なお、この方法によるバブルソートでは、暗号処理装置は、手順(2)において、2つの行の順序があっているかを知るために引き算を1回行う。
 手順(2)の結果、必要な入れ替えを行うために、手順(3)、(4)において、THFEのマルチプレクサ(HomMUX)演算を1回の比較につき2回行う。MUX演算1回につきGate Bootstrappingを2回行う場合と同じだけの処理時間を要するため、MUX演算2回ではBlindRotate4回分(4ゲート分)の計算時間を要する。
 これは、上記の例(MUX演算1回につきGate Bootstrappingを3回)と比較すると少ない。しかしながら、q行全てに入れ替えに関しては、引き算を(q-1)回行い、MUX演算式を2(q-1)回行うため、必要なソートを全て行うためには膨大な処理時間がかかることになる。
 そこで、本実施形態では、1回の入れ替えに関して、2回のMUXを行う上記手順のうち、手順(3)及び手順(4)を他の手順で置き換えることで、MUX演算2回分の処理を高速化し、ソートを高速にする。
 具体的には、テストベクタ多項式を改良し、且つ1回のBlindRotateの後でSampleExtractを2回行って2種類の暗号文を取り出すことにより、3ゲート分(Gate Bootstrapping3回分)の処理時間で、1回の入れ替えを行うことができる。MUX演算を用いる場合と比べて単純計算で3÷4=75%となり理論上約25%の高速化が見込め、実装では約21%の高速化が確認された。
 下記に詳しく説明する。
 バブルソートについての基本的な考え方は上記のMUX演算を用いる場合と同じである。暗号文az、暗号文bzから暗号文az’、暗号文bz’を算出する方法が異なる。
 まず、MUX演算を用いる場合と同様に、「年齢の合計」カラム82の値と「人数」カラム83の値に基づいて、集約結果テーブル80(図8)の各行の平均年齢を演算する。
 各行の平均年齢の演算は、例えば上記に説明した全加算器によって行うことができる。
 すなわち、i行目の「平均年齢」を示すデータの任意のビットを暗号文avとし、i-1行目の「平均年齢」示すデータの同じ位置のビットを暗号文bvとする。
 暗号文av、暗号文bvは、条件付き入れ替えの基準となる「平均年齢」を示す暗号文である。
 条件付き入れ替えの対象となる「住所」、「年齢の合計」、「人数」に関して、i行目のデータの任意のビットを暗号文azとし、i-1行目のデータの同じ位置のビットを暗号文bzとする。
 新しいi行目のデータを暗号文az’とし、新しいi-1行目のデータを暗号文bz’とする。
 i-1行目の「平均年齢」がi行目の「平均年齢」より大きければ暗号文az’と暗号文azの平文を同じくし、暗号文bz’と暗号文bzの平文を同じくする。そうでなければ暗号文az’と暗号文bz、暗号文bz’と暗号文azの平文を同じくする。
 TLWE暗号文az、TLWE暗号文bz、さらに下記のTLWE暗号文czは、上記論文通り、ビット「0」の場合は平文として0±1/16とし、ビット「1」の場合は1/4±1/16とする。
 下記の手順(11)~(14)によって平均年齢を基準にした集約結果テーブル80のレコードのソートが可能である。
手順(11):i=2とする。上記したように、集約結果テーブル80における見出しを表示する先頭行は行数に含めないものとする。実際に住所、年齢の合計、人数を登録している集約結果テーブル80の2番目の行(住所フィールドに「千代田区」)を1行目とし、3番目の行(名前フィールドに「港区」)を2行目とし、以下同様とする。
手順(12):条件付き入れ替えの基準となる平均年齢の暗号文bv-暗号文avのボロービット(繰り下がり)を暗号文czとする。
手順(13):下記に説明するソート処理を行う。
手順(14):iの値を1増やし、手順(12)に戻る。
 iの値をインクリメントしながら、手順(11)~(14)からなる処理を集約結果テーブル80(図8)の行数分繰り返すことで、最も大きな(小さな)値がリストの端に浮かび上がるかたちとなる。
 手順(11)~(14)をレコードの数(見出しを除く行数分)-1だけ繰り返すことにより、集約結果テーブル80の全てレコードを基準となる「平均年齢」に基づいて降順又は昇順に入れ替えることができる。
 条件付き入れ替えの対象となる「住所」、「年齢の合計」、「人数」の各カラムのデータについて、手順(12)~(14)を繰り返す処理を行うことにより、集約結果テーブル80全体をソートすることが出来る。
 集約結果テーブル80(図8)のレコード数は3つなので、最悪の場合、手順(12)、(13)のソート処理を2回行い、それをさらに2回繰り返し、合計4回行う(最悪計算量(q-1)→2)。
 バブルソートはO(q)であるが、実際の計算量は(q-1)である。(q-1)=q-2q+1なので、O((q-1))=O(q)となる。
 手順(12)の演算も、全部で(q-1)回(q=レコード数)行う。これも上記に説明した全加算器によって行うことができる。
 手順(13)におけるソート処理は、下記の3つのステップによって実行する。
[第1のステップ]
 まず、暗号処理装置1は、az+cz-(0,1/8)を計算し、上記論文に記載のGate Bootstrapping(1回目)を行う。
 上記論文では、BlindRotateにおけるテストベクタとして、
F(X)=μXn-1+μXn-2・・・+μX+μ
ただし、μ=1/8を用いていた。
 それに対して、暗号処理装置1は、Gate BootstrappingのBlindRotateにおけるテストベクタとして、
T1(X)=μn-1+μn-2+…μ(n/2)+μ(n/2)-1+…μX+μを用いる。なお、μ=0、μ=1/2とする。
 こうすると、SampleExtract直後の段階で、暗号文azと暗号文czの平文ビットが異なる場合は1/2が得られ、暗号文azと暗号文czがともに0もしくは1ならば、0が得られる。上記論文ではここに(0,1/8)を足しているが、何も加えないこととする。以降は上記論文と同様にキースイッチングを行う。すると、0もしくは1/2の暗号文で、誤差は±1/16のTLWE暗号文tzが得られる。
 図10は、第1のステップのGate Bootstrappingの動作を説明する図である。
 上記論文と同様のキースイッチングを行うと、図10に示すように、0から0.25(1/4)の区間が1/2となり、0.25(1/4)から0.5(1/2)の区間、0.75(3/4)から1の区間は0となる。
 結果的に、第1のステップでは、平文として1/2と0の2種類の値を取り得、誤差が±1/16であるTLWE暗号文tzが得られる。
 TLWE暗号文czの値とTLWE暗号文azの値が異なるときTLWE暗号文tzの平文は1/2であり、TLWE暗号文czの値とTLWE暗号文azの値が同じ(ともに0もしくは1)ときTLWE暗号文tzの平文は0である。このような一時暗号文tzを得るのが、第1のステップである。
[第2のステップ]
 次に、暗号処理装置1は、tz+bz-(0,1/8)を計算し、Gate Bootstrapping(2回目)を行う。
 上記と同様に、暗号処理装置1は、Gate BootstrappingのBlindRotateにおけるテストベクタとして、
T1(X)=μn-1+μn-2+…μ(n/2)+μ(n/2)-1+…μX+μ
を用いる。今回はμ=5/8、μ=1/8とする。上記論文ではここで(0,1/8)を足しているが、本実施形態では何も加えない。
 図11は、第2のステップのGate Bootstrappingの動作を説明する図である。
 Gate Bootstrappingの結果、図11に示すように、0から0.25(1/4)の範囲が1/8となり、0.25(1/4)から0.5(1/2)の範囲が5/8となる。
 これらは、テストベクタにおいてμ=5/8、μ=1/8として指定した値がそのまま出ている。
 0.5(1/2)から0.75(3/4)の範囲が7/8となる。0.5(1/2)から0.75(3/4)の範囲には0から0.25(1/4)の範囲の負の値が出てくるので-1/8となり、-1/8は円周群{T}上では7/8に相当するからである。
 0.75(3/4)から1の範囲は3/8となる。0.75(3/4)から1の範囲には0.25(1/4)から0.5(1/2)の範囲の負の値が出てくるので-5/8となり、-5/8は円周群{T}上では3/8に相当するからである。
 第2のステップでは、平文として1/8、3/8、5/8、7/8の4種類の値を有する一時暗号文uzが得られる。
[第3のステップ]
 次に、暗号処理装置1は、(0,1/4)-uz+czを計算し、計算結果として1/8、3/8、5/8、7/8を得る。そして、これらの値に対して上記論文通りのGate Bootstrapping(3回目)を行う。
 図12は、第3のステップのGate Bootstrappingの動作を説明する図である。
 3回目のGate Bootstrappingにおいて、暗号処理装置1は、異なるサンプリング位置でSampleExtractを2回行う。
 まず、0の位置でSampleExtract(0)を行ってキースイッチングを行うと、図12(a)に示すような1/8と7/8の2種類の値が得られる。
 図12(a)における0から0.25(1/4)の範囲が7/8となり、0.25(1/4)から0.5(1/2)の範囲が1/8となる。
 0.5(1/2)から0.75(3/4)の範囲は、0から0.25(1/4)の範囲の負の値が出てくるので-7/8の暗号文となり、-7/8は円周群{T}上では1/8に相当する。
 0.75(3/4)から1の範囲は、0.25(1/4)から0.5(1/2)の範囲の負の値が出てくるので-1/8の暗号文となり、-1/8は円周群{T}上では7/8に相当する。得られた値に(0,1/8)を足すと、平文として0、1/4の2種類の値を取り得る新たな暗号文az’が得られる。
 また、n/2の位置でSampleExtract(n/2)を行ってキースイッチングを行うと、図12(b)に示すような1/8と7/8の2種類の値が得られ、得られた値を(0,1/8)から引くと、平文として0、1/4の2種類の値を取り得る新たな暗号文bz’が得られる。
 図12(b)における0から0.25(1/4)の範囲が7/8となり、0.25(1/4)から0.5(1/2)の範囲が7/8となる。
 0.5(1/2)から0.75(3/4)の範囲は、0から0.25(1/4)の範囲の負の値が出てくるので-7/8の暗号文となり、-7/8は円周群{T}上では1/8に相当する。
 0.75(3/4)から1の範囲は、0.25(1/4)から0.5(1/2)の範囲の負の値が出てくるので-7/8の暗号文となり、-7/8は円周群{T}上では1/8に相当する。得られた値を(0,1/8)から引くと、平文として0、1/4の2種類の値を取り得る新たな暗号文bz’が得られる。
 このように、一度のGate BootstrappingにおいてSample extractを2回行うことで、暗号文az’の値と、暗号文bz’の値とを一度に求めることができる。
 その結果、Gate Bootstrapping(BlindRotate)の回数を3回とすることができる。Gate Bootstrappingを2回行うHomMUXを2回使う場合に比べて、Gate Bootstrappingを1回減らし、ソートを高速化することができる。
 暗号文czの平文が1/4、つまりビットとして1でありi-1行目の方が小さく、すなわち順序を入れ替えたい場合には、暗号文azの平文=暗号文bz’の平文、暗号文bzの平文=暗号文az’の平文となる。暗号分czの平文が0の場合は、暗号文azの平文=暗号文az’の平文、暗号文bzの平文=暗号文bz’の平文となる。
 図13は、本実施形態の条件付き入れ替え処理において暗号文が取り得る値を示す図である。
 図13の(1)~(4)は、ボロービットを示す暗号文czの平文が0である場合を示している。
 (1)において、i行目のデータの暗号文azの平文が0、i-1行目のデータの暗号文bzの平文が0の場合、第1のステップで得られる暗号文tzの平文は0である。第2のステップで得られる暗号文uzの平文は3/8であり、第3のステップで得られる(0,1/4)-uz+czの平文は7/8である。
 上記SampleExtract(0)で得られた値に(0,1/8)を足して得られる新しいi行目のデータの暗号文az’は0となる。また上記SampleExtract(n/2)で得られた値を(0,1/8)から引いて得られる新しいi-1行目のデータの暗号文bz’は0となる。
 この場合、暗号文azの平文=暗号文az’の平文、暗号文bzの平文=暗号文bz’の平文となっており、暗号文azと暗号文bzを、夫々新たな暗号文az’と暗号文bz’で置き換えたとき、平文として、i行目とi-1行目のレコードは夫々元の順序のままである。
 (2)~(4)においても(1)と同様に、暗号文azの平文=暗号文az’の平文、暗号文bzの平文=暗号文bz’の平文となっている。例えば(2)において、i行目のデータの暗号文azの平文が0、i-1行目のデータの暗号文bzの平文が1/4であり、新しいi行目のデータの暗号文az’は0、新しいi-1行目のデータの暗号文bz’は1/4である。
 暗号文azと暗号文bzを、夫々新たな暗号文az’と暗号文bz’で置き換えたとき、平文として、i行目とi-1行目のレコードは夫々元の順序のままである。
 図13の(5)~(8)は、ボロービットを示す暗号文czの平文が1/4である場合を示している。
 (5)において、i行目のデータの暗号文azの平文が0、i-1行目のデータの暗号文bzの平文が0の場合、第1のステップで得られる暗号文tzの平文は1/2である。第2のステップで得られる暗号文uzの平文は5/8であり、第3のステップで得られる(0,1/4)-uz+czの平文は7/8である。
 上記SampleExtract(0)で得られた値に(0,1/8)を足して得られる新しいi行目のデータの暗号文az’は0となる。また上記SampleExtract(n/2)で得られた値を(0,1/8)から引いて得られる新しいi-1行目のデータの暗号文bz’は0となる。
 この場合、暗号文azの平文=暗号文bz’の平文、暗号文bzの平文=暗号文az’の平文となっており、暗号文azと暗号文bzを、夫々暗号文az’と暗号文bz’で置き換えたとき、平文として、i行目とi-1行目のレコードは元の順序から入れ替わっている。
 (6)~(8)においても(5)と同様に、暗号文azの平文=暗号文bz’の平文、暗号文azの平文=暗号文bz’の平文となっている。例えば(6)において、i行目のデータの暗号文azの平文が0、i-1行目のデータの暗号文bzの平文が1/4であり、新しいi行目のデータの暗号文az’は1/4、新しいi-1行目のデータの暗号文bz’は0となっている。
 暗号文azと暗号文bzを、夫々新たな暗号文az’と暗号文bz’で置き換えたとき、平文として、i行目とi-1行目のレコードは元の順序から入れ替わっている。
 上記に説明したように、暗号文az’と暗号文bz’は、暗号文czの平文によって、夫々の平文が、暗号文az、暗号文bzの平文と同じ異なる暗号文となるか、暗号文bz、暗号文azの平文と同じ異なる暗号文になるか、のいずれかとなる。
 復号関数をφとしたとき、φ(cz)=0の場合(i-1行目の方が平均年齢が大きく、順序を入れ替えない場合)、
φ(az’)=φ(az)
φ(bz’)=φ(bz)
となる。
 φ(cz)=1/4の場合(i-1行目の方が平均年齢が小さく、順序を入れ替える場合)、
φ(az’)=φ(bz)
φ(bz’)=φ(az)
となる。
 いずれの場合でも、暗号文az≠暗号文az’かつ、暗号文bz≠暗号文bz’であり、暗号文自体は、元の暗号文と新たな暗号文とで異なるものになる。暗号文自体は、暗号処理装置1が直接扱うものであり、暗号文az’、暗号文bz’が、暗号文azと暗号文bzと夫々同じ暗号文であるか否か、あるいは暗号文bzと暗号文azと夫々同じ暗号文であるか否かがわかると、暗号文czの平文が推測できてしまう。従って、暗号文自体は元の暗号文と新たな暗号文とで必ず異なるものになる。ただし、暗号文az’の平文、暗号文bz’の平文は、暗号文czの平文によって、暗号文azの平文、暗号文bzの平文のいずれかになる。
 実際のところ、新たな暗号文az’と暗号文bz’を得た段階で、暗号文czによって暗号文azと暗号文bzを入れ替えるか否かの処理が済んでいる。従って、暗号文azと暗号文bzを、暗号文az’と暗号文bz’で夫々置き換えることで、条件付き入れ替えの処理が完了する。
 本実施形態の暗号処理装置1は、条件付き入れ替えの基準となる、例えば「平均年齢」の暗号文av、bvから得られた同じ暗号文czを用いて、条件付き入れ替えの対象となる「住所」、「年齢の合計」、「人数」等の他のフィールドの暗号文az、bzから暗号文az’、bz’を求める。
 そして暗号処理装置1は、「住所」、「年齢の合計」、「人数」等の条件付き入れ替えの対象となる各カラムについて暗号文az’、bz’で暗号文az、bzを置き換えることで、集約結果テーブル80全体のソートを行うことが出来る。
 条件付き入れ替えの基準となる平均年齢(暗号文av、bv)についてもソートを行う場合には、上記に説明した暗号文az、bzの並び替えの場合と同様の処理によって、新たな暗号文av’、bv’を求め、暗号文av’、bv’によって暗号文av、bvを置き換えることによって行うことが出来る。
 図14は、暗号処理装置による集約結果ソート処理の流れを説明するフローチャートである。
 図14に示す処理は、暗号処理装置1(集約部21)が、暗号化データベースを集約してソートをするクエリに対して、暗号化データベースの集約を行った後に行われる処理である。
 情報処理装置1は、ステップS201において、変数qに集約結果テーブル80の行数(レコード数)を代入し、変数iに2を代入する。
 情報処理装置1(比較部22)は、ステップS202において暗号文bv-暗号文avを演算し、ボロービットの暗号文czを得る。
 比較部22は、この演算を、例えば上記に説明した全加算器によって行わせることができる。
 情報処理装置1(第1演算部12)は、ステップS203においてaz+cz-(0,1/8)を計算する。
 情報処理装置1(第1Bootstrapping部15)は、ステップS204において1回目のGate Bootstrappingを行い、その結果、ステップS205において、暗号文tzを得る。
 次に、情報処理装置1(第2演算部13)は、ステップS206においてtz+bz-(0,1/8)を計算する。
 情報処理装置1(第2算出部16)は、ステップS207において2回目のGate Bootstrappingを行い、その結果、ステップS208において、暗号文uzを得る。
 次に、情報処理装置1(第3演算部14)は、ステップS209において、(0,1/4)-uz+czを計算する。
 次に、情報処理装置1(第3Bootstrapping部17)は、ステップS210~S214において、3回目のGate Bootstrappingを行う。
 情報処理装置1(第3Bootstrapping部17)は、ステップS210でBlindRotateを行い、ステップS211において、SampleExtract(0)とキースイッチングを行い、その結果、ステップS212において暗号文az’を得る。
 情報処理装置1(第3Bootstrapping部17)は、ステップS213においてSampleExtract(n/2)とキースイッチングを行い、その結果ステップS214において、暗号文bz’を得る。
 情報処理装置1(置換部23)は、ステップS214において、集約結果テーブル80において、暗号文azと暗号文az’、暗号文bzと暗号文bz’を置き換える。
 情報処理装置1は、ステップS216において、i=qか、すなわち、全ての行についてソート処理を終了したか否かを判定する。
 i=qでなかった場合(ステップS216でNo)、情報処理装置1は、ステップS217で変数iにi+1を代入してインクリメントし、ステップS202に処理を戻す。
 i=qであった場合(ステップS216でYes)、情報処理装置1は、ソート処理を終了する。
 さらに、図14の処理を、集約結果テーブル80の行数(レコード数)-1分繰り返すことで、集約結果テーブル80のレコードを全てソートして、図15のような結果を得ることができる。
 図15は、ソート処理を完了後の集約結果テーブルの一例を示す図である。
 図14の処理を必要回数行った結果、図8の集約結果テーブル80は、図15のように入れ替えがされた。
 図8において、千代田区についての平均年齢は40歳、港区についての平均年齢は46.5歳、台東区についての平均年齢は58歳であった。
 この平均年齢に基づいて、上記のバブルソートを行った結果、平均年齢の高い順に、集約結果テーブル80のレコードがソートされた。
 上記に説明したように、本実施形態の暗号処理装置1では、Gate Bootstrappingの回数を3回に減らすことが出来ている。演算時間のほぼ全てを占めるGate Bootstrappingには多くの処理時間がかかるため、この回数を削減することで、MUX演算を高速且つ短時間で行い得ることが見込まれる。
 ただし図3に示すように、Gate Bootstrappingの回数は3回に減ったものの、Bootstrappingの段数は3段階に増えているので、マルチスレッディングを行った場合の図1に比べて図3の構成による処理が決定的に高速であるとは言い切れない。
 下記に説明する変形例では、本実施形態の暗号処理装置1では、TLWE暗号文az、bz、czの平文が有する誤差を、例えば±1/40に削減する。これにより、MUX演算において、第1演算部12に2値の暗号文を3つ入力可能とし、Gate Bootstrappingを改良することにより、準同型演算処理の回数を全体で2回に減らす。その結果、暗号処理装置1では、準同型演算処理のほぼ全てを占めるGate Bootstrappingの回数を全体で2回に減らすことが出来る。Bootstrappingの段数は2段階としたまま準同型演算処理の回数を全体で2回に減らし、マルチスレッドで処理した場合の図1に比べてMUX演算を50%高速化することが出来る。また図3に示した構成の66%の時間でMUX演算を行うことが出来る。
 図16は、本実施形態の変形例に係る暗号処理装置の機能構成を説明する図である。
 暗号処理装置1は、制御部10と、記憶部20と、通信部25と、入力部26と、を備える。
 制御部10は、受付部11と、第4演算部31と、第5演算部32と、第4Bootstrapping部(第4算出部)33と、第5Bootstrapping部(第5算出部)34と、出力部18と、を備えている。また、制御部10は、集約部21と、比較部22と、置換部23とを備えている。
 第4演算部31と、第5演算部32と、第4Bootstrapping部33と、第5Bootstrapping部34以外の構成については図2と同様であるので説明は省略する。
 第4演算部31は、受付部11が受け付けた入力暗号に対して、第4準同型演算を行う。
 第5演算部32は、第4Bootstrapping部33から出力される暗号文に対して、第5準同型演算を行う。
 第4Bootstrapping部33は、第4演算部31の演算結果に対して下記に説明するGate Bootstrapping処理を行って、新たな暗号文を出力する。
 第5Bootstrapping部34は、第5演算部32の演算結果に対して下記に説明するGate Bootstrapping処理を行って、新たな暗号文を出力する。
 図17は、変形例に係る暗号処理装置の演算プロセスを詳しく説明する図である。
 図17の説明において、暗号処理装置1に入力される暗号文az、cz、czは、いずれも上記論文に示されるTLWE暗号文である。TLWE暗号は、0又はμ(非0)の値を平文として有するBit-wise型の完全準同型暗号である。
 論理ゲートを用いた論理演算によって様々な演算を行うことができる。
 TLWE暗号文は、二進数のシンボル0又は1に対応する所定の値に所定の分散を持つ誤差を与えた値を平文として2値を有し、復号することなく論理演算が可能である。
 これらの暗号文は、それぞれ特別に設定したシステムパラメータによるTLWE暗号文であり、Gate Bootstrappingにより生成された又は新規に暗号化されたものである。
 TLWE暗号文az、cz、czは、何れも平文として0又は1/4を有し、平文に付加される誤差は±1/40の範囲に含まれる。
 TLWE暗号文ca、cb、ccは、夫々0が二進数のシンボル0に対応し、1/4がシンボル1に対応する。
 2値3入力とすることで誤差範囲が重なる可能性があり、平文に付加される誤差を上記論文の±1/16よりも小さく±1/40以内としている。
 ただし後述するように、誤差が重なることによる問題が許容できる場合はその限りではなく、誤差として実施例の±1/40や上記論文の±1/16を採用してもよい。
 図17に示す構成では、非特許文献1の論文(上記論文)で提示された(2値)Gate Bootstrappingを使用する。
 入力された暗号文az、bz、czを第4演算部31に入力して準同型演算(2×(az+cz)+bz-(0,1/8))を行い、その演算結果である暗号文を2値Gate Bootstrappingを行う第4Bootstrapping部33に入力する。
 第4Bootstrapping部33の出力は、平文として2値(0,μ)の何れかを取り得る一時暗号文uzである。
 暗号文uz、暗号文czを第5演算部32に入力して準同型演算((0,1/4)-uz+cz)を行い、その出力結果を第5Bootstrapping部34に入力し、2値Gate Bootstrappingが行われて新たな暗号文az’、新たな暗号文bz’が出力される。
 第5演算部32、第5Bootstrapping部34の処理は、上記の第3演算部14、第3Bootstrapping部17の処理と同じである。
 暗号処理装置1(第4演算部31)は、2(az+cz)+bz-(0,1/8)を計算し、演算結果としてTLWE暗号文ctを得る。(0,1/8)は平文が1/8となる自明な暗号文である。
 2(az+cz)+bz-(0,1/8)の演算結果の平文は、以下のとおりである。
azが0、bzが0、czが0(2(az+cz)+bzは二進数のシンボルで2×(0+0)+0=0)
⇒2×(0+0)+0-1/8=-1/8(7/8)
azが0、bzが0、czが1/4(2(az+cz)+bzは二進数のシンボルで2×(0+1)+0=0)
⇒2×(0+1/4)+0-1/8=3/8
azが0、bzが1/4、czが0(2(az+cz)+bzは二進数のシンボルで2×(0+0)+1=1)
⇒2×(0+0)+1/4-1/8=1/8
azが0、bzが1/4、czが1/4(2(az+cz)+bzは二進数のシンボルで2×(0+1)+1=3)
⇒2(0+1/4)+1/4-1/8=5/8
azが1/4、bzが0、czが0(2(az+cz)+bzは二進数のシンボルで2×(1+0)+0=2)
⇒2(1/4+0)+0-1/8=3/8
azが1/4、bzが0、czが1/4(2(az+cz)+bzは二進数のシンボルで2×(1+1)+0=4)
⇒2(1/4+1/4)+0-1/8=-1/8(7/8)
azが1/4、bzが1/4、czが0(2(az+cz)+bzは二進数のシンボルで2×(1+0)+1=3)
⇒2(1/4+0)+1/4-1/8=5/8
azが1/4、bzが1/4、czが1/4(2(az+cz)+bzは二進数のシンボルで2×(1+1)+1=5)
⇒2(1/4+1/4)+1/4-1/8=9/8⇒1/8
 TLWE暗号文ctは、平文として1/8、3/8、5/8、7/8の4つのいずれかを有し、平文に付加される誤差は±1/8の範囲に含まれる。
 これはca+cbの誤差±1/40の和×2と、ccの誤差±1/40を足しているためである。
 次に暗号処理装置1(第4Bootstrapping部)33は、TLWE暗号文ctに対して上記論文どおりのGate Bootstrappingを行うと、上記の[第2のステップ]で算出したものと同じ、平文として1/8、3/8、5/8、7/8を有し、平文が有する誤差が±1/40である一時暗号文uzが得られる。
 一時暗号文uzと暗号文czを用いた以降の処理は、上記[第3のステップ]と同じであるので説明を省略する。
 図18は、変形例に係る集約結果ソート処理の流れを説明するフローチャートである。
 図18に示す処理は、暗号処理装置1(集約部21)が、暗号化データベースを集約してソートをするクエリに対して、暗号化データベースの集約を行った後に行われる処理である。
 情報処理装置1は、ステップS201において、変数qに集約結果テーブル80の行数(レコード数)を代入し、変数iに2を代入する。
 情報処理装置1(比較部22)は、ステップS202において暗号文bv-暗号文avを演算し、ボロービットの暗号文czを得る。
 比較部22は、この演算を、例えば上記に説明した全加算器によって行わせることができる。
 情報処理装置1(第4演算部31)は、ステップS203Aにおいて2(az+cz)++bz-(0,1/8)を計算する。
 情報処理装置1(第4Bootstrapping部33)は、ステップS204Aにおいて1回目のGate Bootstrappingを行い、その結果、ステップS208において、暗号文uzを得る。この暗号文uzは、平文に付加される誤差以外は、図14のステップS208で得られる暗号文uzと同じである。
 次に、情報処理装置1(第5演算部32)は、ステップS209Aにおいて、(0,1/4)-uz+czを計算する。
 次に、情報処理装置1(第5算出部33)は、ステップS210A~S214Aにおいて、3回目のGate Bootstrappingを行う。
 情報処理装置1(第5Bootstrapping部32)は、ステップS210AでBlindRotateを行い、ステップS211において、SampleExtract(0)とキースイッチングを行い、その結果、ステップS212において暗号文az’を得る。
 情報処理装置1(第5Bootstrapping部32)は、ステップS213AにおいてSampleExtract(n/2)とキースイッチングを行い、その結果ステップS214Aにおいて、暗号文bz’を得る。
 第5算出部33によるステップS210A~S214Aの処理は、図14に示した第3算出部17によるステップS210~S214と同じ処理である。
 情報処理装置1(置換部23)は、ステップS214において、集約結果テーブル80において、暗号文azと暗号文az’、暗号文bzと暗号文bz’を置き換える。
 情報処理装置1は、ステップS216において、i=qか、すなわち、全ての行についてソート処理を終了したか否かを判定する。
 i=qでなかった場合(ステップS216でNo)、情報処理装置1は、ステップS217で変数iにi+1を代入してインクリメントし、ステップS202に処理を戻す。
 i=qであった場合(ステップS216でYes)、情報処理装置1は、ソート処理を終了する。
 さらに、図14の処理を、集約結果テーブル80の行数(レコード数)-1分繰り返すことで、集約結果テーブル80のレコードを全てソートして、図15のような結果を得ることができる。
 図19は、本実施形態のGate Bootstrappingに入出力される暗号文を示す図である。
 上記では、図19(a)に示すように、BlindRotate、SampleExtract、キースイッチングの順番でGate Bootstrappingを行うように説明をしていた。
 それに限らず、図19(b)に示すように、Gate Bootstrappingにおいてキースイッチングを最初に実行し、その後で、BlindRotateとSampleExtractを行うことが出来る。
 TLWE暗号文にはセキュリティ強度に応じたレベルの概念がある。
 図19(a)のGate Bootstrappingでは入出力となるTLWE暗号文はLEVEL0である。LEVEL0のTLWE暗号文に対してBlindRotateを行い、その出力のTRLWE暗号文に対するSampleExtractによって得られるTLWE暗号文はLEVEL1となるが、キースイッチングの結果、LEVEL0のTLWE暗号文が出力される。
 それに対して図19(b)に示す方法では、Gate Bootstrappingの入出力となるTLWE暗号文をLEVEL1とし、最初にキースイッチングを行ってLEVEL0に下げた状態でBlindRotateを行い、その出力のTRLWE暗号文に対するSampleExtractを行うとLEVEL1のTLWE暗号文が出力される。
 LEVEL0の暗号文は、N次の秘密鍵[s]で暗号化された円周群{T}上の要素のN次のベクトル[a]よりなっている。一方、SampleExtractの結果得られるLEVEL1の暗号文は、n次の秘密鍵[s’]で暗号化された円周群{T}上の要素のn次のベクトル[a']よりなっている。
 LEVEL0の暗号文は、LWE問題の難易度となる係数の数(ベクトルの次数)がLEVEL1の暗号文よりも少ないので、LEVEL1と比較して準同型加算の計算量は少ない。
 一方でLEVEL0の暗号文は、上記の変形例のように2値3入力の準同型演算を可能とするために平文に付加する許容誤差を小さくすると、セキュリティ強度が下がりやすい問題がある。LWE系暗号は、平文に付加する誤差によって安全性が担保されるからである。
 TLWE暗号は、平文に付加する誤差が大きいほど、係数の数(ベクトルの次数)が多いほど計算(解読)が難しい。
 裏を返すと、TLWE暗号は、平文に付加する誤差が小さいほど、係数の数(ベクトルの次数)が少ないほど、計算(解読)が容易となるのである。
 誤差を小さくする場合には暗号文の係数の数(ベクトルの次数)を上げてセキュリティを確保する必要がある。
 変形例では、平文に付加する誤差を±1/40と小さくすることによって2値3入力の準同型演算によってBlindRotateの回数を減らし、MUX演算を高速化する。平文に付加する誤差を小さくすることで計算(解読)が容易となった暗号文のセキュリティを確保するために、キースイッチングをGate Bootstrappingの先頭に移動し、係数の数(ベクトルの次数)が多く誤差の範囲を小さくしやすいLEVEL1の暗号文をGate Bootstrappingの入出力とすることが望ましい。そして、Gate Bootstrappingの先頭でLEVEL0に変換してから、最後にLEVEL0に戻さないようにする。
 BlindRotateの所要時間は、入力となるTLWE暗号文の係数の数(ベクトルの次数)に比例する。よって、LEVEL1の暗号文を入力とした場合は、LEVEL0の暗号文を入力とした場合よりも、係数の数(ベクトルの次数)に比例してBlindRotateの所要時間が長くなる。
 暗号文のセキュリティを確保するためにLEVEL1の暗号文をGate Bootstrappingの入力としても、キースイッチングで変換したLEVEL0のTLWE暗号文を入力としてBlindRotateを行うことで、所要時間の増加を避けることが出来る。
 Gate Bootstrappingの入出力をLEVEL1のTLWE暗号文とする方法は、変形例のような2値3入力の準同型演算を行う場合に限らず、図3の2値2入力の準同型演算の場合にも適用可能である。LEVEL0に戻さないことで、次段でのTLWE暗号文の計算でも同様に、安全に多値入力を行って高速に処理を行うことが出来る。
 また、平文に付加する誤差を±1/40などにすることには、上記のセキュリティ強度以外に復号時エラーの問題もある。
 本実施形態の構成では、Gate Bootstrappingの処理時間の大半を占めるBlindRotateを1回で済ますことができるが、誤差範囲をより小さくとる必要があるため、セキュリティ強度が低下したり、復号エラー率が上がったりする問題もある。
 TFHE含めLWE系の準同型暗号では平文に付加する誤差は正規分布で分布しており、厳密に「誤差の範囲」を設定することはできない。
 0付近に集中することに変わりはないが、原理的には、誤差を指定範囲により多く集中させることが出来るのみである。
 例えば、平文に付加する誤差を±1/40以内と設定しても、その範囲外の誤差が付加される可能性が数パーセント存在する。
 設定した範囲から誤差がはみ出した場合、その平文は別の平文として解釈されるため、予期せぬ計算結果が得られる可能性がある。
 計算自体ができなくなるのではなく異なる結果が得られるのみである。異なる計算結果が得られる確率をどの程度許容できるかは、準同型暗号を応用するアプリケーション次第である。
 本実施形態では、平文に付加する誤差を±1/40と設定するようにシステムパラメータを変更することで、計算にエラーが発生する確率を抑える、BlindRotateの数を減らして計算を高速化する、セキュリティを高く保つ、という3つの目標をバランスよく解決することが出来る。
 これらのバランスが最もとれるように、誤差範囲の重なりが一定値内に収まるように誤差となるようにシステムパラメータを設定することが必要である。
 なお、本実施形態を適用するシステムや装置に応じて、特に重視する条件を満たすように誤差を設定してもよい。
 演算の高速化を重視する場合には、平文に付加する誤差を±1/32の範囲内に設定することで2値4入力などの準同型演算も可能となる。
 異なる計算結果が得られる可能性をある程度許容できるアプリケーションであれば、誤差範囲が重なる可能性はある程度許容しつつ、2値3入力として計算を高速化しながら、誤差を±1/16以内と大きくとってセキュリティを保つことも出来る。
 例えば、平文に付加する誤差を±1/16以内と設定してある上記論文のパラメータを用いても、原理上、2値3入力の準同型演算で全加算器を高速化する本実施形態の構成は可能である。設定範囲から誤差がはみ出し、異なる計算結果が得られる確率が上がるのみである。
 図20は、コンピュータ装置の一実施例を示すブロック図である。
 図20を参照して、コンピュータ装置100の構成について説明する。
 コンピュータ装置100は、例えば、各種情報を処理する暗号処理装置である。そして、コンピュータ装置100は、制御回路101と、記憶装置102と、読書装置103と、記録媒体104と、通信インターフェイス105と、入出力インターフェイス106と、入力装置107と、表示装置108とを含む。また、通信インターフェイス105は、ネットワーク200と接続される。そして、各構成要素はバス110により接続される。
 暗号処理装置1は、コンピュータ装置100に記載の構成要素の一部又は全てを適宜選択して構成することができる。
 制御回路101は、コンピュータ装置100全体の制御をする。制御回路101は、例えば、Central Processing Unit(CPU)、Field Programmable Gate Array(FPGA)、Application Specific Integrated Circuit(ASIC)及びProgrammable Logic Device(PLD)などのプロセッサである。制御回路101は、例えば、図2、図16における制御部10として機能する。
 記憶装置102は、各種データを記憶する。そして、記憶装置102は、例えば、Read Only Memory(ROM)及びRandom Access Memory(RAM)などのメモリや、Hard Disk(HD)などである。記憶装置102は、制御回路101を、図2、図16における制御部10として機能させる情報処理プログラムを記憶してもよい。記憶装置102は、例えば、図2、図16における記憶部20として機能する。
 暗号処理装置1は、情報処理を行うとき、記憶装置102に記憶されたプログラムをRAMに読み出す。
 暗号処理装置1は、RAMに読み出されたプログラムを制御回路101で実行することにより、受付処理、第1演算処理、第2演算処理、第3演算処理、第4演算処理、第5演算処理、第1Bootstrapping処理、第2Bootstrapping処理、第3Bootstrapping処理、第4Bootstrapping処理、第5Bootstrapping処理、出力処理、比較処理、集約処理、置換処理のいずれか1以上を含む処理を実行する。
 なおプログラムは、制御回路101が通信インターフェイス105を介してアクセス可能であれば、ネットワーク200上のサーバが有する記憶装置に記憶されていても良い。
 読書装置103は、制御回路101に制御され、着脱可能な記録媒体104のデータのリード/ライトを行う。
 記録媒体104は、各種データを保存する。記録媒体104は、例えば、情報処理プログラムを記憶する。記録媒体104は、例えば、Secure Digital(SD)メモリーカード、Floppy Disk(FD)、Compact Disc(CD)、Digital Versatile Disk(DVD)、Blu-ray(登録商標) Disk(BD)、及びフラッシュメモリなどの不揮発性メモリ(非一時的記録媒体)である。
 通信インターフェイス105は、ネットワーク200を介してコンピュータ装置100と他の装置とを通信可能に接続する。通信インターフェイス105は、例えば、図2において、通信部25として機能する。
 入出力インターフェイス106は、例えば、各種入力装置と着脱可能に接続するインターフェイスである。入出力インターフェイス106と接続される入力装置107には、例えば、キーボード、及びマウスなどがある。入出力インターフェイス106は、接続された各種入力装置とコンピュータ装置100とを通信可能に接続する。そして、入出力インターフェイス106は、接続された各種入力装置から入力された信号を、バス110を介して制御回路101に出力する。また、入出力インターフェイス106は、制御回路101から出力された信号を、バス110を介して入出力装置に出力する。入出力インターフェイス106は、例えば、図2、図16において、入力部26として機能する。
 表示装置108は、各種情報を表示する。ネットワーク200は、例えば、LAN、無線通信、P2Pネットワーク、又はインターネットなどであり、コンピュータ装置100と他の装置を通信接続する。
 なお、本実施形態は、以上に述べた実施形態に限定されるものではなく、本実施形態の要旨を逸脱しない範囲内で種々の構成又は実施形態をとることができる。
1 暗号処理装置、10 制御部、11 受付部、12 第1演算部、13 第2演算部、14 第3演算部、15 第1算出部、16 第2算出部、17 第3算出部、21 集約部、22 比較部、23 置換部、18 出力部、20 記憶部、25 通信部、26 入力部、100 コンピュータ装置、101 制御回路、102 記憶装置、103 読書装置、104 記録媒体、105 通信インターフェイス、106 入出力インターフェイス、107 入力装置、108 表示装置、110 バス、200 ネットワーク

Claims (8)

  1.  暗号文を処理する暗号処理装置であって、
     前記暗号文は、シンボル0または1に対応する所定の値に所定の分散を持つ誤差を与えた値を平文として2値を有し、復号することなく論理演算が可能な完全準同型暗号文であり、
     所定の順序で配列される第1暗号文の平文と第2暗号文の平文の夫々に対応する新たな暗号文を、前記順序と同じ又は逆の順序で得ることができ、
     前記新たな暗号文の順序を第3暗号文の平文に基づいて選択可能な処理を行い、
     平文として2値よりも多い多値を有する前記暗号文に基づく一時暗号文を出力とする多値論理演算を用いることにより前記処理に必要な計算の回数を削減する、
    ことを特徴とする暗号処理装置。
  2.  請求項1に記載の暗号処理装置において、
     誤差の重なりが所定値以内となるように前記誤差を設定することにより、前記暗号文を用いて前記多値論理演算を行う際の多項式による演算の回数を削減する、
    ことを特徴とする暗号処理装置。
  3.  請求項1又は2に記載の暗号処理装置において、
     入力された前記暗号文に対して前記所定の演算に係る準同型演算を行う演算部と、
     前記演算部による準同型演算の結果に対して、所定の多項式を用いて新たな暗号文を算出する算出部と、を備え、
     前記演算部による準同型演算の結果に対して、所定の多項式を用いて新たな暗号文を算出するまえに暗号文の係数の数を削減する、
    ことを特徴とする暗号処理装置。
  4.  請求項1乃至3の何れか一項に記載の暗号処理装置において、
     前記処理を実行することによりバブルソートを行う
    ことを特徴とする暗号処理装置。
  5.  請求項1乃至3の何れか一項に記載の暗号処理装置において、
     入れ替える暗号文は、暗号化データベースに格納される値を集約した集約用テーブルに格納される値であり
     前記暗号化データベースに格納される値は、集約の基準となる複数の基準値と、各基準値に関連付けられた値と、を含み、
     前記集約テーブルは、前記複数の基準値と、前記暗号化データベースにおいて各基準値に付けられた値の集約結果と、を含み、
     前記集約用テーブルが備える集約用基準値と、前記暗号化データベースが備える基準値と、を比較した比較結果に基づいて、集約用基準値に対応する前記暗号化データベースの値を、集約用基準値に対応づけて前記集約用テーブルにおいて集約することによって前記暗号化データベースを集約し、
     集約後の前記集約用テーブルに対して前記処理を実行することを特徴とする暗号処理装置。
  6.  請求項5に記載の暗号処理装置において、
     前記基準値と前記集約用基準値は複数ビットの値よりなり、
     一の前記基準値と、一の前記集約用基準値とをビットごとに比較した結果を集計することによって比較を行い、
     前記比較結果と、前記基準値に対応する値と、に基づく値を前記集約テーブルにおける対応する合計値に加算することにより前記暗号化データベースを集約する、
    ことを特徴とする暗号処理装置。
  7.  プロセッサによって実行される、暗号文を処理する暗号処理方法であって、
     前記暗号文は、シンボル0または1に対応する所定の値に所定の分散を持つ誤差を与えた値を平文として2値を有し、復号することなく論理演算が可能な完全準同型暗号文であり、
     所定の順序で配列される第1暗号文の平文と第2暗号文の平文の夫々に対応する新たな暗号文を、前記順序と同じ又は逆の順序で得ることができ、
     前記新たな暗号文の順序を第3暗号文の平文に基づいて選択可能な処理を行い、
     平文として2値よりも多い多値を有する前記暗号文に基づく一時暗号文を出力とする多値論理演算を用いることにより前記処理に必要な計算の回数を削減する、
    ことを特徴とする暗号処理方法。
  8.  暗号文を処理する暗号処理方法をプロセッサに実行させる暗号処理プログラムであって、
     前記暗号文は、シンボル0または1に対応する所定の値に所定の分散を持つ誤差を与えた値を平文として2値を有し、復号することなく論理演算が可能な完全準同型暗号文であり、
     所定の順序で配列される第1暗号文の平文と第2暗号文の平文の夫々に対応する新たな暗号文を、前記順序と同じ又は逆の順序で得ることができ、
     前記新たな暗号文の順序を第3暗号文の平文に基づいて選択可能な処理を行い、
     平文として2値よりも多い多値を有する前記暗号文に基づく一時暗号文を出力とする多値論理演算を用いることにより前記処理に必要な計算の回数を削減する、
    ことを特徴とする暗号処理プログラム。
PCT/JP2022/001829 2021-03-26 2022-01-19 暗号処理装置、暗号処理方法、及び暗号処理プログラム WO2022201791A1 (ja)

Priority Applications (1)

Application Number Priority Date Filing Date Title
US18/473,876 US20240022395A1 (en) 2021-03-26 2023-09-25 Encryption processing device and encryption processing method

Applications Claiming Priority (4)

Application Number Priority Date Filing Date Title
JP2021-053360 2021-03-26
JP2021053360 2021-03-26
JP2021-131701 2021-08-12
JP2021131701A JP7084067B1 (ja) 2021-03-26 2021-08-12 暗号処理装置、暗号処理方法、及び暗号処理プログラム

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US18/473,876 Continuation US20240022395A1 (en) 2021-03-26 2023-09-25 Encryption processing device and encryption processing method

Publications (1)

Publication Number Publication Date
WO2022201791A1 true WO2022201791A1 (ja) 2022-09-29

Family

ID=82016046

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP2022/001829 WO2022201791A1 (ja) 2021-03-26 2022-01-19 暗号処理装置、暗号処理方法、及び暗号処理プログラム

Country Status (3)

Country Link
US (1) US20240022395A1 (ja)
JP (1) JP7084067B1 (ja)
WO (1) WO2022201791A1 (ja)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116204912B (zh) * 2023-04-28 2023-09-12 北京天润基业科技发展股份有限公司 基于全同态加密的数据处理方法和装置

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2019514301A (ja) * 2016-04-12 2019-05-30 ザ ガバニング カウンシル オブ ザ ユニバーシティ オブ トロントThe Governing Council Of The University Of Toronto 準同型に暗号化されたデータに対する検証および演算の実行のためのシステムおよび方法
CN111931243A (zh) * 2020-10-09 2020-11-13 北京微智信业科技有限公司 一种基于全同态加密的排序方法
US20210075588A1 (en) * 2014-02-28 2021-03-11 Shield Crypto Systems Inc. Systems, devices, and processes for homomorphic encryption

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20210075588A1 (en) * 2014-02-28 2021-03-11 Shield Crypto Systems Inc. Systems, devices, and processes for homomorphic encryption
JP2019514301A (ja) * 2016-04-12 2019-05-30 ザ ガバニング カウンシル オブ ザ ユニバーシティ オブ トロントThe Governing Council Of The University Of Toronto 準同型に暗号化されたデータに対する検証および演算の実行のためのシステムおよび方法
CN111931243A (zh) * 2020-10-09 2020-11-13 北京微智信业科技有限公司 一种基于全同态加密的排序方法

Also Published As

Publication number Publication date
US20240022395A1 (en) 2024-01-18
JP2022151492A (ja) 2022-10-07
JP7084067B1 (ja) 2022-06-14

Similar Documents

Publication Publication Date Title
Wang et al. MILP-aided method of searching division property using three subsets and applications
US11593711B2 (en) Method and system for adaptively reducing feature bit-size for homomorphically encrypted data sets used to train machine learning models
US20240022395A1 (en) Encryption processing device and encryption processing method
Burek et al. Algebraic attacks on block ciphers using quantum annealing
WO2023074133A1 (ja) 暗号処理装置、暗号処理方法、及び暗号処理プログラム
WO2023067928A1 (ja) 暗号処理装置、暗号処理方法、及び暗号処理プログラム
JP7069460B2 (ja) 暗号処理装置、暗号処理方法、及び暗号処理プログラム
Beighton et al. Algebraic attacks on Grain-like keystream generators
JP7261502B2 (ja) 暗号処理装置、暗号処理方法、及び暗号処理プログラム
WO2022270080A1 (ja) 暗号処理装置、暗号処理方法、及び暗号処理プログラム
CN114936350A (zh) 一种基于gpu快速数论转换的全同态加密门自举方法
JP7185346B1 (ja) 暗号処理装置、暗号処理方法、及び暗号処理プログラム
JP7187076B1 (ja) 暗号処理装置、暗号処理方法、及び暗号処理プログラム
WO2022044464A1 (ja) 暗号処理装置、暗号処理方法、及び暗号処理プログラム
JP7228287B1 (ja) 暗号処理装置、暗号処理方法、及び暗号処理プログラム
WO2023157117A1 (ja) 秘密計算装置、秘密計算方法、プログラム
WO2023157118A1 (ja) 秘密計算装置、秘密計算方法、プログラム
WO2023233516A1 (ja) 秘密計算装置、秘密計算方法、プログラム
US20240129107A1 (en) Encryption processing device and encryption processing method
JP2024013184A (ja) 暗号処理装置、暗号処理方法、暗号処理プログラム
WO2020039522A1 (ja) 情報処理装置、情報処理方法及びプログラム
KR102522393B1 (ko) 동형암호로 암호화된 데이터 연산 방법
US20240048353A1 (en) Encryption processing device and encryption processing method
Chakraborty et al. An FPGA based non-feistel block cipher through recursive substitutions of bits on prime-nonprime detection of sub-stream (RSBPNDS)
WO2023281694A1 (ja) 秘密計算システム、装置、方法及びプログラム

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22774594

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 22774594

Country of ref document: EP

Kind code of ref document: A1