WO2020001113A1 - 数据加解密的方法及装置 - Google Patents

数据加解密的方法及装置 Download PDF

Info

Publication number
WO2020001113A1
WO2020001113A1 PCT/CN2019/081055 CN2019081055W WO2020001113A1 WO 2020001113 A1 WO2020001113 A1 WO 2020001113A1 CN 2019081055 W CN2019081055 W CN 2019081055W WO 2020001113 A1 WO2020001113 A1 WO 2020001113A1
Authority
WO
WIPO (PCT)
Prior art keywords
result
data
encryption
random
decryption
Prior art date
Application number
PCT/CN2019/081055
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 WO2020001113A1 publication Critical patent/WO2020001113A1/zh
Priority to US16/888,531 priority Critical patent/US10911216B2/en
Priority to US17/164,603 priority patent/US11101977B2/en
Priority to US17/397,140 priority patent/US11431471B2/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
    • G06F7/00Methods or arrangements for processing data by operating upon the order or content of the data handled
    • G06F7/60Methods or arrangements for performing computations using a digital non-denominational number representation, i.e. number representation without radix; Computing devices using combinations of denominational and non-denominational quantity representations, e.g. using difunction pulse trains, STEELE computers, phase computers
    • G06F7/72Methods or arrangements for performing computations using a digital non-denominational number representation, i.e. number representation without radix; Computing devices using combinations of denominational and non-denominational quantity representations, e.g. using difunction pulse trains, STEELE computers, phase computers using residue arithmetic
    • G06F7/727Modulo N arithmetic, with N being either (2**n)-1,2**n or (2**n)+1, e.g. mod 3, mod 4 or mod 5
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/04Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks
    • H04L63/0428Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks wherein the data content is protected, e.g. by encrypting or encapsulating the payload
    • 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/08Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
    • H04L9/0861Generation of secret information including derivation or calculation of cryptographic keys or passwords
    • H04L9/0863Generation of secret information including derivation or calculation of cryptographic keys or passwords involving passwords or one-time passwords
    • 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/08Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
    • H04L9/0861Generation of secret information including derivation or calculation of cryptographic keys or passwords
    • H04L9/0869Generation of secret information including derivation or calculation of cryptographic keys or passwords involving random numbers or seeds

