Data encryption method, data decryption method, device, equipment and storage medium

By utilizing the ElGamal encryption algorithm based on elliptic curves and employing modulo operations and elliptic curve base point encryption, the problems of long key lengths and low computational performance in the ElGamal homomorphic encryption algorithm are solved. This enables data encryption processing from smaller plaintext spaces to larger plaintext spaces, improving computational performance and providing homomorphic encryption characteristics.

CN118659886BActive Publication Date: 2024-11-12BEIJING INFOSEC TECH CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202411118170.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-14
Publication Date
2024-11-12
Estimated Expiration
2044-08-14

AI Technical Summary

Technical Problem

In existing technologies, the ElGamal homomorphic encryption algorithm has a long key length and low computational performance, making it difficult to meet the needs of secure data transmission and storage.

Method used

The ElGamal encryption algorithm based on elliptic curves is adopted. By obtaining the public key of the second user terminal, the target number of second random numbers are moduloed using the data to be encrypted to generate intermediate data. The random numbers and intermediate data are then encrypted using the base points of the elliptic curve to form the target ciphertext, which is then sent to the second user terminal.

Benefits of technology

It achieves improved encryption of longer data by encrypting shorter intermediate data, based on homomorphic encryption properties, thereby improving computational performance and reducing key length.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118659886B_ABST
    Figure CN118659886B_ABST
Patent Text Reader

Abstract

This application provides a data encryption method, data decryption method, apparatus, device, and storage medium. It employs the ElGamal encryption algorithm based on elliptic curves for encryption. By performing a modulo operation on a target number of second random numbers using the longer data to be encrypted, a target number of shorter intermediate data are obtained. Encryption of these shorter intermediate data is then performed to encrypt the longer data to be encrypted. This achieves the goal of increasing the plaintext encryption space from a smaller one to a larger one, while maintaining homomorphic encryption properties. The technical solution of this application implements encryption using the ElGamal homomorphic encryption algorithm, enabling the encryption of plaintext data from a smaller plaintext space to a larger one.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of data processing, and in particular to a data encryption method, a data decryption method, an apparatus, a device and a storage medium. Background Art

[0002] With the widespread use of cloud services, data security issues have become increasingly prominent. In order to meet the needs of secure data transmission and storage, homomorphic encryption has emerged. Homomorphic encryption schemes can be used to encrypt data to be encrypted, and use ciphertext to perform a series of operations such as uploading, downloading, deleting, updating, and retrieving, avoiding the risk of data being intercepted, copied, tampered with, or forged during transmission, and also avoiding the risk of data leakage by the data storage party or being hacked on the server side.

[0003] In traditional schemes, the ElGamal homomorphic encryption algorithm is usually used to implement it. However, the key length of this algorithm is long and the computing performance is low. Summary of the invention

[0004] The embodiments of the present application provide a data encryption method, a data decryption method, an apparatus, a device and a storage medium, which are used to solve the problem that when the ElGamal homomorphic encryption algorithm is used for data encryption in the prior art, the key length of the algorithm is long and the computing performance is low.

[0005] In a first aspect, an embodiment of the present application provides a data encryption method, applied to a first user terminal, comprising:

[0006] Obtaining a public key of a second client, the public key comprising a sub-public key generated by the second client based on a first random number and an elliptic curve base point and a target number of second random numbers, the first random number being used as a private key of the second client;

[0007] Using the data to be encrypted to perform a modulo operation on the target number of second random numbers to obtain the target number of intermediate data; wherein the length of the second random number is less than the length of the data to be encrypted;

[0008] Generate a target number of third random numbers, and encrypt the target number of third random numbers using the elliptic curve base point to obtain a first ciphertext;

[0009] Using the sub-public key to encrypt the target number of third random numbers to obtain a first encryption result, and using the elliptic curve base point to encrypt the target number of intermediate data to obtain a second encryption result, and obtaining a second ciphertext based on the first encryption result and the second encryption result;

[0010] The target ciphertext composed of the first ciphertext and the second ciphertext is sent to the second client.

[0011] In a second aspect, an embodiment of the present application provides a data decryption method, which is applied to a second user terminal, comprising:

[0012] Receive a target ciphertext sent by a first client, the target ciphertext consists of a first ciphertext and a second ciphertext, the first ciphertext is obtained by encrypting a target number of third random numbers by an elliptic curve base point, the second ciphertext is obtained based on the first encryption result and the second encryption result, the first encryption result is obtained by encrypting the target number of third random numbers by a sub-public key, the second encryption result is obtained by encrypting the target number of intermediate data by the elliptic curve base point, the intermediate data is obtained by performing a modulus operation on the target number of second random numbers by the data to be encrypted, the sub-public key is generated by the second client based on the first random number and the elliptic curve base point, the first random number and the target number of second random numbers are generated by the second client, the first random number is used as the private key of the second client, the sub-public key and the target number of second random numbers are used as the public key of the second client and are sent by the second client to the first client;

[0013] Decrypting the target ciphertext using the private key to obtain the target number of intermediate data;

[0014] The target number of intermediate data are calculated based on the Chinese remainder theorem to obtain the data to be encrypted.

[0015] In a third aspect, an embodiment of the present application provides a data encryption device, applied to a first user terminal, comprising:

[0016] An acquisition module, configured to acquire a public key of a second user terminal, wherein the public key includes a sub-public key generated by the second user terminal based on a first random number and an elliptic curve base point and a target number of second random numbers, wherein the first random number is used as a private key of the second user terminal;

[0017] A modular operation module, used to perform a modular operation on the target number of second random numbers using the data to be encrypted to obtain a target number of intermediate data; wherein the length of the second random number is less than the length of the data to be encrypted;

[0018] A first encryption module is used to generate a target number of third random numbers, and encrypt the target number of third random numbers using the elliptic curve base point to obtain a first ciphertext;

[0019] a second encryption module, configured to encrypt the target number of third random numbers using the sub-public key to obtain a first encryption result, and to encrypt the target number of intermediate data using the elliptic curve base point to obtain a second encryption result, and to obtain a second ciphertext based on the first encryption result and the second encryption result;

[0020] The sending module is used to send the target ciphertext composed of the first ciphertext and the second ciphertext to a second user terminal.

[0021] In a fourth aspect, an embodiment of the present application provides a data decryption device, applied to a second user terminal, comprising:

