Data transmission method and apparatus, device, and storage medium

By using encryption methods that combine encryption keys and blockchain account public keys during data transmission, the problem of low data transmission security is solved, achieving higher security and contract storage efficiency.

CN116781390BActive Publication Date: 2025-12-16CHINA MOBILE INFORMATION TECHNOLOGY CO LTD +1
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202310883684.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-07-18
Publication Date
2025-12-16
Estimated Expiration
2043-07-18

AI Technical Summary

Technical Problem

Existing technologies have low data transmission security, and local randomization methods cannot fully protect privacy data.

Method used

The plaintext message is encrypted into ciphertext using an encryption key, and the encryption key is then encrypted using the blockchain's chain account public key to generate key ciphertext. This generates an encrypted message and uploads it to the target blockchain, combining symmetric and asymmetric encryption algorithms to improve data transmission security.

Benefits of technology

It improves the security of data transmission, is suitable for various data distribution scenarios, and reduces the storage space occupation and maintenance difficulty of smart contracts.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116781390B_ABST
    Figure CN116781390B_ABST
Patent Text Reader

Abstract

The application discloses a data transmission method and device, equipment and storage medium, comprising: when receiving the message plaintext submitted by the data uploader, the message plaintext is encrypted into data ciphertext through the encryption key; the chain account public key of the data receiver is acquired in the target blockchain according to the receiving account information corresponding to the message plaintext; the encryption key is encrypted through the chain account public key to generate the key ciphertext; the encrypted message packet is generated according to the data ciphertext, the key ciphertext and the receiving account information, and the encrypted message packet is uploaded to the target blockchain. The data to be transmitted is encrypted through the encryption key and the chain account public key, and the security of data transmission is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of data privacy protection technology, and in particular to a data transmission method, apparatus, device, and storage medium. Background Technology

[0002] Currently, local randomization is generally used to encrypt transmitted data. Although this method can reduce the amount of information loss, it cannot fully protect private data because it uses local randomization, resulting in low security during data transmission. Summary of the Invention

[0003] The main objective of this invention is to provide a data transmission method, apparatus, device, and storage medium, aiming to solve the technical problem of low data transmission security in the prior art.

[0004] To achieve the above objectives, the present invention provides a data transmission method, the method comprising the following steps:

[0005] Upon receiving a plaintext message submitted by the data uploader, the plaintext message is encrypted into ciphertext using an encryption key;

[0006] Based on the receiving account information corresponding to the plaintext of the message, obtain the public key of the data recipient's chain account in the target blockchain;

[0007] The encryption key is encrypted using the chain account public key to generate key ciphertext;

[0008] An encrypted message is generated based on the encrypted data, the encrypted key, and the receiving account information, and then the encrypted message is uploaded to the target blockchain.

[0009] Optionally, the step of encrypting the plaintext message submitted by the data uploader into ciphertext using an encryption key upon receiving the plaintext message includes:

[0010] Upon receiving a plaintext message submitted by the data uploader, a symmetric encryption key is randomly generated;

[0011] The plaintext message is encrypted using the symmetric encryption key to generate ciphertext.

[0012] Optionally, encrypting the encryption key using the chain account public key to generate key ciphertext includes:

[0013] Convert the chain account public key into an asymmetric encryption public key;

[0014] The encryption key is encrypted using the asymmetric encryption public key to generate key ciphertext.

[0015] Optionally, converting the chain account public key into an asymmetric encryption public key includes:

[0016] The public key of the chain account is parsed to obtain the public key data of the chain account.

[0017] The asymmetric encryption public key corresponding to the chain account public key is generated based on the public key data and the preset public key identifier.

[0018] Optionally, the step of generating an encrypted message based on the encrypted data, the encrypted key, and the receiving account information, and uploading the encrypted message to the target blockchain, includes:

[0019] A message header is generated based on the key ciphertext and the receiving account information, and the message header is uploaded to the smart contract of the target blockchain;

