CN113132484B - Data transmission method and device - Google Patents

Data transmission method and device Download PDF

Info

Publication number
CN113132484B
CN113132484B CN202110423115.1A CN202110423115A CN113132484B CN 113132484 B CN113132484 B CN 113132484B CN 202110423115 A CN202110423115 A CN 202110423115A CN 113132484 B CN113132484 B CN 113132484B
Authority
CN
China
Prior art keywords
data
fragment
processed
encrypted
current
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110423115.1A
Other languages
Chinese (zh)
Other versions
CN113132484A (en
Inventor
王睿宇
陈钢
周亚桥
程启健
尚岩
任翔宇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing QIYI Century Science and Technology Co Ltd
Original Assignee
Beijing QIYI Century Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing QIYI Century Science and Technology Co Ltd filed Critical Beijing QIYI Century Science and Technology Co Ltd
Priority to CN202110423115.1A priority Critical patent/CN113132484B/en
Publication of CN113132484A publication Critical patent/CN113132484A/en
Application granted granted Critical
Publication of CN113132484B publication Critical patent/CN113132484B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/06Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/04Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks
    • H04L63/0428Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks wherein the data content is protected, e.g. by encrypting or encapsulating the payload
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/27Server based end-user applications
    • H04N21/274Storing end-user multimedia data in response to end-user request, e.g. network recorder
    • H04N21/2743Video hosting of uploaded data from client
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/44Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream, rendering scenes according to MPEG-4 scene graphs
    • H04N21/4408Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream, rendering scenes according to MPEG-4 scene graphs involving video stream encryption, e.g. re-encrypting a decrypted video stream for redistribution in a home network
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/80Generation or processing of content or additional data by content creator independently of the distribution process; Content per se
    • H04N21/83Generation or processing of protective or descriptive data associated with content; Content structuring
    • H04N21/845Structuring of content, e.g. decomposing content into time segments
    • H04N21/8456Structuring of content, e.g. decomposing content into time segments by decomposing the content in the time domain, e.g. in time segments

Abstract

The embodiment of the invention provides a data transmission method and a data transmission device, which can acquire respective fragmentation information of data fragments contained in a file to be processed; for each data fragment, encrypting the data fragment based on encrypted data obtained by encrypting a previous data fragment of the data fragment and fragment information of the data fragment to obtain encrypted data corresponding to the data fragment; and sending the encrypted data corresponding to each data fragment to the server. Based on the processing, the data fragments contained in the file to be processed can be encrypted, and then the encrypted data corresponding to each data fragment can be sent to the server, so that the safety of data transmission can be improved.

Description

Data transmission method and device
Technical Field
The present invention relates to the field of data security, and in particular, to a data transmission method and apparatus.
Background
With the rapid development of network technology, web browsers provide more and more functions for users, for example, users can send target files (e.g., videos, pictures, etc.) to a server through the web browsers. In an application scene, when a user participates in a micro-cinema competition, the shot micro-cinema can be uploaded to a server of a competition host through a web browser. In another application scenario, a service provider may upload a video with a copyright to a server through a web browser, and then the server may perform format conversion on the received video, or adjust the definition of the video, to obtain a processed video. Subsequently, when the server receives different playing requests of the user for the video, the server can send the processed video to the corresponding video playing terminal so as to meet different playing requirements of the user.
In the process of transmitting the target file to the server, a malicious user may intercept the target file, so that the target file is stolen. In the prior art, a corresponding method is not provided, so that a target file sent by a web browser can be prevented from being stolen, and further, the security of data transmission of the web browser in the prior art is low.
Disclosure of Invention
The embodiment of the invention aims to provide a data transmission method and a data transmission device so as to improve the safety of data transmission. The specific technical scheme is as follows:
in a first aspect of the present invention, there is provided a data transmission method, where the method includes:
acquiring respective fragmentation information of data fragments contained in a file to be processed;
for each data fragment, encrypting the data fragment based on encrypted data obtained by encrypting a previous data fragment of the data fragment and fragment information of the data fragment to obtain encrypted data corresponding to the data fragment; the encrypted data corresponding to the previous data fragment of the first data fragment in the data fragments contained in the file to be processed is a preset initial value;
and sending the encrypted data corresponding to each data fragment to the server.
Optionally, after the obtaining of the respective fragmentation information of the data fragments contained in the file to be processed, the method further includes:
storing the acquired fragment information to a preset queue;
the encrypting the data fragment based on the encrypted data obtained by encrypting the previous data fragment of the data fragment and the fragment information of the data fragment to obtain the encrypted data corresponding to the data fragment includes, for each data fragment:
according to the sequence of the fragment information in the preset queue, acquiring one fragment information from the preset queue as the current fragment information to be processed; wherein, the fragmentation information of a data fragment comprises: a start address of the data slice and an end address of the data slice;
acquiring a data fragment corresponding to the current fragment information to be processed according to the start address and the end address recorded in the current fragment information to be processed, and taking the data fragment as the current data fragment to be processed;
encrypting the current data to be processed in a slicing mode based on encrypted data obtained by encrypting a previous data slice of the current data to be processed in a slicing mode to obtain encrypted data corresponding to the current data to be processed in a slicing mode;
and if the current to-be-processed fragment information is not the last fragment information in the preset queue, acquiring the next fragment information of the current to-be-processed fragment information from the preset queue as the current to-be-processed fragment information, and returning to execute the step of acquiring the data fragment corresponding to the current to-be-processed fragment information according to the start address and the end address recorded in the current to-be-processed fragment information as the current to-be-processed data fragment until the data fragment corresponding to the last fragment information is encrypted.
Optionally, the encrypting the current to-be-processed data fragment based on the encrypted data obtained by encrypting the previous data fragment of the current to-be-processed data fragment to obtain the encrypted data corresponding to the current to-be-processed data fragment includes:
acquiring encrypted data obtained by encrypting a previous data fragment of the current to-be-processed data fragment as the current to-be-processed encrypted data;
aiming at each character in the current data fragment to be processed, processing the character and the character corresponding to the character in the current encrypted data to be processed according to a target operation mode to obtain the current data to be encrypted; the characters in the current data fragment to be processed correspond to the characters in the current encrypted data to be processed one by one; the target operation mode is exclusive-or operation, or exclusive-nor operation;
and encrypting the current data to be encrypted to obtain corresponding encrypted data which is taken as the encrypted data corresponding to the current data to be processed in a fragmentation mode.
Optionally, the sending, to the server, the encrypted data corresponding to each data fragment includes:
and according to the sequence of generating the encrypted data corresponding to each data fragment, transmitting the encrypted data corresponding to the data fragment to the server every time the encrypted data corresponding to one data fragment is generated.
Optionally, the sending, to the server, the encrypted data corresponding to each data fragment includes:
and sending a target splicing result obtained by splicing the encrypted data corresponding to each data fragment to the server.
Optionally, before the sending, to the server, a target splicing result obtained by splicing the encrypted data corresponding to each data fragment, the method further includes:
after obtaining the encrypted data corresponding to each data fragment, obtaining a splicing result of splicing the encrypted data corresponding to the encrypted data fragments before the data fragment from a preset storage area, wherein the splicing result is used as a first splicing result;
and splicing the encrypted data corresponding to the data fragments with the first splicing result to obtain a second splicing result, and storing the second splicing result in a preset storage area until the splicing of the encrypted data corresponding to all the data fragments contained in the file to be processed is completed to obtain a corresponding target splicing result.
Optionally, before encrypting the data fragment based on the encrypted data obtained by encrypting the previous data fragment of the data fragment and the fragment information of the data fragment to obtain the encrypted data corresponding to the data fragment, for each data fragment, the method further includes:
acquiring encrypted data which is stored in a preset cache region and obtained by encrypting a previous data fragment of the data fragment aiming at each data fragment;
after encrypting the data fragment based on the encrypted data obtained by encrypting the previous data fragment of the data fragment and the fragment information of the data fragment for each data fragment to obtain the encrypted data corresponding to the data fragment, the method further includes:
and storing the encrypted data corresponding to the data fragment into a preset cache region, deleting the encrypted data stored in the preset cache region and obtained by encrypting the previous data fragment of the data fragment.
In a second aspect of the present invention, there is also provided a data transmission apparatus, including:
the first acquisition module is used for acquiring the respective fragment information of the data fragments contained in the file to be processed;
the encryption module is used for encrypting the data fragments to obtain encrypted data corresponding to the data fragments based on encrypted data obtained by encrypting the previous data fragments of the data fragments and the fragment information of the data fragments; the encrypted data corresponding to the previous data fragment of the first data fragment in the data fragments contained in the file to be processed is a preset initial value;
and the sending module is used for sending the encrypted data corresponding to each data fragment to the server.
Optionally, the apparatus further comprises:
the first storage module is used for storing the acquired fragment information to a preset queue after the first acquisition module acquires the fragment information of the data fragments contained in the file to be processed;
the encryption module is specifically configured to obtain one piece of fragmentation information from the preset queue according to the sequence of the pieces of fragmentation information in the preset queue, where the piece of fragmentation information is used as current piece information to be processed; wherein, the fragment information of one data fragment comprises: a start address of the data slice and an end address of the data slice;
acquiring a data fragment corresponding to the current fragment information to be processed according to the start address and the end address recorded in the current fragment information to be processed, and taking the data fragment as the current data fragment to be processed;
encrypting the current data to be processed in a slicing mode based on encrypted data obtained by encrypting a previous data slice of the current data to be processed in a slicing mode to obtain encrypted data corresponding to the current data to be processed in a slicing mode;
and if the current to-be-processed fragment information is not the last fragment information in the preset queue, acquiring the next fragment information of the current to-be-processed fragment information from the preset queue as the current to-be-processed fragment information, and returning to execute the step of acquiring the data fragment corresponding to the current to-be-processed fragment information according to the start address and the end address recorded in the current to-be-processed fragment information as the current to-be-processed data fragment until the data fragment corresponding to the last fragment information is completely encrypted.
Optionally, the encryption module is specifically configured to obtain encrypted data obtained by encrypting a previous data fragment of the current to-be-processed data fragment, and use the encrypted data as the current to-be-processed encrypted data;
aiming at each character in the current data fragment to be processed, processing the character and the character corresponding to the character in the current encrypted data to be processed according to a target operation mode to obtain the current data to be encrypted; the characters in the current data fragment to be processed correspond to the characters in the current encrypted data to be processed one by one; the target operation mode is exclusive-or operation, or exclusive-nor operation;
and encrypting the current data to be encrypted to obtain corresponding encrypted data which is taken as the encrypted data corresponding to the current data to be processed in a fragmentation mode.
Optionally, the sending module is specifically configured to send, to the server, the encrypted data corresponding to the data fragment each time encrypted data corresponding to one data fragment is generated according to the sequence of generating the encrypted data corresponding to each data fragment.
Optionally, the sending module is specifically configured to send, to the server, a target splicing result obtained by splicing the encrypted data corresponding to each data fragment.
Optionally, the apparatus further comprises:
the second obtaining module is used for obtaining a splicing result of splicing the encrypted data corresponding to the data fragments encrypted before the data fragments are encrypted from a preset storage area as a first splicing result after the encrypted data corresponding to each data fragment is obtained before the sending module sends a target splicing result obtained by splicing the encrypted data corresponding to each data fragment to the server;
and the splicing module is used for splicing the encrypted data corresponding to the data fragments with the first splicing result to obtain a second splicing result, and storing the second splicing result in a preset storage area until the splicing of the encrypted data corresponding to all the data fragments contained in the file to be processed is completed to obtain a corresponding target splicing result.
Optionally, the apparatus further comprises:
a third obtaining module, configured to, before the encryption module performs encryption on each data slice based on encrypted data obtained by encrypting a previous data slice of the data slice and slice information of the data slice, encrypt the data slice to obtain encrypted data corresponding to the data slice, perform encryption on each data slice to obtain encrypted data stored in a preset cache area and obtained by encrypting the previous data slice of the data slice;
and the second storage module is used for encrypting the data fragments based on the encrypted data obtained by encrypting the previous data fragment of the data fragments and the fragment information of the data fragments and storing the encrypted data corresponding to the data fragments into a preset cache region, deleting the encrypted data stored in the preset cache region and obtained by encrypting the previous data fragment of the data fragments in the encryption module.
In another aspect of the present invention, there is also provided an electronic device, including a processor, a communication interface, a memory and a communication bus, where the processor, the communication interface, and the memory complete communication with each other through the communication bus;
a memory for storing a computer program;
and the processor is used for realizing any one of the steps of the data transmission method when the processor executes the program stored in the memory.
In yet another aspect of the present invention, there is also provided a computer-readable storage medium having a computer program stored therein, the computer program, when executed by a processor, implementing any of the data transmission methods described above.
In yet another aspect of the present invention, there is also provided a computer program product containing instructions which, when run on a computer, cause the computer to perform any of the data transmission methods described above.
The data transmission method provided by the embodiment of the invention obtains respective fragmentation information of data fragments contained in a file to be processed; for each data fragment, encrypting the data fragment based on encrypted data obtained by encrypting a previous data fragment of the data fragment and fragment information of the data fragment to obtain encrypted data corresponding to the data fragment; and sending the encrypted data corresponding to each data fragment to the server.
Based on the processing, the data fragments contained in the file to be processed can be encrypted, and then the encrypted data corresponding to each data fragment can be sent to the server, so that the safety of data transmission can be improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below.
Fig. 1 is a flowchart of a data transmission method provided in an embodiment of the present invention;
fig. 2 is a flowchart of another data transmission method provided in the embodiment of the present invention;
fig. 3 is a flowchart of another data transmission method provided in the embodiment of the present invention;
fig. 4 is a flowchart of another data transmission method provided in the embodiment of the present invention;
fig. 5 is a flowchart of another data transmission method provided in the embodiment of the present invention;
fig. 6 is a flowchart of another data transmission method provided in an embodiment of the present invention;
fig. 7 is a flowchart of another data transmission method provided in the embodiment of the present invention;
fig. 8 is a flowchart of another data transmission method provided in the embodiment of the present invention;
fig. 9 is a structural diagram of a data transmission apparatus provided in an embodiment of the present invention;
fig. 10 is a block diagram of another data transmission apparatus provided in an embodiment of the present invention;
fig. 11 is a structural diagram of another data transmission apparatus provided in the embodiment of the present invention;
fig. 12 is a block diagram of another data transmission apparatus provided in the embodiment of the present invention;
fig. 13 is a structural diagram of an electronic device provided in an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be described below with reference to the drawings in the embodiments of the present invention.
Referring to fig. 1, fig. 1 is a flowchart of a data transmission method according to an embodiment of the present invention, where the method is applied to an electronic device, and the electronic device may transmit data to a server. The method may comprise the steps of:
s101: and acquiring the respective fragment information of the data fragments contained in the file to be processed.
S102: and for each data fragment, encrypting the data fragment based on the encrypted data obtained by encrypting the previous data fragment of the data fragment and the fragment information of the data fragment to obtain the encrypted data corresponding to the data fragment.
The encrypted data corresponding to the previous data fragment of the first data fragment in the data fragments contained in the file to be processed is a preset initial value.
S103: and sending the encrypted data corresponding to each data fragment to the server.
The data transmission method provided by the embodiment of the invention can encrypt the data fragments contained in the file to be processed, and further can send the encrypted data corresponding to each data fragment to the server, so that the safety of data transmission can be improved.
In addition, in the prior art, since the file to be processed is not encrypted, the file to be processed may be stolen by a malicious user in the process of sending the file to be processed to the server by the web browser. In the prior art, the size of the file to be processed sent to the server is limited, for example, the size of the file to be processed does not exceed 2GB, and the time required for sending the file to be processed to the server is reduced, so that the probability that the file to be processed is stolen by a malicious user is reduced.
The data transmission method provided by the embodiment of the invention can encrypt the file to be processed and improve the security of data transmission to the server, so that the data transmission method provided by the embodiment of the invention can not limit the size of the file to be processed transmitted to the server.
In the embodiment of the present invention, the electronic device may be a predetermined terminal, such as a mobile phone, a tablet computer, a desktop computer, and the like. An application program, such as a web browser, for sending files to a server may be installed in the electronic device. The file to be processed can be video, picture, etc. The file to be processed may be stored in a preset storage area (e.g., a hard disk) of the electronic device.
In step S101, when a user needs to send a file (i.e., a file to be processed in the embodiment of the present invention) to a server through an electronic device, a file transmission instruction may be input to the electronic device. Accordingly, the electronic device may display the identification of each file stored in the preset storage area. The user may then select the identity of the file that needs to be sent. The electronic device may determine that the file to which the identifier selected by the user belongs is a file to be processed. Furthermore, the electronic device may send the file to be processed to the server according to the method provided by the embodiment of the present invention.
The identifier of each file may be a name of each file, or may be a thumbnail of each file, and is not particularly limited.
For example, a user may input a file transfer instruction to an electronic device while participating in a micro-cinema production game. The electronic device may display the identification of each file stored in the preset storage area. Further, the user may select the identity of the captured micro-movie. Correspondingly, the electronic equipment can determine that the micro-shadow to which the identifier selected by the user belongs is the file to be processed. Furthermore, the electronic device may send the file to be processed to the server according to the data transmission method provided by the embodiment of the present invention.
The fragmentation information of one data fragment may include: the starting address of the data fragment, the ending address of the data fragment, the serial number of the data fragment, the total number of the data fragments contained in the file to be processed, the size of the file to be processed and the like.
In one implementation, the electronic device may determine the number of data fragments contained in the file to be processed according to the size of the file to be processed and the size of the preset fragment. For example, if the size of the file to be processed is 10M and the preset fragmentation size is 5M, the electronic device may determine that the file to be processed includes 2 data fragments each having a size of 5M. Or, if the size of the file to be processed is 10 and the preset fragment size is 3M, the electronic device may determine that the file to be processed includes 3 data fragments with 3M sizes and 1 data fragment with 1M size.
The preset slice size may be set by a technician according to experience, for example, the preset slice size may be 1MB, or the preset slice size may also be 3MB, but is not limited thereto.
Then, the electronic device may determine the respective start address and end address of the data fragment contained in the file to be processed according to the start address and end address of the file to be processed in the storage area and the preset fragment size.
For example, the preset fragmentation size may be 3MB, the size of the file to be processed may be 10MB, the start address of the file to be processed may be 1 st byte in the preset storage area, and the end address of the file to be processed may be 10485760 bytes in the preset storage area.
Since the occupied bytes of 1MB data in the preset storage area are 1048576 bytes, the electronic device may determine that the start address of the 1 st data slice is the 1 st byte in the preset storage area, the end address of the 1 st data slice is the 3145728 bytes in the preset storage area, the start address of the 2 nd data slice is the 3145729 bytes in the preset storage area, the end address of the 2 nd data slice is the 6291456 bytes in the preset storage area, the start address of the 3 rd data slice is 6291457 bytes in the preset storage area, the end address of the 3 rd data slice is the 9437184 bytes in the preset storage area, the start address of the 4 th data slice is 9437185 bytes in the preset storage area, and the end address of the 4 th data slice is 10485760 bytes in the preset storage area.
The electronic device may also number each data fragment in sequence according to the sequence from small to large of the respective start address of each data fragment, so as to obtain the respective serial number of each data fragment.
In step S102, in an implementation manner, for each data fragment, the electronic device may obtain, according to an arrangement order of the data fragments, encrypted data corresponding to a previous data fragment of the data fragment, and then encrypt the data fragment based on fragment information of the data fragment and the encrypted data corresponding to the previous data fragment of the data fragment. Wherein, the arrangement order of the data fragments can be the order of the initial addresses of the data fragments from small to large, or the arrangement order of the data fragments may be the order from small to large of the end addresses of the data fragments.
In another implementation, referring to fig. 2, on the basis of fig. 1, after step S101, the method may further include the following steps:
s104: and storing the acquired fragment information to a preset queue.
Accordingly, step S102 may include the steps of:
s1021: and acquiring one piece of fragment information from the preset queue according to the sequence of each piece of fragment information in the preset queue, wherein the obtained piece of fragment information is used as the current piece of fragment information to be processed.
Wherein, the fragment information of one data fragment comprises: the starting address of the data slice and the ending address of the data slice.
S1022: and acquiring the data fragment corresponding to the current to-be-processed fragment information as the current to-be-processed data fragment according to the start address and the end address recorded in the current to-be-processed fragment information.
S1023: and encrypting the current to-be-processed data fragment based on the encrypted data obtained by encrypting the previous data fragment of the current to-be-processed data fragment to obtain the encrypted data corresponding to the current to-be-processed data fragment.
S1024: and if the current to-be-processed fragment information is not the last fragment information in the preset queue, acquiring the next fragment information of the current to-be-processed fragment information from the preset queue as the current to-be-processed fragment information, and returning to execute the step of acquiring the data fragment corresponding to the current to-be-processed fragment information according to the start address and the end address recorded in the current to-be-processed fragment information as the current to-be-processed data fragment until the data fragment corresponding to the last fragment information is encrypted.
In step S104, after obtaining the fragment information of each data fragment included in the file to be processed, the electronic device may sequentially store each fragment information to a preset queue according to the arrangement order of the data fragments corresponding to each fragment information.
For step S1021 and step S1022, the electronic device may obtain one piece of fragment information according to an order of each piece of fragment information in the preset queue, so as to obtain the current to-be-processed piece of fragment information. Then, the electronic device may read the start address and the end address recorded in the current to-be-processed slice information. Furthermore, the electronic device may obtain the data slice corresponding to the current to-be-processed slice information from the preset storage area according to the start address and the end address recorded in the current to-be-processed slice information, so as to obtain the current to-be-processed data slice.
In an embodiment of the present invention, referring to fig. 3, on the basis of fig. 2, step S1023 may include the following steps:
s10231: and acquiring encrypted data obtained by encrypting the previous data fragment of the current data fragment to be processed as the current encrypted data to be processed.
S10232: and processing the character and the character corresponding to the character in the current to-be-processed encrypted data according to a target operation mode aiming at each character in the current to-be-processed data fragment to obtain the current to-be-encrypted data.
The characters in the current data fragment to be processed correspond to the characters in the current encrypted data to be processed one by one; the target operation mode is exclusive-or operation, exclusive-nor operation, nand operation or nor operation.
S10233: and encrypting the current data to be encrypted to obtain corresponding encrypted data which is taken as the encrypted data corresponding to the current data to be processed in a fragmentation mode.
In one implementation, the electronic device may determine a previous data fragment of the current to-be-processed data fragment, and may further obtain encrypted data (i.e., current to-be-processed encrypted data) corresponding to the previous data fragment of the current to-be-processed data fragment. Then, the electronic device may process each character in the current to-be-processed data slice and the character corresponding to the character in the current to-be-processed encrypted data to obtain the current to-be-encrypted data.
Illustratively, the target operation is an exclusive or operation. The characters in the current to-be-processed data slice may be: 1101, the characters in the current encrypted data to be processed may be: 0100. the 1 st character in the current to-be-processed data fragment is "1", the corresponding character in the current to-be-processed encrypted data is "0", and the electronic device can perform exclusive or operation on "1" and "0" to obtain the corresponding character as "1". Similarly, the electronic device may perform an exclusive or operation on the 2 nd character (i.e., "1") in the current to-be-processed data fragment and the character (i.e., "1") corresponding to the 2 nd character in the current to-be-processed encrypted data fragment, so as to obtain a corresponding character "0"; performing exclusive-or operation on the 3 rd character (namely '0') in the current to-be-processed data fragment and the character (namely '0') corresponding to the 3 rd character in the current to-be-processed encrypted data fragment to obtain the corresponding character of '0'; and carrying out exclusive OR operation on the 4 th character (namely '1') in the current data fragment to be processed and the character (namely '0') corresponding to the 4 th character in the current encrypted data fragment to be processed to obtain the corresponding character as '1'. Further, the current data to be encrypted can be obtained as follows: 1001.
furthermore, the electronic device may encrypt the current data to be encrypted based on the target encryption algorithm to obtain corresponding encrypted data, which is used as the encrypted data corresponding to the current data to be processed in a fragmentation manner.
The target Encryption algorithm may be an AES (Advanced Encryption Standard) algorithm, or the target Encryption algorithm may also be a DES (Data Encryption Standard) algorithm, but is not limited thereto.
In step S1024, the electronic device may determine whether the current to-be-processed fragment information is the last fragment information in the preset queue, and if the current to-be-processed fragment information is not the last fragment information in the preset queue, it indicates that there is unprocessed fragment information, that is, there is an unencrypted data fragment, the electronic device may obtain the next fragment information in the preset queue, then obtain the data fragment corresponding to the next fragment information, encrypt the data fragment corresponding to the next fragment information, and so on until the data fragment corresponding to the last fragment information is encrypted.
If the current to-be-processed fragment information is the last fragment information in the preset queue, it indicates that there is no unprocessed fragment information, that is, all data fragments have been encrypted. Subsequently, the electronic device may send the encrypted data corresponding to each data fragment to the server.
Based on the above processing, for each data slice, the data slice may be encrypted based on encrypted data obtained by encrypting a previous data slice of the data slice. Correspondingly, even if the encrypted data corresponding to the data fragment is stolen by a malicious user in the transmission process, after the malicious user decrypts the encrypted data corresponding to the data fragment, the decrypted data comprises the encrypted data corresponding to the previous data fragment and the data fragment, the difficulty of the malicious user in extracting the data fragment from the decrypted data can be increased, and further, the safety of data transmission can be further improved.
In an embodiment of the present invention, referring to fig. 4, on the basis of fig. 1, before step S102, the method may further include the steps of:
s105: and acquiring encrypted data which is stored in a preset cache region and obtained by encrypting a previous data fragment of the data fragment aiming at each data fragment.
Accordingly, after step S102, the method may further include the steps of:
s106: and storing the encrypted data corresponding to the data fragment into a preset cache region, deleting the encrypted data stored in the preset cache region and obtained by encrypting the previous data fragment of the data fragment.
For step S105 and step S106, the preset buffer area may be: a cache area of an application (e.g., a web browser) installed in the electronic device for transmitting a file to be processed to the server.
Correspondingly, for each data fragment, when encrypting the data fragment, the electronic device may obtain, from the buffer area, encrypted data corresponding to a previous data fragment of the data fragment, and encrypt the data fragment based on the encrypted data corresponding to the previous data fragment of the data fragment and fragment information of the data fragment, to obtain encrypted data corresponding to the data fragment. The way in which the electronic device encrypts each data fragment may be referred to in the related description of the foregoing embodiments.
Then, the electronic device may store the encrypted data corresponding to the data fragment in a preset cache region, and delete the encrypted data corresponding to a previous data fragment of the data fragment from the preset cache region.
Furthermore, when encrypting the next data fragment of the data fragment, the electronic device may obtain the encrypted data corresponding to the data fragment from a preset cache area, and encrypt the next data fragment of the data fragment based on the encrypted data corresponding to the data fragment and the fragment information of the next data fragment of the data fragment to obtain the encrypted data corresponding to the next data fragment of the data fragment, and then may store the encrypted data corresponding to the next data fragment of the data fragment to the preset cache area, and delete the encrypted data corresponding to the data fragment from the preset cache area, and so on, so that only the encrypted data corresponding to one data fragment may be stored in the preset cache area.
Based on the processing, only the encrypted data corresponding to one data fragment is stored in the preset cache region, so that the waste of the preset cache region can be reduced, the speed of acquiring the encrypted data can be increased, and further, the efficiency of data encryption of the electronic equipment can be improved.
It can be understood that, when the 1 st data segment is encrypted, since there is no encrypted data obtained by encrypting a previous data segment, the electronic device may obtain a preset initial value, and use the preset initial value as encrypted data obtained by encrypting a previous data segment of the 1 st data segment.
Wherein the preset initial value can be set by a technician empirically.
In addition, after the last data fragment is encrypted, the electronic device may generate verification information for determining whether the file to be processed is faulty during transmission. The Check information of the file to be processed may be a Cyclic Redundancy Check (CRC) code.
Subsequently, after receiving the encrypted data sent by the electronic device, the server may check the received encrypted data based on the CRC code in the received encrypted data to determine whether the received encrypted data is in error. Furthermore, when it is determined that the received encrypted data is not in error, the server may perform decryption processing on the received encrypted data to obtain a file to be processed.
In step S103, after the encryption of each data fragment included in the file to be processed is completed, the electronic device may send the encrypted data corresponding to each data fragment to the server.
In one implementation, step S103 may include the following steps:
and according to the sequence of generating the encrypted data corresponding to each data fragment, transmitting the encrypted data corresponding to the data fragment to the server every time the encrypted data corresponding to one data fragment is generated.
Referring to fig. 5, fig. 5 is a flowchart of another data transmission method according to an embodiment of the present invention.
For each data fragment contained in the file to be processed, the electronic device may encrypt the data fragment, and after obtaining the corresponding encrypted data, may separately send the encrypted data corresponding to the data fragment to the server.
In another implementation, step S103 may include the following steps:
and sending a target splicing result obtained by splicing the encrypted data corresponding to each data fragment to the server.
Referring to fig. 6, fig. 6 is a flowchart of another data transmission method according to an embodiment of the present invention.
After the data fragments included in the file to be processed are encrypted to obtain the encrypted data corresponding to each data fragment, the electronic device may send a target splicing result obtained by splicing the encrypted data corresponding to each data fragment to the server.
Before sending the target splicing result to the server, the electronic device may splice the encrypted data corresponding to each data fragment to obtain the target splicing result.
In one implementation, after obtaining the encrypted data corresponding to each data fragment, the electronic device may store the obtained encrypted data in a preset storage region, and after completing encryption of the last data fragment and obtaining the corresponding encrypted data, the electronic device may obtain the encrypted data corresponding to each data fragment from the preset storage region, and splice the encrypted data corresponding to each data fragment to obtain a target splicing result.
In another implementation manner, after each data fragment is encrypted to obtain encrypted data corresponding to the data fragment, the electronic device may splice the encrypted data corresponding to the data fragment with encrypted data corresponding to other data fragments before the data fragment to obtain a corresponding splicing result, and so on, may obtain a target splicing result of splicing the encrypted data corresponding to all data fragments included in the file to be processed.
In an embodiment of the present invention, referring to fig. 7, in a case that a target splicing result obtained by splicing encrypted data corresponding to each data fragment is sent to a server, the method may further include the following steps:
s107: after the encrypted data corresponding to each data fragment is obtained, a splicing result of splicing the encrypted data corresponding to the encrypted data fragments before the data fragment is obtained from a preset storage area and is used as a first splicing result.
S108: and splicing the encrypted data corresponding to the data fragments with the first splicing result to obtain a second splicing result, and storing the second splicing result in a preset storage area until the splicing of the encrypted data corresponding to all the data fragments contained in the file to be processed is completed to obtain a corresponding target splicing result.
Accordingly, step S103 may include the steps of:
s1031: and sending a target splicing result obtained by splicing the encrypted data corresponding to each data fragment to the server.
For step S107 and step S108, after encrypting the first data fragment included in the file to be processed to obtain corresponding encrypted data, the electronic device may store the encrypted data corresponding to the first data fragment in a preset storage area.
After the second data fragment is encrypted to obtain the corresponding encrypted data, the electronic device may obtain the encrypted data corresponding to the first data fragment from the preset storage area, splice the encrypted data corresponding to the first data fragment and the encrypted data corresponding to the second data fragment, and store the obtained splicing result in the preset storage area.
After the third data fragment is encrypted to obtain corresponding encrypted data, the electronic device may obtain a splicing result of splicing the encrypted data corresponding to the first data fragment and the encrypted data corresponding to the second data fragment from a preset storage area. Then, the electronic device can splice the encrypted data corresponding to the third data fragment and the obtained splicing result, store the obtained splicing result in a preset storage area, and so on until the splicing of the encrypted data corresponding to all the data fragments contained in the file to be processed is completed, and obtain a corresponding target splicing result.
For example, after the first data fragment is encrypted to obtain corresponding encrypted data, a blob object corresponding to the encrypted data corresponding to the first data fragment may be generated as a this. The blob object represents a class file object of immutable raw data.
After the second data fragment is encrypted to obtain corresponding encrypted data, a new blob object is generated as a this blob object based on the encrypted data corresponding to the second data fragment and the previous blob object (i.e., the encrypted data corresponding to the first data fragment), where the this blob object includes the encrypted data corresponding to the first data fragment and the encrypted data corresponding to the second data fragment.
And repeating the steps until the last data fragment is encrypted, wherein the blob object contains the encrypted data corresponding to each data fragment. The electronic device generates this.blob object, which is realized based on Web Assembly language (an Assembly language applied to the front end), the server processes data based on Java Script (a programming language based on prototype and oriented to object), the Web Assembly and Java Script are two different computer languages, if this.blob object is directly sent to the server, the server cannot acquire the file to be processed sent by the electronic device. The electronic equipment can generate a Java Script File object based on a Java Script language according to the this, wherein the Java Script File object is a target splicing result, and further the electronic equipment can send the target splicing result to the server.
After all the data fragments contained in the file to be processed are encrypted, the target splicing result for splicing the encrypted data corresponding to each data fragment can be sent to the server, so that the time for completing the encryption of all the data fragments is long. Therefore, under the condition that the target splicing result needs to be sent to the server, the electronic equipment can determine the encryption progress in the process of encrypting each data fragment and display the encryption progress in the display page, so that a user can know the encryption progress of encrypting the file to be processed.
In one embodiment of the present invention, during the process of encrypting each data fragment, the electronic device may determine the number of encrypted data fragments based on the serial number of the currently encrypted data fragment. Then, the electronic device may calculate a ratio of the number of the encrypted data fragments to the total number of the encrypted data fragments, so as to obtain an encryption progress. Further, the electronic device may display the encryption progress in the display interface.
Illustratively, the total number of the data fragments contained in the file to be processed is 10, and the sequence number of the currently encrypted data fragment is 4. The electronic device may determine that the number of the encrypted data fragments is 4, and further, calculate the number of the encrypted data fragments (i.e. 4) and the total number of the data fragments contained in the file to be processed (i.e. 10), so as to obtain that the encryption progress is 40%. The electronic device may then display the encryption progress in the display interface as 40%.
Referring to fig. 8, fig. 8 is a flowchart of another data transmission method according to an embodiment of the present invention.
The electronic device may comprise a determining module for determining fragmentation information of data fragments contained in the file to be processed, and an encrypting module for encrypting the data fragments. The determining module is realized based on Java Script, and the encrypting module is realized based on Web Assembly.
The electronic device can determine the respective fragmentation information of the data fragments contained in the file to be processed according to the starting address and the ending address of the file to be processed in the preset storage area and the preset fragmentation size through the determination module, and then store the fragmentation information to the preset queue.
The electronic equipment can acquire each piece of fragment information from the preset queue through the encryption module according to the sequence of the piece of fragment information in the preset queue. For example, the encryption module may obtain each piece of slice information from a preset queue based on an encrypt blocks shift function, or the encryption module may obtain each piece of slice information from a preset queue based on a splice (obtain element in array) function.
Then, the electronic device may obtain the data slice corresponding to the slice information from a preset storage area based on the start address and the end address recorded in the slice information. The electronic device may further encrypt the data fragment based on the fragment information of the data fragment and encrypted data corresponding to a previous data fragment of the data fragment to obtain encrypted data corresponding to the data fragment. Furthermore, the electronic device may splice the encrypted data corresponding to the data fragment with the encrypted data corresponding to other data fragments before the data fragment to obtain a corresponding splicing result.
Then, the electronic device may determine whether unprocessed fragment information still exists, for example, the electronic device may determine the length of the current preset queue based on an encrypt block length function, and if the length of the current preset queue is not 0, may determine that unprocessed fragment information exists. If the unprocessed fragment information exists, which indicates that the unencrypted data fragment exists, the electronic device may return to execute the step of acquiring one fragment information from the preset queue according to the sequence of each fragment information in the preset queue.
If the length of the current preset queue is 0, it may be determined that there is no unprocessed fragmentation information. If the unprocessed fragment information does not exist, it is indicated that the currently encrypted data fragment is the last data fragment in the data fragments contained in the file to be processed, that is, the unencrypted data fragment does not exist, and the currently obtained splicing result is a target splicing result containing encrypted data corresponding to each data fragment. Further, the electronic device may send the target stitching result to the server.
In addition, in the process of encrypting each data fragment, the electronic device may display a first reminding page, and the user may input a pause encryption instruction or a cancel encryption instruction to the electronic device through the first reminding page. Correspondingly, when the electronic device receives the encryption pause instruction or the encryption cancel instruction, the electronic device can call the interrupt callback function to pause or cancel encryption of each data fragment.
Based on the processing, in the process of encrypting the file to be processed, the user can operate the file to be processed to suspend or cancel the encryption of the file to be processed, so that the user operation can be facilitated, and the user experience is improved.
In the process of encrypting each data fragment, if the encryption is wrong, for example, the file to be processed is deleted, the electronic device cannot acquire the data fragment of the file to be processed, thereby causing the encryption error. Correspondingly, the electronic device can call an Error callback function, and a second reminding page used for reminding a user that the encryption of the file to be processed is wrong is displayed in the display interface.
In the process of encrypting each data fragment, the electronic device may further determine an encryption progress of encrypting the data fragment contained in the file to be processed, call a callback function for displaying the encryption progress, and display the encryption progress in the display interface.
After the last data fragment is encrypted, the electronic device may call an encryption completion callback function, and send a target splicing result including encrypted data corresponding to each data fragment to the server.
Based on the above processing, since the Web Assembly is in a binary format, the method has the advantages of small size, fast loading, high execution efficiency and the like, and can improve the efficiency of encrypting each data fragment, and the decompiling difficulty of the program compiled by the Web Assembly is high, so that the security of the encrypted data corresponding to each data fragment can be further improved, and further, the security of data transmission can be further improved.
Corresponding to the embodiment of the method in fig. 1, referring to fig. 9, fig. 9 is a structural diagram of a data transmission apparatus according to an embodiment of the present invention, where the apparatus includes:
a first obtaining module 901, configured to obtain respective fragmentation information of data fragments included in a file to be processed;
an encryption module 902, configured to encrypt, for each data slice, a data slice based on encrypted data obtained by encrypting a previous data slice of the data slice and slice information of the data slice, to obtain encrypted data corresponding to the data slice; the encrypted data corresponding to the previous data fragment of the first data fragment in the data fragments contained in the file to be processed is a preset initial value;
a sending module 903, configured to send the encrypted data corresponding to each data fragment to the server.
Optionally, referring to fig. 10, the apparatus further includes:
a first storing module 904, configured to, after the first obtaining module 901 obtains respective fragmentation information of data fragments included in a file to be processed, perform storing of the obtained fragmentation information to a preset queue;
the encryption module 902 is specifically configured to obtain one piece of fragmentation information from the preset queue according to the sequence of the pieces of fragmentation information in the preset queue, where the obtained piece of fragmentation information is used as current to-be-processed piece information; wherein, the fragment information of one data fragment comprises: a start address of the data slice and an end address of the data slice;
acquiring a data fragment corresponding to the current fragment information to be processed according to the start address and the end address recorded in the current fragment information to be processed, and taking the data fragment as the current data fragment to be processed;
encrypting the current data to be processed in a slicing mode based on encrypted data obtained by encrypting a previous data slice of the current data to be processed in a slicing mode to obtain encrypted data corresponding to the current data to be processed in a slicing mode;
and if the current to-be-processed fragment information is not the last fragment information in the preset queue, acquiring the next fragment information of the current to-be-processed fragment information from the preset queue as the current to-be-processed fragment information, and returning to execute the step of acquiring the data fragment corresponding to the current to-be-processed fragment information according to the start address and the end address recorded in the current to-be-processed fragment information as the current to-be-processed data fragment until the data fragment corresponding to the last fragment information is encrypted.
Optionally, the encryption module 902 is specifically configured to obtain encrypted data obtained by encrypting a data fragment before the current to-be-processed data fragment, and use the encrypted data as the current to-be-processed encrypted data;
aiming at each character in the current data fragment to be processed, processing the character and the character corresponding to the character in the current encrypted data to be processed according to a target operation mode to obtain the current data to be encrypted; the characters in the current data fragment to be processed correspond to the characters in the current encrypted data to be processed one by one; the target operation mode is exclusive-or operation, or exclusive-nor operation;
and encrypting the current data to be encrypted to obtain corresponding encrypted data which is taken as the encrypted data corresponding to the current data to be processed in a fragmentation mode.
Optionally, the sending module 903 is specifically configured to send, to the server, the encrypted data corresponding to the data fragment when the encrypted data corresponding to one data fragment is generated each time according to the sequence of generating the encrypted data corresponding to each data fragment.
Optionally, the sending module 903 is specifically configured to send, to the server, a target splicing result obtained by splicing the encrypted data corresponding to each data fragment.
Optionally, referring to fig. 11, the apparatus further includes:
a second obtaining module 905, configured to obtain, from a preset storage area, a splicing result obtained by splicing encrypted data corresponding to data segments that have been encrypted before the data segments are obtained after encrypted data corresponding to each data segment is obtained before the sending module 903 sends a target splicing result obtained by splicing encrypted data corresponding to each data segment to a server, where the target splicing result is obtained by splicing encrypted data corresponding to each data segment;
and the splicing module 906 is configured to splice the encrypted data corresponding to the data fragment with the first splicing result to obtain a second splicing result, and store the second splicing result in a preset storage area until the splicing of the encrypted data corresponding to all the data fragments contained in the file to be processed is completed to obtain a corresponding target splicing result.
Optionally, referring to fig. 12, the apparatus further includes:
a third obtaining module 907, configured to, before the encrypting module 902 performs encryption on each data slice, based on encrypted data obtained by encrypting a previous data slice of the data slice and slice information of the data slice, encrypt the data slice to obtain encrypted data corresponding to the data slice, perform obtaining, for each data slice, encrypted data stored in a preset cache region and obtained by encrypting the previous data slice of the data slice;
a second storage module 908, configured to, after the encryption module 902 executes to encrypt each data slice based on encrypted data obtained by encrypting a previous data slice of the data slice and slice information of the data slice, encrypt the data slice to obtain encrypted data corresponding to the data slice, store the encrypted data corresponding to the data slice into a preset cache region, delete encrypted data stored in the preset cache region, and encrypt the previous data slice of the data slice.
The data transmission device provided by the embodiment of the invention can encrypt the data fragments contained in the file to be processed, and further can send the encrypted data corresponding to each data fragment to the server, so that the safety of data transmission can be improved.
An embodiment of the present invention further provides an electronic device, as shown in fig. 13, including a processor 1301, a communication interface 1302, a memory 1303, and a communication bus 1304, where the processor 1301, the communication interface 1302, and the memory 1303 complete communication with each other through the communication bus 1304;
a memory 1303 for storing a computer program;
the processor 1301 is configured to implement the following steps when executing the program stored in the memory 1303:
acquiring respective fragmentation information of data fragments contained in a file to be processed;
for each data fragment, encrypting the data fragment based on encrypted data obtained by encrypting a previous data fragment of the data fragment and fragment information of the data fragment to obtain encrypted data corresponding to the data fragment; the encrypted data corresponding to the previous data fragment of the first data fragment in the data fragments contained in the file to be processed is a preset initial value;
and sending the encrypted data corresponding to each data fragment to the server.
The communication bus mentioned in the electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface is used for communication between the electronic equipment and other equipment.
The Memory may include a Random Access Memory (RAM) or a non-volatile Memory (non-volatile Memory), such as at least one disk Memory. Alternatively, the memory may be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; the Integrated Circuit may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, a discrete Gate or transistor logic device, or a discrete hardware component.
The electronic equipment provided by the embodiment of the invention can encrypt the data fragments contained in the file to be processed, and further can send the encrypted data corresponding to each data fragment to the server, so that the safety of data transmission can be improved.
In still another embodiment of the present invention, a computer-readable storage medium is further provided, in which a computer program is stored, and the computer program, when executed by a processor, implements the data transmission method in any of the above embodiments.
In yet another embodiment provided by the present invention, there is also provided a computer program product containing instructions which, when run on a computer, cause the computer to perform the data transmission method described in any of the above embodiments.
In the above embodiments, all or part of the implementation may be realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the invention to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website site, computer, server, or data center to another website site, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more of the available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid State Disk (SSD)), among others.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising a … …" does not exclude the presence of another identical element in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the apparatus, the electronic device, the computer-readable storage medium, and the computer program product embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, and in relation to them, reference may be made to the partial description of the method embodiments.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (9)