[0022] A receiving module, used for receiving a target ciphertext sent by a first user terminal, wherein the target ciphertext is composed of a first ciphertext and a second ciphertext, wherein the first ciphertext is obtained by encrypting a target number of third random numbers by an elliptic curve base point, and the second ciphertext is obtained based on the first encryption result and the second encryption result, wherein the first encryption result is obtained by encrypting the target number of third random numbers by a sub-public key, and the second encryption result is obtained by encrypting the target number of intermediate data by the elliptic curve base point, and the intermediate data is obtained by performing a modulus operation on the target number of second random numbers by the data to be encrypted, the sub-public key is generated by the second user terminal based on the first random number and the elliptic curve base point, the first random number and the target number of second random numbers are generated by the second user terminal, the first random number is used as the private key of the second user terminal, and the sub-public key and the target number of second random numbers are used as the public key of the second user terminal and are sent by the second user terminal to the first user terminal;

[0023] A first decryption module, used to decrypt the target ciphertext using the private key to obtain the target number of intermediate data;

[0024] The second decryption module is used to calculate the target number of intermediate data based on the Chinese remainder theorem to obtain the data to be encrypted.

[0025] In a fifth aspect, an embodiment of the present application provides a computing device, comprising a storage component and a processing component; the storage component stores one or more computer instructions, the one or more computer instructions are called and executed by the processing component, and the processing component executes the one or more computer instructions to implement the data encryption method as described in the first aspect, or the data decryption method as described in the second aspect.

[0026] In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium storing a computer program, which, when executed by a computer, implements the data encryption method described in the first aspect, or the data decryption method described in the second aspect.

[0027] In a seventh aspect, an embodiment of the present application provides a computer program product storing a computer program, which, when executed by a computer, implements the data encryption method as described in the first aspect, or the data decryption method as described in the second aspect.

[0028] In an embodiment of the present application, the first user terminal can obtain a public key sent by the second user terminal, and the public key may include a sub-public key generated based on a first random number and an elliptic curve base point, and a target number of second random numbers, and the target number of second random numbers are modulo-operated using the data to be encrypted to obtain a target number of intermediate data, wherein the length of the second random number may be less than the length of the data to be encrypted. Also, a target number of third random numbers may be generated, and the target number of third random numbers may be encrypted using the elliptic curve base point to obtain a first ciphertext, and the target number of third random numbers may be encrypted using the sub-public key to obtain a first encryption result, and the target number of intermediate data may be encrypted using the elliptic curve base point to obtain a second encryption result, and a second ciphertext may be obtained based on the first encryption result and the second encryption result, and the target ciphertext consisting of the first ciphertext and the second ciphertext may be sent to the second user terminal. Encryption is performed by adopting the ElGamal encryption algorithm based on elliptic curves, and a target number of second random numbers are modulo-operated with the data to be encrypted with a larger length to obtain a target number of intermediate data with a smaller length, so that the data to be encrypted with a larger length can be encrypted by encrypting the target number of intermediate data with a smaller length. This enables the encryption of the plaintext data from a smaller plaintext space to be upgraded to a larger plaintext space based on the homomorphic encryption feature.

[0029] These and other aspects of the present application will become more clearly understood in the description of the following embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following is a brief introduction to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0031] Figure 1 A flow chart of an embodiment of a data encryption method provided by the present application is shown;

[0032] Figure 2 A flow chart of an embodiment of a data decryption method provided by the present application is shown;

[0033] Figure 3 A schematic diagram showing the structure of an embodiment of a data encryption device provided by the present application is shown;

[0034] Figure 4 A schematic diagram showing the structure of an embodiment of a data decryption device provided by the present application is shown;

[0035] Figure 5 A schematic diagram of an embodiment of a data transmission scenario provided by the present application is shown;

[0036] Figure 6 A schematic diagram of the structure of an embodiment of a computing device provided by the present application is shown. DETAILED DESCRIPTION

[0037] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application.

[0038] In some of the processes described in the specification and claims of this application and the above-mentioned figures, multiple operations that appear in a specific order are included, but it should be clearly understood that these operations may not be executed in the order in which they appear in this article or executed in parallel. The serial numbers of the operations, such as 101, 102, etc., are only used to distinguish between different operations, and the serial numbers themselves do not represent any execution order. In addition, these processes may include more or fewer operations, and these operations may be executed in sequence or in parallel. It should be noted that the descriptions of "first", "second", etc. in this article are used to distinguish different messages, devices, modules, etc., do not represent the order of precedence, and do not limit the "first" and "second" to different types.

[0039] The technical solution of this application is applicable to the field of data processing, especially to data encryption and decryption scenarios. With the widespread application of cloud services, data security issues have become increasingly prominent. In order to meet the needs of secure data transmission and storage, homomorphic encryption has emerged. The homomorphic encryption scheme can be used to encrypt encrypted data, and the ciphertext can be uploaded, downloaded, deleted, updated, retrieved, and other operations to avoid the risk of data being intercepted, copied, tampered with, or forged during transmission, and to avoid the risk of data leakage by the data storage party or being hacked on the server side.

[0040] In traditional schemes, the ElGamal homomorphic encryption algorithm is usually used to implement it. However, the key length of this algorithm is long and the computing performance is low.

[0041] The inventors thought that the elliptic curve has the advantages of short key length and high computing performance under the same security. If the ElGamal homomorphic encryption algorithm can be implemented by taking advantage of the short key length and high computing performance of the elliptic curve, the above technical problems can be solved. Based on this, a technical solution of an embodiment of the present application is proposed, including obtaining a public key of a second user terminal, the public key including a sub-public key and a target number of second random numbers generated by the second user terminal based on a first random number and an elliptic curve base point, the first random number being used as a private key of the second user terminal; performing a modulus operation on the target number of second random numbers using the data to be encrypted to obtain a target number of intermediate data; wherein the length of the second random number is less than the length of the data to be encrypted; generating a target number of third random numbers, and encrypting the target number of third random numbers using the elliptic curve base point to obtain a first ciphertext; encrypting the target number of third random numbers using the sub-public key to obtain a first encryption result, and encrypting the target number of intermediate data using the elliptic curve base point to obtain a second encryption result, and obtaining a second ciphertext based on the first encryption result and the second encryption result; and sending the target ciphertext consisting of the first ciphertext and the second ciphertext to the second user terminal.

