Data transmission method and device, equipment, storage medium and computer program product

The encrypted data is reencrypted and forwarded through the server, which solves the burden of decrypting and re-encrypting of the sending end in data transmission, improves transmission efficiency and ensures data security.

CN120185833APending Publication Date: 2025-06-20TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311762522.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-12-19
Publication Date
2025-06-20

AI Technical Summary

Technical Problem

In the prior art, the sending end needs to decrypt and re-encrypt the data during data transmission, resulting in heavy burden and low efficiency on the sending end.

Method used

The encrypted data is directly reencrypted through the server and sent to the receiving end to avoid the process of decrypting and re-encrypting on the sending end.

Benefits of technology

It reduces the burden on the sending end, improves data transmission efficiency, and ensures secure data transmission.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120185833A_ABST
    Figure CN120185833A_ABST
Patent Text Reader

Abstract

The invention relates to a data transmission method and device, computer equipment, a storage medium and a computer program product. The method comprises the following steps: uploading encrypted data corresponding to target data to a server; in response to a trigger operation of transmitting the target data to the receiving end, generating an encryption key according to the public key of the sending end, the public key of the receiving end and a specified parameter, and generating a data transmission request according to the encryption key and the identifier of the receiving end, the data transmission request being used for instructing the server to re-encrypt the uploaded encrypted data according to the encryption key, and after obtaining the re-encrypted data, sending the re-encrypted data to a receiving end corresponding to the receiving end identifier, the re-encrypted data being used for indicating the receiving end to decrypt and verify the received re-encrypted data by using a corresponding receiving end private key and a specified parameter to obtain target data. And sending the data transmission request to the server. Therefore, the data transmission efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technologies, and in particular, to a data transmission method, apparatus, computer device, storage medium, and computer program product. Background Art

[0002] With the development of Internet technologies, data transmission via the Internet (such as sharing file transmission, message transmission, etc.) has provided convenience for people's lives and work. In actual data transmission, encrypting the data before transmission can ensure the security of the data, and the data uploader only needs to keep the decryption key well.

[0003] For example, the sending end encrypts the data using its own public key and stores it on the server. If the data needs to be transmitted to the receiving end, the encrypted data obtained from the server is first decrypted, and then the decrypted data is encrypted using the receiving end's public key before transmission. That is to say, since the encrypted file can only be decrypted by the sending end itself, the stored encrypted file cannot be directly transmitted to the other party through the server. Each time data is transmitted, the sending end needs to perform decryption and encryption operations, which increases the burden on the sending end and reduces the data transmission efficiency. Summary of the Invention

[0004] Based on this, in view of the above technical problems, it is necessary to provide a data transmission method, apparatus, computer device, computer-readable storage medium, and computer program product. On the basis of ensuring that the receiving end can decrypt by itself to complete data reception and the server cannot know the data content to ensure secure data transmission, the encrypted data is directly re-encrypted by the server and sent to the receiving end, avoiding decryption and re-encryption by the sending end, reducing the burden on the sending end, and improving the data transmission efficiency.

[0005] The present application provides a data transmission method. Executed by a sending end, the method includes:

[0006] Uploading the encrypted data corresponding to the target data to a server, where the encrypted data is obtained by encrypting the target data in plaintext using the public key of the sending end;

[0007] In response to a trigger operation of transmitting the target data to the receiving end, an encryption key is generated according to the public key of the sending end, the public key of the receiving end, and a specified parameter. A data transmission request is generated according to the encryption key and the receiving end identifier. The specified parameter is shared between the sending end and the receiving end. The data transmission request is used to instruct the server to re-encrypt the uploaded encrypted data according to the encryption key, and after obtaining the re-encrypted data, send the re-encrypted data to the receiving end corresponding to the receiving end identifier. The re-encrypted data is used to instruct the receiving end to use its corresponding private key of the receiving end and the specified parameter to decrypt and verify the received re-encrypted data, and then obtain the target data;

[0008] Send the data transmission request to the server.

[0009] This application also provides a data transmission device. The device includes:

[0010] A data upload module, configured to upload encrypted data corresponding to the target data to the server, where the encrypted data is obtained by encrypting the plaintext target data using the public key of the sending end;

[0011] A data transmission request generation module, configured to, in response to a trigger operation of transmitting the target data to the receiving end, generate an encryption key according to the public key of the sending end, the public key of the receiving end, and a specified parameter, and generate a data transmission request according to the encryption key and the receiving end identifier. The specified parameter is shared between the sending end and the receiving end. The data transmission request is used to instruct the server to re-encrypt the uploaded encrypted data according to the encryption key, and after obtaining the re-encrypted data, send the re-encrypted data to the receiving end corresponding to the receiving end identifier. The re-encrypted data is used to instruct the receiving end to use its corresponding private key of the receiving end and the specified parameter to decrypt and verify the received re-encrypted data, and then obtain the target data;

[0012] A data transmission request sending module, configured to send the data transmission request to the server.

[0013] In some embodiments, the data upload module is configured to obtain the plaintext target data; encrypt the plaintext target data using the public key of the sending end to obtain corresponding encrypted data; and upload the encrypted data to the server.

[0014] In some embodiments, the device further includes a decryption module. The target data is a shared file belonging to a target account, and the encrypted data corresponding to the target data is the encrypted file corresponding to the shared file. The data upload module is configured to store the encrypted file corresponding to the target account and the shared file in the server. The decryption module is configured to, when the target account is logged in at the sending end, download the encrypted file belonging to the target account from the server, and decrypt the encrypted file using the private key of the sending end to obtain the shared file.

[0015] In some embodiments, the device further includes a file sending module. The file sending module is configured to encrypt the decrypted shared file using the public key of the receiving end to obtain an encrypted file, and send the encrypted file to the server. The encrypted file is used to instruct the server to forward the encrypted file to the receiving end, and the encrypted file is used to instruct the receiving end to decrypt the received encrypted file using the private key of the receiving end to obtain the shared file.

[0016] In some embodiments, the data upload module is configured to generate a random number through a random number generation program, generate a plurality of temporary ciphertexts for encrypting the target data according to the random number, the public key of the sending end, and the target data, and splice the plurality of temporary ciphertexts to obtain the encrypted data corresponding to the target data.

[0017] In some embodiments, the data upload module is configured to obtain the base point coordinates corresponding to a preset base point on an elliptic curve, generate a first temporary ciphertext according to the random number and the base point coordinates, generate a second temporary ciphertext according to the random number, the public key of the sending end, the bit length of the target data, and the target data, generate a third temporary ciphertext according to the random number, the public key of the sending end, and the target data, and generate a fourth temporary ciphertext according to the first temporary ciphertext, the target data, and the third temporary ciphertext. The data upload module is configured to splice the first temporary ciphertext, the third temporary ciphertext, the fourth temporary ciphertext, and the second temporary ciphertext to obtain the encrypted data corresponding to the target data.

[0018] In some embodiments, the data upload module is configured to generate the coordinate of a data point on the elliptic curve according to the random number and the public key of the sending end, calculate a fixed-length key with a bit length equal to that of the target data through a key derivation function according to the coordinate of the data point and the bit length of the target data, and perform an exclusive OR operation on the fixed-length key and the target data to obtain a second temporary ciphertext.

[0019] In some embodiments, the specified parameter is a static specified parameter, and the static specified parameter is the recipient account logged in to the receiving end; the data transmission request generation module is configured to, in response to a trigger operation of transmitting the target data to the receiving end logged in with the recipient account, generate an encryption key according to the public key of the sending end, the public key of the receiving end, and the recipient account.

[0020] In some embodiments, the specified parameter is a dynamic specified parameter, and the dynamic specified parameter is a random verification code; the data transmission request generation module is configured to, in response to a trigger operation of transmitting the target data to the receiving end logged in with the recipient account, generate a random verification code, generate an encryption key according to the public key of the sending end, the public key of the receiving end, and the random verification code, and send the random verification code to the receiving end.

[0021] In some embodiments, the data transmission request generation module is configured to use a key derivation function to calculate a first temporary key according to the product of the random number used when generating the encrypted data corresponding to the target data and the public key of the sending end; use a hash function to generate a hash value corresponding to the specified parameter; use the key derivation function to calculate a second temporary key according to the product of the hash value, the random number, and the public key of the receiving end; and perform an exclusive OR operation on the first temporary key and the second temporary key to obtain an encryption key.

[0022] In some embodiments, the data transmission request sending module is configured to parse the encryption key from the data transmission request; update the second temporary ciphertext in the uploaded encrypted data using the encryption key to obtain re-encrypted data, and the re-encrypted data is obtained according to the updated second temporary ciphertext.

[0023] In some embodiments, the re-encrypted data is formed by splicing the first temporary ciphertext, the third temporary ciphertext, the fourth temporary ciphertext, and the updated second temporary ciphertext; the data transmission request sending module is configured to extract the first temporary ciphertext and the updated second temporary ciphertext from the re-encrypted data; and decrypt according to the private key of the receiving end, the specified parameter, the extracted first temporary ciphertext, and the updated second temporary ciphertext to obtain decrypted data.

[0024] In some embodiments, the device further includes a verification module, and the verification module is configured to extract the third temporary ciphertext and the fourth temporary ciphertext from the re-encrypted data; splice the first temporary ciphertext, the decrypted data obtained by decryption, and the extracted third temporary ciphertext to obtain spliced data; calculate the hash value of the spliced data; and if the hash value of the spliced data is equal to the fourth temporary ciphertext, verify that the re-encrypted data has not been tampered with.

[0025] The present application also provides a data transmission system. The system includes a sending end, a server, and a receiving end;

[0026] The sending end is configured to upload encrypted data corresponding to target data to the server, and in response to a trigger operation of transmitting the target data to the receiving end, generate an encryption key according to the public key of the sending end, the public key of the receiving end, and a specified parameter, generate a data transmission request according to the encryption key and the receiving end identifier, and send the data transmission request to the server. The encrypted data is obtained by encrypting the plaintext target data with the public key of the sending end, and the specified parameter is shared between the sending end and the receiving end;

[0027] The server is configured to receive the data transmission request, re-encrypt the uploaded encrypted data according to the encryption key in the data transmission request, and send the re-encrypted data to the receiving end corresponding to the receiving end identifier after obtaining the re-encrypted data;

[0028] The receiving end is configured to receive the re-encrypted data, and decrypt and verify the received re-encrypted data with the private key of the receiving end and the specified parameter to obtain the target data.

[0029] The present application also provides a computer device. The computer device includes a memory and a processor. The memory stores a computer program, and when the processor executes the computer program, the steps of the above data transmission method are implemented.

[0030] The present application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the above data transmission method are implemented.

[0031] The present application also provides a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, the steps of the above data transmission method are implemented.

[0032] The above data transmission method, device, computer equipment, storage medium and computer program product. First, the sending end uses the public key of the sending end to encrypt the target data of the plaintext to obtain encrypted data. Secondly, the sending end uploads the encrypted data to the server, so that when it is necessary to transmit the target data to one or more receiving ends subsequently, the server can directly re-encrypt the encrypted data and forward the re-encrypted data to the receiving end. When it is necessary to transmit the target data to the receiving end safely and efficiently, the sending end does not need to download the encrypted data from the server, nor does it need to decrypt and encrypt the obtained encrypted data, but only needs to generate an encryption key in real time according to the public key of the sending end, the public key of the receiving end and the specified parameter in response to the trigger operation of transmitting the target data to the receiving end. Next, the sending end generates a data transmission request according to the encryption key and the receiving end identifier and sends the data transmission request to the server, which reduces the burden on the sending end. After that, the server can re-encrypt the uploaded encrypted data according to the encryption key in the data transmission request. After obtaining the re-encrypted data, the server sends the re-encrypted data to the receiving end corresponding to the receiving end identifier in the data transmission request. Since the specified parameter is shared between the sending end and the receiving end, the receiving end can use the private key of the receiving end and the specified parameter to decrypt and verify the received re-encrypted data to obtain the target data. In the whole data transmission process, on the one hand, the server cannot know the target data, ensuring the secure transmission of the data. On the other hand, re-encrypting the encrypted data with the encryption key also ensures that the receiving end can decrypt the re-encrypted data by itself to complete data reception. In addition, it avoids the sending end from decrypting and re-encrypting, reduces the burden on the sending end, and improves the data transmission efficiency.

[0033] The present application provides a data transmission method. The method includes:

[0034] Receiving the encrypted data uploaded by the sending end, where the encrypted data is obtained by encrypting the target data of the plaintext using the public key of the sending end;

[0035] Receiving the data transmission request sent by the sending end, where the data transmission request is initiated by the sending end in response to the trigger operation of transmitting the target data to the receiving end, and the data transmission request carries the encryption key and the receiving end identifier, and the encryption key is generated according to the public key of the sending end, the public key of the receiving end and the specified parameter, and the specified parameter is shared between the sending end and the receiving end;

[0036] After re-encrypting the uploaded encrypted data according to the encryption key in the data transmission request to obtain re-encrypted data, the re-encrypted data is sent to the receiver corresponding to the receiver identifier in the data transmission request, and the re-encrypted data is used to instruct the receiver to use the receiver private key and the specified parameter to decrypt and verify the received re-encrypted data to obtain the target data.

[0037] This application provides a data transmission device. The device includes:

[0038] A data receiving module, configured to receive encrypted data uploaded by a sender, where the encrypted data is obtained by encrypting the target data of the plaintext using the public key of the sender;

[0039] A data transmission request receiving module, configured to receive a data transmission request sent by the sender, where the data transmission request is initiated by the sender in response to a trigger operation of transmitting the target data to the receiver, and the data transmission request carries an encryption key and a receiver identifier, the encryption key is generated according to the public key of the sender, the public key of the receiver, and a specified parameter, and the specified parameter is shared between the sender and the receiver;

[0040] A data sending module, configured to re-encrypt the uploaded encrypted data according to the encryption key in the data transmission request to obtain re-encrypted data, and then send the re-encrypted data to the receiver corresponding to the receiver identifier in the data transmission request, where the re-encrypted data is used to instruct the receiver to use the receiver private key and the specified parameter to decrypt and verify the received re-encrypted data to obtain the target data.

[0041] This application also provides a computer device. The computer device includes a memory and a processor, the memory stores a computer program, and when the processor executes the computer program, the steps of the above data transmission method are implemented.

[0042] This application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the above data transmission method are implemented.

[0043] This application also provides a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, the steps of the above data transmission method are implemented.