1. A method of data transmission, the method comprising:
acquiring respective fragmentation information of data fragments contained in a file to be processed;
for each data fragment, encrypting the data fragment based on encrypted data obtained by encrypting a previous data fragment of the data fragment and fragment information of the data fragment to obtain encrypted data corresponding to the data fragment; the encrypted data corresponding to the previous data fragment of the first data fragment in the data fragments contained in the file to be processed is a preset initial value;
sending the encrypted data corresponding to each data fragment to a server;
the encrypting the data fragment based on the encrypted data obtained by encrypting the previous data fragment of the data fragment and the fragment information of the data fragment to obtain the encrypted data corresponding to the data fragment for each data fragment includes:
acquiring the data fragment indicated by the fragment information as the current to-be-processed data fragment aiming at each fragment information;
acquiring encrypted data obtained by encrypting a previous data fragment of the current data fragment to be processed as current encrypted data to be processed;
processing the character and the character corresponding to the character in the current data to be processed in the encrypted data to be processed according to a target operation mode aiming at each character in the current data to be processed fragment to obtain the current data to be encrypted; the characters in the current data fragment to be processed correspond to the characters in the current encrypted data to be processed one by one;
and encrypting the current data to be encrypted to obtain corresponding encrypted data which is taken as the encrypted data corresponding to the current data to be processed in a fragmentation mode.
2. The method according to claim 1, wherein after the obtaining of the fragmentation information of each data fragment contained in the file to be processed, the method further comprises:
storing the acquired fragment information to a preset queue;
the step of, for each piece of fragment information, taking the data piece corresponding to the piece information according to the piece information as the current to-be-processed data piece, includes:
according to the sequence of the fragment information in the preset queue, acquiring one fragment information from the preset queue as the current fragment information to be processed; wherein, the fragment information of one data fragment comprises: a start address of the data slice and an end address of the data slice;
acquiring a data fragment corresponding to the current fragment information to be processed according to the start address and the end address recorded in the current fragment information to be processed, and taking the data fragment as the current data fragment to be processed;
and if the current to-be-processed fragment information is not the last fragment information in the preset queue, acquiring the next fragment information of the current to-be-processed fragment information from the preset queue as the current to-be-processed fragment information, and returning to execute the step of acquiring the data fragment corresponding to the current to-be-processed fragment information according to the start address and the end address recorded in the current to-be-processed fragment information as the current to-be-processed data fragment until the data fragment corresponding to the last fragment information is encrypted.
3. The method according to claim 1, wherein the sending encrypted data corresponding to each data slice to the server includes:
and according to the sequence of generating the encrypted data corresponding to each data fragment, transmitting the encrypted data corresponding to the data fragment to the server every time the encrypted data corresponding to one data fragment is generated.
4. The method according to claim 1, wherein the sending encrypted data corresponding to each data slice to the server includes:
and sending a target splicing result obtained by splicing the encrypted data corresponding to each data fragment to the server.
5. The method according to claim 4, wherein before the sending, to the server, the target splicing result obtained by splicing the encrypted data corresponding to each data slice, the method further includes:
after obtaining the encrypted data corresponding to each data fragment, obtaining a splicing result of splicing the encrypted data corresponding to the encrypted data fragments before the data fragment from a preset storage area, wherein the splicing result is used as a first splicing result;
and splicing the encrypted data corresponding to the data fragments with the first splicing result to obtain a second splicing result, and storing the second splicing result in a preset storage area until the splicing of the encrypted data corresponding to all the data fragments contained in the file to be processed is completed to obtain a corresponding target splicing result.
6. The method according to claim 1, wherein before encrypting, for each of the data slices, the data slice based on the encrypted data obtained by encrypting the previous data slice of the data slice and the slice information of the data slice to obtain the encrypted data corresponding to the data slice, the method further comprises:
acquiring encrypted data which is stored in a preset cache region and obtained by encrypting a previous data fragment of the data fragment aiming at each data fragment;
after encrypting the data fragment based on the encrypted data obtained by encrypting the previous data fragment of the data fragment and the fragment information of the data fragment for each data fragment to obtain the encrypted data corresponding to the data fragment, the method further includes:
and storing the encrypted data corresponding to the data fragment into a preset cache region, deleting the encrypted data stored in the preset cache region and obtained by encrypting the previous data fragment of the data fragment.
7. A data transmission apparatus, characterized in that the apparatus comprises:
the first acquisition module is used for acquiring the respective fragment information of the data fragments contained in the file to be processed;
the encryption module is used for encrypting the data fragments to obtain encrypted data corresponding to the data fragments based on encrypted data obtained by encrypting the previous data fragments of the data fragments and the fragment information of the data fragments; the encrypted data corresponding to the previous data fragment of the first data fragment in the data fragments contained in the file to be processed is a preset initial value;
the sending module is used for sending the encrypted data corresponding to each data fragment to the server;
the encryption module is specifically configured to, for each piece of piece information, obtain a data piece indicated by the piece information as a current to-be-processed data piece;
acquiring encrypted data obtained by encrypting a previous data fragment of the current to-be-processed data fragment as the current to-be-processed encrypted data;
aiming at each character in the current data fragment to be processed, processing the character and the character corresponding to the character in the current encrypted data to be processed according to a target operation mode to obtain the current data to be encrypted; the characters in the current data fragment to be processed correspond to the characters in the current encrypted data to be processed one by one;
and encrypting the current data to be encrypted to obtain corresponding encrypted data which is taken as the encrypted data corresponding to the current data to be processed in a fragmentation mode.
8. An electronic device is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor and the communication interface are used for realizing mutual communication by the memory through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of any one of claims 1 to 6 when executing a program stored in a memory.
9. A computer-readable storage medium, characterized in that a computer program is stored in the computer-readable storage medium, which computer program, when being executed by a processor, carries out the method steps of any one of claims 1 to 6.
CN202110423115.1A 2021-04-20 2021-04-20 Data transmission method and device Active CN113132484B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110423115.1A CN113132484B (en) 2021-04-20 2021-04-20 Data transmission method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110423115.1A CN113132484B (en) 2021-04-20 2021-04-20 Data transmission method and device