Definitions

  • One or more embodiments of the present specification relate to the field of data transmission security, and more particularly, to a method and device for data encryption and decryption.
  • Homomorphic Encryption is a type of encryption method with special natural attributes. Compared with general encryption algorithms, homomorphic encryption can achieve a variety of calculation functions between ciphertexts in addition to basic encryption operations. It allows people to perform specific algebraic operations on the ciphertext to obtain the result that is still encrypted. The result obtained by decrypting it is the same as the result of the same operation on the plaintext. In other words, the calculation first and the decryption are equivalent to the first. Calculated after decryption.
  • homomorphic encryption makes it play a great advantage in a variety of information security protection scenarios.
  • multiple ciphertexts can be calculated first and then decrypted. It is not necessary to decrypt each ciphertext and cost a high computational cost.
  • the use of homomorphic encryption technology can also realize the calculation of the ciphertext by the keyless party. The ciphertext calculation does not need to pass through the key party, which can reduce the communication cost and transfer the computing tasks, thereby balancing the calculation costs of all parties.
  • the use of homomorphic encryption technology can realize that the decrypting party can only know the final result, but cannot obtain the message of each ciphertext, which further improves the security of the information.
  • One or more embodiments of the present specification describe a method and device for data encryption and decryption transmission.
  • the data beyond the result range can be confused, thereby preventing one party from stealing another.
  • One party's private data increases the security of encrypted transmission.
  • a method for data encryption including:
  • the result range including a result minimum value a and a result maximum value b, the random item R being a product of a random number r and an agreed constant c, the The agreed constant c is greater than the difference between the result maximum b and the result minimum a;
  • performing the homomorphic operation to obtain the encryption result specifically includes:
  • performing the second homomorphic operation based on the first operation result and the random term includes: obtaining a difference between the first operation result and the minimum value a of the result as the second operation. Result; performing homomorphic sum encryption on the second operation result and the random term, thereby generating the encryption result.
  • the minimum value a is 0 and the maximum value b is a natural number of n bits; the agreed constant c is 10 ⁇ n, so that the random item R is arranged in the last n bits from high to low Both are 0, where n is a natural number.
  • the minimum value a is 0, the maximum value b is 2 ⁇ n, the agreed constant c is 2 ⁇ (n + 1), and the random term is expressed in binary.
  • the last n bits arranged from high to low are all 0, where n is a natural number.
  • the agreed constant c has a value of ⁇ + 1, where ⁇ is the difference between the result maximum b and the result minimum a.
  • a method for data decryption including:
  • a value of the first operation result is determined based on the remainder.
  • determining the value of the first operation result based on the remainder further includes:
  • the modulo operation includes obtaining the last n bits from the high bit to the low bit in the decryption result as the remainder.
  • the decryption result and the random term are both represented in binary, and in the binary representation of the random term, the last n bits arranged from the high bit to the low bit are all 0; the modulo operation at this time includes obtaining the The last n bits in the binary representation of the decrypted result are arranged from high to low as the remainder.
  • a data encryption device including:
  • a receiving unit configured to receive first data from a peer end
  • a random generating unit configured to generate a random term R based on a result range agreed in advance with the peer, the result range including a result minimum value a and a result maximum value b, the random item R being a random number r and an agreed constant a product of c, the agreed constant c is greater than a difference between the result maximum b and the result minimum a;
  • An arithmetic unit configured to perform a homomorphic operation based on the first data, the locally private second data, and the random term to obtain an encrypted result
  • the sending unit is configured to return the encryption result to the peer end.
  • a data decryption device including:
  • a receiving unit configured to receive an encryption result of homomorphic encryption, the encryption result being encrypted by the device of claim 9;
  • a decryption unit configured to perform homomorphic decryption on the encryption result to obtain a decryption result
  • a modulo unit configured to obtain a remainder modulo the agreed constant c from the decryption result
  • the determining unit is configured to determine a value of the operation result based on the remainder.
  • a computer-readable storage medium having stored thereon a computer program, which when executed in a computer, causes the computer to execute the methods of the first and second aspects.
  • a computing device including a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, the first aspect and the first aspect are implemented Two ways.
  • a specially constructed random term is introduced in the encrypted result based on the agreed result range and predetermined constants, so that the random term has no effect on the calculation result of the normal result range, Data is obfuscated. If the first end sends normal homomorphic encrypted data, the operation result after the second end operation should be within the agreed result range, and the first end can recover the operation result from the encrypted result; if the first end sends the Dishonestly constructed encrypted data, the calculation result will exceed the normal result range, and such a part that exceeds the normal result range will be confused by random terms, and its true value cannot be known, so the first end cannot pass the result beyond the result range. Partial theft of private data on the second end. In this way, the first end is prevented from stealing the private data of the second end without additional communication.
  • FIG. 1 is a schematic diagram of an implementation scenario of homomorphic encrypted transmission in an embodiment
  • Figure 2a shows a specific example of normal homomorphic encryption
  • Figure 2b shows a specific example of homomorphic encryption fraud
  • FIG. 3 shows a flowchart of a data encryption method according to an embodiment
  • FIG. 4 shows a flowchart of a data decryption method according to an embodiment
  • FIGS. 3 and 4 illustrates an example of a process of homomorphic encrypted transmission using the encryption and decryption methods of FIGS. 3 and 4;
  • FIG. 6 shows a schematic block diagram of a data encryption device according to an embodiment
  • FIG. 7 shows a schematic block diagram of a data decryption apparatus according to an embodiment.
  • FIG. 1 is a schematic diagram of an implementation scenario of homomorphic encrypted transmission according to an embodiment disclosed in this specification.
  • a process of homomorphic encryption and data transmission between two parties is shown.
  • the first end P1 performs homomorphic encryption on its private data X (x1, x2, x3 ...) to obtain encrypted data E (X), which includes E (x1), E (x2), E (x3) ...
  • the first end P1 transmits the encrypted data E (x1), E (x2), E (x3), etc. to the second end P2.
  • the second end has private data Y (y1, y2, y3 ). After receiving the encrypted data E (X) transmitted by the first end, the second end performs further operations based on the encrypted data E (X) and its private data Y, and the operation logic is expressed as a function f. According to the principle of homomorphic encryption and homomorphic operations:
  • F is a homomorphic operation function corresponding to the function f
  • F Homo f
  • the second end P2 operation obtains the encrypted operation result E (f (X, Y)), and returns the result to the first end P1.
  • the first end P1 decrypts the received operation result to obtain the value of f (X, Y).
  • the second end P2 does not need and cannot know the value of the private data X of the first end, but can perform the required operation directly based on the encrypted data E (X).
  • the first end P1 can directly obtain the calculation result f (X, Y) related to Y without knowing the private data Y of the second end P2, which makes both the first end and the second end need not know
  • the other party's private data can perform data calculations.
  • FIG. 2a shows a specific example of normal homomorphic encryption.
  • P1 performs homomorphic encryption on the private data, and transmits the encrypted data E (x1), E (x2) to the second end P2.
  • the second end P2 returns the encrypted result E (11) obtained by the operation to the first end P1.
  • the P1 party only knows the operation result f (X, Y), and cannot know the specific value of Y.
  • P2 After P2 receives the ciphertext data transmitted by P1, it performs the operation as usual, but the actual operation process is:
  • FIG. 3 shows a flowchart of a data encryption method according to an embodiment. This method is performed by a party that receives encrypted data and performs data operations, such as the second end P2 in FIG. 1 and FIG. 2a and FIG. 2b. As shown in FIG.
  • the encryption method includes, step S31, receiving first data from a peer; step S33, generating a random term R based on a result range agreed in advance with the peer, the random term R being a random number r and The product of the agreed constant c, which is greater than the difference between the maximum value and the minimum value of the result range; step S35, performing a homomorphic operation based on the first data, the locally private second data, and the above-mentioned random term R to generate an encrypted result Step S37: Return the encryption result to the peer end. The following describes how each step in FIG. 3 is performed.
  • the method in FIG. 3 is used for data processing and encryption between two parties of data transmission.
  • the two parties of data transmission may be referred to as the first end and the second end, where the first end provides encrypted data and requests to obtain data based on the Encrypted data is used for further calculation of the encrypted result, such as P1 in Figure 1, Figure 2a, and Figure 2b.
  • the second end receives the encrypted data and performs further calculations based on the encrypted data to obtain the operation encrypted result and return it to the first ;
  • the second end is, for example, the P2 side in FIGS. 1 and 2a and 2b.
  • the method steps in the flowchart of FIG. 3 are executed by the second end P2.
  • the two communication parties Before executing this method, the two communication parties, namely the first end P1 and the second end P2, need to agree to calculate the normal result range of the encrypted result.
  • P1 and P2 can agree on the result range before the encrypted transmission process begins, in a different way from the encrypted transmission communication method.
  • the result range can be expressed as [a, b], where a is the minimum value of the result, and b is the maximum value of the result.
  • the second end may use the method shown in FIG. 3 to perform data encryption.
  • first data is received from the opposite end.
  • P2 receives data from the first end P1.
  • This received data is referred to herein as the first data.
  • the first data is normal encrypted data in which homogeneous encryption is performed on the private data of the first end P1 according to the agreement, or ciphertext data to which special structured data is added.
  • the first data c1 and c2 are honest data that is homomorphically encrypted according to the agreement; if p1 and / or p2 are not 0, then the first data is forged with a special structure data.
  • a random term R is generated based on a result range agreed in advance with the peer end, the random term R is a product of a random number r and an agreed constant c, and the preset constant c is greater than the result
  • the difference between the maximum value and the minimum value of the range in step 35, based on the first data received in step 31, the local private second data, and the random term R generated in step 33, a further homomorphic operation is performed to obtain the encryption result. Yu returns to the first terminal P1.
  • the minimum value of the agreed result range is 0, and therefore, the result range can be expressed as [0, b].
  • the result range is expressed in binary, where the result maximum b can be expressed as 2 ⁇ n.
  • the constant c can be set to 2 ⁇ (n + 1) in the binary representation, so that in the binary representation of the random term obtained by multiplying the random number by the constant c, the lower n bits are 0.
  • the constant c may also be set or agreed in advance at both ends, for example, while the result range is agreed, the above-mentioned constant c is set or agreed.
  • a random term R r * c is generated according to the aforementioned constant c and random number r.
  • step 35 a homomorphic operation is performed based on the first data received from the first end, the second data locally private at the second end, and the random term R generated at step 33.
  • a first homomorphic operation may be performed first based on the first data and the second data that is locally private to obtain a first operation result.
  • the second end P2 does not judge and distinguish the first data E (X) received from P1, and normally combines the local private data (herein referred to as the second data, corresponding to the data in FIG. 4).
  • the data Y) is subjected to a homomorphic operation to obtain a first operation result, that is, E (f (X, Y)).
  • the first operation result is combined with the above-mentioned random term, that is, a further homomorphic operation is performed to obtain an encrypted result.
  • the further homomorphic operation is the homomorphic addition encryption of the first operation result and the random term R, thereby obtaining the following encryption result:
  • first data, the second data, and the random item may also be homomorphically calculated without distinguishing between the first homomorphic operation process and the second homomorphic operation process, or using different homomorphisms. Operation order.
  • you can first calculate E (x1 * y1), then calculate E (x1 * y1 + R), and then calculate E (x1 * y1 + R + x2 * y2) E (f (X, Y ) + R).
  • E (x2 * y2) E (x2 * y2 + R)
  • E (x2 * y2 + R + x1 * y1) E (f (X, Y) + R).
  • E (x1 * y1 + x2 * y2 + R) can also be directly calculated, thereby directly obtaining the encryption result E (f (X, Y) + R).
  • the random term R can be designed such that the high order random (corresponding to the random number r) and the low order n bits are 0, so that if f (X, Y) Within the normal range b, then f (X, Y) can be recovered from the last n bits of the result of f (X, Y) + R; while the part beyond n bits is confused and covered by the high bits of the random term R.
  • a second operation function g (X, Y) F (X, Y) -a, then obviously, the normal result range of the second operation function is [0, ba].
  • the constant c is set larger than b-a.
  • the constant c is set to 10 ⁇ n.
  • the constant c can be set to any value greater than 46.
  • the constant c can be set to 47; or, more simply, it can be set to 100.
  • the constant c may be set or agreed in advance by both ends of the communication, for example, the above-mentioned constant c may be set or agreed while the result range is agreed.
  • step 33 a random number r is generated.
  • the product of the constant c set above and the random number r is taken as the random term R.
  • a homomorphic operation is performed based on the first data, the locally-owned second data, and the generated random term R to obtain an encryption result.
  • the homomorphic operation includes: first performing a homomorphic operation on the first data and the second data to obtain a first operation result; and then subtracting the minimum value a of the result range from the first operation result to obtain the same result as the second value.
  • the second operation result corresponding to the operation function; then the second operation result and the random term R are homomorphically added and encrypted to obtain the following encryption result:
  • the calculation process of the encryption result is not limited to the above example.
  • the first data, the second data, and the random item may be directly subjected to a homomorphic operation, without distinguishing between the first operation result and the second operation result, or using different homomorphic operation orders. The specific process is not repeated here.
  • the random term R r * c, where c must be greater than b-a. Therefore, the random term R actually confuses the part of g (X, Y) beyond b-a, but has no effect on the part smaller than b-a.
  • the random term R can be designed such that the high order random (corresponding to the random number r) and the low order n bits are 0, so that if g (X, Y ) Is within the normal range ba, then g (X, Y) can be recovered from the last n bits of the result of g (X, Y) + R; while the part beyond n bits is confused and covered by the high bits of the random term R .
  • the second end generates an encrypted result by adding a specially constructed random term R to the result.
  • the encryption result has no effect on the data of the agreed result range, but it will confuse data beyond the agreed result range. Then, in step 37, the second end returns such an encrypted result to the opposite end, that is, the first end.
  • FIG. 4 shows a flowchart of a data decryption method according to an embodiment. It can be understood that the method steps are executed by an end opposite to the execution end of the method of FIG. 3. For example, in the case where FIG. 3 is executed by the second end P2, the method of FIG. 4 is executed by the first end P1. As shown in FIG. 4, the method includes: Step 41, receiving an encryption result of homomorphic encryption according to the method of FIG. 3; Step 43, performing homomorphic decryption on the encryption result to obtain a decryption result; Step 45, obtaining a decryption result Take the remainder of the modulo constant c; step 47, determine the value of the operation result based on the remainder. The following describes the execution process of the above steps.
  • the second end returns the encrypted result to the opposite end, that is, the first end; correspondingly, in step 41, the first end receives the encryption result from the second end.
  • the encryption result is an encryption result doped with a random term R according to the method of FIG. 3.
  • the agreed result range can be expressed as [0, b], and accordingly, the encryption result sent by the second end can be expressed as E (f (X, Y) + R), where R is a random term .
  • step 43 the above-mentioned encryption result is homomorphically decrypted to obtain a decryption result, that is, a value d of f (X, Y) + R is obtained.
  • step 45 the remainder of the decryption result d modulo the agreed constant c is obtained.
  • the decryption result d is divided by the agreed constant c, the quotient is necessarily r, and the remainder is the part f (X, Y) that is less than c.
  • the convention constant c is set to 10 ⁇ n.
  • the method of modulo the agreed constant c in step 45 becomes very simple, that is, obtaining the lowest n bits in the decryption result d, that is, the remainder after the modulo.
  • the convention constant c is set to 2 ⁇ (n + 1), and the decryption result and the random term are both represented in binary. Since the convention constant c is set to 2 ⁇ (n + 1), in the binary representation of the random term R, the first n bits arranged from the low to the high are all 0. In such a case, the way to modulo the agreed constant c in step 45 is to obtain the first n bits arranged from the low bit to the high bit in the binary representation of the decryption result d as the remainder.
  • f (X, Y) of the normal operation is necessarily smaller than c, so in step 47, the remainder can be determined as the value of the operation result f (X, Y).
  • step 43 the above encryption result is homomorphically decrypted to obtain the decryption result, that is, the value d of g (X, Y) + R is obtained.
  • step 45 the remainder of the decryption result d modulo the agreed constant c is obtained.
  • the convention constant c is set to 10 ⁇ n
  • the remainder after the modulus can be obtained by obtaining the lowest n bits in the decryption result d.
  • the convention constant c is set to 2 ⁇ (n + 1), and the decryption result and the random term are both represented in binary, then the first n digits arranged from low to high in the binary representation of the decryption result d can be obtained as the remainder.
  • FIG. 5 shows an example of a process of homomorphic encrypted transmission using the encryption and decryption methods of FIGS. 3 and 4.
  • the normal f (X, Y) value can still be extracted by the last 2 bits; however, the result of 100 * y1 + 10000 * y2 designed to steal the private data y1 and y2 of the P2 party is R Confusing. As shown in Figure 2b, P1 can no longer determine y1 through the hundreds digits and y2 through the tens of thousands.
  • the first end P1 and the second end P2 agree in advance a normal result range, and a predetermined constant c.
  • the second end P2 introduces a specially constructed random term in the encrypted result based on the agreed result range and predetermined constants, so that the random term has no effect on the calculation result of the normal result range, and confuses data beyond the normal result range. If the first end P1 sends normal homomorphic encrypted data, the operation result after the second end P2 operation should be within the agreed result range. Then the first-end P1 can recover the operation result from the encrypted result; if the first-end P1 sends dishonest and specially-structured encrypted data, the operation result will exceed the normal result range, and this is beyond the normal result range. Part of it will be confused by random terms, and its true value cannot be known, so P1 cannot steal the private data of P2 through the part beyond the result range. In this way, the first end is prevented from stealing the private data of the second end without additional communication.
  • FIG. 6 shows a schematic block diagram of a data encryption device according to an embodiment.
  • the data encryption device 60 includes: a receiving unit 61 configured to receive first data from a peer end; and a random generating unit 63 configured to generate a random term R based on a result range agreed in advance with the peer end,
  • the result range includes a result minimum value a and a result maximum value b, the random term R is a product of a random number r and an agreed constant c, and the agreed constant c is greater than a difference between the result maximum b and the result minimum a.
  • operation unit 65 configured to perform homomorphic operation based on the first data, locally private second data, and the random term to obtain an encrypted result; and sending unit 67 configured to return the encrypted result to The opposite end.
  • the operation unit includes (not shown): a first operation module configured to perform a first homomorphic operation based on the first data and the second data to obtain a first operation result;
  • the operation module is configured to perform a second homomorphic operation based on the first operation result and the random term to obtain an encrypted result.
  • the above-mentioned second operation module is configured to: obtain a difference between the first operation result and the minimum value a of the result as a second operation result;
  • the random term is homomorphically summed and encrypted, thereby generating the encryption result.
  • the minimum value a of the result is 0, and the maximum value b of the result is an n-bit natural number; the conventional constant c is 10 ⁇ n.
  • the last n digits of the random items R generated from the random item R generated by the high order to the low order are all 0, where n is a natural number.
  • the minimum value a is 0, the maximum value b is 2 ⁇ n, the agreed constant c is 2 ⁇ (n + 1), and the random term is expressed in binary.
  • the last n bits arranged from the high bit to the low bit are all 0, where n is a natural number.
  • the agreed constant c has a value of ⁇ + 1, where ⁇ is the difference between the result maximum b and the result minimum a.
  • FIG. 7 shows a schematic block diagram of a data decryption apparatus according to an embodiment.
  • the data decryption device 70 includes: a receiving unit 71 configured to receive a homomorphic encryption result from the data encryption device 60 of FIG. 6; a decryption unit 73 configured to homomorphically decrypt the encryption result, A decryption result is obtained; a modulo unit 75 is configured to obtain a remainder modulo the agreed constant c from the decryption result; a determining unit 77 is configured to determine a value of the operation result based on the remainder.
  • the determining unit 77 is configured to determine that the value of the operation result is the value of the remainder plus the result minimum value a.
  • the convention constant c is set to 10 ⁇ n.
  • the modulo unit 75 is configured to obtain the last n bits arranged from the high bit to the low bit in the decryption result as the remainder.
  • the decryption result and the random term are both represented in binary.
  • the last n bits arranged from the high bit to the low bit are all 0.
  • the modulo unit 75 is configured to obtain the last n bits arranged from the high bit to the low bit in the binary representation of the decryption result as the remainder.
  • a computer-readable storage medium having stored thereon a computer program, and when the computer program is executed in a computer, the computer is caused to execute the method described in conjunction with FIG. 3 and FIG. 4.
  • a computing device which includes a memory and a processor, where the executable code is stored in the memory, and when the processor executes the executable code, the combination of FIG. 3 and FIG. The method described.
  • the functions described in the present invention may be implemented by hardware, software, firmware, or any combination thereof. When implemented in software, these functions may be stored in or transmitted over as one or more instructions or code on a computer-readable medium.