[0044] The above data transmission method, device, computer device, storage medium, and computer program product receive the encrypted data uploaded by the sending end, so that when the target data needs to be transmitted to one or more receiving ends subsequently, the server can directly forward the encrypted data to the receiving end. Among them, the encrypted data is obtained by encrypting the plaintext target data using the public key of the sending end. In this way, when it is necessary to securely and efficiently transmit the target data to the receiving end, the sending end does not need to download the encrypted data from the server, nor does it need to decrypt and encrypt the obtained encrypted data. Instead, the sending end only needs to respond to the trigger operation of transmitting the target data to the receiving end, generate an encryption key in real time according to the public key of the sending end, the public key of the receiving end, and the specified parameter, and generate a data transmission request according to the encryption key and the receiving end identifier. At this time, the server receives the data transmission request sent by the sending end. In this way, the burden on the sending end can be reduced. After that, the server directly re-encrypts the uploaded encrypted data according to the encryption key in the data transmission request to obtain the re-encrypted data, and sends the re-encrypted data to the receiving end corresponding to the receiving end identifier in the data transmission request. Since the specified parameter is shared between the sending end and the receiving end, the receiving end can use the private key of the receiving end and the specified parameter to decrypt and verify the received re-encrypted data to obtain the target data. In the whole data transmission process, on the one hand, the server cannot know the target data, ensuring the secure transmission of the data. On the other hand, re-encrypting the encrypted data using the encryption key also ensures that the receiving end can decrypt the re-encrypted data by itself to complete data reception. In addition, it avoids the sending end from decrypting and re-encrypting, reducing the burden on the sending end and improving the data transmission efficiency. Description of the Drawings

[0045] Figure 1a It is a schematic diagram of data transmission in the related art in an embodiment;

[0046] Figure 1b It is an application environment diagram of the data transmission method in an embodiment;

[0047] Figure 2 It is an application environment diagram of the data transmission method in another embodiment;

[0048] Figure 3 It is a schematic flowchart of the data transmission method in an embodiment;

[0049] Figure 4 It is a schematic diagram of the generation steps of multiple temporary ciphertexts in an embodiment;

[0050] Figure 5 It is a schematic flowchart of the encrypted data generation steps in an embodiment;

[0051] Figure 6 It is a schematic flowchart of the decryption process steps in an embodiment;

[0052] Figure 7 is a schematic flowchart of a data transmission method in another embodiment;

[0053] Figure 8 is a flowchart of data transmission steps in an embodiment;

[0054] Figure 9 is a structural block diagram of a data transmission device in an embodiment;

[0055] Figure 10 is a structural block diagram of a data transmission device in another embodiment;

[0056] Figure 11 is a structural block diagram of a data transmission system in an embodiment;

[0057] Figure 12 is an internal structure diagram of a computer device in an embodiment. Detailed implementation manners

[0058] In order to make the objectives, technical solutions and advantages of the present application clearer, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0059] In the related art, as Figure 1a shown, is a schematic diagram of data transmission in the related art in an embodiment. The sending end uses its own public key to encrypt the data for the first time to obtain the first encrypted data, and uploads the first encrypted data to the server. If it is necessary to transmit the data to the receiving end, the server sends the first encrypted data to the sending end so that the sending end can obtain the first encrypted data from the server. Then, the sending end uses its own private key to decrypt the first encrypted data to obtain the decrypted data, and then uses the public key of the receiving end to encrypt the decrypted data for the second time to obtain the second encrypted data, and uploads the second encrypted data to the server. The server sends the second encrypted data to the receiving end. That is to say, every time data is transmitted, the sending end needs to perform decryption and encryption operations, which increases the burden on the sending end and reduces the efficiency of data transmission.

[0060] The data transmission method provided by the embodiment of the present application. First, the sending end uses the public key of the sending end to encrypt the target data of the plaintext to obtain encrypted data. Secondly, the sending end uploads the encrypted data to the server, so that when it is necessary to transmit the target data to one or more receiving ends subsequently, the server can directly re-encrypt the encrypted data and forward the re-encrypted data to the receiving end. When it is necessary to securely and efficiently transmit the target data to the receiving end, the sending end does not need to download the encrypted data from the server, nor does it need to decrypt and encrypt the obtained encrypted data. Instead, it only needs to respond to the trigger operation of transmitting the target data to the receiving end, and generate an encryption key in real time according to the public key of the sending end, the public key of the receiving end, and the specified parameter. Next, the sending end generates a data transmission request according to the encryption key and the receiving end identifier, and sends the data transmission request to the server, which reduces the burden on the sending end. After that, the server can re-encrypt the uploaded encrypted data according to the encryption key in the data transmission request. After obtaining the re-encrypted data, it sends the re-encrypted data to the receiving end corresponding to the receiving end identifier in the data transmission request. Since the specified parameter is shared between the sending end and the receiving end, the receiving end can use the private key of the receiving end and the specified parameter to decrypt and verify the received re-encrypted data to obtain the target data. In the whole data transmission, on the one hand, the server cannot know the target data, ensuring the secure transmission of the data. On the other hand, using the encryption key to re-encrypt the encrypted data also ensures that the receiving end can decrypt the re-encrypted data by itself to complete the data reception. In addition, it also avoids the sending end decrypting the re-encrypted data, reducing the burden on the sending end and improving the data transmission efficiency.

[0061] The data transmission method provided by the embodiment of the present application can be applied to an application environment as Figure 1b shown. Among them, the sending end 102 communicates with the server 104 through the network, and the receiving end 106 communicates with the server 104 through the network. The data storage system can store the data that the server 104 needs to process. The data storage system can be integrated on the server 104, or can be placed on the cloud or other servers.

[0062] In one embodiment, the sender 102 uploads the encrypted data corresponding to the target data to the server 104. The encrypted data is obtained by encrypting the plaintext target data using the public key of the sender of the sender 102. In response to a trigger operation for transmitting the target data to the receiver, the sender 102 generates an encryption key according to the public key of the sender of the sender 102, the public key of the receiver of the receiver 106, and a specified parameter. A data transmission request is generated according to the encryption key and the receiver identifier. The specified parameter is shared between the sender 102 and the receiver 106. The data transmission request is used to instruct the server 104 to re-encrypt the uploaded encrypted data according to the encryption key. After obtaining the re-encrypted data, the re-encrypted data is sent to the receiver 106 corresponding to the receiver identifier. The re-encrypted data is used to instruct the receiver 106 to decrypt and verify the received re-encrypted data using its corresponding private key of the receiver and the specified parameter, and then obtain the target data. The sender 102 sends a data transmission request to the server 104.

[0063] As Figure 2 shown, it is an application environment diagram of the data transmission method in another embodiment. First, the sender 102 uploads the encrypted data corresponding to the target data to the server 104. For each receiver 106, the sender 102 generates an encryption key corresponding to the receiver 106 according to the public key of the sender of the sender 102, the public key of the receiver of the receiver 106, and the corresponding specified parameter, and generates a data transmission request corresponding to the receiver 106 according to the corresponding encryption key and the receiver identifier of the receiver 106, and sends it to the server 104. The server 104 receives the data transmission request and parses the data transmission request to obtain the encryption key. The server 104 encrypts the encrypted data according to the encryption key to obtain re-encrypted data. It can be understood that the re-encrypted data corresponding to each receiver 106 is different from each other. The server 104 sends the re-encrypted data corresponding to each receiver 106 to the corresponding receiver 106 respectively. Based on this, for each receiver 106, the receiver 106 can decrypt and verify the received re-encrypted data using the corresponding private key of the receiver to obtain the target data.

[0064] Among them, the sending end 104 and the receiving end 106 are two different terminals. The terminal can be but is not limited to various personal computers, laptop computers, smart phones, tablet computers, Internet of Things devices, and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart in-vehicle devices, etc. The portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. The server 104 can be an independent physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms.

[0065] In one embodiment, as Figure 3 shown, a data transmission method is provided. Taking the sending end 102 in Figure 1b as an example, the method includes the following steps:

[0066] Step S302: Upload the encrypted data corresponding to the target data to the server. The encrypted data is obtained by encrypting the plaintext target data using the public key of the sending end.

[0067] In the embodiments of the present application, the target data is the data to be transmitted. The form of the target data includes but is not limited to files, pictures, strings, videos, session messages, etc. The plaintext target data refers to the unencrypted target data. Correspondingly, the encrypted data corresponding to the target data is the encrypted target data.

[0068] The public key is a kind of key. A key is a parameter, and the key is used to encrypt data. Further, the public key is a key that is publicly available to the outside world. Correspondingly, the key that is not publicly available to the outside world is called the private key. The public key and the private key exist in pairs, that is, a key pair is obtained through an encryption algorithm. The key pair includes a matching public key and a private key. After encrypting with the public key in the key pair, the encrypted data can be decrypted with the private key in the same key pair. In the embodiments of the present application, the sending end and the receiving end each have a key pair, and the key pair of the sending end should be different from the key pair of the receiving end. The key pair of the sending end includes the public key of the sending end and the private key of the sending end. The public key of the sending end refers to the public key of the sending end, and the private key of the sending end is the private key of the sending end; the key pair of the receiving end includes the public key of the receiving end and the private key of the receiving end. The public key of the receiving end is the public key of the receiving end, and the private key of the receiving end is the private key of the receiving end.

[0069] The encrypted data corresponding to the target data is obtained by encrypting the plaintext target data using the public key of the sending end. Optionally, the encrypting entity can be the sending end itself. That is, after the sending end obtains the plaintext target data, it encrypts it using its own public key (i.e., the public key of the sending end) to obtain the corresponding encrypted data. Optionally, as mentioned above, the public key is a key that is publicly available to the outside world. Then, the encrypting entity of the encrypted data can also be other computer devices other than the sending end, and the sending end obtains the encrypted data corresponding to the target data from this other computer device.

[0070] Optionally, when the sending end uploads the encrypted data corresponding to the target data to the server, it can also upload the sending end identifier of the sending end (or the target account currently logged in to the sending end) together with the encrypted data, so that the server can store the sending end identifier (or the target account currently logged in to the sending end) corresponding to the encrypted file. Thus, when the server receives a download request for the encrypted data sent by the sending end, the server can query the corresponding encrypted data according to the sending end identifier (or the target account currently logged in to the sending end) and send it to the sending end to achieve cloud storage of the data. Or, when the server receives a transmission request for the encrypted data sent by the sending end, the server can query the corresponding encrypted data according to the sending end identifier (or the target account currently logged in to the sending end), re-encrypt the encrypted data to obtain re-encrypted data, and send the re-encrypted data to the receiving end to achieve data transmission.

[0071] Step S304, in response to a trigger operation to transmit the target data to the receiving end, generate an encryption key according to the public key of the sending end, the public key of the receiving end, and a specified parameter, generate a data transmission request according to the encryption key and the receiving end identifier. The specified parameter is shared between the sending end and the receiving end. The data transmission request is used to instruct the server to re-encrypt the uploaded encrypted data according to the encryption key, obtain re-encrypted data, and send the re-encrypted data to the receiving end corresponding to the receiving end identifier. The re-encrypted data is used to instruct the receiving end to use its corresponding private key of the receiving end and the specified parameter to decrypt and verify the received re-encrypted data to obtain the target data.

[0072] Optionally, the triggering operation for transmitting the target data to the receiving end can be an operation actively triggered by the user, and its specific forms include, but are not limited to, touch operations, cursor operations, button operations, voice operations, or biometric recognition operations. A touch operation refers to an operation of touching the screen, for example, finger touching. A cursor operation refers to an operation of controlling the cursor using a mouse device, for example, controlling the cursor to click, controlling the cursor to press, controlling the cursor to slide, etc. A button operation can be an operation using an input device such as a keyboard, for example, a physical button operation using a physical keyboard. A voice operation refers to an operation using an audio recording device, for example, sending a voice containing keywords. A biometric recognition operation is an operation of recognizing biometric features, for example, the sending end recognizing a face.

[0073] Optionally, the triggering operation for transmitting the target data to the receiving end can also be that a preset condition for data transmission is automatically satisfied, which is regarded as the triggering operation for transmitting the target data to the receiving end being triggered. For example, the preset condition is "10 am every Sunday", and at 10 am every Sunday, it automatically triggers the transmission of the target data from the sending end to the receiving end.

[0074] The sending end can detect whether the triggering operation for transmitting the target data to the receiving end is triggered. If the triggering operation is triggered, the sending end will respond to the triggering operation, generate an encryption key according to the public key of the sending end, the public key of the receiving end, and the specified parameters, and generate a data transmission request according to the encryption key and the receiving end identifier. The triggering operation can be a file sharing operation in a file sharing scenario, a picture sharing operation in a picture transmission scenario, a payment information sharing operation in a payment scenario, a location information sharing operation in a map location scenario, and so on.

[0075] For example, in an application scenario, user A can view the files that he has uploaded to the server. Specifically, he can view the file identifier list. When user A needs to send the target file represented by the target file identifier in the file identifier list to user B, he can trigger the corresponding file sharing operation for the target file identifier in the file identifier list. This file sharing operation is the triggering operation for transmitting the target data to the receiving end.

[0076] The specified parameter can be a string composed of numbers, letters, and underscores, a sequence of numbers, a sequence of letters, etc., without specific limitation. The specified parameter and the receiving end public key jointly identify the current data transmission process. It can be understood that the data transmission involves the sending end and the receiving end. Therefore, the specified parameter is a parameter shared between the sending end and the receiving end. By "shared", it means that both the sending end and the receiving end can obtain the specified parameter. The specified parameter involved in each data transmission can be the same or different. Exemplarily, the specified parameter can be the receiving end identifier of the receiving end, the receiving party account currently logged in to the receiving end. Of course, the specified parameter can also be the receiving end identifier of the sending end, the sending party account currently logged in to the sending end, or obtained by combining the receiving end identifier and the sending end identifier, without specific limitation. In this example, the specified parameter is fixed. Exemplarily, the specified parameter can be a string randomly generated by the sending end (which can be sent by the sending end to the receiving end or directly sent to the server in plain text and then forwarded by the server to the receiving end), without specific limitation.

[0077] The encryption key is also a kind of key. The encryption key is used by the server for secondary encryption and is generated based on the sending end public key, the receiving end public key, and the specified parameter. It can be seen that for different receiving ends, the receiving end public keys are different, and the sending end will generate different encryption keys for different receiving ends. Even for the same receiving end, when sending the target data separately multiple times, if the specified parameters are different, the sending end will also generate different encryption keys for it. Exemplarily, when the sending end needs to send the encrypted data corresponding to the target data to receiving end 1, receiving end 2, and receiving end 3 respectively, the encryption key 1 will be generated based on the sending end public key T_KEY, the receiving end public key R_KEY1 of receiving end 1, and the specified parameter PARA1, the encryption key 2 will be generated based on the sending end public key T_KEY, the receiving end public key R_KEY2 of receiving end 2, and the specified parameter PARA2, and the encryption key 3 will be generated based on the sending end public key T_KEY, the receiving end public key R_KEY3 of receiving end 3, and the specified parameter PARA3.

[0078] The receiving end identifier is used to uniquely identify a receiving end. The receiving end identifier can be the receiving party account currently logged in to this receiving end, or the MAC (Media Access Control) address of the receiving end. In different application scenarios, the receiving end identifier can also be other identifiers that can be used to distinguish different receiving ends.

[0079] The data transmission request is a request generated and sent by the sending end, used to request the server to re-encrypt the encrypted data and transmit the re-encrypted data (i.e., the re-encrypted data) to the receiving end.

[0080] The re-encrypted data generated by the server is different from the encrypted data uploaded by the sender to the server. Since the uploaded encrypted data is encrypted with the sender's public key, the receiver cannot decrypt it to obtain the target data therein. However, the receiver can decrypt the re-encrypted data with its own private key to obtain the target data therein and verify whether the decrypted data has been tampered with, i.e., the receiver verifies whether the decrypted data has been tampered with.

