A data processing method and device

Through the use of the multi -e -terms remaining category ring in homomorphic encryption technology for encryption processing, the problem of low computing efficiency and less applicable scenarios of traditional homogenous encryption technology is solved, and the efficient and secure homogenic encryption effect is achieved.

CN117499010BActive Publication Date: 2025-01-24BEIJING HAITAI FANGYUAN HIGH TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311430323.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-10-31
Publication Date
2025-01-24
Estimated Expiration
2043-10-31

AI Technical Summary

Technical Problem

Traditional homomorphic encryption technology has low computing efficiency and few applicable application scenarios. The computing efficiency and practicality of many homomorphic algorithms need to be improved.

Method used

By using elements in the polynomial residual class ring for encryption processing, and utilizing the addition and multiplication operation characteristics of polynomials, efficient homomorphic encryption of plaintext data is achieved. Specific methods include generating polynomial residual class rings, calculating ciphertext polynomials based on plaintext data, and ensuring that the ciphertext polynomials remain within a controllable range during the operation to avoid data expansion.

Benefits of technology

The computing efficiency and practicality of homogenous encryption of bright text data is improved, and the scale of ciphertext data is ensured in a controllable range, avoiding data redundancy and resource loss, and at the same time enhance the security of ciphertext polynomial.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117499010B_ABST
    Figure CN117499010B_ABST
Patent Text Reader

Abstract

The present application is applied to the field of Internet technology, and provides a data processing method and device for improving the operational efficiency and practicality of homomorphic encryption of plaintext data. The method includes: a first device responds to a data processing instruction, obtains a first parameter, a second parameter and a third parameter, the first parameter is a reducible polynomial, the second parameter is a positive integer, and the third parameter is a polynomial; the first device generates a polynomial residue class ring of the first parameter based on the first parameter; the first device determines the first plaintext polynomial corresponding to the first plaintext data according to the binary number corresponding to the first plaintext data; the first device calculates the first plaintext polynomial according to the first parameter, the second parameter and the third parameter, and obtains a first ciphertext polynomial corresponding to the first plaintext data, and the first ciphertext polynomial belongs to the polynomial residue class ring; and outputs the first ciphertext polynomial.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of Internet technology, and in particular to a data processing method and device. Background Art

[0002] In the privacy computing process, the owner of the data and the computer of the data are often different. Based on this, in order to avoid data leakage, it may be necessary to use homomorphic encryption and decryption algorithms to implement privacy computing. Therefore, it is very necessary to study the homomorphic encryption (HE) technology (including encryption and decryption algorithms) of data. Among them, homomorphic encryption can be divided into three types: partially homomorphic encryption (PHE), somewhat homomorphic encryption (SWHE) and fully homomorphic encryption (FHE).

[0003] Homomorphic encryption technology can be used to protect privacy information in data during outsourced storage and computing, as well as to perform operations such as retrieval, size comparison, or privacy intersection in encrypted data. Homomorphic encryption technology can also be used in the fields of federated machine learning, secure multi-party computing, data exchange and sharing. Homomorphic encryption technology can also be applied in the future fields of cloud computing, privacy computing, zero-knowledge proof, blockchain, and homomorphic signatures. However, the traditional homomorphic encryption technology has low computational efficiency and is applicable to fewer application scenarios. For example, the RSA cryptographic algorithm is only applicable to semi-homomorphic encryption operations of multiplication. In addition, the computational efficiency and practicality of many homomorphic algorithms need to be improved. Summary of the invention

[0004] The present application provides a data processing method and device to improve the operational efficiency and practicality of homomorphic encryption of plaintext data.

[0005] In a first aspect, the present application provides a data processing method, the method comprising: a first device responds to a data processing instruction to obtain a first parameter, a second parameter and a third parameter, the first parameter being a reducible polynomial, the second parameter being a positive integer, and the third parameter being a polynomial; the data processing instruction is used to instruct encryption processing to be performed on the first plaintext data to be processed; the first device generates a polynomial remainder class ring of the first parameter based on the first parameter, the polynomial remainder class ring containing multiple polynomials; the first device determines a first plaintext polynomial corresponding to the first plaintext data according to a binary number corresponding to the first plaintext data; the coefficient of each term in the first plaintext polynomial corresponds one-to-one to the numerical value of each bit in the binary number; the first device calculates the first plaintext polynomial according to the first parameter, the second parameter and the third parameter to obtain a first ciphertext polynomial corresponding to the first plaintext data; the first ciphertext polynomial is contained in the aforementioned multiple polynomials; the first device outputs the first ciphertext polynomial.

[0006] Based on the above method, the first device can determine the first ciphertext polynomial through the first parameter, the second parameter and the third parameter, thereby realizing the encryption of the first plaintext data. The encrypted result (i.e., the first ciphertext polynomial) can maintain the additive homomorphism based on the XOR operation compared to the first plaintext data. At the same time, the first ciphertext polynomial is an element in the polynomial remainder class ring generated according to the first parameter. Since the polynomial remainder class ring is a closed set obtained according to polynomial addition and multiplication operations (i.e., the polynomial remainder class ring includes a finite number of polynomials), this method can ensure that the data volume of the first ciphertext polynomial is within a controllable range, avoid data redundancy or resource loss caused by data expansion, and improve the operational efficiency and practicality of homomorphic encryption of the first plaintext data.

[0007] In a possible design, the first parameter, the second parameter, the third parameter, the first plaintext polynomial and the first ciphertext polynomial satisfy the following formula: C x =(K x M x ) m mod F x Among them, F x is the first parameter, m is the second parameter, K x is the third parameter, M x is the first plaintext polynomial, C x is the first ciphertext polynomial.

[0008] With this design, the first device can perform a modular operation on the polynomial so that the value of the first ciphertext polynomial is always an element in the polynomial remainder class ring generated according to the first parameter, thereby improving the feasibility and practicality of the data processing method while satisfying homomorphic encryption.

[0009] In a possible design, the first parameter is the product of multiple irreducible polynomials, and the first device can also determine the maximum order of the polynomials contained in the polynomial residue class ring according to the multiple irreducible polynomials; the first device can also determine the second parameter according to the maximum order; wherein the polynomial degree of the first parameter, the maximum order and the second parameter satisfy the following formula: N ≡m mod R; where N is the polynomial degree of the first parameter, R is the maximum order, and m is the second parameter.