Abstract

本说明书实施例提供一种数据加密、数据解密的方法和装置。根据加密方法,在加密结果中基于约定的结果范围和预定常数引入特殊构造的随机项,使得该随机项对于正常结果范围的运算结果没有影响,对于超出正常结果范围的数据进行混淆。在解密过程中,可以从加密结果中恢复出约定结果范围之内的运算结果。

Description

数据加解密的方法及装置 技术领域
本说明书一个或多个实施例涉及数据传输安全领域,尤其涉及数据加解密的方法和装置。
背景技术
随着互联网的发展和云计算概念的诞生,以及人们在密文搜索、密文传输和多方计算等方面的需求日益增加,同态加密(Homomorphic Encryption)变得更加重要。同态加密是一类具有特殊自然属性的加密方法,与一般加密算法相比,同态加密除了能实现基本的加密操作之外,还能实现密文间的多种计算功能。它允许人们对密文进行特定的代数运算得到仍然是加密的结果,将其解密所得到的结果与对明文进行同样的运算结果一样,换而言之,即先计算后解密可等价于先解密后计算。
同态加密的上述性质使得它在多种信息安全保护场景中发挥很大优势。人们可以委托第三方对数据进行处理而不泄露信息。此外,利用同态加密技术可以先对多个密文进行计算之后再解密,不必对每一个密文解密而花费高昂的计算代价。利用同态加密技术还可以实现无密钥方对密文的计算,密文计算无须经过密钥方,既可以减少通信代价,又可以转移计算任务,由此可平衡各方的计算代价。另外,利用同态加密技术可以实现让解密方只能获知最后的结果,而无法获得每一个密文的消息,进一步提高信息的安全性。
然而,在一些情况下,多方计算中的某一方,有可能通过构造特殊字段伪装成同态加密密文的方式,窃取其他方的原数据。
因此,希望能有改进的方案,进一步提高同态加密数据传输的安全性。
发明内容
本说明书一个或多个实施例描述了一种数据加解密传输的方法和装置,通过在约定的结果范围的基础上引入特殊构造的随机项,来混淆超出结果范围的数据,从而防止一方窃取另一方的私有数据,增加加密传输的安全性。
根据第一方面,提供了一种数据加密的方法,包括:
从对端接收第一数据;
基于与所述对端预先约定的结果范围,生成随机项R,所述结果范围包括结果最小值a和结果最大值b,所述随机项R为随机数r与约定常数c的乘积,所述约定常数c大于所述结果最大值b与结果最小值a的差值;
基于所述第一数据、本地私有的第二数据,以及所述随机项,进行同态运算,得到加密结果;
将所述加密结果返回给所述对端。
在一个实施例中,进行同态运算得到加密结果具体包括:
基于所述第一数据和所述第二数据,进行第一同态运算,得到第一运算结果;然后基于所述第一运算结果和所述随机项,进行第二同态运算,得到加密结果。
进一步地,在一个实施例中,以上基于所述第一运算结果和随机项,进行第二同态运算包括:获取所述第一运算结果与所述结果最小值a的差值作为第二运算结果;对所述第二运算结果与所述随机项进行同态求和加密,从而生成所述加密结果。
在一种可能的设计中,结果最小值a为0,结果最大值b为n位自然数;所述约定常数c为10^n,使得所述随机项R中从高位向低位排列的后n位均为0,其中n为自然数。
在一种可能的设计中,结果最小值a为0,结果最大值b为2^n,所述约定常数c为2^(n+1),所述随机项以二进制表示,在所述随机项R的二进制表示中,从高位向低位排列的后n位均为0,其中n为自然数。
在一种实施方式中,约定常数c取值为Δ+1,其中Δ为所述结果最大值b与结果最小值a的差值。
根据第二方面,提供一种数据解密的方法,包括:
接收同态加密的加密结果,所述加密结果根据第一方面的加密方法生成;
对所述加密结果进行同态解密,得到解密结果;
获取解密结果对所述约定常数c取模的余数;
基于所述余数确定所述第一运算结果的值。
在一个实施例中,基于所述余数确定所述第一运算结果的值进一步包括:
确定运算结果的值为所述余数的值加上所述结果最小值a。
在一种可能的设计中,约定常数c为10^n,此时取模操作包括,获取所述解密结果中从高位向低位排列的后n位,作为余数。
在一种可能的设计中,解密结果和随机项均以二进制表示,所述随机项的二进制表示中,从高位向低位排列的后n位均为0;此时取模操作包括,获取所述解密结果的二进制表示中从高位向低位排列的后n位,作为余数。
根据第三方面,提供一种数据加密的装置,包括:
接收单元,配置为从对端接收第一数据;
随机生成单元,配置为基于与所述对端预先约定的结果范围,生成随机项R,所述结果范围包括结果最小值a和结果最大值b,所述随机项R为随机数r与约定常数c的乘积,所述约定常数c大于所述结果最大值b与结果最小值a的差值;
运算单元,配置为基于所述第一数据、本地私有的第二数据,以及所述随机项,进行同态运算,得到加密结果;
发送单元,配置为将所述加密结果返回给所述对端。
根据第四方面,提供一种数据解密的装置,包括:
接收单元,配置为接收同态加密的加密结果,所述加密结果由权利要求9的装置加密生成;
解密单元,配置为对所述加密结果进行同态解密,得到解密结果;
取模单元,配置为获取解密结果对所述约定常数c取模的余数;
确定单元,配置为基于所述余数确定所述运算结果的值。
根据第五方面,提供了一种计算机可读存储介质,其上存储有计算机程序,当所述计算机程序在计算机中执行时,令计算机执行第一方面和第二方面的方法。
根据第六方面,提供了一种计算设备,包括存储器和处理器,其特征在于,所述存储器中存储有可执行代码,所述处理器执行所述可执行代码时,实现第一方面和第二方面的方法。
通过本说明书实施例提供的方法和装置,在加密结果中基于约定的结果范围和预定常数引入特殊构造的随机项,使得该随机项对于正常结果范围的运算结果没有影响,对 于超出正常结果范围的数据进行混淆。如果第一端发送的是正常的同态加密数据,那么第二端运算之后的运算结果应该在约定的结果范围,第一端可以从加密结果中恢复出运算结果;如果第一端发送的是不诚实的特殊构造的加密数据,那么运算结果将会超出正常结果范围,而这样的超出正常结果范围的部分会被随机项混淆,无法获知其真实值,因而第一端无法通过超出结果范围的部分窃取第二端的私有数据。如此,在不增加附加通信的情况下,防止第一端窃取第二端的私有数据。
附图说明
为了更清楚地说明本发明实施例的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其它的附图。
图1为一个实施例中同态加密传输的实施场景示意图;
图2a示出正常同态加密的具体例子;
图2b示出同态加密欺诈的具体例子;
图3示出根据一个实施例的数据加密方法的流程图;
图4示出根据一个实施例的数据解密的方法流程图;
图5示出采用图3和图4的加密和解密方法进行同态加密传输的过程的例子;
图6示出根据一个实施例的数据加密装置的示意性框图;
图7示出根据一个实施例的数据解密装置的示意性框图。
具体实施方式
下面结合附图,对本说明书提供的方案进行描述。
图1为本说明书披露的一个实施例的同态加密传输的实施场景示意图。在图1中,示出了双方进行同态加密和数据传输的过程。在这个过程中,首先,第一端P1对其私有数据X(x1,x2,x3…)进行同态加密,得到加密数据E(X),即包括E(x1),E(x2),E(x3)…。然后第一端P1将加密数据E(x1),E(x2),E(x3)等传输给第二端P2。
第二端具有私有数据Y(y1,y2,y3…)。在接收到第一端传输的加密数据E(X)之后,第二端基于加密数据E(X)和其私有数据Y进行进一步运算,运算逻辑表示为函数f。根据同态加密和同态运算的原理:
F(E(x1),E(x2),E(x3)…,Y)=F(E(X),Y)=E(f(X,Y))
其中F是与函数f对应的同态运算函数,F=Homo f,使得解密出来的明文对应函数f运算。
因此,第二端P2运算得到加密的运算结果E(f(X,Y)),并将该结果返回给第一端P1。第一端P1对接收到的运算结果进行解密,可以得到f(X,Y)的值。如此,第二端P2无需也无法知道第一端的私有数据X的值,而可以直接基于加密的数据E(X)进行所需的运算。而第一端P1则可以在不知道第二端P2的私有数据Y的情况下,直接获得与Y有关的计算结果f(X,Y),这使得第一端和第二端双方都无需知道对方的私有数据,就可以进行数据的运算。
然而,经过发明人的观察和研究,在实际的同态加密传输过程中,有可能一方,例如P1端,向对方P2发送的不是约定的同态加密算法的正常数据结构的密文E(X),而是特殊构造明文的密文,或者特殊构造的其他串,在此记为E(X’),以此试图窃取P2的私有数据Y的信息。而P2对来自P1的数据E(X’)和其本地私有数据Y进行函数运算之后,得到的计算结果是密文形式,也就是E(f(X’,Y)),没有P1方的秘钥,P2无法从该密文形式中判断计算结果是否符合约定,是否在正常范围。
下面结合具体例子描述正常同态加密和同态加密欺诈的过程。
图2a示出正常同态加密的具体例子。在该例子中,P1一端具有私有数据X(x1=3,x2=5)。P1对私有数据进行同态加密,并将加密后的数据E(x1),E(x2)传输给第二端P2。
第二端P2具有私有数据Y(y1=2,y2=1)。在接收到第一端P1传输的加密数据之后,第二端基于加密数据E(X)和其私有数据Y进行进一步运算,假定运算逻辑f可以表示为:
f(X,Y)=x1*y1+x2*y2
那么P2就可以基于E(X)和Y进行计算,得到:
E(f(X,Y))=E(x1*y1+x2*y2)=E(11)
于是,第二端P2将运算得到的加密结果E(11)返回给第一端P1。第一端P1解密就 得到可以f(X,Y)=11。在该常规同态加密传输过程中,P1方只会知道运算结果f(X,Y),而无法知道Y的具体值。
然而,通过构造特殊明文或字段,却有可能窃取到P2的私有数据Y。图2b示出同态加密欺诈的具体例子。与图2a类似地,P1一端具有私有数据X(x1=3,x2=5)。但是在传输的时候,P1并不是如图2a一样诚实地将同态加密数据E(x1),E(x2)传输给第二端P2,而是在其中添加了构造数据100和10000,将伪造数据E(x1+100)和E(x2+10000)传输给P2。
P2接收到P1传输的密文数据之后,照常进行运算,但是实际运算过程为:
E(f(100+x1,10000+x2,y1,y2))
=E(x1*y1+x2*y2+100*y1+10000*y2)        (式1)
=E(10211)
之后,P2如常地将该结果返回给P1,P1通过解密得到f(X’,Y)=10211。此时,如果P1已经通过图2a的过程知道f(X,Y)=11,或者P1预先知道f(X,Y)的正常结果不会超过百位,那么根据构造数据100和10000的设置方式,从式(1)就可以知道,百位对应的数字应该为y1,万位对应的数字应该为y2。于是,P1就可以推断出,y1=2,y2=1。如此,P1通过构造数据,窃取到P2端的私有数据y1和y2。
如前所述,由于P2的计算结果E(f)本身是密文形式,因此P2很难判断计算结果是否正常。而P1方传输过来的数据E(X)也是加密形式,若要判断E(X)是否为正常数据,也需要很大的附加计算量和附加通信。基于这样的考虑,在本说明书的实施例中,P1和P2预先约定计算结果的正常范围。在此基础上,P2在进行运算时,根据预先约定的范围生成随机项,使得该随机项对于正常范围内的运算结果没有影响,但是对于超出正常范围的运算结果进行混淆,从而防止P1通过构造特殊数据窃取P2的私有数据。下面描述该构思的具体实现方式。
图3示出根据一个实施例的数据加密方法的流程图。该方法由接收加密数据并进行数据运算的一方执行,例如图1和图2a、图2b中的第二端P2。如图3所示,该加密方法包括,步骤S31,从对端接收第一数据;步骤S33,基于与对端预先约定的结果范围,生成随机项R,所述随机项R为随机数r与约定常数c的乘积,约定常数c大于结果范围的最大值与最小值的差;步骤S35,基于第一数据、本地私有的第二数据,以及上述随机项R进行同态运算,以生成加密结果;步骤S37,将加密结果返回给对端。下面描 述图3中各个步骤的执行方式。
可以理解,图3的方法用于在数据传输的双方之间进行数据处理和加密,数据传输的双方可以称为第一端和第二端,其中第一端提供加密数据,并请求获得基于该加密数据进行进一步运算的运算加密结果,例如图1、图2a、图2b中的P1方;第二端接收加密数据,并基于该加密数据进行进一步运算,以得到运算加密结果返回给第一端;第二端例如是图1和图2a、图2b中的P2方。图3流程图中的方法步骤由第二端P2执行。
在执行该方法之前,通信双方,即第一端P1和第二端P2,需要约定,运算加密结果的正常结果范围。一般地,出于安全需要,P1和P2可以在加密传输过程开始之前,通过与加密传输的通信方式不同的方式来约定该结果范围。不失一般性地,结果范围可以表示为[a,b],其中a表示结果最小值,b表示结果最大值。
在第一端和第二端约定好运算加密结果的正常结果范围的情况下,第二端即可以采用图3所示方法进行数据加密。
首先,在步骤31,从对端接收第一数据。在图4的示意中,即P2从第一端P1接收数据。该接收的数据在此被称为第一数据。然而,在本步骤中,并不知晓第一数据是第一端P1按照约定,对其私有数据进行同态加密的正常加密数据,还是添加了特殊构造数据的密文数据。例如,第一端P1的私有数据X包括x1和x2,那么从第一端接收的第一数据E(X)可以表示为c1=E(x1+p1),c2=E(x2+p2),这里并不知晓p1和p2的值。在p1和p2均为0的情况下,第一数据c1和c2为按照约定进行同态加密的诚实数据;如果p1和/或p2不为0,那么第一数据则为进行了特殊构造的伪造数据。
在接收到上述第一数据之后,在步骤33,基于与对端预先约定的结果范围,生成随机项R,所述随机项R为随机数r与约定常数c的乘积,预设常数c大于结果范围的最大值与最小值的差;在步骤35,基于步骤31接收的第一数据,本地私有的第二数据,以及步骤33生成的随机项R,进行进一步同态运算,得到加密结果,用于返回给第一端P1。
下面结合预先约定的结果范围的不同情况,描述步骤33和35的执行。
在第一实施例中,约定的结果范围的最小值为0,因此,该结果范围可以表示为[0,b]。
在第一实施例的一个例子中,常数c可以被设置为任意大于b的值,例如较为简单的,c被设置为c=b+1。比如,如果约定结果范围为[0,99],那么c可以被设置为100;如果约定结果范围为[0,63],那么c可以设置为64。
在第一实施例的另一例子中,考虑结果范围的最大值b的位数,假定b是n位的自然数,那么不管b值具体为何,都将常数c设定为10^n。然后生成一随机数r。如此,在将常数c与随机数r相乘得到随机项后,随机项的高位对应于随机数r,低位的n位均为0。比如,在上面的例子中,不管M为99还是63,都是一个2位自然数,那么在这样的情况下,都将c设置为10^2=100。于是,将常数100与随机数r相乘之后得到的随机项R中,后面的2位,即低位的2位必然均为0。比如r=2356,那么随机项为235600,低2位均为0。
在第一实施例的另一例子中,结果范围以二进制表示,其中结果最大值b可以表示为2^n。此时可以将常数c设置为,在二进制表示下的2^(n+1),如此使得,在将随机数与常数c相乘得到的随机项的二进制表示中,低位的n个位均为0。
需要理解的是,由于结果范围是通信的两端预先约定的,常数c也可以是两端预先设置或约定的,例如,在约定结果范围的同时,设置或约定上述常数c。
如此,在第一实施例中,按照前述的常数c和随机数r,生成随机项R=r*c。
接着,在步骤35,基于从第一端接收的第一数据,第二端本地私有的第二数据,以及步骤33生成的随机项R,进行同态运算。
在一个实施例中,可以首先基于第一数据以及本地私有的第二数据,进行第一同态运算,得到第一运算结果。在这个过程中,第二端P2并不对从P1接收到的第一数据E(X)进行判断和区分,照常地结合本地私有的数据(在此称为第二数据,对应于图4中的数据Y)进行同态运算,得到第一运算结果,即E(f(X,Y))。然后将第一运算结果与上述随机项结合运算,即进行进一步同态运算,得到加密结果。在第一实施例中,该进一步同态运算即为第一运算结果和随机项R的同态相加加密,从而得到如下加密结果:
E(f(X,Y)+R)
然而,加密结果的运算过程并不限于以上实施例。下面以f(X,Y)=x1*y1+x2*y2为例进行描述。
在如上述实施例描述分别进行第一同态运算和第二同态运算的情况下,首先运算E(x1*y1+x2*y2),得到第一运算结果,然后进行第二同态运算,得到E(x1*y1+x2*y2+R)=E(f(X,Y)+R)。
在另一实施例中,也可以直接对第一数据、第二数据和随机项进行同态运算,而不 区分上述第一同态运算过程和第二同态运算过程,或者采用不同的同态运算顺序。
例如,在一个例子中,可以首先计算E(x1*y1),然后计算E(x1*y1+R),再计算E(x1*y1+R+x2*y2)=E(f(X,Y)+R)。当然也可以首先计算E(x2*y2),然后计算E(x2*y2+R),再计算E(x2*y2+R+x1*y1)=E(f(X,Y)+R)。
或者,在一个例子中,也可以直接计算E(x1*y1+x2*y2+R),从而直接得到加密结果E(f(X,Y)+R)。
不管采用怎样的同态运算顺序,最终得到混淆有随机项的加密结果E(f(X,Y)+R)。
可以理解,如果第一端P1发送的是正常的同态加密数据E(X),那么f(X,Y)的运算结果应该在约定的结果范围之内。在第一实施例中,f(X,Y)<b。而随机项R=r*c,其中c必然大于b。因此,随机项R实际上混淆了超出b的部分,而对小于b的部分没有影响。特别是,根据前述的若干例子,如果b为n位数,随机项R可以被设计为,高位随机(对应随机数r),低位的n位为0,如此使得,如果f(X,Y)在正常范围b之内,那么可以从f(X,Y)+R结果的后n位中恢复f(X,Y);而超出n位的部分,则被随机项R的高位混淆和覆盖。
更一般地,在第二实施例中,约定的结果范围的最小值为a,最大值为b,因此,该结果范围可以表示为[a,b],其中a,b是任意整数,例如[-99,98],[12,58],等等。实际上,第一实施例可以认为是a=0的特殊例子。
由于f(X,Y)约定的结果范围在a和b之间,即a<f(X,Y)<b,那么在第二实施例中,可以构造第二运算函数g(X,Y)=f(X,Y)-a,那么显然,第二运算函数的正常结果范围为[0,b-a]。将第二运算函数作为要处理的运算函数,问题再次转化为第一实施例中范围最小值为0的情况。
类似地,设置常数c使其大于b-a。例如,在一个例子中,将常数c设置为:c=b-a+1。在另一例子中,如果b-a的结果为n位数,则将常数c设置为10^n。
比如,如果针对f(X,Y)约定的结果范围为[12,58],那么构造的第二运算函数g(X,Y)=f(X,Y)-12的结果范围为[0,46]。可以将常数c设置为任意大于46的值。例如,可以将常数c设为47;或者,更简便地,将其设置为100。
如前所述,常数c可以是通信两端预先设置或约定的,例如,在约定结果范围的同时,设置或约定上述常数c。
在已经设置或约定上述常数c的基础上,在步骤33中,生成一随机数r。将以上设置的常数c与随机数r的乘积作为随机项R。
接着,在步骤35,基于第一数据、本地私有的第二数据,以及生成的随机项R,进行同态运算,得到加密结果。在一个示例中,该同态运算包括,首先对第一数据和第二数据进行同态运算,得到第一运算结果;然后将第一运算结果减去结果范围的最小值a,得到与第二运算函数对应的第二运算结果;之后将该第二运算结果和随机项R进行同态相加加密,从而得到如下加密结果:
E(g(X,Y)+R)=E(f(X,Y)-a+R)=E(f(X,Y)-a+r*c)
与第一实施例中的描述类似的,加密结果的运算过程并不限于以上示例。在其他示例中,也可以直接对第一数据、第二数据和随机项进行同态运算,而不区分上述第一运算结果和第二运算结果,或者采用不同的同态运算顺序。具体过程不再赘述。
不管采用怎样的同态运算顺序,最终得到混淆有随机项的加密结果E(g(X,Y)+R)。
如果第一端P1发送的是正常的同态加密数据E(X),那么f(X,Y)的运算结果应该在约定的结果范围[a,b]之内,相应地,g(X,Y)=f(X,Y)-a应该在[0,b-a]之内。而随机项R=r*c,其中c必然大于b-a。因此,随机项R实际上混淆了g(X,Y)超出b-a的部分,而对小于b-a的部分没有影响。特别是,在某些具体例子中,如果b-a为n位数,随机项R可以被设计为,高位随机(对应随机数r),低位的n位为0,如此使得,如果g(X,Y)在正常范围b-a之内,那么可以从g(X,Y)+R结果的后n位中恢复g(X,Y);而超出n位的部分,则被随机项R的高位混淆和覆盖。
如此,第二端通过在结果中加入特殊构造的随机项R,生成加密结果。该加密结果对于约定结果范围的数据没有影响,但是会混淆超出约定结果范围的数据。接着,在步骤37,第二端将这样的加密结果返回给对端,即第一端。
接下来描述,第一端对接收到的加密结果进行解密的过程。
图4示出根据一个实施例的数据解密的方法流程图,可以理解,该方法步骤由与图3方法的执行端相对的一端来执行。例如,在图3由第二端P2执行的情况下,图4的方法由第一端P1执行。如图4所示,该方法包括:步骤41,接收根据图3的方法进行同态加密的加密结果;步骤43,对所述加密结果进行同态解密,得到解密结果;步骤45,获取解密结果对所述约定常数c取模的余数;步骤47,基于所述余数确定运算结果的值。下面描述上述各个步骤的执行过程。
如前所述,在图3的步骤39中,第二端将加密结果返回给对端,即第一端;那么相对应地,在步骤41,第一端从第二端接收到上述加密结果。可以理解,该加密结果是根据图3的方法,掺杂了随机项R的加密结果。
下面仍然与前述第一实施例和第二实施例对应地描述后续步骤的执行方式。
在第一实施例中,约定的结果范围可以表示为[0,b],相应地,第二端发送的加密结果可以表示为E(f(X,Y)+R),其中R为随机项。
接着,在步骤43,对上述加密结果进行同态解密,得到解密结果,即得到f(X,Y)+R的值d。
如前所述,随机项R可以表示为R=r*c,其中r为随机数,c为约定常数,且c>b。因此解密结果d可以表示为:
d=f(X,Y)+R=f(X,Y)+r*c
基于此,在步骤45,获取解密结果d对约定常数c取模的余数。
由于f(X,Y)的约定范围为[0,b],因此,如果第一端发送的是正常同态加密数据E(X),那么基于此的计算结果f(X,Y)<=b;又有:c>b,那么,f(X,Y)<c。
因此,如果用解密结果d除以约定常数c,必然得出商为r,余数即为不足c的部分f(X,Y)。
在一个具体例子中,约定常数c被设置为10^n。此时,步骤45中对约定常数c取模的方式变得非常简单,即获取解密结果d中最低的n位,即为取模之后的余数。
在另一具体例子中,约定常数c被设置为2^(n+1),并且解密结果和随机项均以二进制表示。由于约定常数c为设置为2^(n+1),在随机项R的二进制表示中,从低位向高位排列的前n位均为0。在这样的情况下,步骤45中对约定常数c取模的方式即为,获取解密结果d的二进制表示中从低位向高位排列的前n位,作为余数。
如前所述,正常运算的f(X,Y)必然小于c,因此,在步骤47,可以将该余数确定为运算结果f(X,Y)的值。
在第二实施例中,约定的结果范围可以表示为[a,b],相应地,第二端发送的加密结果可以表示为E(g(X,Y)+R)=E(f(X,Y)-a+R),其中R为随机项。
类似的,在步骤43,对上述加密结果进行同态解密,得到解密结果,即得到g(X,Y)+R的值d。
在这里,随机项R可以表示为R=r*c,其中r为随机数,c为约定常数,且c>b-a。因此解密结果d可以表示为:
d=g(X,Y)+R=g(X,Y)+r*c
与第一实施例类似的,在步骤45,获取解密结果d对约定常数c取模的余数。
由于f(X,Y)的约定范围为[a,b],因此,如果第一端发送的是正常同态加密数据E(X),那么基于此的计算结果a<=f(X,Y)<=b;
于是有0<=g(X,Y)<=b-a;
另一方面又有:c>b-a,那么,g(X,Y)<c。
因此,如果用解密结果d除以约定常数c,必然得出商为r,g(X,Y)由于不足c,即作为d除以c的余数。
与前述类似的,如果约定常数c被设置为10^n,那么可以通过获取解密结果d中最低的n位得到取模之后的余数。如果约定常数c被设置为2^(n+1),并且解密结果和随机项均以二进制表示,那么可以获取解密结果d的二进制表示中从低位向高位排列的前n位作为余数。
接下来,在步骤47,基于上述余数确定运算结果的值。具体地,在该第二实施例中,步骤47进一步包括,首先基于余数确定中间运算结果g(X,Y)的值。如上所述,可以将步骤45中确定出的余数作为中间运算结果g(X,Y)的值。然后,将中间运算结果加上结果范围的最小值a,即可得到运算结果f(X,Y)的值,即f(X,Y)=g(X,Y)+a。
下面结合一个具体例子描述加密和解密的完整过程。图5示出采用图3和图4的加密和解密方法进行同态加密传输的过程的例子。
假定第一端P1和第二端P2预先约定,正常的结果范围为2位数,且约定常数c为100。然后第一端P1向第二端P2发送加密数据E(X’),即E(x1+b1)和E(x2+b2)。例如,当b1=100,b2=10000,即为图2a所示的窃取数据的情况。
第二端P2正常计算E(f(X’,Y))后,还生成随机项R,例如随机数r取2356,那么随机项R=r*c=235600。第二端将该随机项R添加到加密结果中,并将该加密结果E(f(X’,Y)+R)返回给第一端P1。
在与图2a和2b例子中X,Y取值相同的情况下,f(X,Y)=11。P1通过对加密结果进行解密得到解密结果d,其中结果d可以分解为:
d=f(X’,Y)+R=x1*y1+x2*y2+100*y1+10000*y2+R
=f(X,Y)+100*y1+10000*y2+R
=11+10211+235600
=245811
在该结果d中,仍然可以通过最后2位提取出正常的f(X,Y)的值;但是,设计用于窃取P2方私有数据y1和y2的100*y1+10000*y2的结果被R混淆。P1无法再像图2b所示一样,通过百位数字定出y1,通过万位定出y2。
通过以上过程可以看到,第一端P1和第二端P2预先约定正常的结果范围,和预定常数c。第二端P2在加密结果中基于约定的结果范围和预定常数引入了特殊构造的随机项,使得该随机项对于正常结果范围的运算结果没有影响,对于超出正常结果范围的数据进行混淆。如果第一端P1发送的是正常的同态加密数据,那么第二端P2运算之后的运算结果应该在约定的结果范围。那么第一端P1可以从加密结果中恢复出运算结果;如果第一端P1发送的是不诚实的特殊构造的加密数据,那么运算结果将会超出正常结果范围,而这样的超出正常结果范围的部分会被随机项混淆,无法获知其真实值,因而P1无法通过超出结果范围的部分窃取P2的私有数据。如此,在不增加附加通信的情况下,防止第一端窃取第二端的私有数据。
根据另一方面的实施例,还提供了数据加密和数据解密的装置。图6示出根据一个实施例的数据加密装置的示意性框图。如图6所示,数据加密装置60包括:接收单元61,配置为从对端接收第一数据;随机生成单元63,配置为基于与所述对端预先约定的结果范围,生成随机项R,所述结果范围包括结果最小值a和结果最大值b,所述随机项R为随机数r与约定常数c的乘积,所述约定常数c大于所述结果最大值b与结果最小值a的差值;运算单元65,配置为基于所述第一数据、本地私有的第二数据,以及所述随机项,进行同态运算,得到加密结果;发送单元67,配置为将所述加密结果返回给所述对端。
在一个实施例中,运算单元包括(未示出):第一运算模块,配置为基于所述第一数据和所述第二数据,进行第一同态运算,得到第一运算结果;第二运算模块,配置为基于所述第一运算结果和所述随机项,进行第二同态运算,得到加密结果。
进一步地,在一个实施例中,上述第二运算模块配置为:获取所述第一运算结果与所述结果最小值a的差值作为第二运算结果;对所述第二运算结果与所述随机项进 行同态求和加密,从而生成所述加密结果。
根据一个实施例,结果最小值a为0,结果最大值b为n位自然数;约定常数c为10^n。此时,随机生成单元65所生成的所述随机项R中从高位向低位排列的后n位均为0,其中n为自然数。
根据一个实施例,结果最小值a为0,结果最大值b为2^n,约定常数c为2^(n+1),并且所述随机项以二进制表示。此时,随机生成单元65生成的随机项R的二进制表示中,从高位向低位排列的后n位均为0,其中n为自然数。
在一个实施例中,约定常数c取值为Δ+1,其中Δ为所述结果最大值b与结果最小值a的差值。
图7示出根据一个实施例的数据解密装置的示意性框图。如图7所示,数据解密装置70包括:接收单元71,配置为从图6的数据加密装置60接收同态加密的加密结果;解密单元73,配置为对所述加密结果进行同态解密,得到解密结果;取模单元75,配置为获取解密结果对所述约定常数c取模的余数;确定单元77,配置为基于所述余数确定所述运算结果的值。
在一个实施例中,确定单元77配置为:确定运算结果的值为所述余数的值加上所述结果最小值a。
根据一个实施例,约定常数c被设置为10^n。此时,取模单元75配置为,获取所述解密结果中从高位向低位排列的后n位,作为所述余数。
根据一个实施例,解密结果和随机项均以二进制表示,随机项的二进制表示中,从高位向低位排列的后n位均为0。此时,取模单元75配置为,获取所述解密结果的二进制表示中从高位向低位排列的后n位,作为所述余数。
根据另一方面的实施例,还提供一种计算机可读存储介质,其上存储有计算机程序,当所述计算机程序在计算机中执行时,令计算机执行结合图3和图4所描述的方法。
根据再一方面的实施例,还提供一种计算设备,包括存储器和处理器,所述存储器中存储有可执行代码,所述处理器执行所述可执行代码时,实现结合图3和图4所述的方法。
本领域技术人员应该可以意识到,在上述一个或多个示例中,本发明所描述的 功能可以用硬件、软件、固件或它们的任意组合来实现。当使用软件实现时,可以将这些功能存储在计算机可读介质中或者作为计算机可读介质上的一个或多个指令或代码进行传输。
以上所述的具体实施方式,对本发明的目的、技术方案和有益效果进行了进一步详细说明,所应理解的是,以上所述仅为本发明的具体实施方式而已,并不用于限定本发明的保护范围,凡在本发明的技术方案的基础之上,所做的任何修改、等同替换、改进等,均应包括在本发明的保护范围之内。