[0081] Optionally, in response to a trigger operation for transmitting target data to the receiver, the sender queries the receiver's public key and the specified parameters shared by the sender and the receiver from the pre-stored receiver information list based on the receiver identifier of the receiver, and obtains the sender's public key from local storage. According to the sender's public key, the receiver's public key, and the specified parameters, an encryption key for the sender and the receiver is generated. The sender randomly selects a transmission protocol from multiple transmission protocols, and generates a request body according to the selected transmission protocol, the generated encryption key, and the receiver identifier of the receiver. The request body includes the encryption key and the receiver identifier. A data transmission request is generated based on the request body and the data transmission request is sent to the server. The request body contains the encryption key and the receiver identifier.

[0082] After receiving the data transmission request, the server parses the data transmission request to obtain the encryption key and the receiver identifier in the data transmission request. The server queries the encrypted data sent by the sender from the encrypted data pre-stored by each sender, and re-encrypts the queried encrypted data with the encryption key to obtain re-encrypted data. The server determines the corresponding receiver according to the receiver identifier and sends the re-encrypted data to the receiver. After receiving the re-encrypted data, the receiver decrypts the re-encrypted data with the receiver's private key to obtain decrypted data. In the case where the receiver verifies that the re-encrypted data has not been tampered with, the receiver confirms the decrypted data as the target data.

[0083] Alternatively, the sender can send the encrypted data and the data transmission request to the server simultaneously. At this time, the server can parse the data transmission request to obtain the encryption key and the receiver identifier in the data transmission request, and re-encrypt the received encrypted data with the encryption key to obtain re-encrypted data.

[0084] The receiver information list contains the receiver information of at least one receiver. The receiver information includes the receiver's public key. The receiver information may further include the specified parameters shared by the receiver and the sender. The receiver information list can be obtained in advance and stored locally.

[0085] Exemplarily, in the application scenario of file sharing, the sending end displays a data transmission page, and a transmission window is pulled up from the data transmission page. The transmission window shows a list of receivers and a confirmation control. In response to the confirmation operation on any receiver account in the receiver list, after clicking the confirmation control, it is determined that the target data will be transmitted to the receiving end corresponding to the receiver account. That is, this receiver account can be regarded as the receiving end identifier. Then, based on this receiver account, the sending end queries the public key of the receiving end and the specified parameters shared by the sending end and the receiving end from the pre-stored receiving end information list, and generates a corresponding encryption key.

[0086] Exemplarily, after the receiving end receives the re-encrypted data, the receiving end obtains the specified parameters shared with the sending end, and decrypts the re-encrypted data according to the specified parameters and the receiving end private key to obtain the decrypted data. The receiving end uses the decrypted data to generate encrypted data again. When the encrypted data generated again is consistent with the re-encrypted data, the receiving end verifies that the re-encrypted data has not been tampered with, and confirms the decrypted data as the target data. When the encrypted data generated again is inconsistent with the re-encrypted data, the receiving end verifies that the re-encrypted data has been tampered with. At this time, a warning message is generated and returned to the server, and then returned to the sending end by the server.

[0087] Step S306, send a data transmission request to the server.

[0088] In the above data transmission method, first, the sending end uses the public key of the sending end to encrypt the target data of the plaintext to obtain encrypted data. Secondly, the sending end uploads the encrypted data to the server, so that when it is necessary to transmit the target data to one or more receiving ends subsequently, the server can directly re-encrypt the encrypted data and forward the re-encrypted data to the receiving end. When it is necessary to securely and efficiently transmit the target data to the receiving end, the sending end does not need to download the encrypted data from the server, nor does it need to decrypt and encrypt the obtained encrypted data. Instead, it only needs to respond to the trigger operation of transmitting the target data to the receiving end, and generate an encryption key in real time according to the public key of the sending end, the public key of the receiving end, and the specified parameters. Next, the sending end generates a data transmission request according to the encryption key and the receiving end identifier, and sends the data transmission request to the server, which reduces the burden on the sending end. After that, the server can re-encrypt the uploaded encrypted data according to the encryption key in the data transmission request. After obtaining the re-encrypted data, it sends the re-encrypted data to the receiving end corresponding to the receiving end identifier in the data transmission request. Since the specified parameters are shared between the sending end and the receiving end, the receiving end can use the private key of the receiving end and the specified parameter to decrypt and verify the received re-encrypted data to obtain the target data. In the whole data transmission process, on the one hand, the server cannot know the target data, ensuring the secure transmission of the data. On the other hand, re-encrypting the encrypted data with the encryption key also ensures that the receiving end can decrypt the re-encrypted data by itself to complete data reception. In addition, it avoids the sending end from decrypting and re-encrypting, reduces the burden on the sending end, and improves the data transmission efficiency.

[0089] In some embodiments, uploading the encrypted data corresponding to the target data to the server includes: obtaining the target data of the plaintext; encrypting the target data of the plaintext with the public key of the sending end to obtain the corresponding encrypted data; and uploading the encrypted data to the server.

[0090] Optionally, the sending end obtains the target data of the plaintext and obtains the public key of the sending end from local storage. The sending end encrypts the target data of the plaintext with the public key of the sending end to obtain the corresponding encrypted data. The sending end uploads the encrypted data to the server.

[0091] Exemplarily, the generation steps of the key pair of the sending end include: the sending end determines a finite field F q (q = p, and p is a prime number greater than 3). This finite field refers to a field containing only a finite number of elements, that is, containing q elements. The number of elements in the finite field is called the order of the finite field. The sending end determines an elliptic curve based on the number of elements in the finite field. This elliptic curve is determined based on the asymmetric encryption algorithm. For example, constructing the curve equation of the elliptic curve, that is, y 2 = x 3+ax + b (mod p), where y and x represent the abscissa and ordinate on the elliptic curve respectively. a and b are the parameters of the curve, and mod(.) is the modulo operation. The sender determines the value of p as the number of elements in the finite field and sets the values of the curve parameters a and b. Thus, the sender determines the curve equation of the elliptic curve. Then, the sender obtains the base point of the elliptic curve. The base point is a fixed point, and it can also be called the generating point. Each elliptic curve corresponds to a base point. The sender randomly generates an integer d using a random number generator, where d ∈ [1, n - 2] and n is an integer. The randomly generated integer d is determined as the sender's private key. The sender calculates the public key based on the coordinates of the base point and the integer d. For example, the sender multiplies the integer d by the base point to obtain point P, and determines point P as the sender's public key. That is, point P = (x p , y p ) = [d]G. Where x p , y p are the abscissa and ordinate of point P on the elliptic curve respectively. [.] represents a numerical value. It can be understood that the sender's public key is a point, that is, the sender's public key is point P. Therefore, the sender's key pair is (d, P). Where d is the sender's private key and P is the sender's public key.

[0092] Similarly, for the generation steps of the receiver's key pair, the above generation steps of the sender's key pair can be referred to. Exemplarily, the receiver randomly generates an integer f, where f ∈ [1, n - 2]. The integer f is different from the integer d. The integer f is determined as the receiver's private key, and the receiver determines the receiver's public key based on the product of the coordinates of the base point and the integer f.

[0093] After generating the sender's key pair, the sender locally stores the sender's key pair and uploads the sender's public key and sender identifier to the server so that the server stores the sender's public key and sender identifier.

[0094] In this embodiment, after obtaining the plaintext target data, the sender encrypts the plaintext target data using the sender's public key to obtain the corresponding encrypted data and uploads the encrypted data to the server. That is, the server cannot obtain the plaintext target data, so that the leakage of the target data can be effectively avoided and the security of the target data is ensured.

[0095] In some embodiments, the target data is a shared file belonging to the target account, and the encrypted data corresponding to the target data is the encrypted file corresponding to the shared file. Uploading the encrypted data corresponding to the target data to the server includes: storing the target account corresponding to the encrypted file of the shared file in the server.

[0096] Among them, a shared file refers to an unencrypted file, and a shared file can be understood as a file to be shared. A target account refers to an account with target data management permissions. Thus, a shared file belonging to a target account refers to a shared file managed by the target account. For example, the target account has the permission to edit the shared file. For another example, the target account has the permission to determine the sharing scope of the shared file. An encrypted file refers to an encrypted file. Optionally, an encrypted file refers to a file obtained by encrypting a shared file using the public key of the sender. The corresponding encrypted file of the target account and the shared file are stored correspondingly, which means associating the target account and the encrypted file to obtain an association relationship, and the server stores the target account and the encrypted file into the storage space belonging to the target account according to this association relationship.

[0097] Optionally, after the sender obtains the encrypted file corresponding to the shared file, it associates the target account with the encrypted file to generate an association relationship corresponding to the encrypted file, and sends the association relationship, the target account, and the shared file to the server, so that the server stores the target account and the shared file into the storage space belonging to the target account according to this association relationship.

[0098] In some embodiments, the method further includes: when the sender logs in to the target account, downloading the encrypted file belonging to the target account from the server; decrypting the encrypted file using the private key of the sender to obtain the shared file.

[0099] Optionally, when the sender logs in to the target account, the sender sends a download request carrying the target account to the server, so that the server obtains the target account by parsing the download request. The server queries the encrypted file belonging to the target account according to the target account and sends the encrypted file to the sender. After receiving the encrypted file, the sender decrypts the encrypted file using the private key of the sender to obtain the shared file.

[0100] Among them, multiple accounts are registered in the server. Thus, the service pre-divides storage spaces for each account respectively. For each account, the storage space of the account is used to store at least one encrypted file belonging to the account and the transmission records of each encrypted file. Therefore, when there are multiple encrypted files belonging to the target account, the download request further includes the association relationship between the target account and the encrypted file. At this time, after the server obtains the download request, it parses the download request to parse out the association relationship between the target account and the encrypted file, and according to this association relationship, queries the corresponding encrypted file from the storage space belonging to the target account and returns the queried encrypted file to the sender.

[0101] It should be noted that when the sending end obtains the shared file for the first time, the shared file is encrypted using the public key of the sending end to obtain an encrypted file. After the sending end uploads the encrypted file to the server, at this time, the sending end may not save the encrypted file and the shared file. Or, due to improper storage by the sending end, the saved shared file is missing. Then, subsequently, once the sending end needs to obtain the complete shared file again, for example, the sending end needs to edit the shared file. At this time, the sending end can adopt this embodiment to obtain the encrypted file from the server again and decrypt it to obtain the shared file again.

[0102] In this way, when the sending end logs in to the target account, the sending end can quickly query and download the encrypted file belonging to the target account from the server according to the target account. In this way, in the case where the sending end did not store the encrypted file after uploading the encrypted file previously, or the encrypted file is lost, the encrypted file can be obtained again according to the target account. And, by using the private key of the sending end, the encrypted file can be directly decrypted to obtain the shared file. In this way, the convenience of the sending end to obtain the shared file again is improved.

[0103] In this embodiment, when the target data is the shared file belonging to the target account and the encrypted data corresponding to the target data is the encrypted file corresponding to the shared file, by storing the target account and the encrypted file corresponding to the shared file in the server correspondingly, the encrypted file can be quickly and accurately queried subsequently, so as to facilitate the sending end to quickly obtain the encrypted file and decrypt it in time, improving the acquisition efficiency of the shared file by the sending end.

[0104] In some embodiments, the method further includes: encrypting the decrypted shared file using the public key of the receiving end to obtain an encrypted file; sending the encrypted file to the server, where the encrypted file is used to instruct the server to forward the encrypted file to the receiving end, and the encrypted file is used to instruct the receiving end to decrypt the received encrypted file using the private key of the receiving end to obtain the shared file.

[0105] Optionally, after the sending end decrypts to obtain the shared file, the sending end obtains the public key of the receiving end and encrypts the shared file using the public key of the receiving end to obtain an encrypted file. The sending end sends the encrypted file and the receiving end identifier to the server. The server sends the encrypted file to the corresponding receiving end according to the receiving end identifier. The receiving end decrypts the encrypted file using the private key of the receiving end to obtain the shared file.

[0106] Of course, when the target account is logged in at the sending end, after decrypting the shared file at the sending end, the shared file is edited using the target account to obtain an edited shared file. The sending end encrypts the edited shared file using the public key of the receiving end to obtain another encrypted file. The sending end sends the other encrypted file to the server so that the server forwards the other encrypted file to the receiving end, and the receiving end decrypts the other encrypted file using the private key of the receiving end to obtain the edited shared file.

[0107] In this way, when the shared file needs to be edited, the shared file obtained again is directly edited using the target account. Then, the edited shared file is directly encrypted using the public key of the receiving end so that the receiving end can directly decrypt the edited shared file to achieve timely sharing of the edited shared file.

[0108] In this embodiment, the decrypted shared file is encrypted using the public key of the receiving end to obtain an encrypted file. Then, the encrypted file is sent to the server, and the encrypted file is used to instruct the server to forward the encrypted file to the receiving end. At this time, the receiving end can directly decrypt the received encrypted file using the private key of the receiving end to obtain the shared file in a timely manner, improving the efficiency of file sharing.

[0109] In some embodiments, encrypting the plaintext target data using the public key of the sending end to obtain corresponding encrypted data includes: generating a random number through a random number generation program; generating multiple temporary ciphertexts for encrypting the target data according to the random number, the public key of the sending end, and the target data; and splicing the multiple temporary ciphertexts to obtain the encrypted data corresponding to the target data.

[0110] Among them, the random number refers to a digital sequence with randomness, and the random number generation program is a program for generating random numbers. It should be noted that the random number mentioned in this embodiment is used to generate encrypted data, rather than for generating public keys. Therefore, the random number mentioned in this example is completely different from the integer d and integer f in the previous text. The temporary ciphertext is encrypted data, and the temporary ciphertext is part of the encrypted data. It can be understood that each of the multiple generated temporary ciphertexts belongs to part of the encrypted data.

[0111] Optionally, a random number is generated through a random number generation program, the sending end obtains the random number, and multiple temporary ciphertexts are generated according to the random number, the public key of the sending end, and the target data. The multiple temporary ciphertexts are obtained by encrypting the target data. Among the multiple temporary ciphertexts, there is a temporary ciphertext with an unknown length, and the lengths of the remaining temporary ciphertexts are known. Here, the length refers to the data length of the temporary ciphertext. The sending end splices the multiple temporary ciphertexts according to the sorting rule that the temporary ciphertexts with known lengths are in the front and the temporary ciphertext with an unknown length is in the back to obtain the encrypted data corresponding to the target data.

[0112] In the above process, by splicing the temporary ciphertexts according to the sorting rule that the temporary ciphertext with a known length is in the front and the temporary ciphertext with an unknown length is in the back, in this way, not only can the corresponding temporary ciphertext be accurately extracted according to a known length, but also the temporary ciphertext with an unknown length can be quickly extracted according to the temporary ciphertexts with known lengths, ensuring the efficiency and accuracy of the extraction.

[0113] In this embodiment, first, a random number is generated by a random number generation program. Then, according to the random number, the public key of the sending end, and the target data, multiple temporary ciphertexts for encrypting the target data are generated. Finally, by splicing the multiple temporary ciphertexts, the encrypted data corresponding to the target data is obtained. Thus, the sending end directly sends the encrypted data to the server, ensuring that the server cannot decrypt the encrypted data during the entire data transmission process, ensuring the security of the data transmission.

[0114] In some embodiments, as Figure 4 shown, it is a schematic diagram of the generation steps of multiple temporary ciphertexts in an embodiment. According to the random number, the public key of the sending end, and the target data, generating multiple temporary ciphertexts for encrypting the target data includes:

[0115] Step S402, obtaining the base point coordinates corresponding to the preset base point on the elliptic curve.

[0116] Among them, the elliptic curve is pre-set, and the relevant explanations of the elliptic curve and the base point are as described above.

[0117] Exemplarily, let point G be the base point, and the corresponding base point coordinates be (x G , y G ). Among them, x G , y G are the abscissa and ordinate of the base point respectively.

[0118] Step S404, generating a first temporary ciphertext according to the random number and the base point coordinates.

[0119] Optionally, the sending end determines the product of the random number and the base point coordinates as the first temporary ciphertext.

[0120] Exemplarily, let the random number be k, where k ∈ [1, n - 1] and n is an integer. Let the first temporary ciphertext be C1. At this time, the calculation formula of the first temporary ciphertext C1 is as follows:

[0121] C1 = [k]G = (x1, y1)

[0122] It can be seen from this that the first temporary ciphertext C1 can be understood as k times the base point. The abscissa and ordinate of k times the base point are x1 and y1 respectively. The first temporary ciphertext C1 is still a point on the elliptic curve. It can be understood that according to this calculation formula, it can be known that the first temporary ciphertext C1 is generated by a random number. The first temporary ciphertext C1 reflects the randomness of the encryption process. The first temporary ciphertext C1 is used to verify whether the public key of the sending end and the private key of the sending end match, that is, whether the public key of the sending end and the private key of the sending end belong to the same key pair, thereby ensuring the security and correctness of the encryption.

[0123] Step S406, generate a second temporary ciphertext according to the random number, the public key of the sending end, the bit length of the target data, and the target data.

[0124] Among them, the bit length refers to the length of the data. It can be understood that the length of the data is quantified in bits. The second temporary ciphertext is used to store the ciphertext corresponding to the target data.

[0125] In some embodiments, generating a second temporary ciphertext according to the random number, the public key of the sending end, the bit length of the target data, and the target data includes: generating the coordinate of a data point on the elliptic curve according to the random number and the public key of the sending end; through a key derivation function, calculating a fixed-length key according to the coordinate of the data point and the bit length of the target data, and the bit length of the fixed-length key is equal to the bit length of the target data; performing an exclusive OR operation on the fixed-length key and the target data to obtain the second temporary ciphertext.

[0126] As mentioned above, the public key of the sending end is a point on the elliptic curve. Therefore, based on the random number and the public key of the sending end, a data point on the elliptic curve can be generated. The coordinate of the data point on the elliptic curve refers to the coordinate of the data point on the elliptic curve. The key derivation function is a cryptographic hash function, and the key derivation function is used to derive one or more keys from a key. The fixed-length key refers to a key with the same bit length as the target data. The exclusive OR operation is a binary operation, and the symbol is "⊕". The characteristic of this exclusive OR operation is that if the two values are the same, the exclusive OR result is 0; if the two values are different, the exclusive OR result is 1.

[0127] Optionally, the sending end calculates the product of the random number and the public key of the sending end to obtain a product value, and determines the product value as the coordinate of the data point on the elliptic curve. The sending end parses the abscissa and ordinate of the data point from the coordinate of the data point, and splices the abscissa and ordinate of the data point to obtain the spliced data for calculating the second temporary ciphertext. The sending end inputs the spliced data and the bit length of the target data into the key derivation function, and outputs a fixed-length key. Among them, the bit length of the fixed-length key is equal to the bit length of the target data. The sending end performs a bit-by-bit exclusive OR operation on the target data and the fixed-length key to obtain the second temporary ciphertext.

[0128] Exemplarily, let the random number be k, where k ∈ [1, n - 1] and n is an integer. The target data is M. The public key of the sender is pkA, and the bit length of the target data is klen. First, calculate the product of [k] and pkA to obtain [k]pkA = (x2, y2). Here, x2 and y2 are the abscissa and ordinate of the data point, respectively.

[0129] At this time, the concatenated data for calculating the second temporary ciphertext is x2||y2, where the symbol "||" is the concatenation symbol, that is, the ordinate is concatenated after the abscissa. Then, calculate the fixed-length key t, that is, t = KDF(x2||y2, klen). Here, KDF(.) is the key derivation function. In the case where the calculated fixed-length key t is a bit string of all 0s, return to the step of obtaining the random number and continue to execute. In the case where the fixed-length key t is not a bit string of all 0s, the sender calculates the second temporary ciphertext C2, that is, C2 = M ⊕ t.

[0130] In this embodiment, first, according to the random number and the public key of the sender, the coordinates of the data point on the elliptic curve are randomly generated, ensuring the randomness of the second temporary ciphertext. Then, through the key derivation function, according to the coordinates of the data point and the bit length of the target data, a fixed-length key is calculated, and the bit length of the fixed-length key is equal to the bit length of the target data. Finally, perform an exclusive OR operation on the fixed-length key and the target data to directly obtain the second temporary ciphertext. In this way, through the input security and output randomness of the key derivation function, the risk of being attacked can be reduced, the risk of data tampering during subsequent data transmission can be reduced, and the security of data transmission is ensured.

[0131] Step S408, generate a third temporary ciphertext according to the random number, the public key of the sender, and the target data.

[0132] Among them, the third temporary ciphertext is used to verify whether the subsequent re-encrypted data has been tampered with.

[0133] Optionally, after the sender generates the coordinates of the data point on the elliptic curve according to the random number and the public key of the sender, the sender sequentially concatenates the abscissa in the coordinates of the data point, the target data, and the ordinate in the coordinates of the data point to obtain the concatenated data for calculating the third temporary ciphertext. The sender calculates the hash value of the concatenated data and determines the calculated hash value as the third temporary ciphertext.

[0134] Exemplarily, as described above, the abscissa and ordinate of the data point are x2 and y2, respectively. Let the target data be M. At this time, after concatenating x2, M, and y2, the concatenated data (x2||M||y2) is obtained. The sender inputs the concatenated data into the hash function and outputs the third temporary ciphertext C3, that is:

[0135] C3 = Hash(x2||M||y2)

[0136] In the formula for calculating the third temporary ciphertext C3 above, Hash(.) is a hash function. The concatenated data of the third temporary ciphertext is input into the hash function, and the third temporary ciphertext is output.

[0137] Step S410: Generate a fourth temporary ciphertext based on the first temporary ciphertext, the target data, and the third temporary ciphertext.

[0138] Among them, both the fourth temporary ciphertext and the third temporary ciphertext are used to verify whether the re-encrypted data has been tampered with.

[0139] Optionally, the sender concatenates the first temporary ciphertext, the target data, and the third temporary ciphertext in sequence to obtain the concatenated data for generating the fourth temporary ciphertext. The sender calculates the hash value of this concatenated data to obtain the fourth temporary ciphertext.

[0140] Exemplarily, after the sender calculates the first temporary ciphertext C1 and the third temporary ciphertext C3, the first temporary ciphertext, the target data, and the third temporary ciphertext are concatenated to obtain the concatenated data (C1||M||C3) for generating the fourth temporary ciphertext. Then, this concatenated data is input into the hash function, and the fourth temporary ciphertext C4 is output, that is:

[0141] C4 = Hash(C1||M||C3)

[0142] In this embodiment, the base point coordinates corresponding to the base point on the elliptic curve are obtained; a first temporary ciphertext is generated based on the random number and the base point coordinates, thereby ensuring the randomness of the encryption process. A second temporary ciphertext obtained by encrypting the target data is generated based on the random number, the public key of the sender, the bit length of the target data, and the target data. A third temporary ciphertext is generated based on the random number, the public key of the sender, and the target data. Then, a fourth temporary ciphertext is generated based on the first temporary ciphertext, the target data, and the third temporary ciphertext. In this way, subsequently, based on the third temporary ciphertext and the fourth temporary ciphertext, it can be timely verified whether the re-encrypted data has been tampered with, ensuring the effectiveness of data transmission.

[0143] In some embodiments, concatenating multiple temporary ciphertexts to obtain the encrypted data corresponding to the target data includes: concatenating the first temporary ciphertext, the third temporary ciphertext, the fourth temporary ciphertext, and the second temporary ciphertext to obtain the encrypted data corresponding to the target data.

[0144] It should be noted that the lengths of the first temporary ciphertext, the third temporary ciphertext, and the fourth temporary ciphertext are known, while the length of the second temporary ciphertext is unknown. Therefore, in order to ensure that each temporary ciphertext can be accurately extracted subsequently, the fourth temporary ciphertext is concatenated after the other three temporary ciphertexts.

[0145] Exemplarily, after obtaining the first temporary ciphertext C1, the second temporary ciphertext C2, the third temporary ciphertext C3, and the fourth temporary ciphertext C4, they are concatenated in the order of the first temporary ciphertext C1, the third temporary ciphertext C3, the fourth temporary ciphertext C4, and the second temporary ciphertext C2 to obtain the encrypted data C, that is:

[0146] C = C1||C3||C4||C2

[0147] For example, if it is necessary to extract the second temporary ciphertext with an unknown length, then successively subtract the length of the first temporary ciphertext C1, the length of the third temporary ciphertext C3, and the length of the fourth temporary ciphertext C4 from the length of the encrypted data, and what is obtained is the second temporary ciphertext C2.

[0148] The process of encrypting data will be described in detail below. As Figure 5 shown, it is a schematic flow diagram of the steps for generating encrypted data in an embodiment. It should be noted that Figure 5 the meanings of the characters that appear have all been mentioned above, and reference can be made to the meanings of the respective characters in the foregoing text. After the sender obtains the target data M and the sender's public key pkA, the following steps are executed:

[0149] Step 5.1: Generate a random number k through a random number generation program, where k ∈ [1, n - 1] and n is an integer. The sender obtains the random number k.

[0150] Step 5.2: The sender generates the first temporary ciphertext C1 according to the random number k and the base point coordinates G, that is, C1 = [k]G = (x1, y1).

[0151] Step 5.3: The sender determines the ratio of the order of the finite field to the base point as the cofactor h. The sender calculates the product of the cofactor h and the sender's public key pkA to obtain the elliptic curve point s, that is: s = [h]pkA. The main role of the cofactor is to prevent the password from being guessed or cracked. The sender determines whether the elliptic curve point s is the value 0. If so, the sender reports an error and exits. If not, the sender executes Step 5.4.

[0152] Step 5.4: The sender calculates the product of the random number k and the sender's public key pkA to obtain the data point coordinates, that is: [k]pkA = (x2, y2).

[0153] Step 5.5: The sender obtains the abscissa x2 and ordinate y2 from the data point coordinates. The sender concatenates the ordinate y2 after the abscissa x2 to obtain the concatenated data for calculating the second temporary ciphertext. Based on this concatenated data (x2||y2) and the bit length klen of the target data, the sender calculates a fixed-length key t through a key derivation function, i.e., t = KDF(x2||y2, klen). The sender determines whether t is a bit string of all 0s, that is, whether t is all 0s. If so, the sender reports an error and exits. If not, the sender proceeds to Step 5.6.

[0154] Step 5.6: The sender performs a bitwise exclusive OR operation on the target data M and the fixed-length key t to obtain the second temporary ciphertext C2, i.e., C2 = M ⊕ t.

[0155] Step 5.7: The sender sequentially concatenates the abscissa x2, the target data M, and the ordinate y2 to obtain the concatenated data (x2||M||y2) for calculating the third temporary ciphertext. The sender calculates the hash value of this concatenated data and determines the calculated hash value as the third temporary ciphertext C3, i.e., C3 = Hash(x2||M||y2).

[0156] Step 5.8: The sender sequentially concatenates the first temporary ciphertext C1, the target data M, and the third temporary ciphertext C3 to obtain the concatenated data for generating the fourth temporary ciphertext. The sender calculates the hash value of this concatenated data to obtain the fourth temporary ciphertext C4, i.e., C4 = Hash(C1||M||C3).

[0157] Step 5.9: The sender concatenates the first temporary ciphertext, the third temporary ciphertext, the fourth temporary ciphertext, and the second temporary ciphertext to obtain the encrypted data C corresponding to the target data, i.e., C = C1||C3||C4||C2.

[0158] In this embodiment, after obtaining the first temporary ciphertext, the second temporary ciphertext, the third temporary ciphertext, and the fourth temporary ciphertext, directly concatenating the first temporary ciphertext, the third temporary ciphertext, the fourth temporary ciphertext, and the second temporary ciphertext can quickly and accurately obtain the encrypted data corresponding to the target data, improving the efficiency of data encryption. Moreover, subsequently, by sending the encrypted data to the server, the sender can ensure that the server cannot decrypt the encrypted data during the entire data transmission process, ensuring the security of data transmission.

[0159] In some embodiments, the specified parameter is a static specified parameter, and the static specified parameter is the recipient account logged in to the receiver. In response to the trigger operation of transmitting the target data to the receiver, generating an encryption key according to the sender's public key, the receiver's public key, and the specified parameter includes: in response to the trigger operation of transmitting the target data to the receiver logged in with the recipient account, generating an encryption key according to the sender's public key, the receiver's public key, and the recipient account.

[0160] Among them, the static specified parameter refers to a fixed parameter. For example, when the sender and the receiver do not communicate directly, the receiver cannot directly obtain the specified parameter. Then, during at least one data transmission process between the sender and the receiver, the static specified parameter corresponding to each data transmission is the receiver identifier of the receiver, or the static specified parameter corresponding to each data transmission is the recipient account that has logged in to the receiver.

[0161] Optionally, when the receiver has logged in to the recipient account, the receiver determines the recipient account as the static specified parameter and forwards the recipient account to the sender through the server. In response to the trigger operation of transmitting the target data to the receiver, the sender queries the public key of the receiver and the recipient account from the pre-stored receiver information list based on the receiver identifier of the receiver, and obtains the sender public key from the local storage. The sender generates an encryption key for the sender and the receiver according to the sender public key, the receiver public key, and the recipient account.

[0162] Exemplarily, when the receiver has logged in to the recipient account, the receiver determines the recipient account as the static specified parameter. The receiver pre-sends the public key of the receiver, the receiver identifier, and the recipient account corresponding to the receiver to the server, and forwards them to the sender through the server. The sender stores the public key of the receiver, the receiver identifier, and the recipient account corresponding to the receiver in the receiver information list.

[0163] When the receiver needs to obtain the target data, the receiver sends a data request for the target data to the server. After the server obtains the data request, it forwards the data request to the sender. At this time, after receiving the data request, the sender displays a data transmission page and pulls up a transmission window from the data transmission page. The transmission window shows a recipient list and a confirmation control. In response to the confirmation operation on any recipient account in the recipient list, after clicking the confirmation control, it is determined that the target data will be transmitted to the receiver corresponding to the recipient account, that is, the recipient account can be regarded as the receiver identifier. The sender returns and continues to execute by querying the public key of the receiver and the recipient account from the pre-stored receiver information list based on the receiver identifier of the receiver.