[0042] Encryption is performed by adopting the ElGamal encryption algorithm based on elliptic curves, and a target number of second random numbers are modulo-operated with the data to be encrypted with a larger length to obtain a target number of intermediate data with a smaller length, so that the data to be encrypted with a larger length can be encrypted by encrypting the target number of intermediate data with a smaller length. This enables the encryption of the plaintext data from a smaller plaintext space to be upgraded to a larger plaintext space based on the homomorphic encryption feature.

[0043] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of this application.

[0044] like Figure 1 As shown, it is a flowchart of an embodiment of a data encryption method provided by the present application, which can be applied to a first user terminal. The method may include the following steps.

[0045] 101: Obtain a public key of a second user terminal. The public key may include a sub-public key generated by the second user terminal based on a first random number and an elliptic curve base point and a target number of second random numbers, and the first random number is used as a private key of the second user terminal.

[0046] The technical solution of the embodiment of the present application is applicable to data encryption and decryption scenarios. The first user end, as the data encryption party, shares the elliptic curve parameters p, a, b, G and n in the elliptic curve Ep(a, b) in the elliptic curve public key cryptography algorithm (SM2) with the second user end, as the data decryption party, where p is a prime number greater than 3, a and b are the elliptic curve E equation y 2 =x 3 +ax+b, G represents the elliptic curve base point, and n represents the order of G.

[0047] The first user terminal may receive the public key sent by the second user terminal to encrypt the data to be encrypted using the public key. In this embodiment, the public key may include a sub-public key generated by the second user terminal based on the first random number and the elliptic curve base point and a target number of second random numbers. The process of generating the public key by the second user terminal is described below.

[0048] The second user terminal can generate a first random number, such as uniformly randomly selecting d∈[1,n-1], where d represents the first random number, and use the first random number d as its own private key. And, based on the first random number and the elliptic curve base point, generate a sub-public key, such as multiplying the first random number with the elliptic curve base point to calculate P=[d]G, where P represents the sub-public key, and generate a target number of second random numbers, such as uniformly randomly selecting k i ∈[1,n-1],i=1,2,···,t,k i represents the second random number, t represents the target number, and the second random number k i The lengths are consistent, based on the sub-public key P and the target number of second random numbers k i Construct the public key PK={P,k1,k2,···,k t}, send the public key to the first user terminal.

[0049] Thus, the first user terminal can receive the public key PK={P,k1,k2,···,k t}, so that the encrypted data can be encrypted later.

[0050] 102: Perform a modulus operation on a target number of second random numbers using the data to be encrypted to obtain a target number of intermediate data.

[0051] Among them, the data to be encrypted m∈M, M represents the message space, M∈[1,n-1].

[0052] In this embodiment, the second random number k i The length of can be smaller than the length of the data to be encrypted m. Therefore, the target number of second random numbers k can be used iA modulo operation is performed on the data to be encrypted m to obtain a target number of intermediate data. It can be understood that the length of the intermediate data will be smaller than the data to be encrypted, so that the encryption of the data to be encrypted can be achieved by subsequently encrypting the target number of intermediate data, thereby achieving the encryption processing of the plaintext data from a smaller plaintext space to a larger plaintext space.

[0053] As an optional implementation method, the target number t can be 8, and the length of the second random number ki can be 32 bits. In this case, the length of the encrypted data m can be 256 bits, so that the encryption processing of the plaintext data can be increased from a 32-bit plaintext space to a 256-bit plaintext space.

[0054] Of course, subsequent encryption can also be achieved by setting the corresponding target number and the length of the second random number according to actual needs, such as the length of the data to be encrypted in the actual encryption scenario, and this application does not impose any restrictions on this.

[0055] 103: Generate a target number of third random numbers, and encrypt the target number of third random numbers using an elliptic curve base point to obtain a first ciphertext.

[0056] 104: Encrypt a target number of third random numbers using the sub-public key to obtain a first encryption result, and encrypt a target number of intermediate data using the elliptic curve base point to obtain a second encryption result, and obtain a second ciphertext based on the first encryption result and the second encryption result.

[0057] In the embodiment of the present application, the ElGamal encryption algorithm based on the above elliptic curve (an asymmetric encryption algorithm based on the Diffie-Hellman key exchange, proposed by Tahir Gamal) can be used to implement encryption. Specifically, a target number of third random numbers can be generated, such as uniformly randomly selecting l i ∈[1,n-1],i=1,2,···,t,l i represents the third random number, t represents the target number, and the elliptic curve base point G is used to calculate the third random number l of the target number. i Encrypt to obtain the first ciphertext. Specifically, for any third random number l i , they can all be encrypted using the elliptic curve base point G to obtain a target number of first sub-ciphertexts. It can be understood that the target number of first sub-ciphertexts can constitute the first ciphertext.

[0058] And, the sub-public key P can also be used to generate the target number of third random numbers l i Encryption is performed to obtain a first encryption result, and the target number of intermediate data m can also be encrypted using the elliptic curve base point G iEncryption is performed to obtain a second encryption result, and a second ciphertext is obtained based on the first encryption result and the second encryption result. It can be understood that for any third random number l i , can be encrypted with the child public key P to obtain the target number of first sub-encryption results, the target number of first sub-encryption results can constitute the first encryption result, and, for any intermediate data m i , they can all be encrypted using the elliptic curve base point G to obtain a target number of second sub-encryption results, and the target number of second sub-encryption results can constitute a second encryption result.

[0059] After obtaining a first encryption result consisting of a target number of first sub-encryption results and a second encryption result consisting of a target number of second sub-encryption results, a corresponding second sub-ciphertext can be obtained based on the corresponding first sub-encryption result and the second sub-encryption result, and the second ciphertext can be formed by the target number of second sub-ciphertexts. For example, the first sub-encryption result obtained by encrypting the third random number l3 based on the sub-public key P and the second sub-encryption result obtained by encrypting the intermediate data m3 based on the elliptic curve base point G can obtain the corresponding second sub-ciphertext, and the first sub-encryption result obtained by encrypting the third random number l4 based on the sub-public key P and the second sub-encryption result obtained by encrypting the intermediate data m4 based on the elliptic curve base point G can obtain the corresponding second sub-ciphertext, and finally the target number of second sub-ciphertexts are obtained and constitute the second ciphertext.

[0060] 105: Send the target ciphertext composed of the first ciphertext and the second ciphertext to the second client.

[0061] After the encryption is completed, the first client may send the target ciphertext consisting of the first ciphertext and the second ciphertext to the second client.

[0062] In this embodiment, the first user terminal can obtain the public key sent by the second user terminal, and the public key can include a sub-public key generated based on the first random number and the elliptic curve base point, and a target number of second random numbers, and use the data to be encrypted to perform a modulus operation on the target number of second random numbers to obtain a target number of intermediate data, wherein the length of the second random number can be less than the length of the data to be encrypted. In addition, a target number of third random numbers can be generated, and the target number of third random numbers can be encrypted using the elliptic curve base point to obtain a first ciphertext, and the target number of third random numbers can be encrypted using the sub-public key to obtain a first encryption result, and the target number of intermediate data can be encrypted using the elliptic curve base point to obtain a second encryption result. Based on the first encryption result and the second encryption result, a second ciphertext can be obtained, and the target ciphertext composed of the first ciphertext and the second ciphertext can be sent to the second user terminal. By using the data to be encrypted with a larger length to perform a modulo operation on a target number of second random numbers, a target number of intermediate data with a smaller length is obtained, so that encryption can be performed by adopting the ElGamal encryption algorithm based on the elliptic curve. By using the data to be encrypted with a larger length to perform a modulo operation on the target number of second random numbers, a target number of intermediate data with a smaller length is obtained, so that the data to be encrypted with a larger length can be encrypted by encrypting the target number of intermediate data with a smaller length. Therefore, on the basis of having the homomorphic encryption characteristics, the encryption processing of the plaintext data can be upgraded from a smaller plaintext space to a larger plaintext space.

[0063] In some embodiments, the method of performing a modulo operation on a target number of second random numbers using the data to be encrypted to obtain the target number of intermediate data may include:

[0064] According to the following modular operation formula, the target number of second random numbers are modulo-operated using the data to be encrypted to obtain the target number of intermediate data:

[0065] The modulo operation formula can be: i =m mod k i , k i ∈[1,n-1], i=1,2,···,t; where m i represents intermediate data, m represents the data to be encrypted, k i represents the second random number, t represents the target number, t>1, n represents the order of the elliptic curve base point, and mod represents the modular operation.

[0066] In this embodiment, the second random number k i The lengths of the second random number k are consistent and are smaller than the length of the encrypted data m. iThe length of can be 32 bits, the length of the data to be encrypted m can be 256 bits, and the target number t can be 8. After the modulo operation, 8 intermediate data m1, m2, ···, m8 can be obtained. The 8 intermediate data can be subsequently encrypted to realize the encryption of the data to be encrypted.

[0067] Moreover, it can be known from the above modular operation formula that it adopts the form of a group of congruence equations. Based on the characteristics of the group of congruence equations, the Chinese remainder theorem can be used to solve it to achieve decryption. The specific decryption process will be explained in the subsequent embodiments.

[0068] By performing a modulo operation on the target number of second random numbers of the data to be encrypted according to the above-mentioned modulo operation formula, a target number of intermediate data are obtained, so that the encryption of the data to be encrypted with a larger length can be achieved by encrypting the target number of intermediate data with a smaller length. Based on the characteristics of the congruence equation group, the Chinese remainder theorem can be used to solve the problem to achieve decryption, ensuring that the data to be encrypted can be recovered from the decryption result, thereby achieving the encryption processing of the plaintext data from a smaller plaintext space to a larger plaintext space.

[0069] In combination with the above-mentioned modulo operation, the encryption process is described below. In some embodiments, the method of encrypting the target number of third random numbers using the elliptic curve base point to obtain the first ciphertext may include:

[0070] The target number of third random numbers are respectively multiplied by the elliptic curve base point to obtain a first ciphertext.

[0071] Among them, the first ciphertext generation formula can be: 1,i =[l i ]G,i=1,2,···,t,c 1,i Represents the first ciphertext.

[0072] And, using the sub-public key to encrypt the target number of third random numbers to obtain a first encryption result, and using the elliptic curve base point to encrypt the target number of intermediate data to obtain a second encryption result, the method for obtaining the second ciphertext based on the first encryption result and the second encryption result may include:

[0073] Multiplying the target number of third random numbers by the sub-public key respectively to obtain a first encryption result; wherein the sub-public key is generated by multiplying the first random number by the elliptic curve base point;

[0074] Multiplying the target number of intermediate data with the elliptic curve base point respectively to obtain a second encryption result;

[0075] The first encryption result and the second encryption result are added together to obtain a second ciphertext.

[0076] Among them, the second ciphertext generation formula can be: 2,i =[l i ]P+[m i ]G,i=1,2,···,t,c 2,i Represents the second ciphertext, [l i ]P represents the first encryption result, [m i ]G represents the second encryption result.

[0077] Based on the first ciphertext and the second ciphertext, the target ciphertext c=(c 1,i , c 2,i) , i=1,2,···,t, and c represents the target ciphertext.

[0078] By generating the first ciphertext and the second ciphertext according to the above-mentioned first ciphertext generation formula and the second ciphertext generation formula, the data is encrypted using the ElGamal encryption algorithm based on SM2. Since the ElGamal encryption algorithm has the homomorphic encryption characteristic, the encryption algorithm of the embodiment of the present application also has the homomorphic encryption characteristic. As well as the advantages of the SM2 algorithm of short key length and high computing performance, the encryption processing of plaintext data can be upgraded from a smaller plaintext space to a larger plaintext space. Based on this, the encryption processing of plaintext data can be upgraded from a smaller plaintext space to a larger plaintext space on the basis of having the homomorphic encryption characteristic.

[0079] In practical applications, the data encryption scheme of the embodiment of the present application may have homomorphic encryption characteristics. In some embodiments, the encrypted data m and m' may be encrypted respectively to obtain the corresponding target ciphertexts c and c', where c = (c 1,i ,c 2,i ), i=1,2,···,t, the target ciphertext c is obtained by encrypting the encrypted data m, c'=(c 1,i ',c 2,i '), i=1,2,···,t, the target ciphertext c' is obtained by encrypting the data to be encrypted m'. The specific encryption process has been described in the above embodiment and will not be repeated here.

[0080] Add the target ciphertext c and c' to obtain the summed ciphertext c add =c+c'=(c 1,i +c 1,i ',c 2,i +c 2,i '), i=1,2,···,t. The sum of the encrypted data m and m' can be obtained by decrypting the sum ciphertext, thereby having the additive homomorphic encryption characteristic. The decryption process is described in the following embodiment.

[0081] One or more of the above embodiments provide a process of data encryption, and the process of data decryption is described below.

[0082] like Figure 2 As shown, it is a flowchart of an embodiment of a data decryption method provided by the present application, which can be applied to a second user terminal. The method may include the following steps.

[0083] 201: Receive a target ciphertext sent by a first user terminal.

[0084] Among them, the target ciphertext is composed of a first ciphertext and a second ciphertext, the first ciphertext is obtained by encrypting a target number of third random numbers by an elliptic curve base point, the second ciphertext is obtained based on the first encryption result and the second encryption result, the first encryption result is obtained by encrypting a target number of third random numbers by a sub-public key, the second encryption result is obtained by encrypting a target number of intermediate data by an elliptic curve base point, the intermediate data is obtained by performing a modulus operation on the target number of second random numbers by the data to be encrypted, the sub-public key is generated by the second user terminal based on the first random number and the elliptic curve base point, the first random number and the target number of second random numbers are generated by the second user terminal, the first random number is used as the private key of the second user terminal, the sub-public key and the target number of second random numbers are used as the public key of the second user terminal and are sent by the second user terminal to the first user terminal.

[0085] In this embodiment, the second user terminal can generate a first random number, such as uniformly randomly selecting d∈[1,n-1], where d represents the first random number, and use the first random number d as its own private key. And, based on the first random number and the elliptic curve base point, a sub-public key is generated, such as multiplying the first random number with the elliptic curve base point to calculate P=[d]G, where P represents the sub-public key, and a target number of second random numbers is generated, such as uniformly randomly selecting k i ∈[1,n-1],i=1,2,···,t,k i represents the second random number, t represents the target number, and the second random number k i The lengths are consistent, based on the sub-public key P and the target number of second random numbers k i Construct the public key PK={P,k1,k2,···,k t}.

[0086] The second user terminal can send the public key to the first user terminal, so that the first user terminal can use the public key to encrypt the data to be encrypted and obtain the target ciphertext. The process of the first user terminal generating the target ciphertext can be performed in Figure 1 The corresponding description has been given in the illustrated embodiment and will not be repeated here.

[0087] Thus, the second client can receive the target ciphertext sent by the first client.

[0088] 202: Decrypt the target ciphertext using the private key to obtain the target number of intermediate data.

[0089] Among them, since the target ciphertext is composed of the first ciphertext and the second ciphertext, the first ciphertext is obtained by encrypting the target number of third random numbers by the elliptic curve base point, the first encryption result in the second ciphertext is obtained by encrypting the target number of third random numbers by the sub-public key, and the second encryption result is obtained by encrypting the target number of intermediate data by the elliptic curve base point. Since the sub-public key is obtained by multiplying the private key and the elliptic curve base point, the private key can be used to decrypt the first ciphertext and the first encryption result in the second ciphertext, thereby obtaining the second encryption result in the second ciphertext, and then the elliptic curve base point can be decrypted to obtain multiple intermediate data.

[0090] 203: Based on the Chinese remainder theorem, the target number of intermediate data is calculated to obtain the data to be encrypted.

[0091] Among them, since the intermediate data is obtained by performing a modulo operation on the target number of second random numbers of the data to be encrypted, combined with the characteristics of the modulo operation, the Chinese remainder theorem can be used to solve it to achieve decryption. The specific decryption process will be described in subsequent embodiments.

[0092] In this embodiment, the second user terminal can generate a first random number and use it as its own private key, and generate a sub-public key based on the first random number and the elliptic curve base point, and generate a target number of second random numbers, and form a public key based on the sub-public key and the target number of second random numbers, and send it to the first user terminal for encryption. In addition, the second user terminal can receive the target ciphertext sent by the first user terminal, and the target ciphertext can be composed of the first ciphertext and the second ciphertext. The first ciphertext is obtained by encrypting the target number of third random numbers by the elliptic curve base point, and the second ciphertext is obtained based on the first encryption result and the second encryption result. The first encryption result is obtained by encrypting the target number of third random numbers by the sub-public key, and the second encryption result is obtained by encrypting the target number of intermediate data by the elliptic curve base point, and the intermediate data is obtained by performing a modulus operation on the target number of second random numbers by the data to be encrypted. The second user terminal can use the private key to decrypt the target ciphertext to obtain the target number of intermediate data, and calculate the target number of intermediate data based on the Chinese remainder theorem to obtain the data to be encrypted. By adopting the ElGamal encryption algorithm based on elliptic curve for encryption and decryption, the target number of second random numbers are modulo operated with the data to be encrypted with a larger length to obtain the target number of intermediate data with a smaller length, so as to encrypt the target number of intermediate data with a smaller length to realize the encryption of the data to be encrypted with a larger length, and calculate the target number of intermediate data based on the Chinese remainder theorem to restore the data to be encrypted, so that the encryption and decryption processing of the plaintext data can be improved from a smaller plaintext space to a larger plaintext space on the basis of homomorphic encryption characteristics.

[0093] The decryption process is described below. In some embodiments, decrypting the target ciphertext using the private key to obtain the target number of intermediate data may include:

[0094] Multiplying the private key by the first ciphertext to obtain a product value, and performing a difference calculation between the second ciphertext and the product value to obtain a difference value;

[0095] The difference is decrypted using the elliptic curve base point to obtain the target number of intermediate data.

[0096] Among them, the decryption formula can be: c i =c 2,i -[d]c 1,i , m i =logc i =log(c 2,i -[d]c 1,i ), i=1,2,···,t; c i represents the difference, d represents the private key, c 1,i represents the first ciphertext, [d]c 1,i represents the product value, c2,i Represents the second ciphertext, m i represents intermediate data, and log represents logarithmic operation.