[0020] The message body is generated based on the encrypted data, and the message body is stored in the transaction log of the target blockchain.

[0021] Optionally, after generating the message body based on the encrypted data and storing the message body in the transaction log of the target blockchain, the method further includes:

[0022] The data collaboration module integrates the message header and the message body into an encrypted message and then synchronizes it to the off-chain database for storage.

[0023] Upon receiving a message query request from the data recipient, the encrypted message is queried in the off-chain database based on the receiving account information.

[0024] The encrypted message is decrypted to generate plaintext, and the plaintext is returned to the data receiver.

[0025] Optionally, the step of decrypting the encrypted message to generate plaintext and returning the plaintext to the data receiver includes:

[0026] The decryption key is obtained by decrypting the message header in the encrypted message using the data receiver's preset private key.

[0027] The message body in the encrypted message is decrypted using the decryption key to obtain the plaintext message, and the plaintext message is returned to the data receiver.

[0028] Furthermore, to achieve the above objectives, the present invention also proposes a data transmission device, the device comprising:

[0029] The first encryption module is used to encrypt the plaintext message submitted by the data uploader into ciphertext using an encryption key when it receives the plaintext message.

[0030] The acquisition module is used to obtain the public key of the data receiver's chain account in the target blockchain based on the receiving account information corresponding to the plaintext of the message;

[0031] The second encryption module is used to encrypt the encryption key using the chain account public key to generate key ciphertext;

[0032] The generation module is used to generate an encrypted message message based on the encrypted data, the encrypted key, and the receiving account information, and upload the encrypted message message to the target blockchain.

[0033] Furthermore, to achieve the above objectives, the present invention also proposes a data transmission device, the device comprising: a memory, a processor, and a data transmission program stored in the memory and executable on the processor, the data transmission program being configured to implement the steps of the data transmission method as described above.

[0034] Furthermore, to achieve the above objectives, the present invention also proposes a storage medium storing a data transmission program, which, when executed by a processor, implements the steps of the data transmission method described above.

[0035] This invention, upon receiving a plaintext message submitted by a data uploader, encrypts the plaintext message into ciphertext using an encryption key; obtains the data receiver's chain account public key from the target blockchain based on the receiving account information corresponding to the plaintext message; encrypts the encryption key using the chain account public key to generate key ciphertext; generates an encrypted message based on the ciphertext, the key ciphertext, and the receiving account information, and uploads the encrypted message to the target blockchain. This invention encrypts the plaintext message into ciphertext using an encryption key, encrypts the encryption key into key ciphertext using the data receiver's chain account public key, and uploads the encrypted message generated based on the ciphertext, key ciphertext, and encryption key to the blockchain. By encrypting the transmitted data using the encryption key and the chain account public key, the security of data transmission is improved. Attached Figure Description

[0036] Figure 1 This is a schematic diagram of the structure of the data transmission device in the hardware operating environment involved in the embodiments of the present invention;

[0037] Figure 2 This is a flowchart illustrating the first embodiment of the data transmission method of the present invention;

[0038] Figure 3This is a flowchart illustrating the second embodiment of the data transmission method of the present invention;

[0039] Figure 4 This is a flowchart illustrating the third embodiment of the data transmission method of the present invention;

[0040] Figure 5 This is a schematic diagram of the data transmission system framework in one embodiment of the data transmission method of the present invention;

[0041] Figure 6 This is a schematic diagram of data transmission in one embodiment of the data transmission method of the present invention;

[0042] Figure 7 This is a structural block diagram of the first embodiment of the data transmission device of the present invention.

[0043] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0044] It should be understood that the specific embodiments described herein are for illustrative purposes only and are not intended to limit the scope of the invention.

[0045] Reference Figure 1 , Figure 1 This is a schematic diagram of the data transmission device structure of the hardware operating environment involved in the embodiments of the present invention.