[0164] In this embodiment, when the sender and the receiver are not communicating, the specified parameter is a static specified parameter, and the static specified parameter is the receiver account logged in to the receiver. Thus, in response to the trigger operation of transmitting the target data to the receiver logged in with the receiver account, an encryption key is generated based on the public key of the sender, the public key of the receiver, and the receiver account. In this way, subsequently, based on this encryption key, the server can convert the encrypted data into re-encrypted data without decrypting the target data and directly send it to the receiver for decryption, greatly improving the security of data transmission.

[0165] In some embodiments, the specified parameter is a dynamic specified parameter, and the dynamic specified parameter is a random verification code; in response to the trigger operation of transmitting the target data to the receiver, generating an encryption key based on the public key of the sender, the public key of the receiver, and the specified parameter includes: in response to the trigger operation of transmitting the target data to the receiver logged in with the receiver account, generating a random verification code, generating an encryption key based on the public key of the sender, the public key of the receiver, and the random verification code, and sending the random verification code to the receiver.

[0166] Among them, the dynamic specified parameter refers to a parameter that changes dynamically. For example, when the sender and the receiver communicate directly, the receiver can directly obtain the specified parameter. Then, during at least one data transmission between the sender and the receiver, the dynamic specified parameter corresponding to each data transmission is dynamically changing. Exemplarily, each time data is transmitted, the sender (or the receiver randomly generates a random verification code and sends it to the sender) randomly generates a random verification code. A random verification code refers to a randomly generated string. For example, the sender randomly generates a random number e for generating the encryption key, and this random number e can be regarded as a random verification code. It can be understood that the roles of the random number e, the aforementioned random number k, integer d, and integer f are all different. Therefore, the random number e, random number k, integer d, and integer f are all different. Since the dynamic specified parameter corresponding to each data transmission is dynamically changing, that is, each data transmission has a unique corresponding random verification code, and the random verification codes of any two data transmissions are different. Thus, after each data transmission is completed, the sender can store the encrypted data and the random verification code corresponding to each other in the transmission record of the sender. At the same time, the receiver stores the re-encrypted data, the decrypted data, and the random verification code corresponding to each other in the transmission record of the receiver. Thus, it is convenient for the sender and the receiver to be able to view the process of each data transmission in real time.

[0167] Optionally, when the receiving end logs in to the recipient account, the sending end receives a communication establishment request sent by the receiving end, and the communication establishment request includes the receiving end identifier. The sending end returns information agreeing to establish communication to the receiving end, and after establishing communication between the sending end and the receiving end, in response to a trigger operation of transmitting target data to the receiving end, the sending end uses a random number generation program to randomly generate a random verification code, where the trigger operation is an operation of transmitting target data to the receiving end logged in with the recipient account. The sending end queries the public key of the receiving end from a pre-stored receiving end information list based on the receiving end identifier. The sending end generates an encryption key according to the public key of the sending end, the public key of the receiving end, and the random verification code, and sends the random verification code to the receiving end.

[0168] Exemplarily, after establishing communication between the sending end and the receiving end, for each data transmission between the sending end and the receiving end, in response to a trigger operation of transmitting the target data of that time to the receiving end, the sending end uses a random number generation program to randomly generate a random verification code corresponding to the data transmission of that time. The target data of that time refers to the target data requested to be transmitted by the receiving end during the data transmission of that time. The sending end generates an encryption key corresponding to the data transmission of that time according to the public key of the sending end, the public key of the receiving end, and the random verification code. The sending end stores the encryption key, encryption key, and encrypted data generated for the data transmission of that time in a corresponding manner, and sends the random verification code to the receiving end.

[0169] For another example, after logging in to the receiving end with the recipient account and the receiving end randomly generates a random verification code, the sending end receives a communication establishment request sent by the receiving end, and the communication establishment request includes the receiving end identifier and the random verification code. The sending end returns information agreeing to establish communication to the receiving end, and after establishing communication between the sending end and the receiving end, in response to a trigger operation of transmitting target data to the receiving end, the sending end generates an encryption key according to the public key of the sending end, the public key of the receiving end, and the random verification code.

[0170] In this embodiment, when the sending end communicates with the receiving end, the specified parameter is a dynamic specified parameter, and the dynamic specified parameter is a random verification code. In this way, a random verification code corresponding to each data transmission can be randomly generated, ensuring the randomness of data transmission. In response to a trigger operation of transmitting target data to the receiving end logged in with the recipient account, a random verification code is generated, an encryption key is generated according to the public key of the sending end, the public key of the receiving end, and the random verification code, and the random verification code is sent to the receiving end. In this way, subsequently, according to the encryption key, the server can convert the encrypted data into re-encrypted data without decrypting the target data and directly send it to the receiving end for decryption, greatly improving the security of data transmission.

[0171] In some embodiments, generating an encryption key based on a sender public key, a receiver public key, and a specified parameter includes: using a key derivation function to calculate a first temporary key according to the product of a random number used when generating encrypted data corresponding to target data and the sender public key; using a hash function to generate a hash value corresponding to the specified parameter; using the key derivation function to calculate a second temporary key according to the product of the hash value, the random number, and the receiver public key; and performing an exclusive OR operation on the first temporary key and the second temporary key to obtain the encryption key.

[0172] Wherein, the first temporary key is a key related to the sender, the second temporary key is a key related to the receiver, and both the first temporary key and the second temporary key are used to generate an encryption key corresponding to the sender and the receiver.

[0173] Optionally, the sender determines a random number for generating encrypted data, calculates the product of the random number and the sender public key to obtain a first product. The sender calls the key derivation function, inputs the first product into the key derivation function, and outputs a first temporary key related to the sender. The sender calculates the product of the random number and the receiver public key to obtain a second product, and inputs the specified parameter into the hash function to output a hash value of the specified parameter. The sender calculates the product of the hash value and the second product to obtain a third product. The sender inputs the third product into the key derivation function to output a second temporary key related to the receiver. The sender performs an exclusive OR operation on the first temporary key and the second temporary key to obtain the encryption key.

[0174] Exemplarily, let the random number for generating encrypted data be k, the sender public key be pkA, the receiver public key be pkB, and the specified parameter be m. At this time, the sender calls the following formula to calculate the encryption key skA->B between sender A and receiver B:

[0175] skA->B = KDF(k × pkA) ⊕ KDF(hash(m) × (k × pkB))

[0176] When there are multiple data transmissions between the sender and the receiver, for the i-th data transmission, the corresponding dynamic specified parameter m i For each data transmission, the corresponding encryption key (skA->B) i :

[0177] (skA->B) i = KDF(k × pkA) ⊕ KDF(hash(m i ) × (k × pkB))

[0178] In this embodiment, by using a key derivation function, a first temporary key regarding the sender is calculated based on the product of the random number used when generating the encrypted data corresponding to the target data and the public key of the sender. By using a hash function, a hash value corresponding to the specified parameter is generated, and then by using the key derivation function, a second temporary key regarding the receiver is calculated based on the hash value, the random number, and the product of the public key of the receiver. The exclusive OR operation is performed on the first temporary key and the second temporary key to obtain the encryption key. That is, by integrating the key information of the sender (i.e., the public key of the sender) and the key information of the receiver (i.e., the public key of the receiver), an encryption key with better encryption effect can be generated. In this way, the server can use this encryption key to convert the encrypted data into re-encrypted data, so that the receiver can directly decrypt it, improving the effectiveness and accuracy of data transmission.

[0179] In some embodiments, the step of the server encrypting the uploaded encrypted data according to the encryption key in the data transmission request to obtain re-encrypted data includes: parsing out the encryption key from the data transmission request; after updating the second temporary ciphertext in the uploaded encrypted data by using the encryption key, obtaining the re-encrypted data, and the re-encrypted data is obtained according to the updated second temporary ciphertext.

[0180] As described above, the encrypted data includes the first temporary ciphertext, the second temporary ciphertext, the third temporary ciphertext, and the fourth temporary ciphertext. Updating the second temporary ciphertext means encrypting the second temporary ciphertext by using the encryption key to obtain the updated second temporary ciphertext. The re-encrypted data includes the first temporary ciphertext, the updated second temporary ciphertext, the third temporary ciphertext, and the fourth temporary ciphertext.

[0181] Optionally, the server extracts the second temporary ciphertext from the encrypted data to obtain the extracted encrypted data. The extracted encrypted data includes the first temporary ciphertext, the third temporary ciphertext, and the fourth temporary ciphertext. The server encrypts the second temporary ciphertext by using the encryption key to obtain the updated second temporary ciphertext. After the extracted encrypted data, the server continues to splice the updated second temporary ciphertext to obtain the re-encrypted data.

[0182] Exemplarily, the server pre-obtains the bit lengths of the first temporary ciphertext, the third temporary ciphertext, and the fourth temporary ciphertext respectively. Based on the bit lengths of the first temporary ciphertext, the third temporary ciphertext, and the fourth temporary ciphertext respectively, the server superimposes the bit lengths of the first temporary ciphertext, the third temporary ciphertext, and the fourth temporary ciphertext to obtain the length of the partial encrypted data, where the partial encrypted data refers to the encrypted data obtained by splicing the first temporary ciphertext, the third temporary ciphertext, and the fourth temporary ciphertext. The server locates the first data after the partial encrypted data from the encrypted data, and determines the first data in the second temporary ciphertext as the located first data. The server subtracts the sum value from the bit length of the encrypted data to obtain the bit length of the second temporary ciphertext. Based on the first data in the second temporary ciphertext and the bit length of the second temporary ciphertext, the server extracts the second temporary ciphertext from the encrypted data to obtain the encrypted data after extraction and the second temporary ciphertext. Then, the step of the server performing an exclusive OR operation on the encryption key and the second temporary ciphertext to obtain the updated second temporary ciphertext is continued.

[0183] For example, the server obtains the encrypted data C and the encryption key skA->B, where C = C1||C3||C4||C2. The first temporary ciphertext C1, the second temporary ciphertext C2, the third temporary ciphertext C3, and the fourth temporary ciphertext C4. The server calculates the updated second temporary ciphertext C′2 according to the following formula, that is:

[0184] C′2 = skA->B ⊕ C2

[0185] Therefore, the re-encrypted data C′ is C′ = C1||C3||C4||C′2.

[0186] In this embodiment, after the server receives the data transmission request, it directly parses the encryption key from the data transmission request. Then, using the encryption key, it updates the second temporary ciphertext in the uploaded encrypted data to obtain the updated second temporary ciphertext, and then updates the encrypted data according to the updated second plaintext to obtain the re-encrypted data. In this way, during the entire data transmission process, not only can the server not obtain the target data, ensuring the secure transmission of the data, but also, during the transmission process, there is no need for the sender to decrypt and re-encrypt, improving the data transmission efficiency.

[0187] In some embodiments, the re-encrypted data is formed by splicing the first temporary ciphertext, the third temporary ciphertext, the fourth temporary ciphertext, and the updated second temporary ciphertext; the steps for the receiving end to use its corresponding receiving end private key and the specified parameters to decrypt and verify the received re-encrypted data to obtain the target data include: extracting the first temporary ciphertext and the updated second temporary ciphertext from the re-encrypted data; decrypting according to the receiving end private key, the specified parameters, the extracted first temporary ciphertext, and the updated second temporary ciphertext to obtain the decrypted data.

[0188] Among them, the re-encrypted data is formed by splicing the first temporary ciphertext, the third temporary ciphertext, the fourth temporary ciphertext, and the updated second temporary ciphertext, which means that the first temporary ciphertext, the third temporary ciphertext, the fourth temporary ciphertext, and the updated second temporary ciphertext are sequentially spliced to obtain the re-encrypted data.

[0189] Optionally, after the receiving end receives the re-encrypted data, the receiving end extracts the first temporary ciphertext, the third temporary ciphertext, the fourth temporary ciphertext, and the updated second temporary ciphertext from the re-encrypted data. The receiving end obtains the curve equation satisfied by the elliptic curve. When it is verified that the first temporary ciphertext satisfies the curve equation, the receiving end decrypts according to the receiving end private key, the specified parameter, the first temporary ciphertext, and the updated second temporary ciphertext to obtain the decrypted data, and verifies whether the re-encrypted data has been tampered with based on the decrypted data. If no tampering has occurred, the target data is determined based on the decrypted data.

[0190] Exemplarily, as described above, the first temporary ciphertext is the product of a random number and the base point. Therefore, the first temporary ciphertext can also be regarded as a data point, that is, the first temporary ciphertext includes the abscissa and ordinate of the data point. Thus, the step of verifying whether the first temporary ciphertext satisfies the curve equation includes: substituting the abscissa and ordinate in the first temporary ciphertext into the curve equation. If the results on both sides of the curve equation are equal, it means that the first temporary ciphertext satisfies the curve equation.

[0191] Exemplarily, the receiving end calculates the product of the receiving end private key and the first temporary ciphertext to obtain a fourth product. The receiving end calculates the hash value of the specified parameter and calculates the product of the fourth product and the hash value to obtain a fifth product. The receiving end substitutes the fifth product into the key derivation function for calculation to obtain the calculated data. The receiving end performs an exclusive OR operation on the updated second temporary ciphertext and the calculated data to obtain the decrypted data.

[0192] For example, after obtaining the receiving end private key skB, the specified parameter m, the first temporary ciphertext C1, and the updated second temporary ciphertext C2 ′ After that, use the derivation function KDF(.), and decrypt using the following decryption formula to obtain the decrypted data M ′ :

[0193] M ′ = C2 ′ ⊕ KDF(hash(m) × (skB × C1))

[0194] The above hash(m) is the hash value of the specified parameter. The fourth product is skB × C1; the fifth product is hash(m) × (skB × C1).

[0195] In this embodiment, since the re-encrypted data is formed by splicing the first temporary ciphertext, the third temporary ciphertext, the fourth temporary ciphertext, and the updated second temporary ciphertext. Therefore, the receiving end can directly and accurately extract the first temporary ciphertext and the updated second temporary ciphertext from the re-encrypted data. In this way, the receiving end can directly decrypt according to the receiving end private key, the specified parameter, the extracted first temporary ciphertext and the updated second temporary ciphertext to obtain the decrypted data, without the receiving end additionally obtaining the sending end public key for decryption, but directly decrypting according to its own private key and the specified parameter shared with the sending end, improving the decryption efficiency.

[0196] In some embodiments, the method further includes: extracting the third temporary ciphertext and the fourth temporary ciphertext from the re-encrypted data; splicing the first temporary ciphertext, the decrypted obtained decrypted data and the extracted third temporary ciphertext to obtain the spliced data; calculating the hash value of the spliced data; if the hash value of the spliced data is equal to the fourth temporary ciphertext, it is verified that the re-encrypted data has not been tampered with.