Claims (22)

  1. 一种数据加密的方法,包括:
    从对端接收第一数据;
    基于与所述对端预先约定的结果范围,生成随机项R,所述结果范围包括结果最小值a和结果最大值b,所述随机项R为随机数r与约定常数c的乘积,所述约定常数c大于所述结果最大值b与结果最小值a的差值;
    基于所述第一数据、本地私有的第二数据,以及所述随机项,进行同态运算,得到加密结果;
    将所述加密结果返回给所述对端。
  2. 根据权利要求1所述的方法,其中基于所述第一数据、本地私有的第二数据,以及所述随机项,进行同态运算包括:
    基于所述第一数据和所述第二数据,进行第一同态运算,得到第一运算结果;
    基于所述第一运算结果和所述随机项,进行第二同态运算,得到加密结果。
  3. 根据权利要求2所述的方法,其中基于所述第一运算结果和所述随机项,进行第二同态运算包括:
    获取所述第一运算结果与所述结果最小值a的差值作为第二运算结果;
    对所述第二运算结果与所述随机项进行同态求和加密,从而生成所述加密结果。
  4. 根据权利要求1所述的方法,其中所述结果最小值a为0,所述结果最大值b为n位自然数;所述约定常数c为10^n,使得所述随机项R中从高位向低位排列的后n位均为0,其中n为自然数。
  5. 根据权利要求1所述的方法,其中所述结果最小值a为0,所述结果最大值b为2^n,所述约定常数c为2^(n+1),所述随机项以二进制表示,在所述随机项R的二进制表示中,从高位向低位排列的后n位均为0,其中n为自然数。
  6. 根据权利要求1-3中任一项所述的方法,其中所述约定常数c取值为Δ+1,其中Δ为所述结果最大值b与结果最小值a的差值。
  7. 一种数据解密的方法,包括:
    接收同态加密的加密结果,所述加密结果根据权利要求1的加密方法生成;
    对所述加密结果进行同态解密,得到解密结果;
    获取解密结果对所述约定常数c取模的余数;
    基于所述余数确定运算结果的值。
  8. 根据权利要求7所述的方法,其中所述基于所述余数确定运算结果的值,包括:
    将所述运算结果的值确定为,所述余数的值加上所述结果最小值a。
  9. 根据权利要求7所述的方法,其中所述约定常数c为10^n,
    所述获取解密结果对所述约定常数c取模的余数包括,获取所述解密结果中从高位向低位排列的后n位,作为所述余数。
  10. 根据权利要求7所述的方法,其中所述解密结果和所述随机项均以二进制表示,所述随机项的二进制表示中,从高位向低位排列的后n位均为0;
    所述获取解密结果对所述约定常数c取模的余数包括,获取所述解密结果的二进制表示中从高位向低位排列的后n位,作为所述余数。
  11. 一种数据加密的装置,包括:
    接收单元,配置为从对端接收第一数据;
    随机生成单元,配置为基于与所述对端预先约定的结果范围,生成随机项R,所述结果范围包括结果最小值a和结果最大值b,所述随机项R为随机数r与约定常数c的乘积,所述约定常数c大于所述结果最大值b与结果最小值a的差值;
    运算单元,配置为基于所述第一数据、本地私有的第二数据,以及所述随机项,进行同态运算,得到加密结果;
    发送单元,配置为将所述加密结果返回给所述对端。
  12. 根据权利要求11所述的装置,其中所述运算单元包括:
    第一运算模块,配置为基于所述第一数据和所述第二数据,进行第一同态运算,得到第一运算结果;
    第二运算模块,配置为基于所述第一运算结果和所述随机项,进行第二同态运算,得到加密结果。
  13. 根据权利要求12所述的装置,其中所述第二运算模块配置为:
    获取所述第一运算结果与所述结果最小值a的差值作为第二运算结果;
    对所述第二运算结果与所述随机项进行同态求和加密,从而生成所述加密结果。
  14. 根据权利要求11所述的装置,其中所述结果最小值a为0,所述结果最大值b为n位自然数;所述约定常数c为10^n,所述随机生成单元所生成的所述随机项R中从高位向低位排列的后n位均为0,其中n为自然数。
  15. 根据权利要求11所述的装置,其中所述结果最小值a为0,所述结果最大值b为2^n,所述约定常数c为2^(n+1),所述随机项以二进制表示,在所述随机生成单元生成的所述随机项R的二进制表示中,从高位向低位排列的后n位均为0,其中n为自然数。
  16. 根据权利要求11-13中任一项所述的装置,其中所述约定常数c取值为Δ+1,其中Δ为所述结果最大值b与结果最小值a的差值。
  17. 一种数据解密的装置,包括:
    接收单元,配置为接收同态加密的加密结果,所述加密结果由权利要求11的装置加密生成;
    解密单元,配置为对所述加密结果进行同态解密,得到解密结果;
    取模单元,配置为获取解密结果对所述约定常数c取模的余数;
    确定单元,配置为基于所述余数确定运算结果的值。
  18. 根据权利要求17所述的装置,其中所述确定单元配置为:
    将所述运算结果的值确定为,所述余数的值加上所述结果最小值a。
  19. 根据权利要求17所述的装置,其中所述约定常数c为10^n,
    所述取模单元配置为,获取所述解密结果中从高位向低位排列的后n位,作为所述余数。
  20. 根据权利要求17所述的装置,其中所述解密结果和所述随机项均以二进制表示,所述随机项的二进制表示中,从高位向低位排列的后n位均为0;
    所述取模单元配置为,获取所述解密结果的二进制表示中从高位向低位排列的后n位,作为所述余数。
  21. 一种计算机可读存储介质,其上存储有计算机程序,当所述计算机程序在计算机中执行时,令计算机执行权利要求1-10中任一项的所述的方法。
  22. 一种计算设备,包括存储器和处理器,其特征在于,所述存储器中存储有可执行代码,所述处理器执行所述可执行代码时,实现权利要求1-10中任一项所述的方法。