[0010] With this design, the second parameter can be calculated by the decomposition formula (ie, multiple irreducible polynomials) of the first parameter, thereby improving the correlation between the first parameter and the second parameter.

[0011] In a possible design, the first device may also determine a third parameter based on the first parameter; the third parameter is not 1 and the third parameter is coprime with the first parameter.

[0012] With this design, the first device can determine the third parameter through the first parameter, thereby improving the correlation between the first parameter and the third parameter, so that the third parameter can be used as a factor of product disturbance in the calculation process of the first ciphertext polynomial, preventing the attacker from selecting the first plaintext data or the first ciphertext polynomial to attack, increasing the difficulty of reversely deriving the first plaintext data through the first ciphertext polynomial, and improving the security of the first ciphertext polynomial.

[0013] In one possible design, the first ciphertext polynomial may be used to perform an XOR addition operation.

[0014] By adopting such a design, the determined first ciphertext polynomial can maintain the additive homomorphism based on the XOR operation compared to the first plaintext data, thereby improving the operational efficiency and practicality of homomorphic encryption of the first plaintext data.

[0015] In one possible design, when the decryption device stores the first parameter, the first ciphertext polynomial can be used to perform multiplication and division operations.

[0016] By adopting such a design, the determined first ciphertext polynomial can maintain homomorphism based on multiplication and division operations compared to the first plaintext data, thereby improving the operational efficiency and practicality of homomorphic encryption of the first plaintext data.

[0017] In a possible design, the first device can also obtain a second ciphertext polynomial; the first device can also calculate the second ciphertext polynomial according to the first parameter, the fourth parameter and the third parameter to obtain a second plaintext polynomial corresponding to the second ciphertext polynomial; the second plaintext polynomial is included in multiple polynomials, and the fourth parameter is a positive integer; the first device can also determine the second plaintext data according to the second plaintext polynomial; the coefficient of each item in the second plaintext polynomial corresponds one-to-one to the numerical value of each bit in the binary number of the second plaintext data; the first device can also output the second plaintext data.

[0018] With this design, the first device can determine the second plaintext polynomial based on the second ciphertext polynomial, and determine the second plaintext data based on the second plaintext polynomial to achieve data decryption, thereby improving the feasibility and practicality of the data processing method.

[0019] In a possible design, the first parameter, the fourth parameter, the third parameter, the second plaintext polynomial and the second ciphertext polynomial satisfy the following formula: x ′=(C x ') d K x -1 mod F x Among them, F x is the first parameter, d is the fourth parameter, K x is the third parameter, M x ' is the second plaintext polynomial, C x ' is the second ciphertext polynomial.

[0020] With this design, the first device can implement the decryption operation of the second ciphertext polynomial, thereby improving the feasibility and practicality of the data processing method while satisfying homomorphic encryption.

[0021] In one possible design, the first device can also determine the fourth parameter based on the second parameter and the maximum order of the polynomial contained in the polynomial residue class ring; wherein the second parameter, the fourth parameter and the maximum order satisfy the following formula: m*d≡1mod R; wherein R is the maximum order, m is the second parameter, and d is the fourth parameter.

[0022] With this design, the first device can determine the fourth parameter based on the second parameter, thereby improving the accuracy of the decryption operation.

[0023] In one possible design, the first device may also send the first parameter and the second parameter to the second device, the first parameter being the product of multiple irreducible polynomials; or, the first device may also send multiple irreducible polynomials to the second device; the multiple irreducible polynomials are used to determine the second parameter.

[0024] With this design, the first device can send partial parameters to the second device so that the second device can obtain the first plaintext data through the first ciphertext polynomial, or obtain the first plaintext data corresponding to the operation result of the first ciphertext polynomial through the operation result of the first ciphertext polynomial, thereby improving the practicality of the data processing method.

[0025] In a second aspect, the present application further provides a data processing device, which includes a communication module and a processing module, wherein the communication module is used to receive and send data, and the processing module is used to execute the method shown in the first aspect.

[0026] In a possible example, the communication module is specifically used to: in response to a data processing instruction, obtain a first parameter, a second parameter and a third parameter, the first parameter is a reducible polynomial, the second parameter is a positive integer, and the third parameter is a polynomial; the data processing instruction is used to instruct encryption processing of the first plaintext data to be processed; the processing module is specifically used to: based on the first parameter, generate a polynomial remainder class ring corresponding to the first parameter, and the polynomial remainder class ring contains multiple polynomials; the processing module is also used to: determine the first plaintext polynomial corresponding to the first plaintext data according to the binary number corresponding to the first plaintext data; the coefficient of each term in the first plaintext polynomial corresponds one-to-one to the numerical value of each bit in the binary number; the processing module is also used to: calculate the first plaintext polynomial according to the first parameter, the second parameter and the third parameter, and obtain the first ciphertext polynomial corresponding to the first plaintext data; the first ciphertext polynomial is included in the aforementioned multiple polynomials; the communication module is also used to: output the first ciphertext polynomial.

[0027] In a possible design, the first parameter, the second parameter, the third parameter, the first plaintext polynomial and the first ciphertext polynomial satisfy the following formula: C x =(K x M x ) m mod F x Among them, F x is the first parameter, m is the second parameter, K x is the third parameter, M x is the first plaintext polynomial, C x is the first ciphertext polynomial.

[0028] In a possible design, the first parameter is the product of multiple irreducible polynomials, and the processing module is further used to: determine the maximum order of the polynomials contained in the polynomial residue class ring according to the multiple irreducible polynomials; determine the second parameter according to the maximum order; wherein the polynomial degree of the first parameter, the maximum order and the second parameter satisfy the following formula: N ≡mmod R; where N is the polynomial degree of the first parameter, R is the maximum order, and m is the second parameter.

[0029] In a possible design, the processing module is further used to: determine a third parameter based on the first parameter; the third parameter is not 1 and the third parameter is coprime with the first parameter.

[0030] In one possible design, the first ciphertext polynomial may be used to perform an XOR addition operation.

[0031] In one possible design, when the decryption device stores the first parameter, the first ciphertext polynomial can be used to perform multiplication and division operations.

[0032] In one possible design, the communication module is also used to: obtain a second ciphertext polynomial; the processing module is also used to: calculate the second ciphertext polynomial according to the first parameter, the fourth parameter and the third parameter to obtain a second plaintext polynomial corresponding to the second ciphertext polynomial; the second plaintext polynomial is included in multiple polynomials, and the fourth parameter is a positive integer; the processing module is also used to: determine the second plaintext data according to the second plaintext polynomial; the coefficient of each item in the second plaintext polynomial corresponds one-to-one to the numerical value of each bit in the binary number of the second plaintext data; the communication module is also used to: output the second plaintext data.

[0033] In a possible design, the first parameter, the fourth parameter, the third parameter, the second plaintext polynomial and the second ciphertext polynomial satisfy the following formula: x ′=(C x ') d K x -1 mod F x ; Among them, F x is the first parameter, d is the fourth parameter, K x is the third parameter, M x ' is the second plaintext polynomial, C x ' is the second ciphertext polynomial.

[0034] In one possible design, the processing module is also used to: determine the fourth parameter based on the second parameter and the maximum order of the polynomial contained in the polynomial residue class ring; the second parameter, the fourth parameter and the maximum order satisfy the following formula: m*d≡1mod R; wherein R is the maximum order, m is the second parameter, and d is the fourth parameter.

[0035] In one possible design, the communication module is used to: send a first parameter and a second parameter to a second device, the first parameter being the product of multiple irreducible polynomials; or, send multiple irreducible polynomials to the second device; and the multiple irreducible polynomials are used to determine the second parameter.

[0036] In a third aspect, the present application further provides an electronic device comprising a processor and a memory, wherein the processor is used to implement the steps of the data processing method as described in the first aspect above and any possible design thereof when executing a computer program stored in the memory.

[0037] In a fourth aspect, the present application further provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the data processing method as described in the first aspect and any possible design thereof.

[0038] In a fifth aspect, the present application also provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, it implements the steps of the data processing method as described in the first aspect and any possible design thereof.

[0039] In addition, the technical effects brought about by the second to fifth aspects can be found in the description of the first aspect above and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0041] Figure 1 A flowchart of a data processing method provided in an embodiment of the present application;

[0042] Figure 2 A flowchart of another data processing method provided in an embodiment of the present application;

[0043] Figure 3 A schematic diagram of a modular structure of a data processing device provided in an embodiment of the present application;

[0044] Figure 4 A schematic diagram of the structure of another data processing device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0045] In order to make the purpose, technical solutions and advantages of this application clearer, this application will be further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of this application, rather than all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application. The acquisition, storage, use, and processing of data in the technical solution of this application are in compliance with the relevant provisions of national laws and regulations.

[0046] The following is an explanation of the terms involved in this application:

[0047] (1) Semi-homomorphic encryption only supports one homomorphic operation, but supports unlimited execution of the homomorphic operation. Semi-homomorphic encryption algorithms can be applied in some scenarios, such as online voting and private information retrieval (PIR). The characteristics of these application scenarios are that only one homomorphic operation is required, such as homomorphic addition or homomorphic multiplication.

[0048] (2) Partially homomorphic encryption can support multiple homomorphic operations, but the number of homomorphic operations is limited. Partially homomorphic encryption algorithms can support homomorphic addition and homomorphic multiplication at the same time, but as the number of homomorphic operations increases, the size of the ciphertext will also grow rapidly, so the total number of operations is limited.

[0049] (3) Fully homomorphic encryption, supporting unlimited times and all types of homomorphic operations.

[0050] (4) Homomorphic encryption: It is a cryptographic technique based on the computational complexity theory of mathematical problems. The data that has been homomorphically encrypted is processed to obtain an output, and the output is decrypted. The result is the same as the output obtained by processing the unencrypted original data in the same way.

[0051] The embodiment of the present application provides a possible data processing architecture, which includes an encryption device, a third-party computing device, and a decryption device. In some scenarios, the encryption device and the decryption device may be the same device. It should be understood that in a data processing architecture, the number of encryption devices, third-party computing devices, and decryption devices can be adjusted, and this is not limited in the present application.

[0052] In order to improve the operational efficiency and practicality of homomorphic encryption of plaintext data, an embodiment of the present application provides a data processing method, which is applied to a first device. The data processing method in the present application can be applied to the aforementioned data processing architecture, wherein the first device can be an encryption device in the aforementioned data processing architecture. The embodiment of the present application calculates the plaintext polynomial through multiple parameters to obtain a ciphertext polynomial contained in the polynomial residue class ring, thereby improving the operational efficiency and practicality of homomorphic encryption of plaintext data.

[0053] The data processing method provided in the embodiment of the present application is described below in conjunction with the accompanying drawings. Figure 1 A data processing method provided in an embodiment of the present application may include the following steps:

[0054] S101: The first device responds to the data processing instruction and obtains the first parameter, the second parameter and the third parameter, wherein the first parameter is a reducible polynomial, the second parameter is a positive integer, and the third parameter is a polynomial; the data processing instruction is used to instruct to encrypt the first plaintext data to be processed. In the embodiment of the present application, the first parameter can be expressed as F x The second parameter can be represented by m, and the third parameter can be represented by K x express.

[0055] It should be understood that the first parameter, the second parameter and the third parameter are the key factors in the data processing method shown in this application.

[0056] In one possible design, the method for the first device to determine the first parameter includes step a and step b:

[0057] Step a: The first device may preset (for example, obtain through a user interface) a bit number N according to the data volume (including data size and information volume) of the first plaintext data that may appear in the data set to be processed.

[0058] Optionally, N is greater than or equal to 256. Thus, as long as the value of N is large enough, the first parameter F x The range of possible values ​​of is also large enough. If an attacker tries to use the fastest computers available today to attack F x It is impossible to judge, calculate and verify each possible combination of F one by one. Therefore, it is possible to prevent attackers from exhaustively searching the modular polynomial F. x .

[0059] In the process of data processing, the first plaintext data often appears in the form of a message or file, and its essence is often some strings or bit strings. In order to discuss homomorphism, it can be assumed that the first plaintext data corresponds to a certain value or polynomial. Common propositions in this field are: Let C n ris the number of combinations of randomly selecting r from n, when n = 2 t When t≥2, then for an integer i satisfying 1≤i≤n-1, 2|C n i (where “|” indicates integer division); therefore, the selection of the aforementioned number of bits N should be able to make all the first plaintext data in the data set to be processed have the same integer as 0 to 2. N The integers between -1.

[0060] Step b: The first device determines a first parameter based on the aforementioned bit length N, where the first parameter is a polynomial of degree N.