[0197] Optionally, the receiving end extracts the third temporary ciphertext and the fourth temporary ciphertext from the re-encrypted data, and the server sequentially splices the first temporary ciphertext, the decrypted obtained decrypted data and the extracted third temporary ciphertext to obtain the spliced data. The receiving end calculates the hash value of the spliced data. If the hash value of the spliced data is equal to the fourth temporary ciphertext, it is verified that the re-encrypted data has not been tampered with. If the hash value of the spliced data is not equal to the fourth temporary ciphertext, it is verified that the re-encrypted data has been tampered with, and the receiving end returns an error prompt to the sending end to inform the sending end that the re-encrypted data has been tampered with during the transmission process.

[0198] Exemplarily, after extracting the third temporary ciphertext C3 and the fourth temporary ciphertext C4, the first temporary ciphertext C1, the decrypted obtained decrypted data and the third temporary ciphertext C3 are sequentially spliced to obtain the spliced data, that is, (C1||M′||C3). At this time, the hash value C′4 of the spliced data is: C′4 = hash(C3||M′||C3). If C′4 is the same as the extracted fourth temporary ciphertext C4, it means that the re-encrypted data has not been tampered with. If C′4 is different from the extracted fourth temporary ciphertext C4, it means that the re-encrypted data has been tampered with.

[0199] The decryption process will be described in detail below. As Figure 6 shown, it is a schematic flowchart of the steps of the decryption process in an embodiment. It should be noted that Figure 6 the meanings of the characters appearing in it have been mentioned above, and the meanings of each character in the previous text can be referred to. After the receiving end obtains the re-encrypted data C′, the following steps are executed:

[0200] Step 6.1: The receiving end extracts the first temporary ciphertext C1 from the re-encrypted data C'. The receiving end verifies whether the first temporary ciphertext C1 satisfies the curve equation. If it does not satisfy the curve equation, the receiving end reports an error and exits. If it satisfies, step 6.2 is executed.

[0201] Step 6.2: The receiving end calculates the decrypted data M'.

[0202] Optionally, the receiving end extracts the updated second temporary ciphertext C'2 from the re-encrypted data C'. The receiving end multiplies the receiving end private key skB by the first temporary ciphertext C1 to obtain the fourth product, i.e., skB×C1. The receiving end calculates the hash value of the specified parameter m, i.e., hash(m), and calculates the product of the fourth product and the hash value to obtain the fifth product, i.e., hash(m)×(skB×C1). The receiving end substitutes the fifth product into the key derivation function for calculation to obtain the calculated data, i.e., KDF(hash(m)×(skB×C1)). The receiving end performs an exclusive OR operation on the updated second temporary ciphertext C'2 and the calculated data to obtain the decrypted data M'.

[0203] Step 6.3: The receiving end verifies whether the re-encrypted data has been tampered with.