[0046] like Figure 1 As shown, the data transmission device may include: a processor 1001, such as a central processing unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. The communication bus 1002 is used to enable communication between these components. The user interface 1003 may include a display screen or an input unit such as a keyboard; optionally, the user interface 1003 may also include a standard wired interface or a wireless interface. The network interface 1004 may optionally include a standard wired interface or a wireless interface (such as a Wireless-Fidelity (Wi-Fi) interface). The memory 1005 may be high-speed random access memory (RAM) or stable non-volatile memory (NVM), such as a disk drive. The memory 1005 may also optionally be a storage device independent of the aforementioned processor 1001.

[0047] Those skilled in the art will understand that Figure 1The structure shown does not constitute a limitation on the data transmission device and may include more or fewer components than shown, or combine certain components, or have different component arrangements.

[0048] like Figure 1 As shown, the memory 1005, which serves as a storage medium, may include an operating system, a network communication module, a user interface module, and a data transmission program.

[0049] exist Figure 1 In the data transmission device shown, the network interface 1004 is mainly used for data communication with the network server; the user interface 1003 is mainly used for data interaction with the user; the processor 1001 and the memory 1005 can be set in the data transmission device. The data transmission device calls the data transmission program stored in the memory 1005 through the processor 1001 and executes the data transmission method provided in the embodiment of the present invention.

[0050] This invention provides a data transmission method, referring to... Figure 2 , Figure 2 This is a flowchart illustrating the first embodiment of the data transmission method of the present invention.

[0051] In this embodiment, the data transmission method includes the following steps:

[0052] Step S10: Upon receiving a plaintext message submitted by the data uploader, encrypt the plaintext message into ciphertext using an encryption key.

[0053] It should be noted that the executing entity in this embodiment can be a computing service device with data processing, network communication, and program execution functions, such as a tablet computer, personal computer, or mobile phone, or an electronic device, data transmission device, or software development kit capable of performing the above functions. The following uses a software development kit as an example to illustrate this embodiment and the subsequent embodiments.

[0054] It is understandable that the data uploader can be the party that needs to send data; the message plaintext can be the plaintext of the data to be sent; the encryption key can be a key generated by the system to encrypt the message plaintext; and the data ciphertext can be the ciphertext generated after encrypting the message plaintext.

[0055] Step S20: Obtain the public key of the data receiver's chain account from the target blockchain based on the receiving account information corresponding to the plaintext message.

[0056] Understandably, the receiving account information can be the information of the account receiving the plaintext message, or it can be submitted by the data uploader. The target blockchain can be the EOS blockchain or other blockchains with the same or similar functions. Compared to other blockchain systems, the EOS blockchain provides a readable and easy-to-remember account name as the account address for blockchain system users. The EOS blockchain's account system implements a decentralized, PKI-like system. Users can find the corresponding public key through the account name for signature verification. At the same time, account holders can update their public keys at any time through the EOS blockchain system, reducing public key maintenance costs. The chain account public key can be the public key stored on the target blockchain corresponding to the recipient's account information.

[0057] Step S30: Encrypt the encryption key using the chain account public key to generate key ciphertext.

[0058] It is understandable that the key ciphertext can be the ciphertext generated after encrypting the encryption key.

[0059] In practice, the encryption key is asymmetrically encrypted using the chain account public key to generate the key ciphertext.

[0060] Step S40: Generate an encrypted message based on the encrypted data, the encrypted key, and the receiving account information, and upload the encrypted message to the target blockchain.

[0061] In practice, the data uploader submits the plaintext message and the receiving account information. The software development kit generates an encryption key to encrypt the plaintext message into ciphertext. Based on the receiving account information, the data uploader queries the public key of the data recipient's chain account on the EOS blockchain. The public key of the chain account is used to encrypt the encryption key into ciphertext. Based on the ciphertext, ciphertext, and receiving account information, an encrypted message is generated and uploaded to the EOS blockchain.

[0062] Furthermore, to improve the security of data transmission, step S10 includes: upon receiving a plaintext message submitted by the data uploader, randomly generating a symmetric encryption key; and encrypting the plaintext message using the symmetric encryption key to generate ciphertext data.