[0097] By performing decryption operations on the target ciphertext according to the above decryption formula, the target number of intermediate data are obtained, and the data is encrypted and decrypted using the ElGamal algorithm based on SM2. Since the ElGamal algorithm has homomorphic encryption characteristics, the encryption and decryption algorithm of the embodiment of the present application also has homomorphic encryption characteristics. As well as the advantages of the SM2 algorithm of short key length and high computing performance, the encryption and decryption processing of plaintext data can be upgraded from a smaller plaintext space to a larger plaintext space. Based on this, the encryption and decryption processing of plaintext data can be upgraded from a smaller plaintext space to a larger plaintext space on the basis of having homomorphic encryption characteristics.

[0098] After decrypting to obtain the target number of intermediate data, the target number of intermediate data can be restored based on the Chinese remainder theorem to obtain the data to be encrypted. In some embodiments, calculating the target number of intermediate data based on the Chinese remainder theorem to obtain the data to be encrypted may include:

[0099] According to the following calculation formula, the target number of intermediate data is calculated based on the Chinese remainder theorem to obtain the data to be encrypted:

[0100] The calculation formula is: , , i=1,2,···,t; where m represents the data to be encrypted, CRT represents the Chinese remainder theorem, and m i represents intermediate data, t represents the number of targets, and k represents t k i The product of i represents the second random number, and mod represents the modular operation.

[0101] By combining the characteristics of the modulo operation, a target number of intermediate data can be calculated from the data to be encrypted. The Chinese remainder theorem can be used to restore the target number of intermediate data to the data to be encrypted, thereby achieving the encryption and decryption of plaintext data from a smaller plaintext space to a larger plaintext space.

[0102] In practical applications, for the addition and ciphertext c add , it can be decrypted according to the decryption process in the above embodiment to obtain the sum of the encrypted data m and m', that is, decrypted to obtain m+m', which will not be described in detail.

[0103] like Figure 3 As shown, it is a structural schematic diagram of an embodiment of a data encryption device provided by the present application, and the device may include the following modules.

[0104] An acquisition module 301 is used to acquire a public key of a second user terminal, where the public key includes a sub-public key generated by the second user terminal based on a first random number and an elliptic curve base point and a target number of second random numbers, and the first random number is used as a private key of the second user terminal;

[0105] A modulus operation module 302 is used to perform a modulus operation on a target number of second random numbers using the data to be encrypted to obtain a target number of intermediate data; wherein the length of the second random number is less than the length of the data to be encrypted;

[0106] The first encryption module 303 is used to generate a target number of third random numbers, and encrypt the target number of third random numbers using an elliptic curve base point to obtain a first ciphertext;

[0107] The second encryption module 304 is used to encrypt the target number of third random numbers using the sub-public key to obtain a first encryption result, and to encrypt the target number of intermediate data using the elliptic curve base point to obtain a second encryption result, and to obtain a second ciphertext based on the first encryption result and the second encryption result;

[0108] The sending module 305 is used to send the target ciphertext composed of the first ciphertext and the second ciphertext to the second user terminal.

[0109] The data encryption device in this embodiment can be used to implement Figure 1 The data encryption method in the illustrated embodiment performs encryption by adopting the ElGamal encryption algorithm based on elliptic curves, and performs modulus operation on a target number of second random numbers using data to be encrypted with a larger length, so as to obtain a target number of intermediate data with a smaller length, so as to encrypt the data to be encrypted with a larger length by encrypting the target number of intermediate data with a smaller length, thereby enabling the encryption of the plaintext data to be upgraded from a smaller plaintext space to a larger plaintext space on the basis of homomorphic encryption characteristics.

[0110] In some embodiments, the modular operation module 302 can be specifically used to perform a modular operation on a target number of second random numbers using the data to be encrypted according to the following modular operation formula to obtain a target number of intermediate data: The modular operation formula is: i =m mod k i , k i ∈[1,n-1], i=1,2,···,t; where m i represents intermediate data, m represents the data to be encrypted, k i represents the second random number, t represents the target number, t>1, n represents the order of the elliptic curve base point, and mod represents the modular operation.

[0111] In some embodiments, the first encryption module 303 may be specifically configured to perform product calculations on the target number of third random numbers and the elliptic curve base points to obtain the first ciphertext;

[0112] The second encryption module 304 can be specifically used to multiply a target number of third random numbers with a sub-public key to obtain a first encryption result; wherein the sub-public key is generated by multiplying the first random number with an elliptic curve base point; multiplying a target number of intermediate data with an elliptic curve base point to obtain a second encryption result; and adding the first encryption result and the second encryption result to obtain a second ciphertext.

[0113] like Figure 4 As shown, it is a structural schematic diagram of an embodiment of a data decryption device provided by the present application, and the device may include the following modules.

[0114] A receiving module 401 is used to receive a target ciphertext sent by a first user terminal, where the target ciphertext is composed of a first ciphertext and a second ciphertext, where the first ciphertext is obtained by encrypting a target number of third random numbers by an elliptic curve base point, and the second ciphertext is obtained based on the first encryption result and the second encryption result, where the first encryption result is obtained by encrypting a target number of third random numbers by a sub-public key, and the second encryption result is obtained by encrypting a target number of intermediate data by an elliptic curve base point, and the intermediate data is obtained by performing a modulus operation on a target number of second random numbers by the data to be encrypted, where the sub-public key is generated by the second user terminal based on the first random number and the elliptic curve base point, and the first random number and the target number of second random numbers are generated by the second user terminal, the first random number is used as a private key of the second user terminal, and the sub-public key and the target number of second random numbers are used as a public key of the second user terminal and are sent by the second user terminal to the first user terminal;

[0115] The first decryption module 402 is used to decrypt the target ciphertext using the private key to obtain the target number of intermediate data;

[0116] The second decryption module 403 is used to calculate the target number of intermediate data based on the Chinese remainder theorem to obtain the data to be encrypted.

[0117] The data decryption device in this embodiment can be used to implement Figure 2The data decryption method in the illustrated embodiment performs encryption and decryption by adopting the ElGamal encryption algorithm based on elliptic curves, performs modulus operation on a target number of second random numbers using data to be encrypted with a larger length, and obtains a target number of intermediate data with a smaller length, so as to encrypt the data to be encrypted with a larger length by encrypting the target number of intermediate data with a smaller length, and calculate the target number of intermediate data based on the Chinese remainder theorem to restore the data to be encrypted, thereby enabling the encryption and decryption of plaintext data to be upgraded from a smaller plaintext space to a larger plaintext space on the basis of homomorphic encryption characteristics.