[0204] Optionally, the receiving end extracts the third temporary ciphertext C3 and the fourth temporary ciphertext C4 from the re-encrypted data C'. The first temporary ciphertext C1, the decrypted decrypted data, and the third temporary ciphertext C3 are sequentially concatenated to obtain the concatenated data, i.e., (C1||M'||C3). At this time, the hash value C'4 of the concatenated data is: C'4 = hash(C3||M'||C3). If C'4 is different from the extracted fourth temporary ciphertext C4, it means that the re-encrypted data has been tampered with, and the receiving end reports an error and exits. If C'4 is the same as the extracted fourth temporary ciphertext C4, it means that the re-encrypted data has not been tampered with, and the receiving end determines the decrypted data M' as the target data and outputs it.

[0205] In this embodiment, first, the third temporary ciphertext and the fourth temporary ciphertext are extracted from the re-encrypted data. Then, the first temporary ciphertext, the decrypted decrypted data, and the extracted third temporary ciphertext are sequentially concatenated to obtain the concatenated data. Then, the hash value of the concatenated data is calculated. By comparing whether the hash value and the extracted fourth hash value are the same, it is possible to timely verify whether the re-encrypted data has been tampered with. If the hash value of the concatenated data is equal to the fourth temporary ciphertext, it is verified that the re-encrypted data has not been tampered with. Based on this, once the data is maliciously tampered with or attacked during the data transmission process, the receiving end can timely verify whether the re-encrypted data has been tampered with.

[0206] Next, it will be described that after the re-encrypted data is obtained by encrypting with the encryption key, the receiving end can decrypt the re-encrypted data to obtain the target data. The meanings of the symbols involved in the following description are all reflected in the foregoing text. Please refer to the foregoing text.

[0207] First, given the first temporary ciphertext C1 = [k]G = (x1, y1), and skB×G = pkB, thus, skB×C1 = [skB×k]G = [k×skB]G = [k](skB×G) = [k]×pkB.

[0208] Second, given Therefore, substituting skA->B into That is:

[0209]

[0210] Third, substituting skB×C1 = [k]×pkB, into That is:

[0211]

[0212] Also, since t = KDF(x2||y2, klen) and [k]pkA = (x2, y2), thus, KDF(k×pkA) = t; and since At this time, substituting KDF(k×pkA) = t and into it and continuing the derivation, that is:

[0213]

[0214] Thus, in the case where the re-encrypted data is not tampered with, it shows that the receiving end can decrypt the target data from the re-encrypted data by using the receiving end private key.

[0215] Of course, the calculation of the encryption key can also be At this time, after the re-encrypted data is obtained based on the encryption key, during decryption, the decrypted data M ′ The calculation can also be: The following will prove that this idea can also decrypt the target data m, that is:

[0216]

[0217] Therefore, using The encryption key calculated, after encrypting the encrypted data, the obtained re-encrypted data can also be decrypted by the receiving end.

[0218] In one embodiment, as Figure 7As shown, a data transmission method is provided. Taking the application of this method to the server 104 in FIG. 1 as an example, it includes the following steps:

[0219] Step S702, receive the encrypted data uploaded by the sending end. The encrypted data is obtained by encrypting the target data of the plaintext using the public key of the sending end.

[0220] Optionally, the sending end obtains the target data of the plaintext; encrypts the target data of the plaintext using the public key of the sending end to obtain the corresponding encrypted data. The sending end uploads the encrypted data to the server. The server receives the encrypted data uploaded by the sending end and stores the encrypted data.

[0221] The above-mentioned determination steps of the encrypted data include: the sending end generates a random number through a random number generation program; the sending end generates multiple temporary ciphertexts for encrypting the target data according to the random number, the public key of the sending end, and the target data. The sending end splices the multiple temporary ciphertexts to obtain the encrypted data corresponding to the target data.

[0222] Further, generating multiple temporary ciphertexts for encrypting the target data according to the random number, the public key of the sending end, and the target data includes: the sending end obtains the base point coordinates corresponding to the base point on the preset elliptic curve. The sending end generates the first temporary ciphertext according to the random number and the base point coordinates. The sending end generates the second temporary ciphertext according to the random number, the public key of the sending end, the bit length of the target data, and the target data. The sending end generates the third temporary ciphertext according to the random number, the public key of the sending end, and the target data. The sending end generates the fourth temporary ciphertext according to the first temporary ciphertext, the target data, and the third temporary ciphertext.

[0223] Further, splicing the multiple temporary ciphertexts to obtain the encrypted data corresponding to the target data includes: the sending end splices the first temporary ciphertext, the third temporary ciphertext, the fourth temporary ciphertext, and the second temporary ciphertext to obtain the encrypted data corresponding to the target data.

[0224] Further, generating the second temporary ciphertext according to the random number, the public key of the sending end, the bit length of the target data, and the target data includes: the sending end generates the coordinate of a data point on the elliptic curve according to the random number and the public key of the sending end. The sending end calculates a fixed-length key according to the coordinate of the data point and the bit length of the target data through a key derivation function. The bit length of the fixed-length key is equal to the bit length of the target data. The sending end performs an exclusive OR operation on the fixed-length key and the target data to obtain the second temporary ciphertext.

[0225] In a file sharing scenario, the target data is a shared file belonging to the target account, and the encrypted data corresponding to the target data is an encrypted file corresponding to the shared file.

[0226] Accordingly, exemplarily, the sending end stores the encrypted file corresponding to the target account and the shared file in the server. In the case where the sending end does not store the shared file, if the sending end needs to obtain the shared file or edit the shared file again. When the sending end logs in to the target account, the sending end downloads the encrypted file belonging to the target account from the server; the sending end decrypts the encrypted file using the private key of the sending end to obtain the shared file. Then, the sending end encrypts the decrypted shared file using the public key of the receiving end to obtain an encrypted file, and sends the encrypted file to the server. This encrypted file is used to instruct the server to forward the encrypted file to the receiving end. After the receiving end receives the encrypted file, the receiving end decrypts the received encrypted file using the private key of the receiving end to obtain the shared file.

[0227] Step S704: Receive the data transmission request sent by the sending end. The data transmission request is initiated by the sending end in response to a trigger operation for transmitting target data to the receiving end. The data transmission request carries an encryption key and a receiving end identifier. The encryption key is generated based on the public key of the sending end, the public key of the receiving end, and a specified parameter, and the specified parameter is shared between the sending end and the receiving end.

[0228] Optionally, the server receives the data transmission request sent by the sending end and parses the data transmission request to obtain the encryption key and the receiving end identifier.

[0229] Exemplarily, the steps for generating the encryption key include: The sending end uses a key derivation function to calculate a first temporary key based on the product of the random number used when generating the encrypted data corresponding to the target data and the public key of the sending end. The sending end uses a hash function to generate a hash value corresponding to the specified parameter. The sending end uses a key derivation function to calculate a second temporary key based on the product of the hash value, the random number, and the public key of the receiving end. The sending end performs an exclusive OR operation on the first temporary key and the second temporary key to obtain the encryption key.

[0230] Exemplarily, the specified parameter is a static specified parameter, and the static specified parameter is the receiving party account logged in to the receiving end. Accordingly, in response to a trigger operation for transmitting target data to the receiving end, generating an encryption key based on the public key of the sending end, the public key of the receiving end, and the specified parameter includes: The sending end responds to a trigger operation for transmitting target data to the receiving end logged in with the receiving party account, and the sending end generates an encryption key based on the public key of the sending end, the public key of the receiving end, and the receiving party account.

[0231] Exemplarily, the specified parameter is a dynamically specified parameter, and the dynamically specified parameter is a random verification code. Thus, in response to a trigger operation of transmitting target data to the receiving end, an encryption key is generated according to the public key of the sending end, the public key of the receiving end, and the specified parameter, including: the sending end generates a random verification code in response to a trigger operation of transmitting target data to the receiving end logged in with the receiving party's account. The sending end generates an encryption key according to the public key of the sending end, the public key of the receiving end, and the random verification code, and sends the random verification code to the receiving end.

[0232] Step S706, encrypt the uploaded encrypted data with the encryption key in the data transmission request to obtain re-encrypted data, and then send the re-encrypted data to the receiving end corresponding to the receiving end identifier in the data transmission request. The re-encrypted data is used to instruct the receiving end to decrypt and verify the received re-encrypted data with the receiving end private key and the specified parameter to obtain the target data.

[0233] Optionally, the server parses the encryption key and the receiving end identifier from the data transmission request. After the server updates the second temporary ciphertext in the uploaded encrypted data with the encryption key, re-encrypted data is obtained, and the re-encrypted data is obtained according to the updated second temporary ciphertext. The server determines the receiving end based on the receiving end identifier and sends the re-encrypted data to the receiving end. The re-encrypted data is used to instruct the receiving end to decrypt and verify the received re-encrypted data with the receiving end private key and the specified parameter to obtain the target data.

[0234] Exemplarily, since the re-encrypted data is formed by splicing the first temporary ciphertext, the third temporary ciphertext, the fourth temporary ciphertext, and the updated second temporary ciphertext. Therefore, after the server sends the re-encrypted data to the receiving end, the receiving end extracts the first temporary ciphertext and the updated second temporary ciphertext from the re-encrypted data. The receiving end decrypts according to the receiving end private key, the specified parameter, the extracted first temporary ciphertext, and the updated second temporary ciphertext to obtain decrypted data.

[0235] The receiving end extracts the third temporary ciphertext and the fourth temporary ciphertext from the re-encrypted data. The receiving end splices the first temporary ciphertext, the decrypted data obtained by decryption, and the extracted third temporary ciphertext to obtain spliced data. The receiving end calculates the hash value of the spliced data. If the hash value of the spliced data is equal to the fourth temporary ciphertext, it is verified that the re-encrypted data has not been tampered with.

[0236] It should be noted that the concepts and detailed processes mentioned in this embodiment can be referred to the previous text.

[0237] The above data transmission method involves receiving the encrypted data uploaded by the sending end. When it is necessary to transmit the target data to one or more receiving ends subsequently, the server can directly forward the encrypted data to the receiving end. Here, the encrypted data is obtained by encrypting the plaintext target data using the public key of the sending end. In this way, when it is necessary to transmit the target data to the receiving end securely and efficiently, the sending end does not need to download the encrypted data from the server, nor does it need to decrypt and encrypt the obtained encrypted data. Instead, the sending end only needs to, in response to the trigger operation of transmitting the target data to the receiving end, generate an encryption key in real time according to the public key of the sending end, the public key of the receiving end, and the specified parameter, and generate a data transmission request according to the encryption key and the receiving end identifier. At this time, the server receives the data transmission request sent by the sending end. In this way, the burden on the sending end is reduced. Subsequently, the server directly re-encrypts the uploaded encrypted data according to the encryption key in the data transmission request to obtain re-encrypted data, and sends the re-encrypted data to the receiving end corresponding to the receiving end identifier in the data transmission request. Since the specified parameter is shared between the sending end and the receiving end, the receiving end can use the private key of the receiving end and the specified parameter to decrypt and verify the received re-encrypted data to obtain the target data. In the entire data transmission, on the one hand, the server cannot know the target data, ensuring the secure transmission of the data. On the other hand, using the encryption key to re-encrypt the encrypted data also ensures that the receiving end can decrypt the re-encrypted data by itself to complete data reception. In addition, it avoids the sending end decrypting and re-encrypting, reduces the burden on the sending end, and improves the data transmission efficiency.

[0238] This application also provides an application scenario, and the above data transmission method can be applied to this application scenario. The description of this application scenario is as follows:

[0239] Nowadays, in order to save local storage space, the sending end corresponding to user A will store a certain or certain files (referred to as target file F) in a file storage server (such as a cloud disk). Also, in order to ensure the security of the target file F, the sending end will encrypt the target file F to obtain the corresponding encrypted file F1, and then store the encrypted file F1 on the server. For example, the sending end can use the public key of the sending end to encrypt the target file F to obtain the encrypted file F1, and then send the encrypted file F1 to the server. The server will generate a corresponding file identifier and store the file identifier corresponding to the encrypted file F1.

[0240] In the file sharing scenario, when the sender needs to share the target file F with the receiver corresponding to user B, in the related art, the sender needs to first download the above-mentioned encrypted file F1 from the server, decrypt the encrypted file F1 to obtain the plaintext target file F, then encrypt the target file F using the receiver's public key to obtain the corresponding encrypted file F2, and then send the encrypted file F2 to the receiver through the server, so as to realize the sharing of the target file from user A to user B. That is to say, since the encrypted file F1 can only be decrypted by the sender itself, the stored encrypted file F1 cannot be directly transmitted to the other party through the server. Every time data is transmitted, the sender needs to perform decryption and encryption operations, which increases the burden on the sender and reduces the data transmission efficiency.

[0241] In this scenario, when applying the data transmission method provided by the embodiments of the present application, when it is necessary to share the target file F with the receiver corresponding to user B, the sender can respond to the trigger operation of user A to transmit and share the file to the receiver, generate an encryption key according to the sender's public key, the receiver's public key and the receiver's identifier, generate a file transmission request according to the encryption key and the receiver's identifier. The file transmission request can also carry the file identifier of the target file, and send the file transmission request to the server. After receiving the file transmission request, the server can find the corresponding encrypted file F1 according to the file identifier, and encrypt the uploaded encrypted file F1 according to the encryption key in the file transmission request to obtain a new encrypted file F3. Then, according to the receiver's identifier in the file transmission request, the server can determine the receiver and send the new encrypted file F3 to the receiver. After receiving the new encrypted file F3, the receiver can use the receiver's private key and the receiver's identifier to decrypt and verify the received new encrypted file F3 to obtain the target file F. In this process, the server has no way of knowing the target file, ensuring the secure transmission of the file. The server uses the encryption key to encrypt the encrypted file F1 again to obtain a new encrypted file F3, ensuring that the receiver can decrypt the encrypted file F3 by itself to complete the file reception. In addition, the sender does not need to decrypt and encrypt again, reducing the burden on the sender and improving the file sharing efficiency.

[0242] Of course, it is not limited to this. The data transmission method provided by the present application can also be applied to other application scenarios. For example, in the payment scenario, to ensure that the account address of the payer is not leaked, when performing a payment operation, it is necessary to encrypt the account address to obtain an encrypted address, and transmit the encrypted address and payment information together to the institution where the account is located for resource deduction. In this scenario, the data transmission method of the embodiments of the present application can also be adopted. At this time, the target data is the account address, and the corresponding encrypted data is the encrypted account address. In this way, data transmission can be efficiently performed while ensuring that the account address is not leaked.

[0243] The above application scenarios are only illustrative. It can be understood that the application of the data transmission method provided by each embodiment of the present application is not limited to the above scenarios.

[0244] In a specific embodiment, as Figure 8 shown, it is a flowchart of the data transmission steps in an embodiment. In this embodiment, the interaction process among the sender, the receiver, and the server is involved.

[0245] Step S802, the sender encrypts the target data of the plaintext to obtain encrypted data.

[0246] Optionally, the sender uses the public key of the sender to encrypt the target data of the plaintext to obtain the corresponding encrypted data.

[0247] Exemplarily, the sender generates a random number through a random number generation program. Obtain the base point coordinates corresponding to the preset base point on the elliptic curve. The sender generates the first temporary ciphertext according to the random number and the base point coordinates. The sender generates the coordinate of the data point on the elliptic curve according to the random number and the public key of the sender. The sender calculates a fixed-length key according to the coordinate of the data point and the bit length of the target data through a key derivation function, and the bit length of the fixed-length key is equal to the bit length of the target data. The sender performs an exclusive OR operation on the fixed-length key and the target data to obtain the second temporary ciphertext. The sender generates the third temporary ciphertext according to the random number, the public key of the sender, and the target data. The sender generates the fourth temporary ciphertext according to the first temporary ciphertext, the target data, and the third temporary ciphertext. The sender splices the first temporary ciphertext, the third temporary ciphertext, the fourth temporary ciphertext, and the second temporary ciphertext to obtain the encrypted data corresponding to the target data.

[0248] Exemplarily, in a sharing scenario, the target data is a shared file belonging to the target account, and the encrypted data corresponding to the target data is the encrypted file corresponding to the shared file. Based on this, the sender stores the target account and the encrypted file corresponding to the shared file in the server correspondingly. The sender may store the target data or may not store the target data, which is not specifically limited.

[0249] In the case where the sender needs to obtain the target data again, the sender downloads the encrypted file belonging to the target account from the server. The sender decrypts the encrypted file using the private key of the sender to obtain the shared file. The sender encrypts the decrypted shared file using the public key of the receiver to obtain the encrypted file. The sender sends the encrypted file to the server, and the encrypted file is used to instruct the server to forward the encrypted file to the receiver, and the encrypted file is used to instruct the receiver to decrypt the received encrypted file using the private key of the receiver to obtain the shared file.

[0250] Step S804, the sender uploads the encrypted data to the server.

[0251] Step S806, the sender generates an encryption key.

[0252] Optionally, in response to a trigger operation of transmitting target data to the receiver, the sender generates an encryption key according to the sender's public key, the receiver's public key, and a specified parameter. Among them, the specified parameter is shared between the sender and the receiver.

[0253] Exemplarily, when the specified parameter is a static specified parameter, the static specified parameter is the receiver's account logged in to the receiver. In response to a trigger operation of transmitting target data to the receiver, the sender generates an encryption key according to the sender's public key, the receiver's public key, and the receiver's account.

[0254] Exemplarily, when the specified parameter is a dynamic specified parameter, the dynamic specified parameter is a random verification code. In response to a trigger operation of transmitting target data to the receiver, the sender generates a random verification code, generates an encryption key according to the sender's public key, the receiver's public key, and the random verification code, and sends the random verification code to the receiver.

[0255] Exemplarily, the sender determines a random number for generating encrypted data, and the sender calculates the product of the random number and the sender's public key. The sender uses a key derivation function to calculate a first temporary key according to the product. The sender uses a hash function to generate a hash value corresponding to the specified parameter. Using the key derivation function, according to the hash value, the product of the random number and the receiver's public key, calculate a second temporary key. Perform an exclusive OR operation on the first temporary key and the second temporary key to obtain the encryption key.

[0256] Step S808, the sender generates a data transmission request according to the encryption key and the receiver identifier.

[0257] Step S810, the sender sends the data transmission request to the server.

[0258] Step S812, the server parses the data transmission request to obtain the encryption key.

[0259] Step S814, the server encrypts the encrypted data using the encryption key to obtain re-encrypted data.

[0260] Optionally, the server parses the encryption key from the data transmission request. After the server updates the second temporary ciphertext in the uploaded encrypted data using the encryption key, the updated second temporary ciphertext is obtained. The server splices the first temporary ciphertext, the third temporary ciphertext, the fourth temporary ciphertext, and the updated second temporary ciphertext to obtain re-encrypted data.

[0261] Step S816, the server sends the re-encrypted data to the receiver.

[0262] Step S818: The receiving end decrypts and verifies the re-encrypted data using the receiving-end private key and the specified parameter pair to obtain the target data.

[0263] Optionally, the receiving end extracts the first temporary ciphertext and the updated second temporary ciphertext from the re-encrypted data. Decryption is performed according to the receiving-end private key, the specified parameter, the extracted first temporary ciphertext, and the updated second temporary ciphertext to obtain decrypted data. The receiving end extracts the third temporary ciphertext and the fourth temporary ciphertext from the re-encrypted data. The receiving end splices the first temporary ciphertext, the decrypted data obtained by decryption, and the extracted third temporary ciphertext to obtain spliced data. The receiving end calculates the hash value of the spliced data. If the hash value of the spliced data is equal to the fourth temporary ciphertext, the receiving end verifies that the re-encrypted data has not been tampered with, and then determines the decrypted data as the target data.

[0264] In this embodiment, first, the sending end encrypts the target data of the plaintext using the sending-end public key to obtain encrypted data. Secondly, the sending end uploads the encrypted data to the server, so that when it is necessary to transmit the target data to one or more receiving ends subsequently, the server can directly re-encrypt the encrypted data and forward the re-encrypted data to the receiving end. When it is necessary to securely and efficiently transmit the target data to the receiving end, the sending end does not need to download the encrypted data from the server, nor does it need to decrypt and encrypt the obtained encrypted data. Instead, it only needs to respond to the trigger operation of transmitting the target data to the receiving end, and generate an encryption key in real time according to the sending-end public key, the receiving-end public key, and the specified parameter. Next, the sending end generates a data transmission request according to the encryption key and the receiving-end identifier, and sends the data transmission request to the server, which reduces the burden on the sending end. After that, the server can re-encrypt the uploaded encrypted data according to the encryption key in the data transmission request. After obtaining the re-encrypted data, it sends the re-encrypted data to the receiving end corresponding to the receiving-end identifier in the data transmission request. Since the specified parameter is shared between the sending end and the receiving end, the receiving end can use the receiving-end private key and the specified parameter to decrypt and verify the received re-encrypted data to obtain the target data. In the whole data transmission, on the one hand, the server cannot know the target data, ensuring the secure transmission of the data. On the other hand, re-encrypting the encrypted data using the encryption key also ensures that the receiving end can decrypt the re-encrypted data by itself to complete data reception. In addition, it avoids the sending end decrypting the re-encrypted data, reducing the burden on the sending end and improving the data transmission efficiency.

[0265] It should be understood that although the steps in the flowcharts involved in the above-described embodiments are shown in sequence according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless there is a clear indication in this article, the execution of these steps has no strict order limit, and these steps can be executed in other orders. Moreover, at least some of the steps in the flowcharts involved in the above-described embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be executed alternately or in turn with at least some of the steps or stages in other steps or other steps.

[0266] Based on the same inventive concept, an embodiment of the present application further provides a data transmission device for implementing the data transmission method described above. The solution provided by this device to solve the problem is similar to the solution described in the above method. Therefore, the specific limitations in one or more embodiments of the data transmission device provided below can refer to the limitations on the data transmission method in the above text, and will not be repeated here.

[0267] In one embodiment, as Figure 9 shown, a data transmission device 900 is provided, including: a data upload module 902, a data transmission request generation module 904, and a data transmission request sending module 906, where:

[0268] The data upload module 902 is configured to upload the encrypted data corresponding to the target data to the server, and the encrypted data is obtained by encrypting the plaintext target data using the public key of the sending end;

[0269] The data transmission request generation module 904 is configured to, in response to a trigger operation for transmitting the target data to the receiving end, generate an encryption key according to the public key of the sending end, the public key of the receiving end, and a specified parameter, generate a data transmission request according to the encryption key and the receiving end identifier, the specified parameter is shared between the sending end and the receiving end, and the data transmission request is used to instruct the server to re-encrypt the uploaded encrypted data according to the encryption key, and after obtaining the re-encrypted data, send the re-encrypted data to the receiving end corresponding to the receiving end identifier, and the re-encrypted data is used to instruct the receiving end to use its corresponding private key of the receiving end and the specified parameter to decrypt and verify the received re-encrypted data to obtain the target data;

[0270] The data transmission request sending module 906 is configured to send a data transmission request to the server.

[0271] In some embodiments, the data upload module 902 is configured to obtain the plaintext target data; encrypt the plaintext target data using the public key of the sending end to obtain the corresponding encrypted data; and upload the encrypted data to the server.

[0272] In some embodiments, the device further includes a decryption module, where the target data is a shared file belonging to the target account, and the encrypted data corresponding to the target data is the encrypted file corresponding to the shared file; a data upload module 902, configured to store the encrypted file corresponding to the target account and the shared file in correspondence to the server; the decryption module, configured to, when the sending end logs in to the target account, download the encrypted file belonging to the target account from the server; and decrypt the encrypted file using the private key of the sending end to obtain the shared file.

[0273] In some embodiments, the device further includes a file sending module, which is configured to encrypt the decrypted shared file using the public key of the receiving end to obtain an encrypted file; and send the encrypted file to the server, where the encrypted file is used to instruct the server to forward the encrypted file to the receiving end, and the encrypted file is used to instruct the receiving end to decrypt the received encrypted file using the private key of the receiving end to obtain the shared file.

[0274] In some embodiments, the data upload module 902 is configured to generate a random number through a random number generation program; generate a plurality of temporary ciphertexts for encrypting the target data according to the random number, the public key of the sending end, and the target data; and splice the plurality of temporary ciphertexts to obtain the encrypted data corresponding to the target data.

[0275] In some embodiments, the data upload module 902 is configured to obtain the base point coordinates corresponding to a preset base point on an elliptic curve; generate a first temporary ciphertext according to the random number and the base point coordinates; generate a second temporary ciphertext according to the random number, the public key of the sending end, the bit length of the target data, and the target data; generate a third temporary ciphertext according to the random number, the public key of the sending end, and the target data; generate a fourth temporary ciphertext according to the first temporary ciphertext, the target data, and the third temporary ciphertext; and the data upload module 902 is configured to splice the first temporary ciphertext, the third temporary ciphertext, the fourth temporary ciphertext, and the second temporary ciphertext to obtain the encrypted data corresponding to the target data.

[0276] In some embodiments, the data upload module 902 is configured to generate the coordinate of a data point on the elliptic curve according to the random number and the public key of the sending end; calculate a fixed-length key with a bit length equal to that of the target data according to the coordinate of the data point and the bit length of the target data through a key derivation function; and perform an exclusive OR operation on the fixed-length key and the target data to obtain the second temporary ciphertext.

[0277] In some embodiments, the specified parameter is a static specified parameter, and the static specified parameter is the receiving party account that has logged in to the receiving end; a data transmission request generation module 904, configured to, in response to a trigger operation of transmitting the target data to the receiving end logged in with the receiving party account, generate an encryption key according to the public key of the sending end, the public key of the receiving end, and the receiving party account.

[0278] In some embodiments, the specified parameter is a dynamically specified parameter, and the dynamically specified parameter is a random verification code; the data transmission request generation module 904 is configured to, in response to a trigger operation of transmitting target data to a receiving end logged in with a recipient account, generate a random verification code, generate an encryption key according to the public key of the sending end, the public key of the receiving end, and the random verification code, and send the random verification code to the receiving end.

[0279] In some embodiments, the data transmission request generation module 904 is configured to use a key derivation function to calculate a first temporary key according to the product of the random number used when generating the encrypted data corresponding to the target data and the public key of the sending end; use a hash function to generate a hash value corresponding to the specified parameter; use a key derivation function to calculate a second temporary key according to the product of the hash value, the random number, and the public key of the receiving end; perform an exclusive OR operation on the first temporary key and the second temporary key to obtain an encryption key.

[0280] In some embodiments, the data transmission request sending module 904 is configured to parse the encryption key from the data transmission request; after updating the second temporary ciphertext in the uploaded encrypted data using the encryption key, obtain re-encrypted data, and the re-encrypted data is obtained according to the updated second temporary ciphertext.

[0281] In some embodiments, the re-encrypted data is formed by splicing the first temporary ciphertext, the third temporary ciphertext, the fourth temporary ciphertext, and the updated second temporary ciphertext; the data transmission request sending module 906 is configured to extract the first temporary ciphertext and the updated second temporary ciphertext from the re-encrypted data; decrypt according to the private key of the receiving end, the specified parameter, the extracted first temporary ciphertext, and the updated second temporary ciphertext to obtain decrypted data.

[0282] In some embodiments, the apparatus further includes a verification module, and the verification module is configured to extract the third temporary ciphertext and the fourth temporary ciphertext from the re-encrypted data; splice the first temporary ciphertext, the decrypted data obtained by decryption, and the extracted third temporary ciphertext to obtain spliced data; calculate the hash value of the spliced data; if the hash value of the spliced data is equal to the fourth temporary ciphertext, it is verified that the re-encrypted data has not been tampered with.

[0283] Based on the same inventive concept, an embodiment of the present application further provides a data transmission apparatus for implementing the data transmission method involved above. The implementation solution provided by the apparatus to solve the problem is similar to the implementation solution described in the above method. Therefore, the specific limitations in one or more embodiments of the data transmission apparatus provided below can refer to the limitations on the data transmission method in the above text, and will not be repeated here.

[0284] In one embodiment, as Figure 10As shown, a data transmission device 1000 is provided, including: a data receiving module 1002, a data transmission request receiving module 1004, and a data sending module 1006, where:

[0285] The data receiving module 1002 is configured to receive the encrypted data uploaded by the sending end, and the encrypted data is obtained by encrypting the target data of the plaintext using the public key of the sending end;

[0286] The data transmission request receiving module 1004 is configured to receive the data transmission request sent by the sending end. The data transmission request is initiated by the sending end in response to the trigger operation of transmitting the target data to the receiving end. The data transmission request carries the encryption key and the receiving end identifier. The encryption key is generated according to the public key of the sending end, the public key of the receiving end, and the specified parameter, and the specified parameter is shared between the sending end and the receiving end;

[0287] The data sending module 1006 is configured to re-encrypt the uploaded encrypted data according to the encryption key in the data transmission request. After obtaining the re-encrypted data, the data sending module sends the re-encrypted data to the receiving end corresponding to the receiving end identifier in the data transmission request. The re-encrypted data is used to instruct the receiving end to decrypt and verify the received re-encrypted data using the private key of the receiving end and the specified parameter, and then obtain the target data.

[0288] Each module in the above data transmission device can be implemented in whole or in part by software, hardware, and their combination. The above modules can be embedded in the processor of the computer device in hardware form or independent of it, or stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to the above modules.

[0289] In one embodiment, as Figure 11 shown, a data transmission system 1100 is provided. The system includes: a sending end 1102, a server 1104, and a receiving end 1106;

[0290] The sending end 1102 is configured to upload the encrypted data corresponding to the target data to the server 1102, and in response to the trigger operation of transmitting the target data to the receiving end 1106, generate an encryption key according to the public key of the sending end, the public key of the receiving end, and the specified parameter, generate a data transmission request according to the encryption key and the receiving end identifier, and send the data transmission request to the server 1104. The encrypted data is obtained by encrypting the target data of the plaintext using the public key of the sending end, and the specified parameter is shared between the sending end 1102 and the receiving end 1106;

[0291] The server 1104 is configured to receive the data transmission request, and re-encrypt the uploaded encrypted data according to the encryption key in the data transmission request. After obtaining the re-encrypted data, the server sends the re-encrypted data to the receiving end 1106 corresponding to the receiving end identifier;

[0292] A receiving end 1106, configured to receive the re-encrypted data, and after decrypting and verifying the received re-encrypted data using the private key of the receiving end and specified parameters, obtain the target data.

[0293] For the interaction process among the sending end 1102, the server 1104, and the receiving end 1106 in the data transmission system 1100 above, refer to the description in the foregoing text.

[0294] In one embodiment, a computer device is provided. The computer device can be a server or a terminal, and its internal structure diagram can be as shown in Figure 12 shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, abbreviated as I / O), and a communication interface. Among them, the processor, the memory, and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and external devices. The communication interface of the computer device is used to communicate with external terminals through a network connection. When the computer program is executed by the processor, it implements the data transmission method.

[0295] Those skilled in the art can understand that Figure 12 the structure shown in is only a block diagram of some structures related to the solution of this application, and does not constitute a limitation on the computer device to which the solution of this application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine some components, or have different component arrangements.

[0296] In one embodiment, a computer device is further provided, including a memory and a processor. A computer program is stored in the memory, and when the processor executes the computer program, the steps in the foregoing method embodiments are implemented.

[0297] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by the processor, the steps in the foregoing method embodiments are implemented.

[0298] In one embodiment, a computer program product is provided, including a computer program. When the computer program is executed by the processor, the steps in the foregoing method embodiments are implemented.

[0299] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use, and processing of relevant data need to comply with the relevant laws, regulations, and standards of relevant countries and regions.

[0300] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above methods. Among them, any reference to a memory, database, or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memories. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc. The databases involved in the embodiments provided in this application can include at least one of relational databases and non-relational databases. Non-relational databases can include distributed databases based on blockchain, etc., and are not limited thereto. The processors involved in the embodiments provided in this application can be general-purpose processors, central processors, graphics processors, digital signal processors, programmable logic devices, data processing logics based on quantum computing, etc., and are not limited thereto.

[0301] The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity of description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered as the scope described in this specification.

[0302] The above-described embodiments merely represent several implementation manners of the present application. The description thereof is relatively specific and detailed, but it should not be construed as a limitation on the patent scope of the present application. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present application, several modifications and improvements can still be made, and these all fall within the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the appended claims.

Claims

1. A data transmission method, characterized in that, Executed by the sender, the method includes: Uploading the encrypted data corresponding to the target data to the server, where the encrypted data is obtained by encrypting the plaintext target data using the sender's public key; In response to a trigger operation for transmitting the target data to the receiver, generating an encryption key according to the sender's public key, the receiver's public key, and a specified parameter, generating a data transmission request according to the encryption key and the receiver identifier, where the specified parameter is shared between the sender and the receiver, and the data transmission request is used to instruct the server to re-encrypt the uploaded encrypted data according to the encryption key, and after obtaining the re-encrypted data, send the re-encrypted data to the receiver corresponding to the receiver identifier, and the re-encrypted data is used to instruct the receiver to use its corresponding receiver's private key and the specified parameter to decrypt and verify the received re-encrypted data to obtain the target data; Sending the data transmission request to the server.

2. The method according to claim 1, characterized in that, The uploading the encrypted data corresponding to the target data to the server includes: Obtaining the plaintext target data; Encrypting the plaintext target data using the sender's public key to obtain the corresponding encrypted data; Uploading the encrypted data to the server.

3. The method according to claim 1, characterized in that, The target data is a shared file belonging to the target account, and the encrypted data corresponding to the target data is the encrypted file corresponding to the shared file; The uploading the encrypted data corresponding to the target data to the server includes: Correspondingly storing the encrypted file corresponding to the target account and the shared file to the server; The method further includes: When the sender logs in to the target account, downloading the encrypted file belonging to the target account from the server; Decrypting the encrypted file using the sender's private key to obtain the shared file.

4. The method according to claim 3, characterized in that, The method further includes: Encrypting the decrypted shared file using the receiver's public key to obtain an encrypted file; Sending the encrypted file to the server, where the encrypted file is used to instruct the server to forward the encrypted file to the receiver, and the encrypted file is used to instruct the receiver to decrypt the received encrypted file using the receiver's private key to obtain the shared file.

5. The method according to claim 2, characterized in that, The encrypting the plaintext target data using the sender's public key to obtain the corresponding encrypted data includes: Generating a random number through a random number generation program; Generating multiple temporary ciphertexts for encrypting the target data according to the random number, the sender's public key, and the target data; Concatenating the multiple temporary ciphertexts to obtain the encrypted data corresponding to the target data.

6. The method according to claim 5, characterized in that, The generating multiple temporary ciphertexts for encrypting the target data according to the random number, the sender's public key, and the target data includes: Obtaining the base point coordinates corresponding to the base point on the preset elliptic curve; Generating a first temporary ciphertext according to the random number and the base point coordinates; Generating a second temporary ciphertext according to the random number, the sender's public key, the bit length of the target data, and the target data; Generating a third temporary ciphertext according to the random number, the sender's public key, and the target data; Generate a fourth temporary ciphertext based on the first temporary ciphertext, the target data, and the third temporary ciphertext; The step of splicing the multiple temporary ciphertexts to obtain the encrypted data corresponding to the target data includes: Splice the first temporary ciphertext, the third temporary ciphertext, the fourth temporary ciphertext, and the second temporary ciphertext to obtain the encrypted data corresponding to the target data.

7. The method according to claim 6, characterized in that, The step of generating the second temporary ciphertext based on the random number, the public key of the sending end, the bit length of the target data, and the target data includes: Generate the coordinate of a data point on the elliptic curve based on the random number and the public key of the sending end; Calculate a fixed-length key through a key derivation function based on the coordinate of the data point and the bit length of the target data, where the bit length of the fixed-length key is equal to the bit length of the target data; Perform an exclusive OR operation on the fixed-length key and the target data to obtain the second temporary ciphertext.

8. The method according to claim 1, wherein The specified parameter is a static specified parameter, and the static specified parameter is the recipient account logged in to the receiving end; In response to a trigger operation for transmitting the target data to the receiving end, generate an encryption key based on the public key of the sending end, the public key of the receiving end, and the specified parameter, including: In response to a trigger operation for transmitting the target data to the receiving end logged in with the recipient account, generate an encryption key based on the public key of the sending end, the public key of the receiving end, and the recipient account.

9. The method according to claim 1, wherein The specified parameter is a dynamic specified parameter, and the dynamic specified parameter is a random verification code; in response to a trigger operation for transmitting the target data to the receiving end, generate an encryption key based on the public key of the sending end, the public key of the receiving end, and the specified parameter, including: In response to a trigger operation for transmitting the target data to the receiving end logged in with the recipient account, generate a random verification code, generate an encryption key based on the public key of the sending end, the public key of the receiving end, and the random verification code, and send the random verification code to the receiving end.

10. The method according to claim 1, wherein The step of generating an encryption key based on the public key of the sending end, the public key of the receiving end, and the specified parameter includes: Use a key derivation function to calculate a first temporary key based on the product of the random number used when generating the encrypted data corresponding to the target data and the public key of the sending end; Generate a hash value corresponding to the specified parameter using a hash function; Use the key derivation function to calculate a second temporary key based on the product of the hash value, the random number, and the public key of the receiving end; Perform an exclusive OR operation on the first temporary key and the second temporary key to obtain the encryption key.

11. The method according to claim 1, wherein The step in which the server re-encrypts the uploaded encrypted data using the encryption key to obtain re-encrypted data includes: Parse the encryption key from the data transmission request; After updating the second temporary ciphertext in the uploaded encrypted data using the encryption key, obtain re-encrypted data, where the re-encrypted data is obtained based on the updated second temporary ciphertext.

12. The method according to claim 1, wherein The re-encrypted data is formed by splicing the first temporary ciphertext, the third temporary ciphertext, the fourth temporary ciphertext, and the updated second temporary ciphertext; The steps for the receiving end to decrypt and verify the re-encrypted data received with the corresponding receiving end private key and the specified parameter to obtain the target data include: Extract a first temporary ciphertext and an updated second temporary ciphertext from the re-encrypted data; Decrypt according to the receiving end private key, the specified parameter, the extracted first temporary ciphertext and the updated second temporary ciphertext to obtain decrypted data.

13. The method according to claim 12, wherein The method further includes: Extract a third temporary ciphertext and a fourth temporary ciphertext from the re-encrypted data; Concatenate the first temporary ciphertext, the decrypted data obtained by decryption and the extracted third temporary ciphertext to obtain concatenated data; Calculate the hash value of the concatenated data; If the hash value of the concatenated data is equal to the fourth temporary ciphertext, it is verified that the re-encrypted data has not been tampered with.

14. A data transmission method, wherein Executed by the server, the method includes: Receive the encrypted data uploaded by the sending end, where the encrypted data is obtained by encrypting the target data of the plaintext with the sending end public key; Receive the data transmission request sent by the sending end, where the data transmission request is initiated by the sending end in response to a trigger operation for transmitting the target data to the receiving end, and the data transmission request carries an encryption key and a receiving end identifier, the encryption key is generated according to the sending end public key, the receiving end public key and a specified parameter, and the specified parameter is shared between the sending end and the receiving end; Re-encrypt the uploaded encrypted data according to the encryption key in the data transmission request to obtain re-encrypted data, and then send the re-encrypted data to the receiving end corresponding to the receiving end identifier in the data transmission request, where the re-encrypted data is used to instruct the receiving end to use the receiving end private key and the specified parameter to decrypt and verify the received re-encrypted data to obtain the target data.

15. A data transmission device, wherein The device includes: A data upload module, configured to upload the encrypted data corresponding to the target data to the server, where the encrypted data is obtained by encrypting the target data of the plaintext with the sending end public key; A data transmission request generation module, configured to, in response to a trigger operation for transmitting the target data to the receiving end, generate an encryption key according to the sending end public key, the receiving end public key and a specified parameter, generate a data transmission request according to the encryption key and the receiving end identifier, the specified parameter is shared between the sending end and the receiving end, and the data transmission request is used to instruct the server to re-encrypt the uploaded encrypted data according to the encryption key to obtain re-encrypted data, and then send the re-encrypted data to the receiving end corresponding to the receiving end identifier, where the re-encrypted data is used to instruct the receiving end to use its corresponding receiving end private key and the specified parameter to decrypt and verify the received re-encrypted data to obtain the target data; A data transmission request sending module, configured to send the data transmission request to the server.

16. A data transmission device, wherein The device includes: A data receiving module, configured to receive the encrypted data uploaded by the sending end, where the encrypted data is obtained by encrypting the target data of the plaintext with the sending end public key; A data transmission request receiving module, configured to receive a data transmission request sent by the sending end, where the data transmission request is initiated by the sending end in response to a trigger operation of transmitting the target data to the receiving end, and the data transmission request carries an encryption key and a receiving end identifier, the encryption key is generated according to the public key of the sending end, the public key of the receiving end, and a specified parameter, and the specified parameter is shared between the sending end and the receiving end; A data sending module, configured to re-encrypt the uploaded encrypted data according to the encryption key in the data transmission request, and after obtaining the re-encrypted data, send the re-encrypted data to the receiving end corresponding to the receiving end identifier in the data transmission request, where the re-encrypted data is used to instruct the receiving end to decrypt and verify the received re-encrypted data using the private key of the receiving end and the specified parameter to obtain the target data.

17. A data transmission system, characterized in that, The system includes a sending end, a server, and a receiving end; The sending end is configured to upload encrypted data corresponding to the target data to the server, and in response to a trigger operation of transmitting the target data to the receiving end, generate an encryption key according to the public key of the sending end, the public key of the receiving end, and a specified parameter, generate a data transmission request according to the encryption key and the receiving end identifier, and send the data transmission request to the server, where the encrypted data is obtained by encrypting the plaintext target data using the public key of the sending end, and the specified parameter is shared between the sending end and the receiving end; The server is configured to receive the data transmission request, re-encrypt the uploaded encrypted data according to the encryption key in the data transmission request, and after obtaining the re-encrypted data, send the re-encrypted data to the receiving end corresponding to the receiving end identifier; The receiving end is configured to receive the re-encrypted data, and decrypt and verify the received re-encrypted data using the private key of the receiving end and the specified parameter to obtain the target data.

18. A computer device, comprising a memory and a processor, the memory storing a computer program, characterized in that, When the processor executes the computer program, the steps of the method according to any one of claims 1 to 14 are implemented.

19. A computer-readable storage medium, having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, the steps of the method according to any one of claims 1 to 14 are implemented.

20. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, the steps of the method according to any one of claims 1 to 14 are implemented.