PCT/CN2019/081055 2018-06-28 2019-04-02 数据加解密的方法及装置 WO2020001113A1 (zh)

Priority Applications (3)

Application Number Priority Date Filing Date Title
US16/888,531 US10911216B2 (en) 2018-06-28 2020-05-29 Data encryption and decryption
US17/164,603 US11101977B2 (en) 2018-06-28 2021-02-01 Data encryption and decryption
US17/397,140 US11431471B2 (en) 2018-06-28 2021-08-09 Data encryption and decryption

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201810687002.0 2018-06-28
CN201810687002.0A CN108933650B (zh) 2018-06-28 2018-06-28 数据加解密的方法及装置

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US16/888,531 Continuation US10911216B2 (en) 2018-06-28 2020-05-29 Data encryption and decryption

Publications (1)

Publication Number Publication Date
WO2020001113A1 true WO2020001113A1 (zh) 2020-01-02

Family

ID=64446522

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/081055 WO2020001113A1 (zh) 2018-06-28 2019-04-02 数据加解密的方法及装置

Country Status (4)

Country Link
US (3) US10911216B2 (zh)
CN (1) CN108933650B (zh)
TW (1) TWI688250B (zh)
WO (1) WO2020001113A1 (zh)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108933650B (zh) 2018-06-28 2020-02-14 阿里巴巴集团控股有限公司 数据加解密的方法及装置
CN110519038B (zh) * 2019-07-29 2022-10-21 北京多思安全芯片科技有限公司 一种数据的同态处理装置和系统
CN110650119B (zh) * 2019-08-20 2022-01-21 创新先进技术有限公司 数据传输方法、装置和电子设备
CN110661618B (zh) * 2019-08-20 2021-04-27 创新先进技术有限公司 数据传输方法、装置和电子设备
CN112560075B (zh) * 2021-02-22 2021-05-25 西南石油大学 一种基于椭圆曲线的轻量级可搜索加密方法及装置
CN113055172B (zh) * 2021-03-31 2022-11-04 北京金山云网络技术有限公司 一种密钥协商方法、装置、电子设备及存储介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110110525A1 (en) * 2009-11-10 2011-05-12 International Business Machines Corporation Fully homomorphic encryption method based on a bootstrappable encryption scheme, computer program and apparatus
US20140233731A1 (en) * 2011-05-09 2014-08-21 Campagnie Industrielle Et Financiere D'Ingenierie "Ingenico" Device and Method for Generating Keys with Enhanced Security for Fully Homomorphic Encryption Algorithm
CN107852324A (zh) * 2015-06-02 2018-03-27 瑞典爱立信有限公司 用于加密消息的方法和加密节点
CN108933650A (zh) * 2018-06-28 2018-12-04 阿里巴巴集团控股有限公司 数据加解密的方法及装置

Family Cites Families (22)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP3503638B1 (ja) * 2002-09-26 2004-03-08 日本電気株式会社 暗号装置及び暗号プログラム
EP1595381B1 (en) * 2003-02-28 2006-11-22 Research In Motion Limited System and method of protecting data on a communication device
ATE408940T1 (de) * 2003-11-03 2008-10-15 Koninkl Philips Electronics Nv Verfahren und einrichtung zur effizienten mehrteilnehmer-vervielfachung
US7284390B2 (en) * 2005-05-18 2007-10-23 Whirlpool Corporation Refrigerator with intermediate temperature icemaking compartment
WO2007074836A1 (ja) * 2005-12-28 2007-07-05 Matsushita Electric Industrial Co., Ltd. 署名生成装置、署名生成方法及び署名生成プログラム
US8024274B2 (en) * 2006-05-05 2011-09-20 President And Fellows Of Harvard College Practical secrecy-preserving, verifiably correct and trustworthy auctions
JP5346933B2 (ja) * 2008-06-04 2013-11-20 パナソニック株式会社 暗号化装置及び暗号化システム
US9946810B1 (en) * 2010-04-21 2018-04-17 Stan Trepetin Mathematical method for performing homomorphic operations
US20120063597A1 (en) * 2010-09-15 2012-03-15 Uponus Technologies, Llc. Apparatus and associated methodology for managing content control keys
US20120121080A1 (en) * 2010-11-11 2012-05-17 Sap Ag Commutative order-preserving encryption
US9281941B2 (en) * 2012-02-17 2016-03-08 International Business Machines Corporation Homomorphic evaluation including key switching, modulus switching, and dynamic noise management
EP2873186B1 (en) * 2012-07-26 2018-03-07 NDS Limited Method and system for homomorphicly randomizing an input
US9306738B2 (en) * 2012-12-21 2016-04-05 Microsoft Technology Licensing, Llc Managed secure computations on encrypted data
CA2887191C (en) * 2014-04-04 2021-05-25 University Of Ottawa Secure linkage of databases
WO2016120975A1 (ja) * 2015-01-26 2016-08-04 株式会社日立製作所 データ集計分析システム及びその方法
CN106160995B (zh) * 2015-04-21 2019-04-16 郑珂威 基于系数映射变换的多项式完全同态加密方法及系统
KR102423885B1 (ko) * 2015-05-08 2022-07-21 한국전자통신연구원 연산 에러 검출이 가능한 준동형 암호 방법 및 그 시스템
WO2017106258A1 (en) * 2015-12-14 2017-06-22 Afero, Inc. System and method for establishing a secondary communication channel to control an internet of things (iot) device
US10116437B1 (en) * 2015-12-14 2018-10-30 Ingram Micro, Inc. Method for protecting data used in cloud computing with homomorphic encryption
US9900147B2 (en) * 2015-12-18 2018-02-20 Microsoft Technology Licensing, Llc Homomorphic encryption with optimized homomorphic operations
CN106100818A (zh) * 2016-06-02 2016-11-09 苏州健雄职业技术学院 一种基于整数多项的全同态加密的数据加密方法
US20190362054A1 (en) * 2018-05-22 2019-11-28 Sony Corporation User-protected license

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110110525A1 (en) * 2009-11-10 2011-05-12 International Business Machines Corporation Fully homomorphic encryption method based on a bootstrappable encryption scheme, computer program and apparatus
US20140233731A1 (en) * 2011-05-09 2014-08-21 Campagnie Industrielle Et Financiere D'Ingenierie "Ingenico" Device and Method for Generating Keys with Enhanced Security for Fully Homomorphic Encryption Algorithm
CN107852324A (zh) * 2015-06-02 2018-03-27 瑞典爱立信有限公司 用于加密消息的方法和加密节点
CN108933650A (zh) * 2018-06-28 2018-12-04 阿里巴巴集团控股有限公司 数据加解密的方法及装置

Also Published As

Publication number Publication date
US11431471B2 (en) 2022-08-30
CN108933650A (zh) 2018-12-04
CN108933650B (zh) 2020-02-14
US20210160049A1 (en) 2021-05-27
US20200295917A1 (en) 2020-09-17
TW202002564A (zh) 2020-01-01
US11101977B2 (en) 2021-08-24
US20210376999A1 (en) 2021-12-02
TWI688250B (zh) 2020-03-11
US10911216B2 (en) 2021-02-02

Similar Documents

Publication Publication Date Title
WO2020001113A1 (zh) 数据加解密的方法及装置
US20220141038A1 (en) Method of rsa signature or decryption protected using a homomorphic encryption
Anees et al. Designing secure substitution boxes based on permutation of symmetric group
JP2022533950A (ja) 準群演算を含む暗号化データに対して等価演算および未満演算を実行するシステムおよび方法
WO2014154270A1 (en) Tamper resistant cryptographic algorithm implementation
WO2021129470A1 (zh) 基于多项式完全同态的二进制数据加密系统及方法
Kasgar et al. A review paper of message digest 5 (MD5)
EP3698262B1 (en) Protecting modular inversion operation from external monitoring attacks
CN108599941A (zh) 随机非对称扩充字节通信数据加密方法
CN106534077A (zh) 一种基于对称密码的可认证的代理重加密系统及方法
US20040039918A1 (en) Secure approach to send data from one system to another
CN114221753B (zh) 密钥数据处理方法和电子设备
WO2022172041A1 (en) Asymmetric cryptographic schemes
KR101026647B1 (ko) 통신 보안 시스템 및 그 방법과 이에 적용되는 키 유도 암호알고리즘
Hossen et al. Join Public Key and Private Key for Encrypting Data
US20230138384A1 (en) Method for securely performing a public key algorithm
Hwang et al. PFX: an essence of authencryption for block‐cipher security
TWI818708B (zh) 驗證模型更新的方法
CN115460020B (zh) 数据共享方法、装置、设备及存储介质
US20240137206A1 (en) Methods and apparatuses for jointly processing data by two parties for data privacy protection
CN113141249B (zh) 一种门限解密方法、系统及可读存储介质
CN114793155A (zh) 多方安全计算的方法及装置
Singh et al. Encryption algorithms with emphasis on probabilistic Encryption & time stamp in network security
Abikoye et al. SYMMETRIC AND ASYMMETRIC BASED ENCRYPTION MODEL FOR MOBILE COMMERCE
Selvi et al. A Novel Hybrid Chaotic Map–Based Proactive RSA Cryptosystem in Blockchain

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

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

Country of ref document: EP

Kind code of ref document: A1