[0063] It is understandable that plaintext messages are symmetrically encrypted. Symmetric encryption methods include, but are not limited to, AES (Advanced Encryption Standard) symmetric encryption and SM4 symmetric encryption.

[0064] In practice, the data uploader submits the plaintext message and the username of the data receiver. The software development kit randomly generates an AES or SM4 symmetric encryption key. The plaintext message is encrypted into ciphertext using the symmetric encryption key. The corresponding chain account public key is obtained from the target blockchain based on the username. The chain account public key is used to encrypt the symmetric encryption key into ciphertext. The receiver's username and ciphertext are used as the message header, and the ciphertext is used as the message body. After forming an encrypted message message, it is uploaded to the blockchain.

[0065] In this embodiment, upon receiving a plaintext message submitted by the data uploader, the plaintext message is encrypted into ciphertext using an encryption key. The receiver's chain account public key is obtained from the target blockchain based on the receiving account information corresponding to the plaintext message. The encryption key is then encrypted using the chain account public key to generate a key ciphertext. An encrypted message is generated based on the ciphertext, the key ciphertext, and the receiving account information, and uploaded to the target blockchain. This embodiment encrypts the plaintext message into ciphertext using an encryption key, encrypts the encryption key into key ciphertext using the receiver's chain account public key, and uploads the encrypted message generated based on the ciphertext, key ciphertext, and encryption key to the blockchain. By encrypting the transmitted data using the encryption key and the chain account public key, the security of data transmission is improved.

[0066] refer to Figure 3 , Figure 3 This is a flowchart illustrating the second embodiment of the data transmission method of the present invention.

[0067] Based on the first embodiment described above, in this embodiment, step S30 includes:

[0068] Step S301: Convert the chain account public key into an asymmetric encryption public key.

[0069] As one implementation method, asymmetric encryption can be achieved through ECC (Elliptic Curve Cryptography) encryption.

[0070] Step S302: Encrypt the encryption key using the asymmetric encryption public key to generate key ciphertext.

[0071] In practice, the chain account public key is first converted into an asymmetric encryption public key, and then the symmetric encryption key is encrypted using the asymmetric encryption public key to generate the key ciphertext.

[0072] Furthermore, in order to convert the chain account public key into a public key for asymmetric encryption to improve the security of data transmission, step S301 includes: parsing the chain account public key to obtain the public key data of the chain account public key; and generating the asymmetric encryption public key corresponding to the chain account public key based on the public key data and a preset public key identifier.

[0073] It is understandable that public key data can be data of the chain account's public key; the preset public key identifier includes: public key type identifier and public key algorithm identifier.

[0074] In practice, the public key of the chain account is parsed to obtain the public key data of the chain account public key. This public key data is then added to the public key data of the asymmetric encryption public key. A public key type identifier and a public key algorithm identifier are added to the asymmetric encryption public key to generate the asymmetric encryption public key corresponding to the chain account public key.

[0075] It should be noted that this embodiment provides both symmetric and asymmetric encryption, which can provide different data encryption options to the uplink, thereby improving the security of data transmission.

[0076] In one example, the chain account public key can be an EOS public key, and the asymmetric encryption can be ECC encryption. When using the EOS public key for encryption, it needs to be converted to an ECC public key. The EOS public key is in WIF (wallet import format) format. A WIF public key is a value obtained by BASE58 encoding the y-value at the point (x,y) on an elliptic curve. An ECC public key is generally in PEM format. A PEM public key contains a type identifier, a public key algorithm identifier, parameters, and public key data. Information such as data (e.g., WIF format public key) needs to be converted to PEM format public key when using the EOS public key for asymmetric encryption. Specifically, the public key conversion process includes: 1. BASE58 decoding: Decode the WIF format EOS public key using BASE58 to obtain the y-values ​​of the elliptic curve points; 2. Filling parameter information: The EOS public key uses the Secp256k1 format, requiring the base point G, curve coefficients a and b, and curve order n to be included in the parameter information; 3. Obtaining elliptic curve point information: Obtain the x-values ​​of the elliptic curve points using the parameter information and y-values, and include (x, y) in the public key data of the ECC public key; 4. Adding a type identifier: Add a type identifier to the PEM format ECC public key to indicate that the public key is an ECC public key; 5. Adding a public key algorithm identifier: Add a public key algorithm identifier to the PEM format ECC public key to indicate that the Secp256k1 curve is used; 6. Format conversion: Convert the constructed public key data structure to PEM format to form a complete PEM format ECC public key.