[0118] In some embodiments, the first decryption module 402 can be specifically used to multiply the private key by the first ciphertext to obtain a product value, and to perform a difference calculation between the second ciphertext and the product value to obtain a difference value; and to decrypt the difference value using an elliptic curve to obtain a target number of intermediate data.

[0119] In some embodiments, the second decryption module 403 may be specifically used to calculate the target number of intermediate data based on the Chinese remainder theorem according to the following calculation formula to obtain the data to be encrypted: The calculation formula is: , , i=1,2,···,t; where m represents the data to be encrypted, CRT represents the Chinese remainder theorem, and m i represents intermediate data, t represents the number of targets, and k represents t k i The product of i represents the second random number, and mod represents the modular operation.

[0120] For ease of understanding, Figure 5 A schematic diagram of an embodiment of a data transmission scenario is shown. Figure 5 As shown, user terminal A and user terminal B share the elliptic curve parameters p, a, b, G and n of the elliptic curve Ep (a, b) in the SM2 algorithm.

[0121] The client B uniformly randomly selects a first random number d∈[1,n-1], and multiplies the first random number d with the elliptic curve base point G to obtain the sub-public key P=[d]G, and uniformly randomly selects a second random number k i ∈[1,n-1], i=1,2,···,t, for example, t=8, k i The user terminal B stores the first random number d as the private key and the public key PK={P,k1,k2,···,k t}Sent to user end A.

[0122] The client A uses the data to be encrypted to perform a modulus operation on the target number of second random numbers to obtain the target number of intermediate data mi =m mod k i , k i ∈[1,n-1], i=1,2,···,t. The data to be encrypted m∈message space M, M∈[1,n-1]. For example, the data to be encrypted may be 256 bits.

[0123] And, the user terminal A uniformly randomly selects a third random number l i ∈[1,n-1], i=1,2,···,t, multiply the target number of third random numbers by the elliptic curve base point to obtain the first ciphertext c 1,i =[l i ]G, i=1,2,···,t. And multiply the target number of third random numbers by the sub-public key to obtain the first encryption result, multiply the target number of intermediate data by the elliptic curve base point to obtain the second encryption result, add the first encryption result and the second encryption result to obtain the second ciphertext c 2,i =[l i ]P+[m i ]G, i=1,2,···,t, based on the first ciphertext and the second ciphertext, the target ciphertext c=(c 1,i ,c 2,i ), i=1,2,···,t. Client A can send the target ciphertext to client B.

[0124] Client B can use the private key to decrypt the target ciphertext and obtain the target number of intermediate data to obtain m i =logc i =log(c 2,i -[d]c 1,i ), i=1,2,···,t, and calculate the target number of intermediate data based on the Chinese remainder theorem to obtain the restored data to be encrypted , , i=1,2,···,t.

[0125] In the present embodiment, the data is encrypted and decrypted using the ElGamal algorithm based on SM2. Since the ElGamal algorithm has homomorphic encryption characteristics, the encryption and decryption algorithm of the embodiment of the present application also has homomorphic encryption characteristics. As well as the advantages of the SM2 algorithm of short key length and high computing performance, the encryption and decryption processing of plaintext data can be upgraded from a smaller plaintext space to a larger plaintext space. Based on this, the encryption and decryption processing of plaintext data can be upgraded from a smaller plaintext space to a larger plaintext space on the basis of having homomorphic encryption characteristics.

[0126] like Figure 6, which is a schematic diagram of the structure of an embodiment of a computing device provided by the present application, the device may include a storage component 601 and a processing component 602 .

[0127] The storage component 601 stores one or more computer instructions, wherein the one or more computer instructions are called and executed by the processing component 602 to implement Figure 1 The data encryption method shown in the embodiment, or Figure 2 The data decryption method shown in the embodiment.

[0128] Of course, the computing device may also include other components, such as input / output interfaces, communication components, etc.

[0129] The input / output interface provides an interface between the processing component and the peripheral interface module, which may be an output device, an input device, etc.

[0130] The communication component is configured to facilitate, among other things, wired or wireless communications between the computing device and other devices.

[0131] The processing component 602 may include one or more processors to execute computer instructions to complete all or part of the steps in the above method. Of course, the processing component can also be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors or other electronic components to perform the above method.

[0132] The storage component 601 is configured to store various types of data to support operations at the terminal. The storage component can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.

[0133] The present application also provides a computer-readable storage medium storing a computer program. When the computer program is executed by a computer, the above-mentioned Figure 1 The data encryption method shown in the embodiment, or Figure 2 The data decryption method shown in the embodiment. The computer-readable medium may be included in the electronic device described in the above embodiment; or it may exist independently without being assembled into the electronic device.

[0134] The present application also provides a computer program product, which includes a computer program carried on a computer-readable storage medium. When the computer program is executed by a computer, the above-mentioned Figure 1 The data encryption method shown in the embodiment, or Figure 2 The data decryption method shown in the embodiment.

[0135] In such an embodiment, the computer program may be downloaded and installed from a network, and / or installed from a removable medium. When the computer program is executed by a processor, various functions defined in the system of the present application are performed.

[0136] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0137] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0138] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0139] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A data encryption method, It is characterized in that Applied to the first user terminal, including: Obtaining a public key of a second client, the public key comprising a sub-public key generated by the second client based on a first random number and an elliptic curve base point and a target number of second random numbers, the first random number being used as a private key of the second client; Using the data to be encrypted to perform a modulo operation on the target number of second random numbers to obtain the target number of intermediate data; wherein the length of the second random number is less than the length of the data to be encrypted; Generate a target number of third random numbers, and encrypt the target number of third random numbers using the elliptic curve base point to obtain a first ciphertext; Using the sub-public key to encrypt the target number of third random numbers to obtain a first encryption result, and using the elliptic curve base point to encrypt the target number of intermediate data to obtain a second encryption result, and obtaining a second ciphertext based on the first encryption result and the second encryption result; The target ciphertext composed of the first ciphertext and the second ciphertext is sent to the second client.

