File fragment transmission method and device and program product
By dynamically adjusting the fragment size and combining symmetric encryption, asymmetric encryption, and chain fingerprint verification in file fragment transmission, the problem of high transmission failure rate caused by network fluctuations is solved, achieving more reliable and secure file transmission.
Patent Information
- Application Number
- CN202511194428.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-25
- Publication Date
- 2025-11-07
AI Technical Summary
During file transfer, when a file is fragmented into pieces of a fixed size, network fluctuations can lead to a high failure rate in the transfer process.
The fragment size is dynamically determined based on the current network bandwidth, and the fragment files are encrypted and transmitted using a combination of symmetric and asymmetric encryption. A chain fingerprint verification mechanism is introduced to ensure the integrity and correctness of the files.
It improves the reliability of file transfer, reduces the transmission failure rate during network fluctuations, and ensures the security and integrity of data.
Smart Images

Figure CN120915773A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of data transmission or financial technology, in particular to a file fragmentation transmission method, device and program product. BACKGROUND
[0002] With the development of information technology, file transmission systems have been widely used in various industries. In the file transmission process, using the file fragmentation transmission in the related technology is a common transmission method in the file transmission process. However, the fragmentation transmission in the related technology also has some shortcomings, for example: the fixed size of fragmentation leads to high transmission failure rate when the network fluctuates.
[0003] In view of the problem in the related art that the file is fragmented by a fixed size in the process of file fragmentation transmission, and the file transmission failure rate is high when the network fluctuates, no effective solution has been proposed so far. SUMMARY
[0004] The main purpose of the present application is to provide a file fragmentation transmission method, device and program product to solve the problem in the related art that the file is fragmented by a fixed size in the process of file fragmentation transmission, and the file transmission failure rate is high when the network fluctuates.
[0005] In order to achieve the above purpose, according to one aspect of the present application, a file fragmentation transmission method is provided. The method comprises: obtaining a current network bandwidth, and determining a fragmentation size based on the current network bandwidth; fragmenting a to-be-transmitted file based on the fragmentation size to obtain a target fragmented file, wherein the target fragmented file includes one of N fragmented files obtained by fragmenting the to-be-transmitted file, and N is a positive integer; encrypting the target fragmented file to obtain an encrypted fragmented file, and transmitting the encrypted fragmented file to a data receiving party.
[0006] Further, based on the current network bandwidth, the fragmentation size is determined, including: obtaining a historical network bandwidth, wherein the historical network bandwidth includes a network bandwidth obtained in a historical process before the current network bandwidth is obtained; calculating a change amount between the historical network bandwidth and the current network bandwidth to obtain a bandwidth change amount; in the case that the bandwidth change amount is greater than a preset change amount threshold, determining the fragmentation size based on the historical network bandwidth and the current network bandwidth.
[0007] Further, the current network bandwidth is acquired, including: acquiring a file size of a historical file and a transmission duration of the historical file, wherein the historical file includes at least one of: a preset test file, a last slice file transmitted before a current time; determining the current network bandwidth based on the file size of the historical file and the transmission duration of the historical file.
[0008] Further, before the current network bandwidth is acquired and the slice size is determined based on the current network bandwidth, further comprising: in a case that the to-be-transmitted file is sliced for the first time, acquiring a file type of the to-be-transmitted file, determining the slice size based on the file type, and performing slicing of the to-be-transmitted file based on the slice size to obtain a target slice file; in a case that the to-be-transmitted file is not sliced for the first time, performing the steps of acquiring the current network bandwidth and determining the slice size based on the current network bandwidth.
[0009] Further, the target slice file is encrypted to obtain an encrypted slice file, including: acquiring a hash value of a previous slice file associated with the target slice file to obtain a target hash value; generating a check code of the target slice file, and generating fingerprint information based on the check code and the target hash value, wherein the fingerprint information is used to verify the integrity and correctness of the target slice file; combining the fingerprint information and the target slice file to obtain a slice object; encrypting the slice object to obtain the encrypted slice file.
[0010] Further, the slice object is encrypted to obtain the encrypted slice file, including: encrypting the slice object by using a symmetric encryption key to obtain an encrypted slice object; encrypting the symmetric encryption key by using an asymmetric encryption strategy to obtain an encrypted key; and obtaining the encrypted slice file based on the encrypted slice object and the encrypted key.
[0011] Further, the encrypted slice file is transmitted to a data receiver, further including: transmitting the encrypted slice file to a relay node, wherein the relay node is used to forward the encrypted slice file; in a case that the encrypted slice file is received by the relay node, verifying the encrypted slice file based on the fingerprint information to obtain a first verification result, wherein the verification manner of the encrypted slice file includes at least one of: a cyclic redundancy check, a hash check; in a case that the first verification result indicates that the verification of the encrypted slice file fails, retransmitting the target slice file; in a case that the first verification result indicates that the verification of the encrypted slice file passes, transmitting the target slice file to the data receiver.
[0012] Further, after the target file slice is encrypted to obtain an encrypted file slice, and the encrypted file slice is transmitted to a data receiver, the method further includes: decrypting the encrypted key by using the asymmetric encryption strategy to obtain a decrypted key; decrypting the encrypted file slice based on the decrypted key to obtain a decrypted file slice; verifying the decrypted file slice based on the fingerprint information to obtain a second verification result; and determining the file received by the data receiver based on the hash value of the previous file slice recorded in the decrypted file slice in a case where the second verification result indicates that the decrypted file slice passes verification.
[0013] To achieve the above object, according to another aspect of the present application, a file slice transmission device is provided. The device includes: a processing unit configured to obtain a current network bandwidth, and determine a slice size based on the current network bandwidth; a slicing unit configured to slice a file to be transmitted based on the slice size to obtain a target file slice, wherein the target file slice includes one of N file slices obtained by slicing the file to be transmitted, and N is a positive integer; and a transmission unit configured to encrypt the target file slice to obtain an encrypted file slice, and transmit the encrypted file slice to a data receiver.
[0014] Further, the processing unit includes: a first obtaining subunit configured to obtain a historical network bandwidth, wherein the historical network bandwidth includes a network bandwidth obtained in a historical process before the current network bandwidth is obtained; a calculating subunit configured to calculate a change amount between the historical network bandwidth and the current network bandwidth to obtain a bandwidth change amount; and a determining subunit configured to determine the slice size based on the historical network bandwidth and the current network bandwidth in a case where the bandwidth change amount is greater than a preset change amount threshold.
[0015] Further, the obtaining subunit includes: an obtaining module configured to obtain a file size of a historical file and a transmission duration of the historical file, wherein the historical file includes at least one of the following: a preset test file, and a previous file slice transmitted before a current time; and a determining module configured to determine the current network bandwidth based on the file size of the historical file and the transmission duration of the historical file.
[0016] Further, the file fragment transmission apparatus further comprises: a first execution unit, configured to, in a case that the file to be transmitted is fragmented for the first time, acquire a file type of the file to be transmitted before acquiring a current network bandwidth and determining a fragment size based on the current network bandwidth, determine the fragment size based on the file type, and perform fragmenting the file to be transmitted based on the fragment size to obtain a target fragment file; and a second execution unit, configured to, in a case that the file to be transmitted is fragmented for the second time, perform the steps of acquiring the current network bandwidth and determining the fragment size based on the current network bandwidth.
[0017] Further, the transmission unit comprises: an acquisition subunit, configured to acquire a hash value of a previous fragment file associated with the target fragment file to obtain a target hash value; a generation subunit, configured to generate a check code of the target fragment file and generate fingerprint information based on the check code and the target hash value, wherein the fingerprint information is used to verify integrity and correctness of the target fragment file; a combination subunit, configured to combine the fingerprint information and the target fragment file to obtain a fragment object; and an encryption subunit, configured to encrypt the fragment object to obtain an encrypted fragment file.
[0018] Further, the encryption subunit comprises: a first encryption module, configured to encrypt the fragment object by using a symmetric encryption key to obtain an encrypted fragment object; a second encryption module, configured to encrypt the symmetric encryption key by using an asymmetric encryption strategy to obtain an encrypted key; and a processing module, configured to obtain the encrypted fragment file based on the encrypted fragment object and the encrypted key.
[0019] Further, the transmission unit further comprises: a transmission subunit, configured to transmit the encrypted fragment file to a relay node, wherein the relay node is configured to forward the encrypted fragment file; a verification subunit, configured to, in a case that the encrypted fragment file is received by the relay node, verify the encrypted fragment file based on the fingerprint information to obtain a first verification result, wherein the verification manner of the encrypted fragment file comprises at least one of the following: a cyclic redundancy check and a hash check; a retransmission subunit, configured to, in a case that the first verification result indicates that the encrypted fragment file fails to pass the verification, retransmit the target fragment file; and a sending subunit, configured to, in a case that the first verification result indicates that the encrypted fragment file passes the verification, send the target fragment file to the data receiver.
[0020] Further, the file fragmentation transmission further comprises: a first decryption unit configured to, after the target fragmented file is encrypted to obtain an encrypted fragmented file and the encrypted fragmented file is transmitted to a data receiver, decrypt the encrypted key by using the asymmetric encryption strategy to obtain a decrypted key at the data receiver; a second decryption unit configured to decrypt the encrypted fragmented object based on the decrypted key to obtain a decrypted fragmented object; a verification unit configured to verify the decrypted fragmented object based on the fingerprint information to obtain a second verification result; and a second determination unit configured to, when the second verification result indicates that the decrypted fragmented object passes the verification, determine the file received by the data receiver based on the hash value of the previous fragmented file recorded in the decrypted fragmented object.
[0021] According to another aspect of the present application, a computer readable storage medium is provided, which comprises a stored executable program, wherein the computer readable storage medium controls a device where the computer readable storage medium is located to perform the file fragmentation transmission method when the executable program is executed.
[0022] According to another aspect of the present application, an electronic device is provided, which comprises a memory storing an executable program and a processor configured to execute the program, wherein the program is executed to perform the file fragmentation transmission method.
[0023] According to another aspect of the present application, a computer program product is provided, which comprises computer instructions configured to implement the steps of the file fragmentation transmission method when executed by a processor.
[0024] In the present application, the current network bandwidth is acquired, and the fragmentation size is determined based on the current network bandwidth; the to-be-transmitted file is fragmented based on the fragmentation size to obtain a target fragmented file, wherein the target fragmented file comprises one of N fragmented files obtained by fragmenting the to-be-transmitted file, and N is a positive integer; the target fragmented file is encrypted to obtain an encrypted fragmented file, and the encrypted fragmented file is transmitted to a data receiver, thereby solving the technical problem that in the related art, the file is fixedly fragmented according to a fixed size in the process of fragmenting the file, and the file transmission failure rate is high when the network fluctuates. In the present application, the fragmentation size is dynamically determined based on the network bandwidth, and the file is fragmented and transmitted according to the fragmentation size, so that the fragmentation size of the transmitted file is dynamically adjusted according to the network bandwidth, thereby achieving the technical effect of improving the reliability of file transmission. BRIEF DESCRIPTION OF DRAWINGS
[0025] The accompanying drawings, which form a part of this application, are included to provide a further understanding of the application and are incorporated in and constitute a part of this application. The embodiments of this application, and their
[0026] Figure 1 A hardware structure block diagram of a computer terminal for implementing the file slice transmission method is shown;
[0027] Figure 2 A flow chart of the file slice transmission method according to an embodiment of the application is shown;
[0028] Figure 3 A schematic diagram of the file slice transmission device according to an embodiment of the application is shown;
[0029] Figure 4 A structure block diagram of an electronic device according to an embodiment of the application is shown. DETAILED DESCRIPTION
[0030] In order to enable persons skilled in the art to better understand the scheme of the present application, the technical scheme in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by persons skilled in the art without creative labor should fall within the scope of protection of the present application.
[0031] It should be noted that the terms "first", "second", and the like in the specification and claims of the present application and the above-described drawings are used to distinguish similar objects, and do not necessarily indicate a specific order or a chronological sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device that includes a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but can include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0032] It should be noted that the file slice transmission method and device in the present application can be used in the case of data transmission of files in the field of financial technology, and can also be used in the case of data transmission of files in any field other than the field of financial technology, for example, can be applied to cloud computing, distributed storage and Internet of Things edge computing scenarios, while ensuring transmission efficiency, emphasizing the response to network fluctuation scenarios in the transmission process, and the application field of the file slice transmission method and device in the present application is not limited.
[0033] First, some of the nouns or terms that appear in the description of the embodiments of the application are applicable to the following explanations:
[0034] File transfer system: a system for transferring files from one computer or device to another computer or device.
[0035] Symmetric encryption: an encryption algorithm that uses one key to encrypt and decrypt plaintext.
[0036] Asymmetric encryption: an encryption algorithm that uses a pair of keys, a public key for encryption and a private key for decryption.
[0037] Hardware security module (HSM): a core component of information security infrastructure, responsible for protecting and managing the most sensitive encryption keys and securely performing critical encryption operations.
[0038] It should be noted that the information collected in this application (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for display, analyzed data, etc.) are authorized by the user or authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of related data comply with relevant laws, regulations and standards, take necessary security measures, do not violate public order and good customs, and provide corresponding operation portal for user selection authorization or refusal. For example, the system and related users or institutions have an interface, which provides a corresponding operation portal for users to choose to agree or refuse automatic decision results; if the user chooses to refuse, the expert decision process is entered.
[0039] The application can be applied to various software products, control systems, and client-side (including but not limited to mobile clients, PCs, etc.) control systems of various financial institutions. Taking a software product as an example, through the software product installed on the mobile client, the business content of the financial institution (including but not limited to: transfer, financial management, fund, payment, account inquiry, advertising, recommendation, etc. Business functions) can be realized.
[0040] Embodiment one
[0041] According to the embodiments of the application, a method embodiment of a file fragment transmission method is also provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0042] The method provided in the embodiment one of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Figure 1 A hardware structure block diagram of a computer terminal (or a mobile device) for implementing the file fragment transmission method is shown. As shown in the figure, Figure 1 The computer terminal 10 (or a mobile device) can include one or more processors 102 (the processor 102 can include but is not limited to a microprocessor MCU or a programmable logic device FPGA and the like processing device), a memory 104 for storing data, and a transmission device 106 for communication function. In addition, it can also include a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which can be included as one of the ports of the BUS bus), a network interface, a power supply and / or a camera. Those skilled in the art can understand that, Figure 1 The structure shown in the figure is only schematic, which does not limit the structure of the above-mentioned electronic device. For example, the computer terminal 10 can include more or less components than those shown in the figure, or have a different configuration from that shown in the figure. Figure 1 The structure shown in the figure is only schematic, which does not limit the structure of the above-mentioned electronic device. For example, the computer terminal 10 can include more or less components than those shown in the figure, or have a different configuration from that shown in the figure. Figure 1 The structure shown in the figure is only schematic, which does not limit the structure of the above-mentioned electronic device. For example, the computer terminal 10 can include more or less components than those shown in the figure, or have a different configuration from that shown in the figure.
[0043] It should be noted that the one or more processors 102 and / or other data processing circuits described above can be referred to as "data processing circuits" herein. The data processing circuit can be embodied in whole or in part as software, hardware, firmware or any other combination. In addition, the data processing circuit can be a single independent processing module, or all or part of any one of the other elements combined into the computer terminal 10 (or a mobile device). As referred to in the embodiments of the present application, the data processing circuit as a processor controls (for example, the selection of the variable resistance terminal path connected with the interface).
[0044] The memory 104 can be used to store software programs and modules of application software, such as program instructions / data storage devices corresponding to the file fragment transmission method in the embodiments of the present application. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, that is, implements the above-mentioned file fragment transmission method. The memory 104 can include a high-speed random access memory, and can also include a non-volatile memory, such as one or more magnetic storage devices, flash memories, or other non-volatile solid state memories. In some examples, the memory 104 can further include a memory remotely arranged with respect to the processor 102, which can be connected to the computer terminal 10 through a network. Examples of the above-mentioned network include but are not limited to the Internet, an intranet, a local area network, a mobile communication network and a combination thereof.
[0045] The transmission device 106 is configured to receive or send data via a network. The network can include a wireless network provided by a communication provider of the computer terminal 10. In one example, the transmission device 106 includes a network interface controller (NIC) that can connect to other network devices through a base station to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module that is configured to communicate with the Internet wirelessly.
[0046] The display can be a touch screen liquid crystal display (LCD) that enables a user to interact with a user interface of the computer terminal 10 (or mobile device).
[0047] In the above operating environment, the present application provides a file fragment transmission method as shown in Figure 2 Figure 2 is a flowchart of the file fragment transmission method according to the first embodiment of the present application.
[0048] In step S201, the current network bandwidth is obtained, and the fragment size is determined based on the current network bandwidth.
[0049] The current network bandwidth can be determined according to the size and transmission duration of a previous transmitted file. The transmitted file can be a test packet for testing the network bandwidth, or a previously transmitted fragment file.
[0050] In this embodiment, the fragment size of the fragmenting of the to-be-transmitted file can be determined according to the current network bandwidth, i.e., the fragment size can be adjusted dynamically according to the network bandwidth in this embodiment. In addition, in order to avoid unnecessary calculation overhead caused by the small variation of the bandwidth (e.g., 100 MB / s becomes 101 MB / s), a threshold can be set for the bandwidth variation, and the fragment size is recalculated when the bandwidth variation exceeds the preset threshold.
[0051] In step S202, the to-be-transmitted file is fragmented based on the fragment size to obtain a target fragment file, wherein the target fragment file includes one of N fragment files obtained by fragmenting the to-be-transmitted file, and N is a positive integer.
[0052] The target fragment file includes one of N fragment files obtained by fragmenting the to-be-transmitted file. In one optional example, the fragment size of each fragment file can be adjusted dynamically according to the corresponding bandwidth during fragmenting. In another optional example, the to-be-transmitted file can be directly divided into N fragment files according to the fragment size.
[0053] Step S203, the target file is encrypted to obtain an encrypted file, and the encrypted file is transmitted to the data receiving party.
[0054] In this embodiment, a composite fingerprint can be generated for the target file (to ensure data integrity and correctness), to obtain a file object. Then, the file object can be encrypted using a symmetric encryption key, and the symmetric encryption key can be encrypted using an asymmetric encryption strategy, to obtain an encrypted file. Then, the encrypted file can be transmitted to the data receiving party.
[0055] In this embodiment, through the above steps, the size of the file is determined based on the network bandwidth, and the file is fragmented and transmitted according to the size of the file. The purpose of dynamically adjusting the size of the transmitted file according to the network bandwidth is achieved, thereby achieving the technical effect of improving the reliability of file transmission. Furthermore, the technical problem of high file transmission failure rate in the related art when the file is fragmented and transmitted according to a fixed size is solved.
[0056] Optionally, in the file fragmentation transmission method provided in the embodiments of the present application, the size of the file is determined based on the current network bandwidth, including: obtaining a historical network bandwidth, wherein the historical network bandwidth includes: a network bandwidth obtained in a historical process before the current network bandwidth is obtained; calculating a change amount between the historical network bandwidth and the current network bandwidth to obtain a bandwidth change amount; and in a case where the bandwidth change amount is greater than a preset change amount threshold, determining the size of the file based on the historical network bandwidth and the current network bandwidth.
[0057] In order to avoid unnecessary calculation overhead caused by a small change in bandwidth (for example, 100MB / s becomes 101MB / s), a threshold can be set for the bandwidth change to trigger the recalculation of the size of the file. The current network bandwidth can be calculated from the last transmitted file (such as a fragmented file or a test package).
[0058] If the historical network bandwidth is obtained as 100MB / s, and the current network bandwidth is 110MB / s, a fluctuation of about 10% occurs, thereby triggering the recalculation of the size of the file. The calculation is as follows: the size of the file can be adjusted by the bandwidth calculation formula: B now =α×B prev +(1-α)×B current , for example, both sides of the formula should be multiplied by the unit time t of transmission, thereby obtaining the change rule of the size of the file, wherein B now may represent the predicted bandwidth of the next fragmented file, B prev represents the historical network bandwidth, and B currentBandwidth, α is a balance factor, which can be freely defined, and is generally selected as 0.8, B now Xt, which represents the calculated size of the slice, in this embodiment, the size of the slice can be automatically adjusted when the packet loss rate is high according to the detected bandwidth, thereby reducing the amount of retransmitted data.
[0059] Optionally, in the file slice transmission method provided in the embodiments of the present application, the current network bandwidth is obtained, including: obtaining the file size of a historical file and the transmission time length of the historical file, wherein the historical file includes at least one of the following: a preset test file, a last slice file transmitted before the current time; determining the current network bandwidth based on the file size of the historical file and the transmission time length of the historical file.
[0060] The historical file can be a test packet for testing the network bandwidth, or a previous slice file that has been transmitted. For example, a test packet can be sent to obtain the current bandwidth, Wherein, Bandwidth represents the network bandwidth, TestPacketSze represents the test packet size, TransmissionTime represents the transmission time length, a 1MB packet is sent, the transmission time (i.e. transmission time length) is 0.01 seconds, and the bandwidth is 100MB / s, achieving the technical effect of accurately determining the network bandwidth.
[0061] Optionally, in the file slice transmission method provided in the embodiments of the present application, before obtaining the current network bandwidth and determining the slice size based on the current network bandwidth, it further includes: in the case of first slicing the to-be-transmitted file, obtaining the file type of the to-be-transmitted file, determining the slice size based on the file type, and performing the step of slicing the to-be-transmitted file based on the slice size to obtain the target slice file; in the case of not first slicing the to-be-transmitted file, performing the steps of obtaining the current network bandwidth and determining the slice size based on the current network bandwidth.
[0062] In this embodiment, the dynamic slicing optimization engine can be used to analyze the file type and the current network bandwidth to determine the optimal slice size. In one optional example, the file can be sliced with a size of 100MB according to the current file type, such as a zip file, and a video file can be sliced with a size of 50MB; in another optional example, the file can be sliced according to the network bandwidth.
[0063] In one optional example, in the case of first slicing the to-be-transmitted file, the file type of the to-be-transmitted file can be obtained, and the slice size is determined based on the file type, and in the subsequent slicing process, the slice size can be dynamically adjusted according to the network bandwidth, avoiding the high transmission failure rate caused by fixed slice size in the case of network fluctuation, and achieving the technical effect of improving the reliability of file transmission.
[0064] Optionally, in the file fragment transmission method provided in the embodiments of the present application, the target fragment file is encrypted to obtain an encrypted fragment file, including: obtaining a hash value of a previous fragment file associated with the target fragment file to obtain a target hash value; generating a check code of the target fragment file, and generating fingerprint information based on the check code and the target hash value, wherein the fingerprint information is used to verify the integrity and correctness of the target fragment file; combining the fingerprint information and the target fragment file to obtain a fragment object; and encrypting the fragment object to obtain the encrypted fragment file.
[0065] In the embodiments, in order to solve the problem that the fingerprint verification in the related art is only for a complete file and cannot locate fragment-level errors, in the embodiments, a composite fingerprint (i.e., fingerprint information) can be generated for each fragment file, including:
[0066] SHA3-512 (Secure Hash Algorithm) hash value of each fragment file is generated: to ensure data integrity.
[0067] CRC32 (Cyclic Redundancy Check 32) check code of each fragment file is generated: to quickly verify the local correctness of the fragment.
[0068] A fragment fingerprint chain is constructed, and each fragment fingerprint (i.e., composite fingerprint information) can contain a hash value of a previous fragment to form a tamper-proof chain structure.
[0069] The target fragment file and the fingerprint information (i.e., the check code of the target fragment file and the hash value of the previous fragment file, corresponding to the target hash value) can constitute a fragment object, and in the embodiments, a chain fingerprint is introduced in the fragment file, and when the fingerprint is inconsistent, the incorrect fragment can be found in O(n) time through chain searching, so as to trigger the operation of discarding the error packet and triggering retransmission.
[0070] Optionally, in the file fragment transmission method provided in the embodiments of the present application, the fragment object is encrypted to obtain an encrypted fragment file, including: encrypting the fragment object by using a symmetric encryption key to obtain an encrypted fragment object; encrypting the symmetric encryption key by using an asymmetric encryption strategy to obtain an encrypted key; and obtaining the encrypted fragment file based on the encrypted fragment object and the encrypted key.
[0071] In order to solve the problem of low efficiency of fragment encryption in the related art (for example, the case of performance bottleneck caused by directly processing fragments by using asymmetric encryption), in the embodiment, each fragment object can be encrypted by using the SM4 algorithm of the national secret (supporting GPU (Graphics Processing Unit, "graphics processor" or "display core") acceleration), and symmetric keys K1, K2, …, Kn of n fragment objects are dynamically generated. The SM4 key is 128 bits. For example, it is assumed that a key derivation function K(h) is provided. The function outputs an SM4 key of 128 bits that meets the condition through the input parameter. For example, by inputting the current timestamp + fragment file size, a key Ki can be generated. The generation of the key can be associated with an ordered change content or an unordered change (seed random) content. Because the key can be transmitted in the later transmission.
[0072] In the embodiment, for each fragment file, ciphertext fragments C1, C2, …, Cn can be generated. For the symmetric key Ki of each ciphertext fragment, the quantum secure algorithm or the asymmetric encryption algorithm can be used to generate key encrypted text Ti. The symmetric key corresponding to the target fragment file associated with the fragment and the key encrypted text can constitute the encrypted fragment file described above. The combination of symmetric encryption and asymmetric encryption is used. The fast symmetric encryption is used to encrypt the larger fragment, the encryption time is reduced, and the asymmetric encryption method is used to encrypt the key to ensure the security of the transmission.
[0073] Optionally, in the file fragment transmission method provided in the embodiment of the application, the encrypted fragment file is transmitted to the data receiving side, and further includes: transmitting the encrypted fragment file to a transfer node, wherein the transfer node is configured to forward the encrypted fragment file; in the case that the encrypted fragment file is received by the transfer node, the encrypted fragment file is checked based on the fingerprint information to obtain a first check result, wherein the checking method of the encrypted fragment file includes at least one of the following: cyclic redundancy check, hash check; in the case that the first check result indicates that the encrypted fragment file fails to pass the check, the target fragment file is retransmitted; in the case that the first check result indicates that the encrypted fragment file passes the check, the target fragment file is sent to the data receiving side.
[0074] In this embodiment, for the ciphertext slice file Ci in the encrypted slice file and the key encrypted text Ti, the transit node can be forwarded to the data receiver, and in the case that the transit node receives the encrypted slice file, the CRC32 check code can be verified immediately based on the fingerprint information, the error slice triggers the local retransmission request, and the slice integrity can be quickly confirmed based on the fingerprint information through the lightweight hash check (such as BLAKE3), thereby reducing the transmission delay.
[0075] Optionally, in the file slice transmission method provided in the embodiments of the present application, after the target slice file is encrypted to obtain the encrypted slice file, and the encrypted slice file is transmitted to the data receiver, the method further comprises: decrypting the encrypted key by an asymmetric encryption strategy at the data receiver to obtain a decrypted key; decrypting the encrypted slice object based on the decrypted key to obtain a decrypted slice object; verifying the decrypted slice object based on the fingerprint information to obtain a second verification result; in the case that the second verification result indicates that the decrypted slice object passes the verification, determining the file received by the data receiver based on the hash value of the previous slice file recorded in the decrypted slice object.
[0076] In the case that the data receiver receives the encrypted slice file, slice-level fingerprint chain verification can be performed. Specifically, when receiving the slice, the GPU acceleration pipeline is used to verify in parallel: (1) CRC32 check: the local correctness of the slice is checked within 50 ms. (2) SHA3-512 hash chain verification: the slice file is confirmed to be correct and in order without being tampered with.
[0077] After the verification passes, layered decryption and key recovery can be performed. Specifically: (1) the receiver private key is used to decrypt Ti (i.e., the encrypted key) to obtain the symmetric key Ki (i.e., the decrypted key), and Ci slice (i.e., the encrypted slice object) is decrypted by SM4 algorithm and Ki, thereby obtaining the original single slice object, wherein the decryption process is isolated by a hardware security module (HSM) to prevent memory leakage. Then all the slice files received by the receiver can be combined to obtain the final file. In this embodiment, all the slice files in the slice objects can be combined to obtain the recovered file according to the hash value of the previous slice object recorded by the fingerprint information of the slice object. The technical effect of improving the reliability of file transmission is achieved.
[0078] In the embodiment, the symmetric encryption and the asymmetric encryption are combined, the symmetric encryption is used to encrypt the larger slice to reduce the encryption time, and the asymmetric encryption is used to encrypt the key to ensure the security of the transmission. According to the detected bandwidth, the size of the slice is automatically adjusted when the packet loss rate is high, so as to reduce the amount of retransmission data. The chain fingerprint is introduced, when the fingerprints are inconsistent, the incorrect slice can be found in O(n) time through chain search, so as to trigger the operation of discarding the error packet and triggering the retransmission.
[0079] It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although the logical order is shown in the flowchart, in some cases, the steps shown or described herein can be executed in an order different from that shown.
[0080] Embodiment two
[0081] The embodiment two of the application provides an optional file transmission system, which can be used to execute the file slice transmission method in the embodiment one of the application, and the system can include an information sender, an information transfer node and a data receiving node. The system is explained in detail as follows.
[0082] (I) Composition and function of the system:
[0083] 1. Information sender:
[0084] (1) Slice processing: the dynamic slice optimization engine is used to analyze the file type and the current network bandwidth to determine the optimal slice size. The simplest slice rule is to slice according to the current file type, for example, a zip file is sliced with a size of 100 MB, and a video file is sliced with a size of 50 MB; the more complex case is to slice according to the network bandwidth, first, a test packet is sent to obtain the current bandwidth, Bandwidth represents the network bandwidth, TestPacketSze represents the test packet size, and TransmissionTime represents the transmission time length, for example, a 1 MB packet is sent, and the transmission time is 0.01 second, so the bandwidth is 100 MB / s. Since the network bandwidth may be unstable, the slice size can be dynamically adjusted according to the size of the network bandwidth. In order to avoid unnecessary calculation overhead caused by the small change of the bandwidth (for example, 100 MB / s changes to 101 MB / s), a threshold value can be set for the bandwidth change to trigger the recalculation of the slice size. The current bandwidth is calculated from the last transmitted slice, for example, from 100 MB / s to 110 MB / s, which fluctuates by about 10%, so that the slice is recalculated, and the calculation formula is: now = α × B prev + (1-α) × Bcurrent , i.e. adjusting the size of the fragment, conveniently, both sides of the formula should be multiplied by the transmission unit time t, so as to obtain the change rule of the size of the fragment, wherein Bn ow may represent the predicted bandwidth of the next fragment file in transmission, B prev represents the historical network bandwidth, B current represents the current network bandwidth, and α is a balance factor, which can be freely defined, and is generally selected as 0.8, B now ×t represents the calculated size of the fragment.
[0085] The to-be-transmitted file is fragmented, and a composite fingerprint is generated for each fragment, including:
[0086] SHA3-512 hash value: ensuring data integrity;
[0087] CRC32 check code: quickly verifying the local correctness of the fragment.
[0088] A fragment fingerprint chain is constructed, and each fragment fingerprint contains the hash value of the previous fragment, forming a tamper-proof chain structure.
[0089] (2) Hierarchical encryption processing:
[0090] Each fragment is encrypted using the national SM4 algorithm (supporting GPU acceleration), and dynamic symmetric keys K1, K2, …, Kn are generated. The SM4 key is 128 bits. For example: a key derivation function K(h) is provided, which outputs an SM4 key of 128 bits that meets the conditions through the input parameters. For example, by inputting the current timestamp + fragment file size, a key Ki can be generated. The generation of the key can be associated with an ordered change content or an unordered change (seed random) content, because the key will be transmitted in the later transmission.
[0091] Ciphertext fragments C1, C2, …, Cn are generated, and for each symmetric key Ki, a quantum-safe algorithm is used to generate key encrypted text Ti.
[0092] (3) Transmission: transmit the ciphertext fragments Ci and the key encrypted texts Ti.
[0093] 2 Information relay node: (1) Fragment fingerprint pre-verification: after receiving the fragment, the relay node immediately verifies the CRC32 check code, and the error fragment triggers a local retransmission request; the integrity of the fragment is quickly confirmed through lightweight hash verification (such as BLAKE3), reducing transmission delay.
[0094] 3 Data receiver:
[0095] (1) Fragment-level fingerprint chain verification: when receiving fragments, verify in parallel through a GPU-accelerated pipeline, including:
[0096] CRC32 check: complete local correctness check of fragments within 50 ms.
[0097] SHA3-512 hash chain verification: confirm that fragments are not tampered with and are in the correct order.
[0098] (2) Layered decryption and key recovery: decrypt Ti using the receiver's private key to obtain symmetric key Ki, and decrypt Ci fragments through SM4 algorithm and Ki to obtain the original single fragment, wherein the decryption process is isolated by a hardware security module (HSM) to prevent memory leakage.
[0099] (II) System implementation steps:
[0100] Fragment transmission process: obtain the current network bandwidth, modify the file fragment size M according to the bandwidth and the type of the transmitted file, and fragment the transmission file S according to the fragment size, with the number of fragments being Obtain the fragment Si. After the fragmentation is completed, encrypt each fragment Ti using the dynamic key pair Ki to obtain the encrypted fragment group Ci, encrypt the dynamic key pair Ki to obtain the encrypted text Ti, and transmit the fragment group Ci and the encrypted text Ti to the next node.
[0101] File relay process: after the relay node receives the file fragments, it performs CRC32 check on each fragment, and if the check code is incorrect, it directly triggers remote retransmission. The integrity of the fragments is also checked through hash verification.
[0102] File receiving and parsing process: after receiving the file and the key string, separate the fragment group Ci and the encrypted text Ti, decrypt the dynamic key pair Ki according to the quantum encryption algorithm or asymmetric encryption algorithm, and obtain the fragment Si according to the symmetric encryption under the condition of secure hardware, and then concatenate the final file according to the verification order after verification.
[0103] (III) System implementation:
[0104] 1. Sender (Sender) processing process:
[0105] The sender is responsible for fragmenting, encrypting, and sending the file to the relay node.
[0106] 1.1 File upload interface:
[0107] The user uploads the file by calling the / upload interface (file upload interface) of the sender.
[0108] The interface is handled by the uploadFile method in the FileController.
[0109] The method calls fileProcessingService.processAndSendFile(file) to process the file.
[0110] 1.2 File Processing Service:
[0111] In the processAndSendFile method:
[0112] Convert the uploaded file to a byte array: byte[] fileData = file.getBytes();
[0113] Call createFragments(fileData) to fragment the file.
[0114] Call sendFragmentsToRelay(fragments) to send the fragments to the relay node.
[0115] 1.3 File Fragmentation (createFragments method):
[0116] The fragmentation process uses DynamicFragmentEngine to dynamically calculate the fragment size.
[0117] DynamicFragmentEngine can calculate the fragment size based on the current network bandwidth and file type.
[0118] Detect the file type: String fileType = FileTypeDetector.detect(fileData);
[0119] Determine the base fragment size based on bandwidth and file type:
[0120] If bandwidth > 10 Mbps, the base fragment size is 2048 KB, otherwise it is 1024 KB.
[0121] Recalculate the fragment size when |current bandwidth size - fragment bandwidth size| / fragment bandwidth size > 10% when the next fragment loop.
[0122] Continue to split the file data into multiple fragments (FileFragment objects) based on the calculated fragment size.
[0123] 1.4 Creation and encryption of FileFragment object:
[0124] Each fragment, at the time of creation (in the FileFragment constructor), is processed as follows:
[0125] Store the original data: this.originalData = data;
[0126] Record the hash of the previous fragment (for chain validation), calculate and store the CRC32 checksum, calculate and store the SHA3-512 hash, call the processEncryption() method for encryption:
[0127] Generate SM4 symmetric key, encrypt the original data using SM4: this.encryptedData = SM4Util.encrypt(originalData, symmetricKey);
[0128] Encrypt the symmetric key using a quantum-safe encryption algorithm (CRYSTALS-Kyber).
[0129] 1.5 Sending fragments to the relay node:
[0130] In the sendFragmentsToRelay (method for sending fragments to the relay node) method:
[0131] Use RestTemplate to send each fragment in a loop.
[0132] For each fragment, calculate the encryption information of the fragment (such as SHA3-512, CRC32, etc., which has been in the fragment object).
[0133] Send the fragment object (send the encrypted file fragment and related metadata from the sender to the relay node or receiver through the HTTP POST (send the encrypted file fragment and related metadata from the sender to the relay node or receiver) to the / relay / fragment (relay / fragment) interface of the relay node), multi-threaded sending, if failed, trigger retransmission.
[0134] 2. Relay node (Relay) processing process:
[0135] The relay node receives the fragments, verifies them, and then forwards them to the receiver.
[0136] 2.1 Receive fragment interface:
[0137] The relay node provides / relay / fragment interface (handled by the handleFragment method of the RelayController).
[0138] The method receives a FragmentTransmission object (containing fragment data, checksum, etc.).
[0139] 2.2 Fragment verification:
[0140] The relay node performs two-step verification:
[0141] 1. CRC32 pre-verification: Call the validationService.validateCRC32(transmission) method to verify whether the CRC32 value of the transmission is consistent with the calculated fragment data.
[0142] 2. BLAKE3 fast hash verification, verify the BLAKE3 hash value of the fragment data.
[0143] If any of the verifications fail, return an error response; otherwise, continue forwarding.
[0144] 2.3 Forwarding fragments to receivers:
[0145] Call the forwardingService.forwardToReceiver(transmission) method to forward the fragment to the receiver.
[0146] Before forwarding, the relay node will store the encryption key corresponding to the fragment (through the KeyStorageService).
[0147] 2.4 Key storage service:
[0148] In KeyStorageService:
[0149] Store the encrypted symmetric key (i.e. the ciphertext of the symmetricKey of the fragment after quantum-safe encryption) into the distributed database.
[0150] Create a KeyEntity object containing fragment ID (fragmentId), encrypted key (encryptedKey), and timestamp.
[0151] Call the keyRepository.save(entity) method to save to the database.
[0152] Asynchronous backup to other nodes (via the replicateToBackupNodes method).
[0153] 3. Receiver processing process:
[0154] The receiver receives the fragments, verifies and decrypts them, and finally reassembles the file.
[0155] 3.1 Receive fragment interface:
[0156] The receiver provides the / receiver / fragment interface (handled by the receiveFragment method of the ReceiverController).
[0157] This method calls the processingService.processFragment(transmission) method to process the fragment.
[0158] 3.2 Fragment processing service:
[0159] In the processFragment method of the FragmentProcessingService:
[0160] GPU-accelerated parallel verification: use HashUtils.verifyWithGPU(transmission) for fast verification (internally uses GPU parallel computing to check CRC32 and SHA3-512).
[0161] If the verification fails, an exception is thrown.
[0162] Verify fragment chain integrity: check if the hash of the previous fragment of the current fragment matches the hash of the last received fragment (ensure fragment order and integrity).
[0163] Decrypt the fragment: call the decryptFragment(transmission) method (method to decrypt the fragment).
[0164] 3.3 Fragment decryption:
[0165] In the decryptFragment method:
[0166] Retrieve the encrypted symmetric key (i.e., the encryptedKey stored by the previous relay node) from distributed storage via keyRetrievalService.getKey(transmission.getFragmentId()).
[0167] Quantum secure decryption using HSM (Hardware Security Module): byte[] symmetricKey = hsmDecryptor.decryptWithHSM(encryptedKey); (CRYSTALS-Kyber decryption is used here because the key is encrypted with a quantum secure algorithm).
[0168] Decrypt the fragmented data using the decrypted SM4 symmetric key, and store the decrypted data into the fragmented transmission object.
[0169] 3.4 File recombination:
[0170] When all fragments are received and processed, the assembleFragments method is triggered, and the recipient will splice all the decrypted data (decryptedData) of the fragments in order to restore the original file.
[0171] Finally, the file data is returned as a binary stream.
[0172] In this embodiment, the method of combining symmetric encryption and asymmetric encryption is used. The speed of symmetric encryption is used to encrypt larger fragments, reducing encryption time, and the asymmetric encryption method is used to encrypt the key to ensure the security of transmission. According to the detected bandwidth, the size of the fragment is automatically adjusted when the packet loss rate is high, thereby reducing the amount of retransmitted data. Chain fingerprints are introduced. When the fingerprints are inconsistent, the incorrect fragment can be found in O(n) time through chain lookup, thereby triggering the operation of discarding the error packet and triggering retransmission.
[0173] Embodiment three
[0174] The embodiments of the present application also provide a file fragmentation transmission device. It should be noted that the file fragmentation transmission device of the embodiments of the present application can be used to execute the file fragmentation transmission method provided by the embodiments of the present application. The file fragmentation transmission device provided by the embodiments of the present application is introduced as follows.
[0175] According to the embodiments of the present application, a device for implementing the above-mentioned file fragmentation transmission method is also provided, as shown in Figure 3 The device includes a processing unit 31, a fragmentation unit 32, and a transmission unit 33.
[0176] The processing unit 31 is configured to obtain the current network bandwidth and determine the fragmentation size based on the current network bandwidth.
[0177] The fragmentation unit 32 is configured to fragment the to-be-transmitted file based on the fragmentation size to obtain a target fragmented file, wherein the target fragmented file includes one of N fragmented files obtained by fragmenting the to-be-transmitted file, and N is a positive integer.
[0178] The transmission unit 33 is configured to encrypt the target fragmented file to obtain an encrypted fragmented file, and transmit the encrypted fragmented file to a data receiving party.
[0179] In the file fragmentation transmission apparatus provided in the embodiment of the present application, the processing unit 31 is configured to obtain a current network bandwidth, and determine the fragmentation size based on the current network bandwidth. The fragmentation unit 32 is configured to fragment the to-be-transmitted file based on the fragmentation size to obtain a target fragmented file, wherein the target fragmented file includes one of N fragmented files obtained by fragmenting the to-be-transmitted file, and N is a positive integer. The transmission unit 33 is configured to encrypt the target fragmented file to obtain an encrypted fragmented file, and transmit the encrypted fragmented file to a data receiving party. Thus, the technical problem of high file transmission failure rate in the prior art when the file is fragmented and transmitted in a fixed manner is solved. In the embodiment, the fragmentation size is dynamically determined based on the network bandwidth, and the file is fragmented and transmitted according to the fragmentation size, so that the fragmentation size of the transmitted file is dynamically adjusted according to the network bandwidth, thereby achieving the technical effect of improving the reliability of file transmission.
[0180] Optionally, in the file fragmentation transmission apparatus provided in the embodiment of the present application, the processing unit includes a first obtaining subunit configured to obtain a historical network bandwidth, wherein the historical network bandwidth includes a network bandwidth obtained in a historical process before the current network bandwidth is obtained; a calculating subunit configured to calculate a change amount between the historical network bandwidth and the current network bandwidth to obtain a bandwidth change amount; and a determining subunit configured to determine the fragmentation size based on the historical network bandwidth and the current network bandwidth when the bandwidth change amount is greater than a preset change amount threshold.
[0181] Optionally, in the file fragmentation transmission apparatus provided in the embodiment of the present application, the obtaining subunit includes an obtaining module configured to obtain a file size of a historical file and a transmission time length of the historical file, wherein the historical file includes at least one of a preset test file and a last fragmented file transmitted before the current time; and a determining module configured to determine the current network bandwidth based on the file size of the historical file and the transmission time length of the historical file.
[0182] Optionally, in the file fragment transmission apparatus provided by the embodiment of the present application, the file fragment transmission apparatus further comprises: a first execution unit, configured to, in the case of fragmenting the to-be-transmitted file for the first time before the current network bandwidth is acquired and the fragment size is determined based on the current network bandwidth, acquire the file type of the to-be-transmitted file, determine the fragment size based on the file type, and perform the step of fragmenting the to-be-transmitted file based on the fragment size to obtain the target fragment file; and a second execution unit, configured to, in the case of fragmenting the to-be-transmitted file for the first time, perform the step of acquiring the current network bandwidth and determining the fragment size based on the current network bandwidth.
[0183] Optionally, in the file fragment transmission apparatus provided by the embodiment of the present application, the transmission unit comprises: an acquisition subunit, configured to acquire the hash value of the previous fragment file associated with the target fragment file to obtain a target hash value; a generation subunit, configured to generate a check code of the target fragment file and generate fingerprint information based on the check code and the target hash value, wherein the fingerprint information is used to verify the integrity and correctness of the target fragment file; a combination subunit, configured to combine the fingerprint information and the target fragment file to obtain a fragment object; and an encryption subunit, configured to encrypt the fragment object to obtain the encrypted fragment file.
[0184] Optionally, in the file fragment transmission apparatus provided by the embodiment of the present application, the encryption subunit comprises: a first encryption module, configured to encrypt the fragment object by using a symmetric encryption key to obtain an encrypted fragment object; a second encryption module, configured to encrypt the symmetric encryption key by using an asymmetric encryption strategy to obtain an encrypted key; and a processing module, configured to obtain the encrypted fragment file based on the encrypted fragment object and the encrypted key.
[0185] Optionally, in the file fragment transmission apparatus provided by the embodiment of the present application, the transmission unit further comprises: a transmission subunit, configured to transmit the encrypted fragment file to a relay node, wherein the relay node is configured to forward the encrypted fragment file; a verification subunit, configured to, in the case that the encrypted fragment file is received by the relay node, verify the encrypted fragment file based on the fingerprint information to obtain a first verification result, wherein the verification manner of the encrypted fragment file comprises at least one of the following: a cyclic redundancy check and a hash check; a retransmission subunit, configured to, in the case that the first verification result indicates that the encrypted fragment file fails to pass the verification, retransmit the target fragment file; and a sending subunit, configured to, in the case that the first verification result indicates that the encrypted fragment file passes the verification, send the target fragment file to a data receiving party.
[0186] Optionally, in the file fragment transmission apparatus provided in this application embodiment, the file fragment transmission further includes: a first decryption unit, configured to, after encrypting the target fragment file to obtain an encrypted fragment file and transmitting the encrypted fragment file to the data receiver, decrypt the encrypted key using an asymmetric encryption strategy to obtain a decrypted key; a second decryption unit, configured to decrypt the encrypted fragment object based on the decrypted key to obtain a decrypted fragment object; a verification unit, configured to verify the decrypted fragment object based on fingerprint information to obtain a second verification result; and a second determination unit, configured to, if the second verification result indicates that the decrypted fragment object has passed verification, determine the file received by the data receiver based on the hash value of the previous fragment file recorded in the decrypted fragment object.
[0187] It should be noted that the processing unit 31, the fragmentation unit 32, and the transmission unit 33 mentioned above correspond to steps S201 to S203 in Embodiment 1. Each unit and the corresponding step implement the same instance and application scenario, but are not limited to the content disclosed in Embodiment 1. It should be noted that the above modules or units can be hardware or software components stored in memory (e.g., memory 104) and processed by one or more processors (e.g., processors 102a, 102b, ..., 102n). The above modules can also be part of the device and run in the computer terminal 10 provided in Embodiment 1.
[0188] Example 4
[0189] Embodiments of this application may provide an electronic device. Figure 4 This is a structural block diagram of an electronic device according to an embodiment of this application. Figure 4 As shown, the electronic device may include: one or more ( Figure 4 Only one of the following is shown: processor 402, memory 404, memory controller, and peripheral interface, wherein the peripheral interface is connected to the radio frequency module, audio module and display.
[0190] The memory can be used to store software programs and modules, such as program instructions / modules corresponding to the method and device in the embodiments of the present application. The processor executes various functions and data processing by running the software programs and modules stored in the memory, that is, implements the above method. The memory can include a high-speed random access memory, and can further include a non-volatile memory, such as one or more magnetic storage devices, flash memories, or other non-volatile solid-state memories. In some examples, the memory can further include a memory remotely arranged with respect to the processor, which can be connected to the terminal through a network. Examples of the above network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof.
[0191] The processor can call information and applications stored in the memory through the transmission device to perform the following steps: obtaining a current network bandwidth, and determining a fragment size based on the current network bandwidth; fragmenting a to-be-transmitted file based on the fragment size to obtain a target fragment file, wherein the target fragment file includes one of N fragment files obtained by fragmenting the to-be-transmitted file, and N is a positive integer; encrypting the target fragment file to obtain an encrypted fragment file, and transmitting the encrypted fragment file to a data receiving party.
[0192] The processor can also call information and applications stored in the memory through the transmission device to perform the following steps: determining a fragment size based on the current network bandwidth, including: obtaining a historical network bandwidth, wherein the historical network bandwidth includes a network bandwidth obtained in a historical process before the current network bandwidth is obtained; calculating a change amount between the historical network bandwidth and the current network bandwidth to obtain a bandwidth change amount; in a case where the bandwidth change amount is greater than a preset change amount threshold, determining the fragment size based on the historical network bandwidth and the current network bandwidth.
[0193] The processor can also call information and applications stored in the memory through the transmission device to perform the following steps: obtaining a current network bandwidth, including: obtaining a file size of a historical file and a transmission time length of the historical file, wherein the historical file includes at least one of the following: a preset test file, a last fragment file transmitted before the current time; determining the current network bandwidth based on the file size of the historical file and the transmission time length of the historical file.
[0194] The processor can further call information and application programs stored in the memory through the transmission device to perform the following steps: before acquiring the current network bandwidth and determining the fragment size based on the current network bandwidth, further comprising: in the case of first fragmenting the to-be-transmitted file, acquiring the file type of the to-be-transmitted file, determining the fragment size based on the file type, and performing the steps of fragmenting the to-be-transmitted file based on the fragment size to obtain the target fragment file; in the case of not first fragmenting the to-be-transmitted file, performing the steps of acquiring the current network bandwidth and determining the fragment size based on the current network bandwidth.
[0195] The processor can further call information and application programs stored in the memory through the transmission device to perform the following steps: encrypting the target fragment file to obtain the encrypted fragment file, comprising: acquiring the hash value of the previous fragment file associated with the target fragment file to obtain a target hash value; generating a check code of the target fragment file, and generating fingerprint information based on the check code and the target hash value, wherein the fingerprint information is used to verify the integrity and correctness of the target fragment file; combining the fingerprint information and the target fragment file to obtain a fragment object; encrypting the fragment object to obtain the encrypted fragment file.
[0196] The processor can further call information and application programs stored in the memory through the transmission device to perform the following steps: encrypting the target fragment file to obtain the encrypted fragment file, comprising: encrypting the fragment object using a symmetric encryption key to obtain an encrypted fragment object; encrypting the symmetric encryption key using an asymmetric encryption strategy to obtain an encrypted key; based on the encrypted fragment object and the encrypted key, obtaining the encrypted fragment file.
[0197] The processor can further call information and application programs stored in the memory through the transmission device to perform the following steps: transmitting the encrypted fragment file to the data receiving party, further comprising: transmitting the encrypted fragment file to a relay node, wherein the relay node is used to forward the encrypted fragment file; in the case that the relay node receives the encrypted fragment file, verifying the encrypted fragment file based on the fingerprint information to obtain a first verification result, wherein the verification method of verifying the encrypted fragment file includes at least one of the following: cyclic redundancy check, hash check; in the case that the first verification result indicates that the encrypted fragment file fails the verification, retransmitting the target fragment file; in the case that the first verification result indicates that the encrypted fragment file passes the verification, sending the target fragment file to the data receiving party.
[0198] The processor can also call the information and application programs stored in the memory through the transmission device to perform the following steps: after the target file is encrypted to obtain the encrypted file, and the encrypted file is transmitted to the data receiving party, the steps further include: at the data receiving party, the encrypted key is decrypted through an asymmetric encryption strategy to obtain a decrypted key; the encrypted file object is decrypted based on the decrypted key to obtain a decrypted file object; the decrypted file object is verified based on the fingerprint information to obtain a second verification result; in a case where the second verification result indicates that the decrypted file object passes verification, the file received by the data receiving party is determined based on the hash value of the previous file recorded in the decrypted file object.
[0199] By adopting the embodiments of the present application, the size of the file is dynamically determined based on the network bandwidth, and the file is fragmented and transmitted according to the size of the file, so that the size of the fragmented file transmitted is dynamically adjusted according to the network bandwidth, thereby achieving the technical effect of improving the reliability of file transmission.
[0200] Those skilled in the art can understand that Figure 4 The structure shown is only schematic, and the electronic device can also be a terminal device such as a smart phone, a tablet computer, a palm computer, a Mobile Internet Device (MID), a PAD, and the like. Figure 4 It does not limit the structure of the electronic device. For example, the electronic device can further include more or fewer components (such as a network interface, a display device, and the like) than those shown in the figure, or have a different configuration from that shown in the figure. Figure 4 It does not limit the structure of the electronic device. For example, the electronic device can further include more or fewer components (such as a network interface, a display device, and the like) than those shown in the figure, or have a different configuration from that shown in the figure. Figure 4 It does not limit the structure of the electronic device. For example, the electronic device can further include more or fewer components (such as a network interface, a display device, and the like) than those shown in the figure, or have a different configuration from that shown in the figure.
[0201] Those skilled in the art can understand that all or part of the steps of the various methods of the above embodiments can be completed by programs instructing the related hardware of the terminal device, and the programs can be stored in a computer readable storage medium, which can include a flash disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and the like.
[0202] Embodiment five
[0203] The embodiments of the present application also provide a storage medium. Optionally, in the present embodiment, the above storage medium can be used to save the program code executed by the file fragmentation transmission method provided in the above embodiment one.
[0204] Optionally, in the embodiment, the storage medium can be located in any one of the computer terminals in the computer terminal group in the computer network, or in any one of the mobile terminals in the mobile terminal group.
[0205] The application also provides a computer program product, which is suitable for executing the steps of the file fragment transmission method when executed on a data processing device.
[0206] The above-mentioned serial numbers of the embodiments of the application are only for description, and do not represent the advantages or disadvantages of the embodiments.
[0207] In the above-mentioned embodiments of the application, the description of each embodiment has its own focus, and the parts not described in detail in a certain embodiment can be referred to the relevant description of other embodiments.
[0208] In the several embodiments provided by the present application, it should be understood that the disclosed technology can be implemented in other ways. Of course, the unit embodiment described above is only schematic. For example, the division of the units is only a logical function division. There can be another division manner for the actual implementation, for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the displayed or discussed mutual couplings or direct couplings or communication connections between the units can be indirect couplings or communication connections through some interfaces, units or modules, and can be electrical or other forms.
[0209] The units described as separate components can or can not be physically separate, and the components displayed as units can or can not be physical units, that is, they can be located in one place, or can be distributed on multiple network units. According to actual needs, some or all of the units can be selected to achieve the purpose of the embodiment.
[0210] In addition, each functional unit in each embodiment of the application can be integrated into a processing unit, or each unit can exist physically, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be realized in the form of hardware, or in the form of a software functional unit.
[0211] The integrated unit, if implemented in the form of a software function unit and sold or used as an independent product, can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application essentially or say the part that contributes to the prior art or the whole or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server or a network device, etc.) to execute all or part of the steps of the method described in the various embodiments of the present application. The aforementioned storage medium includes: a U disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a mobile hard disk, a magnetic disk or an optical disk, and various media that can store program codes.
[0212] The above is only the preferred embodiment of the present application, and it should be pointed out that for those skilled in the art, without departing from the principles of the present application, a number of improvements and refinements can be made, which should be considered as the protection scope of the present application.
Claims
1. A file fragment transmission method, characterized by, The method comprises the following steps: acquiring a current network bandwidth, and determining a file size based on the current network bandwidth; fragmenting a to-be-transmitted file based on the file size to obtain a target fragmented file, wherein the target fragmented file comprises one of N fragmented files obtained by fragmenting the to-be-transmitted file, and N is a positive integer; encrypting the target fragmented file to obtain an encrypted fragmented file, and transmitting the encrypted fragmented file to a data receiving party.
2. The file chunk transmission method of claim 1, wherein, The method for determining the file size based on the current network bandwidth comprises the following steps: acquiring a historical network bandwidth, wherein the historical network bandwidth comprises a network bandwidth acquired in a historical process before the current network bandwidth is acquired; calculating a change amount between the historical network bandwidth and the current network bandwidth to obtain a bandwidth change amount; in a case where the bandwidth change amount is greater than a preset change amount threshold, determining the file size based on the historical network bandwidth and the current network bandwidth.
3. The file fragment transmission method of claim 1, wherein, The method for acquiring the current network bandwidth comprises the following steps: acquiring a file size of a historical file and a transmission time length of the historical file, wherein the historical file comprises at least one of the following: a preset test file, a last fragmented file transmitted before a current time; determining the current network bandwidth based on the file size of the historical file and the transmission time length of the historical file.
4. The file fragmentation transmission method of claim 1, wherein, Before the step of acquiring the current network bandwidth and determining the file size based on the current network bandwidth, the method further comprises the following steps: in a case where the to-be-transmitted file is fragmented for the first time, acquiring a file type of the to-be-transmitted file, determining the file size based on the file type, and performing the step of fragmenting the to-be-transmitted file based on the file size to obtain a target fragmented file; in a case where the to-be-transmitted file is fragmented for the first time, performing the step of acquiring the current network bandwidth and determining the file size based on the current network bandwidth.
5. The file fragment transmission method of claim 1, wherein, The method for encrypting the target fragmented file to obtain an encrypted fragmented file comprises the following steps: acquiring a hash value of a previous fragmented file associated with the target fragmented file to obtain a target hash value; generating a check code of the target fragmented file, and generating fingerprint information based on the check code and the target hash value, wherein the fingerprint information is used to verify the integrity and correctness of the target fragmented file; combining the fingerprint information and the target fragmented file to obtain a fragmented object; encrypting the fragmented object to obtain the encrypted fragmented file.
6. The file fragment transmission method of claim 5, wherein, The method for encrypting the fragmented object to obtain the encrypted fragmented file comprises the following steps: encrypting the fragmented object by using a symmetric encryption key to obtain an encrypted fragmented object; encrypting the symmetric encryption key by using an asymmetric encryption strategy to obtain an encrypted key; obtaining the encrypted fragmented file based on the encrypted fragmented object and the encrypted key.
7. The file fragment transmission method of claim 5, wherein, The method for transmitting the encrypted fragmented file to the data receiving party further comprises the following steps: transmitting the encrypted fragmented file to a relay node, wherein the relay node is used to forward the encrypted fragmented file. In a case that the transit node receives the encrypted fragment file, the encrypted fragment file is checked based on the fingerprint information to obtain a first checking result, wherein the checking manner of the encrypted fragment file includes at least one of the following: cyclic redundancy check, hash check; In a case that the first checking result indicates that the encrypted fragment file fails to pass the check, the target fragment file is retransmitted; In a case that the first checking result indicates that the encrypted fragment file passes the check, the target fragment file is sent to the data receiver.
8. The file fragment transmission method of claim 6, wherein, After the target fragment file is encrypted to obtain an encrypted fragment file, and the encrypted fragment file is transmitted to a data receiver, the method further includes: At the data receiver, the encrypted key is decrypted by the asymmetric encryption strategy to obtain a decrypted key; The encrypted fragment object is decrypted based on the decrypted key to obtain a decrypted fragment object; The decrypted fragment object is checked based on the fingerprint information to obtain a second checking result; In a case that the second checking result indicates that the decrypted fragment object passes the check, a file received by the data receiver is determined based on a hash value of a previous fragment file recorded in the decrypted fragment object.
9. A file fragment transmission apparatus characterized by comprising: The method includes: A processing unit is configured to obtain a current network bandwidth, and determine a fragment size based on the current network bandwidth; A fragment unit is configured to fragment a to-be-transmitted file based on the fragment size to obtain a target fragment file, wherein the target fragment file includes one of N fragment files obtained by fragmenting the to-be-transmitted file, and N is a positive integer; A transmission unit is configured to encrypt the target fragment file to obtain an encrypted fragment file, and transmit the encrypted fragment file to a data receiver.
10. A computer program product comprising computer instructions, characterized in that, The computer instructions, when executed by the processor, implement the steps of the file fragment transmission method in any one of claims 1 to 8.
Citation Information
Cited By
File uploading method and related device
CN121486356A
File uploading method and device based on swan gap system
CN121644557A