[0077] It should be noted that ECC asymmetric encryption, based on the core encryption algorithm, implements a dynamic privacy encryption strategy. This dynamic privacy encryption strategy, based on both symmetric and asymmetric encryption algorithms, can meet the needs of single-user-to-single-user and single-user-to-multi-user data distribution scenarios. In the single-user-to-multi-user scenario: when the data uploader submits a plaintext message and adds multiple recipient accounts, the software development kit randomly generates a symmetric encryption key and uses this key to encrypt the plaintext message into ciphertext. Based on each recipient account, the corresponding chain account public key is obtained on the EOS blockchain. This public key is then converted into a corresponding symmetric encryption public key. The encryption key is then encrypted using the symmetric encryption public key to obtain the ciphertext key corresponding to the recipient account. The recipient account, the ciphertext data, and the corresponding ciphertext key are combined to form an encrypted message for each data recipient, and these encrypted message messages are then uploaded to the EOS blockchain.

[0078] This embodiment converts the chain account public key into an asymmetric encryption public key; the encryption key is then encrypted using the asymmetric encryption public key to generate key ciphertext. This embodiment converts the chain account public key into an asymmetric encryption public key for asymmetric encryption, and uses the asymmetric encryption public key to encrypt the symmetric encryption key into key ciphertext. This combination of symmetric and asymmetric encryption improves the security of data transmission and is applicable to various data distribution scenarios.

[0079] refer to Figure 4 , Figure 4 This is a flowchart illustrating the third embodiment of the data transmission method of the present invention.

[0080] Based on the above embodiments, in this embodiment, step S40 includes:

[0081] Step S401: Generate a message header based on the key ciphertext and the receiving account information, and upload the message header to the smart contract of the target blockchain.

[0082] Understandably, smart contracts can be used to store messages; the message header can be a data header that records message information.

[0083] Step S402: Generate a message body based on the encrypted data and store the message body in the transaction log of the target blockchain.

[0084] It is understandable that the message body can be the entity that records the transmitted data.

[0085] In practice, the software development kit generates a message header based on the key ciphertext and the receiving account information, stores the message header in the smart contract of the EOS blockchain, uses the data ciphertext as the message body, and stores the message body in the transaction log of the EOS blockchain.

[0086] It should be noted that the EOS blockchain is based on EOS's account and key algorithm. Generally, the platform needs to develop a corresponding smart contract for message storage. All encrypted message messages from users are uploaded to this smart contract. However, encrypted message messages require a large amount of storage space. Storing all encrypted message messages in the smart contract table would result in the smart contract's state table occupying a large amount of storage space, making the smart contract difficult to maintain. To reduce the storage space occupied by the smart contract and thus reduce its maintenance difficulty, this embodiment only stores the message header in the smart contract to record the message sending and receiving records. The message body will be stored in the EOS transaction log. Specifically, a complete encrypted message message includes `from` (sender's account), `receiver` (receiver's account), and `receiver_key` (receiver key). The encrypted message consists of three parts: the sender's EOS public key, the encrypted key, and the encrypted data. The encrypted data is the main body of the encrypted message and occupies a large amount of storage space. To reduce the storage space occupied by the data table of the on-chain smart contract, only the header data of the message table—from (sender's account), receiver (receiver's account), receiver_key (receiver's EOS public key), and encrypted_key (encryption key)—is submitted to the smart contract interface. This stores the message header in the smart contract, while the encrypted data is only stored in the transaction log. Finally, the message header and message body are combined to form a complete encrypted message and then stored off-chain for persistent storage.

[0087] Furthermore, to improve the security of data transmission, after step S402, the method further includes: integrating the message header and the message body into an encrypted message message through the data collaboration module and then synchronizing it to the off-chain database for storage; upon receiving a message query request from the data receiver, querying the encrypted message message in the off-chain database according to the receiving account information; decrypting the encrypted message message to generate plaintext, and returning the plaintext to the data receiver.

[0088] It is understandable that the data collaboration module can be a module used to assemble the message header and message body into a complete encrypted message message for off-chain persistent storage; the message query request can be a request to query the encrypted message message.

[0089] In practice, the data collaboration module combines the message header stored in the smart contract and the message body stored in the transaction log into a complete encrypted message. The encrypted message is then synchronized to the off-chain for persistent storage. An off-chain persistent data API is built to allow users to query and retrieve the corresponding ciphertext. Based on the receiving account information, the corresponding encrypted message is queried in the off-chain database, encrypted into plaintext, and returned to the data recipient.

[0090] Furthermore, to improve the security of data transmission, the step of decrypting the encrypted message to generate plaintext and returning the plaintext to the data receiver includes: decrypting the message header in the encrypted message using the data receiver's preset private key to obtain a decryption key; decrypting the message body in the encrypted message using the decryption key to obtain plaintext, and returning the plaintext to the data receiver.

[0091] It is understandable that the preset private key can be the private key of the data recipient that corresponds to the asymmetric encryption public key.

[0092] In one example, refer to Figure 5 , Figure 5 This is a schematic diagram of the data transmission system, which includes the JAVASDK (Software Development Kit), the EOS blockchain, and a monitoring system. Upon receiving a plaintext message and recipient account submitted by the user, the SDK randomly generates an AES or SM4 encryption key. It then performs AES or SM4 symmetric encryption on the plaintext message to generate ciphertext. Based on the recipient account, it retrieves the corresponding EOS public key from the EOS blockchain account, converts it into an ECC public key for asymmetric encryption, and uses the ECC public key to encrypt the encryption key into ciphertext. The recipient account and ciphertext are uploaded as the message header to the EOS blockchain smart contract, while the ciphertext is stored as the message body in the EOS blockchain transaction log. The data collaboration module combines the message header and message body into a complete encrypted message for persistent off-chain storage, providing an off-chain storage API. Upon receiving a message query request, the SDK retrieves the corresponding encrypted message based on the recipient account information via the off-chain storage API. It decrypts the ciphertext using a pre-set private key to obtain the decryption key, decrypts the ciphertext using the decryption key to obtain the plaintext message, and returns the plaintext message to the data recipient. The monitoring system can monitor the user's message sending and receiving records based on the message header.

[0093] In another example, refer to Figure 6 , Figure 6This diagram illustrates data transmission. Assume A is the data uploader and B is the data receiver. A submits a plaintext message and B's username via an SDK. The SDK randomly generates an AES or SM4 symmetric encryption key. The plaintext message is then encrypted using the symmetric encryption key to obtain ciphertext. Based on B's username, A searches for the corresponding EOS public key in the EOS blockchain's account module. This EOS public key is converted to an ECC public key, which is then used to encrypt the symmetric encryption key into ciphertext. B's username, ciphertext, and ciphertext are encapsulated into an encrypted message. This encrypted message is then stored on the EOS blockchain's smart contract, and the smart contract's data is synchronized to off-chain storage. The off-chain storage is monitored for encrypted messages. A retrieves the corresponding encrypted message based on B's username, decrypts the ciphertext using B's pre-set private key to obtain the symmetric encryption decryption key, and uses this decryption key to decrypt the ciphertext back into plaintext, returning it to B.