2. The method according to claim 1, It is characterized in that The step of performing a modulus operation on the target number of second random numbers using the data to be encrypted to obtain the target number of intermediate data comprises: According to the following modular operation formula, the target number of second random numbers are modulo-operated using the data to be encrypted to obtain the target number of intermediate data: The modular operation formula is: i =m mod k i , k i ∈[1,n-1], i=1,2,···,t; where m i represents intermediate data, m represents the data to be encrypted, k i represents the second random number, t represents the target number, t>1, n represents the order of the elliptic curve base point, and mod represents the modular operation.

3. The method according to claim 2, It is characterized in that The step of encrypting the target number of third random numbers using the elliptic curve base point to obtain a first ciphertext comprises: Multiplying the target number of third random numbers by the elliptic curve base point to obtain a first ciphertext; The step of encrypting the target number of third random numbers using the sub-public key to obtain a first encryption result, and encrypting the target number of intermediate data using the elliptic curve base point to obtain a second encryption result, and obtaining a second ciphertext based on the first encryption result and the second encryption result includes: Performing product calculation on the target number of third random numbers and the sub-public key respectively to obtain a first encryption result; wherein the sub-public key is generated by performing product calculation on the first random number and the elliptic curve base point; Multiplying the target number of intermediate data by the elliptic curve base point respectively to obtain a second encryption result; The first encryption result and the second encryption result are added together to obtain a second ciphertext.

4. The method according to claim 1, It is characterized in that The target number is 8, and the length of the second random number is 32 bits.

5. A data decryption method, It is characterized in that Applied to the second user terminal, including: Receive a target ciphertext sent by a first client, the target ciphertext consists of a first ciphertext and a second ciphertext, the first ciphertext is obtained by encrypting a target number of third random numbers by an elliptic curve base point, the second ciphertext is obtained based on the first encryption result and the second encryption result, the first encryption result is obtained by encrypting the target number of third random numbers by a sub-public key, the second encryption result is obtained by encrypting the target number of intermediate data by the elliptic curve base point, the intermediate data is obtained by performing a modulus operation on the target number of second random numbers by the data to be encrypted, the sub-public key is generated by the second client based on the first random number and the elliptic curve base point, the first random number and the target number of second random numbers are generated by the second client, the first random number is used as the private key of the second client, the sub-public key and the target number of second random numbers are used as the public key of the second client and are sent by the second client to the first client; Decrypting the target ciphertext using the private key to obtain the target number of intermediate data; The target number of intermediate data are calculated based on the Chinese remainder theorem to obtain the data to be encrypted.

6. The method according to claim 5, It is characterized in that The decrypting the target ciphertext by using the private key to obtain the target number of intermediate data includes: Performing a product calculation on the private key and the first ciphertext to obtain a product value, and performing a difference calculation on the second ciphertext and the product value to obtain a difference value; The difference is decrypted using the elliptic curve base point to obtain the target number of intermediate data.

7. The method according to claim 6, It is characterized in that The calculating the target number of intermediate data based on the Chinese remainder theorem to obtain the data to be encrypted comprises: According to the following calculation formula, the target number of intermediate data is calculated based on the Chinese remainder theorem to obtain the data to be encrypted: The calculation formula is: , , i=1,2,···,t; where m represents the data to be encrypted, CRT represents the Chinese remainder theorem, and m i represents intermediate data, t represents the number of targets, and k represents t k i The product of i represents the second random number, and mod represents the modular operation.

8. A data encryption device, It is characterized in that Applied to the first user terminal, including: An acquisition module, configured to acquire a public key of a second user terminal, wherein the public key includes a sub-public key generated by the second user terminal based on a first random number and an elliptic curve base point and a target number of second random numbers, wherein the first random number is used as a private key of the second user terminal; A modular operation module, used to perform a modular operation on the target number of second random numbers using the data to be encrypted to obtain a target number of intermediate data; wherein the length of the second random number is less than the length of the data to be encrypted; A first encryption module is used to generate a target number of third random numbers, and encrypt the target number of third random numbers using the elliptic curve base point to obtain a first ciphertext; a second encryption module, configured to encrypt the target number of third random numbers using the sub-public key to obtain a first encryption result, and to encrypt the target number of intermediate data using the elliptic curve base point to obtain a second encryption result, and to obtain a second ciphertext based on the first encryption result and the second encryption result; The sending module is used to send the target ciphertext composed of the first ciphertext and the second ciphertext to a second user terminal.

9. A data decryption device, It is characterized in that Applied to the second user terminal, including: A receiving module, used for receiving a target ciphertext sent by a first user terminal, wherein the target ciphertext is composed of a first ciphertext and a second ciphertext, wherein the first ciphertext is obtained by encrypting a target number of third random numbers by an elliptic curve base point, and the second ciphertext is obtained based on the first encryption result and the second encryption result, wherein the first encryption result is obtained by encrypting the target number of third random numbers by a sub-public key, and the second encryption result is obtained by encrypting the target number of intermediate data by the elliptic curve base point, and the intermediate data is obtained by performing a modulus operation on the target number of second random numbers by the data to be encrypted, the sub-public key is generated by the second user terminal based on the first random number and the elliptic curve base point, the first random number and the target number of second random numbers are generated by the second user terminal, the first random number is used as the private key of the second user terminal, and the sub-public key and the target number of second random numbers are used as the public key of the second user terminal and are sent by the second user terminal to the first user terminal; A first decryption module, used to decrypt the target ciphertext using the private key to obtain the target number of intermediate data; The second decryption module is used to calculate the target number of intermediate data based on the Chinese remainder theorem to obtain the data to be encrypted.

10. A computing device, It is characterized in that including storage components and processing components; The storage component stores one or more computer instructions; the one or more computer instructions are called and executed by the processing component; The processing component executes the one or more computer instructions to implement the data encryption method as described in any one of claims 1 to 4, or the data decryption method as described in any one of claims 5 to 7.

11. A computer-readable storage medium storing a computer program, It is characterized in that When the computer program is executed by a computer, the data encryption method according to any one of claims 1 to 4 or the data decryption method according to any one of claims 5 to 7 is implemented.

Citation Information

Patent Citations

  • Data encryption method, data processing method, data decryption method and electronic equipment

    CN113254985A

  • Encryption method and device

    CN115664747A

  • Data encryption method, homomorphic calculation method and equipment

    CN115865348A

  • Ciphertext decryption method and related equipment

    CN116137564A

  • Public key cryptograph and key sharing method

    EP1148675A1