[0061] An example of this design is provided below: the first device selects several irreducible polynomials of larger degree on F2. The polynomials on F2 satisfy the following two conditions: the coefficients of each term in the polynomial can only be 0 or 1; after adding two (or more) polynomials, if the value of the coefficient is greater than 1, a modulo 2 operation is automatically performed. For example, the first device selects (for example, obtains through a user interface) several irreducible polynomials: f1(x), f2(x), ...f r (x)(r is a positive integer), let the product of these irreducible polynomials be the first parameter, that is, F x =f1(x)f2(x)…f r (x), by selecting these polynomials, the final determined F x The number of times is exactly N.

[0062] Another example of this design is provided below: the first parameter may be determined by a random number generated by a 0 / 1 calculation based on N bits (eg, 128 bits).

[0063] In a possible design, when the first parameter is the product of multiple irreducible polynomials, the method for the first device to obtain the second parameter may include the following steps:

[0064] Step 1: The first device determines the maximum order of the polynomials contained in the polynomial residue class ring according to the multiple irreducible polynomials. The calculation of the maximum order of the polynomial can refer to the common technology in the field, and is not limited in this application.

[0065] Step 2: The first device determines the second parameter according to the maximum order.

[0066] The polynomial degree of the first parameter (i.e. the degree of the highest order term), the maximum order, and the second parameter satisfy the following formula: N ≡m mod R; where N is the polynomial degree of the first parameter, R is the maximum order, and m is the second parameter.

[0067] In a possible design, the first device may also determine a third parameter based on the first parameter; the third parameter is not 1 and the third parameter is coprime with the first parameter.

[0068] For example, the first device may x The value of K is determined by the value of m x For example, K x It is a function value calculated by the first device using the coefficients of each term in the polynomial corresponding to the first parameter as input values.

[0069] Optionally, the method for the first device to determine the third parameter may be: the first device takes a polynomial consisting of the left K bits (for example, 64 bits) of the hash value of the first parameter as a reference polynomial; when the reference polynomial is coprime with the first parameter, the reference polynomial is used as the third parameter; when the reference polynomial is not coprime with the first parameter, the value of the reference polynomial plus one is used as the third parameter.

[0070] For example, when the algorithm used to calculate the hash algorithm is the MD5 message-digest algorithm, the value of K is 128; when the algorithm used to calculate the hash algorithm is the SM3 message-digest algorithm, the value of K is 256.

[0071] S102: The first device generates a polynomial remainder class ring of the first parameter based on the first parameter, and the polynomial remainder class ring includes multiple polynomials. In the embodiment of the present application, the polynomial remainder class ring of the first parameter refers to a polynomial remainder class ring generated by performing a modular operation on the first parameter. The polynomial remainder class ring of the first parameter can be expressed as Z2[x] / (F x ) is represented by . In the aforementioned polynomial remainder class ring, 0 and 1 are also regarded as polynomials.

[0072] Optionally, the degree of any polynomial in the polynomial residue class ring is less than N and each coefficient of the polynomial belongs to {0, 1}.

[0073] In one possible example, based on the first parameter F x , we can construct the modular polynomial remainder class ring Z2[x] / (F x ). The elements in the polynomial remainder class ring are all polynomials on F2 with a degree less than or equal to N-1. The specific method for constructing the polynomial remainder class ring corresponding to the first parameter (polynomial) in this application can refer to the common technology in the field and is not limited here.

[0074] S103: The first device determines the first plaintext polynomial corresponding to the first plaintext data according to the binary number corresponding to the first plaintext data; the coefficient of each term in the first plaintext polynomial corresponds to the value of each bit in the binary number. The coefficient of each term in the first plaintext polynomial is 0 or 1. In the embodiment of the present application, the first plaintext polynomial can be represented by M x express.

[0075] For example, assuming that the decimal number corresponding to the first plaintext data is 1, the first plaintext polynomial is 1; assuming that the decimal number corresponding to the first plaintext data is 2 (binary number 10), the first plaintext polynomial is x; assuming that the decimal number corresponding to the first plaintext data is 3 (binary number 11), the first plaintext polynomial is x+1; assuming that the decimal number corresponding to the first plaintext data is 11 (binary number 1011), the first plaintext polynomial is x 3 +x+1; Assuming that the decimal number corresponding to the first plaintext data is 1536 (binary number 11000000000), the first plaintext polynomial is x 10 +x 9 .

[0076] Similarly, the first device can determine the first plaintext polynomial corresponding to the first plaintext data based on the binary number corresponding to the first plaintext data. For example, the first plaintext data corresponds to the decimal number 32795, and the value of the binary number is 1000000000011011. Correspondingly, the first plaintext polynomial is x 15 +x 4 +x 3 +x+1.

[0077] Therefore, based on the discussion in step a, we can know that according to the correspondence between binary bits and polynomial coefficients, any 0 to 2 N All positive integers between -1 and -2 may correspond to a polynomial in the polynomial remainder class ring corresponding to the first parameter. That is, the first plaintext polynomial is included in the plurality of polynomials described in the aforementioned step S102, that is, it belongs to the aforementioned polynomial remainder class ring.

[0078] S104: The first device calculates the first plaintext polynomial according to the first parameter, the second parameter and the third parameter to obtain a first ciphertext polynomial corresponding to the first plaintext data; the first ciphertext polynomial is included in the multiple polynomials described in the aforementioned step S102, that is, it belongs to the aforementioned polynomial remainder class ring. In the embodiment of the present application, the first ciphertext polynomial can be represented by C x Optionally, the first device may also output the first ciphertext polynomial.

[0079] In this way, the first device can encrypt a first plaintext data of an N-bit block into a ciphertext data of an N-bit block; or, the first device can encrypt a first plaintext polynomial of degree less than N into a ciphertext polynomial of degree less than N; or, the first device can encrypt a 0 to 2 N The first plaintext data between -1 is encrypted as a 0 to 2 N The ciphertext value is between -1.

[0080] It should be understood that since the polynomial remainder class ring satisfies the closure property for polynomial addition and multiplication operations, the addition and multiplication of elements (ie, polynomials) in the polynomial remainder class ring are still elements in the ring.

[0081] In a possible design, the first parameter, the second parameter, the third parameter, the first plaintext polynomial and the first ciphertext polynomial satisfy the following formula: C x =(K x M x ) m mod F x Among them, F x is the first parameter, m is the second parameter, K x is the third parameter, M x is the first plaintext polynomial, C x is the first ciphertext polynomial.

[0082] In this design, K x As a x Multiplication can make the first plaintext data white noise, which is also called product disturbance in the art, to prevent the attacker from selecting the first plaintext data or the first ciphertext polynomial to attack, thereby improving the security of the first ciphertext polynomial.

[0083] The data processing method shown in step S101 to step S104 can be understood as an encryption method. This data processing method can meet the requirements of homomorphic encryption, which will be briefly demonstrated later. Based on this, the third-party computing device can Figure 1 The data processing method shown in the figure obtains multiple ciphertext polynomials, calculates and processes the multiple ciphertext polynomials, and determines the operation result of the ciphertext (i.e., another ciphertext polynomial); under the premise that the data processing method can meet the requirements of homomorphic encryption, the operation result of the ciphertext is consistent with the operation result of the plaintext data obtained by the same calculation and processing method. Among them, the way in which the third-party computing device performs calculation and processing can refer to the commonly used technology in this field, and this application does not limit it.

[0084] In one possible design, the ciphertext polynomial can be used to perform an XOR addition operation; or, when the decryption device (such as the second device in the present application) stores the first parameter, the ciphertext polynomial can be used to perform a multiplication or division operation. In the present application, the result of the addition or multiplication and division operation between multiple ciphertext polynomials is referred to as the operation result.

[0085] In this design, since the ciphertext polynomials are all elements in the polynomial remainder class ring of the first parameter, the results of addition or multiplication and division operations on multiple ciphertext polynomials are also elements in the polynomial remainder class ring of the first parameter. In this way, the data processing method shown in this application can be used for addition between messages and multiplication operations under specific conditions, and can also be used for homomorphic encryption and homomorphic decryption.

[0086] It should be noted that after multiplying two ciphertext polynomials, if the number of times the product reaches or exceeds N, then the product is multiplied by F x Modulo operation is performed so that the result of the operation is still an element in the polynomial residue class ring of the first parameter. For example, if the degree of the polynomial corresponding to the product of the polynomial and the polynomial is greater than N, then it is subjected to F x The result of the modulo operation is taken as the operation result, that is, (P(x)Q(x))mod F x , to ensure that the operation result is still an element in the polynomial remainder class ring determined by the first parameter.

[0087] In a possible design, the first device may also send the first parameter and the second parameter to the second device, the first parameter being the product of multiple irreducible polynomials; or the first device may also send multiple irreducible polynomials to the second device; the multiple irreducible polynomials are used to determine the second parameter. It should be understood that the above design is only for the case where the first device and the second device are not the same device.

[0088] Optionally, the design may be executed in any link after step S101, and this application does not limit this.

[0089] By adopting the data processing method shown in step S101 to step S104, the first device can determine the first ciphertext polynomial through the first parameter, the second parameter and the third parameter, thereby realizing homomorphic encryption of the first plaintext data; at the same time, the first ciphertext polynomial is an element in the polynomial remainder class ring of the first parameter. Since the polynomial remainder class ring satisfies the closure of polynomial addition and multiplication operations, this method can ensure that the data scale of the first ciphertext polynomial is within a controllable range, avoid data redundancy or resource loss caused by data expansion, and improve the operational efficiency and practicality of homomorphic encryption of the first plaintext data. In addition, the first ciphertext polynomial obtained by the above data processing method is small in size, so it can be homomorphically operated multiple times, which can further increase the scope of application of the data processing method.

[0090] Figure 2 A data processing method provided in an embodiment of the present application is applied to a second device. The data processing method in the present application can be applied in the aforementioned data processing architecture, wherein the second device can be a decryption device in the aforementioned data processing architecture. It should be understood that in some scenarios, the first device and the second device can be the same. The method may include the following steps:

[0091] S201: The second device obtains a first parameter, a fourth parameter and a third parameter in response to a data processing instruction, wherein the first parameter is a reducible polynomial, the fourth parameter is a positive integer, and the third parameter is a polynomial; the data processing instruction is used to instruct decryption processing of the second ciphertext polynomial to be processed.

[0092] Optionally, the data processing instruction includes a second ciphertext polynomial.

[0093] In one possible design, before the second device obtains the first parameter, the fourth parameter and the third parameter, the second device may also receive the first parameter and the second parameter from the first device, the first parameter being the product of multiple irreducible polynomials; or, the second device may also receive multiple irreducible polynomials from the first device; the multiple irreducible polynomials are used to determine the second parameter.

[0094] In a possible design, when the first parameter is the product of multiple irreducible polynomials, the method for the second device to determine the fourth parameter may include the following steps A, B, and C:

[0095] Step A: The second device obtains the second parameter according to the first parameter.

[0096] Optionally, the method for the second device to obtain the second parameter may include the following steps A-1 and A-2:

[0097] Step A-1: ​​The second device determines the maximum order of the polynomials included in the polynomial residue class ring according to a plurality of irreducible polynomials.

[0098] Step A-2: The second device determines a second parameter according to the maximum order.

[0099] Among them, the polynomial degree of the first parameter, the maximum order and the second parameter satisfy the following formula: 2 N ≡mmod R; where N is the polynomial degree of the first parameter, R is the maximum order, and m is the second parameter.

[0100] Step B: the second device determines the maximum order of the polynomials contained in the polynomial residue class ring according to the multiple irreducible polynomials;

[0101] Step C: The second device may also determine a fourth parameter according to the second parameter and the maximum order.

[0102] The second parameter, the fourth parameter and the maximum order satisfy the following formula: m*d≡1mod R; wherein R is the maximum order, m is the second parameter, and d is the fourth parameter.

[0103] In a possible design, the second device may also determine a third parameter based on the first parameter; the third parameter is not 1 and the third parameter is coprime with the first parameter.

[0104] S202: The second device generates a polynomial remainder class ring of the first parameter based on the first parameter, wherein the polynomial remainder class ring includes a plurality of polynomials. It should be understood that this step can refer to the discussion in step S102, and will not be repeated here.

[0105] S203: The second device obtains a second ciphertext polynomial; the second device calculates the second ciphertext polynomial according to the first parameter, the fourth parameter and the third parameter to obtain a second plaintext polynomial corresponding to the second ciphertext polynomial; the second plaintext polynomial is included in the multiple polynomials described in the aforementioned step S202, that is, it belongs to the aforementioned polynomial remainder class ring.

[0106] As discussed in the foregoing embodiments, it is assumed that the encryption device (or the first device) uses Figure 1 The data processing method shown in the figure obtains multiple first ciphertext polynomials; the third-party computing device can obtain at least two first ciphertext polynomials (such as ciphertext C1 and ciphertext C2) from the multiple first ciphertext polynomials, and calculate and process the at least two first ciphertext polynomials (such as XOR addition operation / multiplication and division operation) to determine the operation result of the ciphertext (i.e., the second ciphertext polynomial (such as ciphertext C) in step S203). Based on this, the decryption device (or the second device) can adopt the following method: Figure 2 The data processing method shown converts the operation result of the ciphertext (i.e., the second ciphertext polynomial) into the second plaintext data (e.g., plaintext P). The calculation result satisfies homomorphism. For example, assuming that the plaintext corresponding to the ciphertext C1 in the above example is plaintext P1, and the plaintext corresponding to the ciphertext C2 is plaintext P2; then, the operation result plaintext P determined by the above XOR addition calculation (or multiplication and division operation) and decryption satisfies the following calculation: the value obtained by performing XOR addition calculation (or multiplication and division operation) on plaintext P1 and plaintext P2 is plaintext P.

[0107] In a possible design, the first parameter, the fourth parameter, the third parameter, the second plaintext polynomial and the second ciphertext polynomial satisfy the following formula: x ′=(C x ') d K x -1mod F x Among them, F x is the first parameter, d is the fourth parameter, K x is the third parameter, M x ' is the second plaintext polynomial, C x ' is the second ciphertext polynomial.

[0108] S204: The second device determines the second plaintext data corresponding to the second plaintext polynomial according to the second plaintext polynomial; the coefficient of each term in the second plaintext polynomial corresponds to the value of each bit in the binary number of the second plaintext data. Optionally, the second device may also output the second plaintext data.

[0109] It should be understood that the data processing method shown in step S201 to step S204 can be understood as a decryption method, and the data processing method can meet the requirements of homomorphic encryption, which will be briefly demonstrated later. Figure 1 and Figure 2 The data processing methods shown can be used together to complete a complete set of homomorphic encryption processes.

[0110] By adopting the data processing method shown in steps S201 to S204, the second device can determine the second plaintext data through the first parameter, the second parameter and the fourth parameter, thereby realizing homomorphic decryption of the ciphertext data; at the same time, the second ciphertext polynomial is an element in the polynomial remainder class ring corresponding to the first parameter. Since the polynomial remainder class ring satisfies the closure of polynomial addition and multiplication operations, the data scale of the second ciphertext polynomial is within a controllable range, which can avoid data redundancy or resource loss caused by data expansion, and improve the computational efficiency and practicality of homomorphic encryption of the second plaintext data.

[0111] In a possible example, the first device can implement the above-mentioned steps by the following steps: Figure 1 The data processing method shown in the figure comprises:

[0112] Step 1-1: The first device presets a bit number N=64.

[0113] Step 1-2: The first device selects four irreducible polynomials: f1(x)=x 23 +x 5 +1; f2(x) = x 17 +x 11 +1; f3(x) = x 17 +x 3 +1; f4(x) = x 7 +x 6 +1.

[0114] Based on this, the first parameter determined by the first device is:

[0115] F x =f1(x)f2(x)f3(x)f4(x)=x 64 +x 63 +x 58 +x 51 +x 50 +x 49 +x 46 +x 45 +x 44 +x 40 +x 37 +x 35 +x 34 +x 31 +x 30 +x 29 +x 28 +x 27 +x 26 +x 22 +x 21 +x 19 +x 18 +x 17 +x 16 +x 15 +x 12 +x 10 +x 9 +x 8 +x 7 +x 6 +x 5 +x 3 +1.

[0116] Further, the first device generates a polynomial remainder class ring of the first parameter, namely Z2[x] / (F x ).

[0117] Step 1-3: The first device calculates the least common multiple of the orders of the four irreducible polynomials, that is, calculates (2 23 -1, 2 17 -1, 2 17 -1, 2 7 -1), we know that: 8388607*131071*127=139636894728319; therefore, the first parameter corresponds to Z2[x] / (F x ) contains a polynomial of maximum order R of 139636894728319.

[0118] Step 1-4: The first device determines a second parameter according to the number of bits N and the maximum order R.

[0119] Known 2 N≡m mod R; where N = 64, R = 139636894728319, then the first device can determine the second parameter as:

[0120] m=2 N mod 139636894728319=12095624970121.

[0121] Step 1-5: The first device calculates F x The hash value of the hash value is K, and the polynomial consisting of the left 64 bits of the hash value is taken as K x , where K x With F x Mutually prime.

[0122] Step 1-6: The first device determines the plaintext polynomial M corresponding to the message to be encrypted x , M x is Z2[x] / (F x It should be understood that this step can refer to the discussion in the aforementioned step S103.

[0123] Step 1-7: First device according to C x =(K x M x ) m mod F x Calculate the plaintext polynomial M x The corresponding ciphertext polynomial C x It should be understood that this step may refer to the discussion in the aforementioned step S104.

[0124] Step 1-8: The first device sends F to the second device x and m; or the first device sends f1(x), f2(x), f3(x) and f4(x) to the second device. It should be understood that steps 1-8 are optional steps and are selectively performed only when the first device and the second device are not the same device.

[0125] In another possible example, the second device can implement the aforementioned Figure 2 The data processing method shown in the figure comprises:

[0126] Step 2-1: The second device receives the F from the first device x and m; or, the second device receives f1(x), f2(x), f3(x) and f4(x) from the first device. It should be understood that step 1 is an optional step and is selectively performed only when the first device and the second device are not the same device.

[0127] Step 2-2: The second device is based on F x and m, determine Kx Or, the first device determines F according to f1(x), f2(x), f3(x) and f4(x) x , m and K x . Where m = 12095624970121.

[0128] Step 2-3: The second device determines the maximum order R=139636894728319 of the polynomial contained in the polynomial residue class ring according to f1(x), f2(x), f3(x) and f4(x), and determines d according to m and R. The second device determines d=72008725234802 according to m*d≡1mod R.

[0129] Step 2-4: The second device obtains C x '; The second device according to F x , d and K x , for C x 'Calculate and get M x '. The decryption method is M x '=(C x ') d K x -1 mod F x It should be understood that this step may refer to the discussion in the aforementioned step S203.

[0130] Among them, C in steps 2-4 x 'With C in step 1-7 x Usually different, but C in steps 2-4 x 'It can be a third-party computing device that performs multiple C in steps 1-7 x Calculated and processed. Similarly, M in steps 2-4 x 'With M in step 1-7 x Usually different.

[0131] Step 2-5: The second device is based on M x The coefficient of each item in ' is used to determine the plaintext data. It should be understood that this step can refer to the discussion in the aforementioned step S204.

[0132] Next, we verify whether the homomorphic property of the above data processing method exists. If the encryption result of the polynomials A(x) and B(x) on the ring is C A (x)=(K x A(x) m modF x , C B (x)=(K x B(x) m modF x, for the sum of the two polynomials above AB (x)=A(x)+B(x)=A(x)⊕B(x), according to the encryption rule:

[0133] C S (x)≡(K x S AB (x) m modF x .

[0134] ≡(K x A(x)+K x B(x) m modF x .

[0135] ≡(K x A(x)+K x B(x) 2N modF x .

[0136] ≡(K x A(x) 2N +(K x B(x) 2N modF x .

[0137] ≡(K x A(x) m +(K x B(x) m modF x .

[0138] ≡C A (x)+C B (x)modF x .

[0139] It can be seen that this data processing method satisfies the additive homomorphism property on the polynomial remainder class ring.

[0140] If there is M AB (x) = A(x)B(x)modF x , according to the encryption rules:

[0141] C M (x)≡(K x M AB (x) m modF x .

[0142] ≡(K x A(x)B(x)modF x ) m modF x.

[0143] ≡((K x A(x) m modF x )﹒ (B(x) m modF x )modF x .

[0144] ≡C A (x)C B (x)K x -m modF x .

[0145] It can be seen that the multiplication homomorphism on the polynomial residue class ring is not satisfied. However, if the decryption device can calculate K x , after removing K x After perturbing the product of , we can verify the existence of the multiplication homomorphism property.

[0146] Based on the same concept as the above-mentioned authentication method, an embodiment of the present application also provides a data processing device for implementing the above-mentioned method performed by the data processing device.

[0147] Figure 3 Shown is a schematic diagram of a modular structure of a data processing device provided in an embodiment of the present application.

[0148] The communication module 301 can be used to receive and send data, and the processing module 302 can be used to execute the data processing method shown in step S101 to step S104; or the communication module 301 can be used to receive and send data, and the processing module 302 can be used to execute the data processing method shown in step S201 to step S204. The specific actions and functions executed will not be specifically expanded here, and reference can be made to the description of the aforementioned method embodiment part.

[0149] Figure 4 A structural schematic diagram of a data processing device provided in an embodiment of the present application is shown.

[0150] The electronic device in the embodiment of the present application may include a processor 401. The processor 401 is the control center of the data processing device, and various interfaces and lines can be used to connect various parts of the data processing device, by running or executing instructions stored in the memory 402 and calling data stored in the memory 402. Optionally, the processor 401 may include one or more processing units, and the processor 401 may integrate an application processor and a modem processor, wherein the application processor mainly processes operating systems and application programs, etc., and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 401. In some embodiments, the processor 401 and the memory 402 may be implemented on the same chip, and in some embodiments, they may also be implemented separately on independent chips.

[0151] Processor 401 may be a general purpose processor, such as a central processing unit (CPU), a digital signal processor, an application specific integrated circuit, a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component, and may implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of the present application. A general purpose processor may be a microprocessor or any conventional processor, etc. The steps performed by the first device or the second device disclosed in the embodiments of the present application may be performed directly by a hardware processor, or by a combination of hardware and software modules in the processor.

[0152] In an embodiment of the present application, the memory 402 stores instructions that can be executed by at least one processor 401. The at least one processor 401 can be used to execute the aforementioned steps performed by the first device or the second device by executing the instructions stored in the memory 402.

[0153] The memory 402 is a non-volatile computer-readable storage medium that can be used to store non-volatile software programs, non-volatile computer executable programs and modules. The memory 402 may include at least one type of storage medium, such as a flash memory, a hard disk, a multimedia card, a card-type memory, a random access memory (Random Access Memory, RAM), a static random access memory (Static Random Access Memory, SRAM), a programmable read-only memory (Programmable Read Only Memory, PROM), a read-only memory (Read Only Memory, ROM), an electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, EEPROM), a magnetic memory, a disk, an optical disk, etc. The memory 402 is any other medium that can be used to carry or store a desired program code in the form of an instruction or data structure and can be accessed by a computer, but is not limited thereto. The memory 402 in the embodiment of the present application can also be a circuit or any other device that can realize a storage function, for storing program instructions and / or data.

[0154] In the embodiment of the present application, the network device may further include a communication interface 403, and the data processing device may transmit data through the communication interface 403. For example, if the data processing device is a server, the communication interface 403 may be used to obtain information of multiple container network interface CNI plug-ins configured by the user.

[0155] Optional, can be Figure 4 The processor 401 (or the processor 401 and the memory 402) shown implements Figure 3 The processing module 302 shown, and / or, is implemented by the communication interface 403 Figure 3 The communication module 301 is shown.

[0156] Based on the same inventive concept, the embodiment of the present application also provides a computer-readable storage medium, which may store instructions. When the instructions are executed on a computer, the computer executes the operation steps provided in the above method embodiment. The computer-readable storage medium may be Figure 4 Memory 402 is shown.

[0157] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.

[0158] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0159] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0160] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0161] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

Claims

1. A data processing method, applied to a first device, characterized in that: The method comprises: In response to a data processing instruction, a first parameter, a second parameter and a third parameter are acquired, wherein the first parameter is a reducible polynomial, the second parameter is a positive integer, and the third parameter is a polynomial; the data processing instruction is used to instruct to perform encryption processing on the first plaintext data to be processed; Based on the first parameter, generate a polynomial remainder class ring of the first parameter, wherein the polynomial remainder class ring includes a plurality of polynomials; Determine, according to the binary number corresponding to the first plaintext data, a first plaintext polynomial corresponding to the first plaintext data; the coefficient of each term in the first plaintext polynomial corresponds one-to-one to the value of each bit in the binary number; Calculating the first plaintext polynomial according to the first parameter, the second parameter and the third parameter to obtain a first ciphertext polynomial corresponding to the first plaintext data; the first ciphertext polynomial is included in the multiple polynomials; Outputting the first ciphertext polynomial; The first parameter is the product of a plurality of irreducible polynomials, and the method further comprises: Determining the maximum order of the polynomials included in the polynomial remainder class ring according to the multiple irreducible polynomials; determining the second parameter according to the maximum order; The polynomial degree of the first parameter, the maximum order and the second parameter satisfy the following formula: 2 N ≡m mod R; Wherein, N is the polynomial degree of the first parameter, R is the maximum order, and m is the second parameter.

2. The method according to claim 1, characterized in that The first parameter, the second parameter, the third parameter, the first plaintext polynomial, and the first ciphertext polynomial satisfy the following formula: C x =(K x M x ) m mod F x ; Among them, F x is the first parameter, m is the second parameter, K x is the third parameter, M x is the first plaintext polynomial, C x is the first ciphertext polynomial.

3. The method according to claim 2, characterized in that The method further comprises: The third parameter is determined according to the first parameter; the third parameter is not 1 and is relatively prime to the first parameter.

4. The method according to claim 1, characterized in that The first ciphertext polynomial is used to perform XOR and addition operations; or, the first ciphertext polynomial is used to perform multiplication and division operations.

5. The method according to claim 1, characterized in that The method further comprises: Obtain the second ciphertext polynomial; Calculate the second ciphertext polynomial according to the first parameter, the fourth parameter and the third parameter to obtain a second plaintext polynomial corresponding to the second ciphertext polynomial; the second plaintext polynomial is included in the multiple polynomials, and the fourth parameter is a positive integer; Determine the second plaintext data according to the second plaintext polynomial; the coefficient of each term in the second plaintext polynomial corresponds one-to-one to the value of each bit in the binary number of the second plaintext data; The second plaintext data is output.

6. The method according to claim 5, characterized in that The first parameter, the fourth parameter, the third parameter, the second plaintext polynomial and the second ciphertext polynomial satisfy the following formula: M x ′=(C x ’) d K x -1 mod F x ; Among them, F x is the first parameter, d is the fourth parameter, K x is the third parameter, M x ' is the second plaintext polynomial, C x ' is the second ciphertext polynomial.

7. The method according to claim 5 or 6, characterized in that The method further comprises: Determine the fourth parameter according to the second parameter and the maximum order of the polynomial contained in the polynomial residue class ring; The second parameter, the fourth parameter and the maximum order satisfy the following formula: m*d≡1mod R; Among them, R is the maximum order, m is the second parameter, and d is the fourth parameter.

8. The method according to claim 1, characterized in that The method further comprises: Sending the first parameter and the second parameter to a second device, where the first parameter is a product of multiple irreducible polynomials; or, The plurality of irreducible polynomials are sent to a second device; the plurality of irreducible polynomials are used to determine the second parameter.

9. A data processing device, characterized in that: The device comprises: A communication module, configured to obtain a first parameter, a second parameter, and a third parameter in response to a data processing instruction, wherein the first parameter is a reducible polynomial, the second parameter is a positive integer, and the third parameter is a polynomial; the data processing instruction is configured to instruct encryption processing to be performed on the first plaintext data to be processed; A processing module, configured to generate a polynomial remainder class ring of the first parameter based on the first parameter, wherein the polynomial remainder class ring includes a plurality of polynomials; The processing module is further used to: determine a first plaintext polynomial corresponding to the first plaintext data according to the binary number corresponding to the first plaintext data; the coefficient of each term in the first plaintext polynomial corresponds to the value of each bit in the binary number one by one; The processing module is further used to: calculate the first plaintext polynomial according to the first parameter, the second parameter and the third parameter to obtain a first ciphertext polynomial corresponding to the first plaintext data; the first ciphertext polynomial is included in the multiple polynomials; The communication module is further used to: output the first ciphertext polynomial; The first parameter is the product of a plurality of irreducible polynomials, and the processing module is further used for: Determining the maximum order of the polynomials included in the polynomial remainder class ring according to the multiple irreducible polynomials; determining the second parameter according to the maximum order; The polynomial degree of the first parameter, the maximum order and the second parameter satisfy the following formula: 2 N ≡m mod R; Wherein, N is the polynomial degree of the first parameter, R is the maximum order, and m is the second parameter.

10. The device according to claim 9, characterized in that The first parameter, the second parameter, the third parameter, the first plaintext polynomial, and the first ciphertext polynomial satisfy the following formula: C x =(K x M x ) m mod F x ; Among them, F x is the first parameter, m is the second parameter, K x is the third parameter, M x is the first plaintext polynomial, C x is the first ciphertext polynomial.

11. The device according to claim 10, characterized in that The processing module is also used for: The third parameter is determined according to the first parameter; the third parameter is not 1 and is relatively prime to the first parameter.

12. The device according to claim 9, characterized in that The first ciphertext polynomial is used to perform XOR and addition operations; or, the first ciphertext polynomial is used to perform multiplication and division operations.

13. The device according to claim 9, characterized in that The communication module is also used for: Obtain the second ciphertext polynomial; The processing module is also used for: Calculate the second ciphertext polynomial according to the first parameter, the fourth parameter and the third parameter to obtain a second plaintext polynomial corresponding to the second ciphertext polynomial; the second plaintext polynomial is included in the multiple polynomials, and the fourth parameter is a positive integer; Determining second plaintext data according to the second plaintext polynomial; The coefficient of each term in the second plaintext polynomial corresponds one-to-one to the value of each bit in the binary number of the second plaintext data; The second plaintext data is output.

14. The device according to claim 13, characterized in that The first parameter, the fourth parameter, the third parameter, the second plaintext polynomial and the second ciphertext polynomial satisfy the following formula: M x ′=(C x ’) d K x -1 mod F x ; Among them, F x is the first parameter, d is the fourth parameter, K x is the third parameter, M x ' is the second plaintext polynomial, C x ' is the second ciphertext polynomial.

15. The device according to claim 13 or 14, characterized in that The processing module is also used for: Determine the fourth parameter according to the second parameter and the maximum order of the polynomial contained in the polynomial residue class ring; The second parameter, the fourth parameter and the maximum order satisfy the following formula: m*d≡1mod R; Among them, R is the maximum order, m is the second parameter, and d is the fourth parameter.

16. The device according to claim 9, characterized in that The communication module is also used for: Sending the first parameter and the second parameter to a second device, where the first parameter is a product of multiple irreducible polynomials; or, The plurality of irreducible polynomials are sent to a second device; the plurality of irreducible polynomials are used to determine the second parameter.

17. An electronic device, characterized in that: include: A memory for storing program instructions; A processor is used to call the program instructions stored in the memory, and execute the steps included in any one of the methods of claims 1-8 according to the obtained program instructions.

18. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a computer, the computer executes the method according to any one of claims 1 to 8.