[0094] This embodiment generates a message header based on the key ciphertext and the receiving account information, and uploads the message header to the smart contract of the target blockchain; it generates a message body based on the data ciphertext, and stores the message body in the transaction log of the target blockchain. This embodiment stores the message header in the smart contract and the message body in the transaction log, reducing the pressure on off-chain storage and lowering the maintenance difficulty of the smart contract.

[0095] Furthermore, embodiments of the present invention also propose a storage medium storing a data transmission program, which, when executed by a processor, implements the steps of the data transmission method described above.

[0096] Reference Figure 7 , Figure 7 This is a structural block diagram of the first embodiment of the data transmission device of the present invention.

[0097] like Figure 7 As shown, the data transmission device proposed in this embodiment of the invention includes:

[0098] The first encryption module 10 is used to encrypt the plaintext message submitted by the data uploader into ciphertext using an encryption key when it receives the plaintext message.

[0099] The acquisition module 20 is used to acquire the public key of the chain account of the data receiver in the target blockchain based on the receiving account information corresponding to the plaintext of the message;

[0100] The second encryption module 30 is used to encrypt the encryption key using the chain account public key to generate key ciphertext;

[0101] The generation module 40 is used to generate an encrypted message message based on the data ciphertext, the key ciphertext, and the receiving account information, and upload the encrypted message message to the target blockchain.

[0102] In this embodiment, upon receiving a plaintext message submitted by the data uploader, the plaintext message is encrypted into ciphertext using an encryption key. The receiver's chain account public key is obtained from the target blockchain based on the receiving account information corresponding to the plaintext message. The encryption key is then encrypted using the chain account public key to generate a key ciphertext. An encrypted message is generated based on the ciphertext, the key ciphertext, and the receiving account information, and uploaded to the target blockchain. This embodiment encrypts the plaintext message into ciphertext using an encryption key, encrypts the encryption key into key ciphertext using the receiver's chain account public key, and uploads the encrypted message generated based on the ciphertext, key ciphertext, and encryption key to the blockchain. By encrypting the transmitted data using the encryption key and the chain account public key, the security of data transmission is improved.

[0103] Based on the first embodiment of the data transmission device of the present invention described above, a second embodiment of the data transmission device of the present invention is proposed.

[0104] In this embodiment, the first encryption module 10 is further configured to randomly generate a symmetric encryption key when receiving a plaintext message submitted by the data uploader; and encrypt the plaintext message using the symmetric encryption key to generate ciphertext data.

[0105] The second encryption module 30 is further configured to convert the chain account public key into an asymmetric encryption public key; and to encrypt the encryption key using the asymmetric encryption public key to generate key ciphertext.

[0106] The second encryption module 30 is further configured to parse the public key of the chain account to obtain the public key data of the chain account public key; and generate an asymmetric encryption public key corresponding to the chain account public key based on the public key data and a preset public key identifier.

[0107] The generation module 40 is further configured to generate a message header based on the key ciphertext and the receiving account information, and upload the message header to the smart contract of the target blockchain; generate a message body based on the data ciphertext, and store the message body in the transaction log of the target blockchain.

[0108] The generation module 40 is further configured to integrate the message header and the message body into an encrypted message message through the data collaboration module and then synchronize it to the off-chain database for storage; when receiving a message query request from the data receiver, it queries the encrypted message message in the off-chain database according to the receiving account information; decrypts the encrypted message message to generate a plaintext message, and returns the plaintext message to the data receiver.

[0109] The generation module 40 is further configured to decrypt the message header in the encrypted message message using the preset private key of the data receiver to obtain a decryption key; decrypt the message body in the encrypted message message using the decryption key to obtain the message plaintext; and return the message plaintext to the data receiver.

[0110] Other embodiments or specific implementations of the data transmission device of the present invention can be referred to the above-described method embodiments, and will not be repeated here.

[0111] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or system. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or system that includes that element.

[0112] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0113] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as read-only memory / random access memory, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of the present invention.

[0114] The above are merely preferred embodiments of the present invention and do not limit the scope of the patent. Any equivalent structural or procedural transformations made based on the description and drawings of the present invention, or direct or indirect applications in other related technical fields, are similarly included within the scope of patent protection of the present invention.