Publications (2)

Publication Number Publication Date
CN113132484A CN113132484A (en) 2021-07-16
CN113132484B true CN113132484B (en) 2022-10-25

Family

ID=76777726

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110423115.1A Active CN113132484B (en) 2021-04-20 2021-04-20 Data transmission method and device

Country Status (1)

Country Link
CN (1) CN113132484B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113568852A (en) * 2021-07-21 2021-10-29 北京海泰方圆科技股份有限公司 Data processing method and device, cryptographic equipment and storage medium
CN115987513B (en) * 2023-03-17 2023-06-20 山东浪潮科学研究院有限公司 Distributed database fragment encryption and decryption methods, devices, equipment and media

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106231346B (en) * 2016-08-05 2020-01-17 中国传媒大学 Distributed encryption method for offline video
CN110138716B (en) * 2018-02-09 2020-11-27 网宿科技股份有限公司 Key providing method, video playing method, server and client
CN110149373B (en) * 2019-04-28 2022-01-07 平安科技(深圳)有限公司 Data storage method, device, medium and server based on peer-to-peer network
CN110324143B (en) * 2019-05-24 2022-03-11 平安科技(深圳)有限公司 Data transmission method, electronic device and storage medium
CN110602122A (en) * 2019-09-20 2019-12-20 北京达佳互联信息技术有限公司 Video processing method and device, electronic equipment and storage medium
CN112016110B (en) * 2020-09-01 2023-02-28 三星电子(中国)研发中心 Method, device, equipment and storage medium for storing data