Claims

1. A data transmission method, characterized in that, The method includes: Upon receiving a plaintext message submitted by the data uploader, the plaintext message is encrypted into ciphertext using an encryption key; Based on the receiving account information corresponding to the plaintext message, the public key of the data receiver's chain account is obtained in the target blockchain, where the target blockchain is the EOS blockchain; The encryption key is encrypted using the chain account public key to generate key ciphertext; An encrypted message is generated based on the encrypted data, the encrypted key, and the receiving account information, and the encrypted message is uploaded to the target blockchain. The step of encrypting the encryption key using the chain account public key to generate key ciphertext includes: Convert the chain account public key from WIF format to a PEM format asymmetric encryption public key; The symmetric encryption key is encrypted using the asymmetric encryption public key to generate the key ciphertext.

2. The method as described in claim 1, characterized in that, Upon receiving a plaintext message submitted by the data uploader, the step of encrypting the plaintext message into ciphertext using an encryption key includes: Upon receiving a plaintext message submitted by the data uploader, a symmetric encryption key is randomly generated; The plaintext message is encrypted using the symmetric encryption key to generate ciphertext.

3. The method as described in claim 1, characterized in that, The step of converting the chain account public key into an asymmetric encryption public key includes: The public key of the chain account is parsed to obtain the public key data of the chain account. The asymmetric encryption public key corresponding to the chain account public key is generated based on the public key data and the preset public key identifier.

4. The method according to any one of claims 1-3, characterized in that, The step of generating an encrypted message based on the encrypted data, the encrypted key, and the receiving account information, and uploading the encrypted message to the target blockchain, includes: A message header is generated based on the key ciphertext and the receiving account information, and the message header is uploaded to the smart contract of the target blockchain; The message body is generated based on the encrypted data, and the message body is stored in the transaction log of the target blockchain.

5. The method as described in claim 4, characterized in that, After generating the message body based on the encrypted data and storing the message body in the transaction log of the target blockchain, the method further includes: The data collaboration module integrates the message header and the message body into an encrypted message and then synchronizes it to the off-chain database for storage. Upon receiving a message query request from the data recipient, the encrypted message is queried in the off-chain database based on the receiving account information. The encrypted message is decrypted to generate plaintext, and the plaintext is returned to the data receiver.

6. The method as described in claim 5, characterized in that, The step of decrypting the encrypted message to generate plaintext and returning the plaintext to the data receiver includes: The decryption key is obtained by decrypting the message header in the encrypted message using the data receiver's preset private key. The message body in the encrypted message is decrypted using the decryption key to obtain the plaintext message, and the plaintext message is returned to the data receiver.

7. A data transmission device, characterized in that, The device includes: The first encryption module is used to encrypt the plaintext message submitted by the data uploader into ciphertext using an encryption key when it receives the plaintext message. The acquisition module is used to acquire the public key of the data receiver's chain account in the target blockchain based on the receiving account information corresponding to the plaintext of the message, wherein the target blockchain is the EOS blockchain; The second encryption module is used to encrypt the encryption key using the chain account public key to generate key ciphertext; The generation module is used to generate an encrypted message message based on the encrypted data, the encrypted key, and the receiving account information, and upload the encrypted message message to the target blockchain; The step of encrypting the encryption key using the chain account public key to generate key ciphertext includes: Convert the chain account public key from WIF format to a PEM format asymmetric encryption public key; The symmetric encryption key is encrypted using the asymmetric encryption public key to generate the key ciphertext.

8. A data transmission device, characterized in that, The device includes: a memory, a processor, and a data transfer program stored in the memory and executable on the processor, the data transfer program being configured to implement the steps of the data transfer method as described in any one of claims 1 to 6.

9. A storage medium, characterized in that, The storage medium stores a data transmission program, which, when executed by a processor, implements the steps of the data transmission method as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Blockchain smart contract-based data writing method, device and storage medium

    WO2019127265A1