Also Published As

Publication number Publication date
CN113132484A (en) 2021-07-16

Similar Documents

Publication Publication Date Title
US10284372B2 (en) Method and system for secure management of computer applications
CN106412907B (en) Network access method, related equipment and system
US20220353085A1 (en) Secure distributed information system for public device authentication
CN113132484B (en) Data transmission method and device
CN107786331B (en) Data processing method, device, system and computer readable storage medium
CN107612683B (en) Encryption and decryption method, device, system, equipment and storage medium
CN111143869B (en) Application package processing method and device, electronic equipment and storage medium
WO2019134303A1 (en) Live stream room popularity processing method and apparatus, server and storage medium
CN108431819B (en) Method and system for protecting client access to service of DRM agent of video player
JP2015115079A (en) Method and apparatus for input verification
CN108777685B (en) Method and apparatus for processing information
CN110768784B (en) Password transmission method, device, computer equipment and storage medium
WO2017006118A1 (en) Secure distributed encryption system and method
CN110213671B (en) Hotspot short video determination method and device
CN111368322B (en) File decryption method and device, electronic equipment and storage medium
WO2020103060A1 (en) Data processing method and apparatus, system, server, and electronic device
CN110851794A (en) Media file uplink method and device, storage medium and electronic device
WO2019184741A1 (en) Application program information storing method and apparatus, and application program information processing method and apparatus
CN109995534B (en) Method and device for carrying out security authentication on application program
CN115757535A (en) Data query method, data storage method and device and electronic equipment
CN115603907A (en) Method, device, equipment and storage medium for encrypting storage data
WO2016202129A1 (en) Information processing method, device, terminal and server
CN110740112B (en) Authentication method, apparatus and computer readable storage medium
CN113541941A (en) Key processing method and device, electronic equipment and storage medium
CN114329504A (en) Model encryption method and related equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant