A file transmission method, device and computer readable storage medium
By constructing a block transaction pool and establishing active and passive connection channels, dual-channel verification is achieved during file transfer, solving the problem of file tampering and improving the security and efficiency of file transfer.
Patent Information
- Application Number
- CN202410635504.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-22
- Publication Date
- 2025-11-28
- Estimated Expiration
- 2044-05-22
AI Technical Summary
Existing technologies lack real-time security guarantees during file transfer, resulting in a high risk of file tampering and affecting file security.
A block transaction pool is constructed, and active and passive connection channels are established. The files of block members are updated through channel verification results, realizing dual-channel verification of the file transmission process and ensuring the legality and security of files.
The dual-channel verification mechanism effectively prevents tampering during file transfer, improving the security and efficiency of file transfer.
Smart Images

Figure CN118573670B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of file transmission, in particular to a file transmission method, device and computer readable storage medium. BACKGROUND
[0002] In the prior art, when performing file transmission, such as Xunlei download, Tencent download and Google download, etc., a cloud distribution mechanism is mostly used to realize file transmission download. That is, in order to save bandwidth, they will realize file transmission by linking other users. However, they do not perform real-time security protection on the file in the process of establishing transmission, so that the transmitted file has the risk of being tampered with, affecting the security of the file SUMMARY
[0003] The technical problem to be solved by the present application is to provide a file transmission method, device and computer readable storage medium, which can improve the security of file transmission.
[0004] To solve the above technical problems, the present application adopts a technical solution:
[0005] A file transmission method, comprising the steps of:
[0006] Constructing a block transaction pool, wherein the block transaction pool comprises archives corresponding to each block member;
[0007] Receiving a file transmission request sent by a block member, establishing a corresponding link channel for the block member according to the file transmission request, wherein the link channel comprises an active link channel and a passive link channel;
[0008] Respectively receiving a channel verification result sent by an active block member corresponding to the active link channel and a passive block member corresponding to the passive link channel, and updating the archives of the active block member and the passive block member in the block transaction pool according to the channel verification result.
[0009] Further, it further comprises the steps of:
[0010] Establishing a corresponding source server for each block member of the block transaction pool, wherein the source server stores files corresponding to each block member;
[0011] Once the files stored in the source server are downloaded, the download party is determined as a block member.
[0012] Further, the archives comprise a block identifier where each block member is located, a block member number and a complete file list stored by the block;
[0013] When receiving the file transmission request sent by the block member, searching the whole file list of the block where the block member is located according to the file transmission request to determine the matched block member number;
[0014] The block member corresponding to the block member number establishes a link channel.
[0015] Further, the block transaction pool also stores the name, data content and check code corresponding to each file;
[0016] Further, the block transaction pool also stores the name, data content and check code corresponding to each file;
[0017] According to the name, data content and check code corresponding to each file, the block transaction pool is clustered to form a plurality of cluster block sets, and the similarity of the files between the cluster blocks in each cluster block set is within a preset value;
[0018] When the corresponding block member number cannot be matched in the whole file list of the block where the block member is located or the matched block member is not online, the next cluster block in the cluster block set to which the block where the block member is located belongs is searched until the corresponding block member is matched.
[0019] Further, if there are a plurality of matched block members, the matched block members belong to the same cluster block or different cluster blocks, the communication duration after the link channel is established with each matched block member is calculated respectively, and the block member with the shortest communication duration is selected as the matched block member.
[0020] Further, the channel verification result sent by the active block member is the consistency result of the active block member verifying the number and content of the files actively sent and the corresponding files stored in the source server before the active link channel is established.
[0021] Further, the channel verification result sent by the passive block member is the consistency result of the downloaded files and the files of the active block member and the consistency result of the downloaded files and the corresponding files stored in the source server after the passive link channel is established and the corresponding files are downloaded.
[0022] Further, the updating of the archives of the active block member and the passive block member in the block transaction pool according to the channel verification result comprises:
[0023] If the two channel verification results are consistent, the archive of the passive block member is updated according to the file transmission result, otherwise, the block member and the archive causing the inconsistency of the channel verification result are deleted in the block transaction pool.
[0024] In order to solve the above technical problems, another technical solution adopted by the present application is:
[0025] A file transmission device comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the steps of the above file transmission method when executing the computer program.
[0026] To solve the above technical problems, another technical solution adopted by the present application is:
[0027] A computer readable storage medium has computer program instructions stored thereon, and the computer program instructions implement the steps of the above file transmission method when executed by a processor.
[0028] The beneficial effects of the present application are that a block transaction pool including the archives of each block member is constructed, when a file transmission request is received, a corresponding active link channel and passive link channel are established, and the channel verification results for the active link channel and the passive link channel are received respectively, and the archives of the active block member and the passive block member in the block transaction pool are updated according to the channel verification results; by means of the block transaction pool, double-channel verification of the file transmission process is realized, which can effectively avoid tampering during the file transmission process, realize the legality verification and efficient transmission of the file, and thus improve the security of the file transmission. BRIEF DESCRIPTION OF DRAWINGS
[0029] Figure 1 A step flowchart of a file transmission method according to an embodiment of the present application;
[0030] Figure 2 A structural schematic diagram of a file transmission device according to an embodiment of the present application;
[0031] Figure 3 A data structure schematic diagram of a block transaction pool and a source server in a file transmission method according to an embodiment of the present application;
[0032] Figure 4 A file verification process schematic diagram of a block member in a file transmission method according to an embodiment of the present application;
[0033] Figure 5 Two flowcharts of a file transmission method according to an embodiment of the present application;
[0034] Figure 6 An implementation manner of file matching in a file transmission method according to an embodiment of the present application;
[0035] Figure 7 Another implementation manner of file matching in a file transmission method according to an embodiment of the present application. DETAILED DESCRIPTION
[0036] To make the technical contents of the present application, the achieved purposes and effects clear, the following will be described in detail in combination with embodiments and the accompanying drawings.
[0037] The above file transmission method, device and computer readable storage medium can be applied to file transmission and download in various application scenarios, which will be described in detail through specific embodiments.
[0038] In an optional embodiment, as shown in Figure 1 a file transmission method includes the following steps:
[0039] S1, a block transaction pool is constructed, and the block transaction pool includes archives corresponding to each block member;
[0040] In the block transaction pool, each block member is established with a corresponding source server, and the source server stores files corresponding to each block member. If there are N types of files downloaded by the block member, there are N different source servers, that is, the corresponding source server n is allocated based on the file type.
[0041] Once the file stored in the source server is downloaded, the download party is determined as a block member, and a corresponding archive is established for it in the block transaction pool;
[0042] S2, receiving the file transmission request sent by the block member, establishing a corresponding link channel for the block member according to the file transmission request, the link channel including an active link channel and a passive link channel;
[0043] For example, if the block member A sends a file transmission request to download a file from the block member B, the block member A is a passive block member, and the block member B is an active block member. The link channel established between the block member A and the block member B is a passive link channel for A and an active link channel for B.
[0044] S3, respectively receiving the channel verification results sent by the active block member corresponding to the active link channel and the passive block member corresponding to the passive link channel, and updating the archives of the active block member and the passive block member in the block transaction pool according to the channel verification results;
[0045] That is, the channel verification results of block member A and block member B respectively for the respective link channels, specifically, block member B will check the file with the source server before sending the file to verify the security of the file, and get the corresponding verification result, and block member A will also check the file with the source server after receiving the downloaded file to verify the security of the file, and get the corresponding verification result. Only when both verification results are correct, it means that the transmitted file is recognized by the source server, is safe, and has not been tampered with.
[0046] In another optional embodiment, as shown in Figure 3 The archive includes the block identifier B where each block member is located, the block member number N, and the entire file list F stored by the block. Each block member has a corresponding file list f, and the files of all block members constitute the entire file list F.
[0047] When receiving the file transmission request sent by the block member, search the entire file list of the block where the block member is located according to the file transmission request, and determine the matching block member number.
[0048] The block member corresponding to the block member number establishes a link channel.
[0049] In this embodiment, by archiving each block member in the block transaction pool, when a block member needs to download a file, the corresponding entire file list can be searched from the block where the archived block member is located according to the file download request, so as to quickly locate the target file of the block member.
[0050] In another optional embodiment, the block transaction pool also stores the name, data content and check code corresponding to each file.
[0051] Further comprising the steps of:
[0052] According to the name, data content and check code corresponding to each file, clustering each block in the block transaction pool to form a plurality of cluster block sets. The similarity of the files between the cluster blocks in each cluster block set is within a preset value.
[0053] When the corresponding block member number cannot be matched in the entire file list of the block where the block member is located, or the matched block member is not online, then the next cluster block in the cluster block set to which the block where the block member is located belongs is searched until the corresponding block member is matched.
[0054] In this embodiment, by setting a corresponding name, data content, and checksum for each file, it is convenient to cluster the files stored in each block of the block transaction pool and establish data clusters. In this way, when no corresponding file is found in the block where the block member of the requested file is located, or the matched block member is offline, the next block cluster storing similar files can be used for matching until the corresponding file is matched, thereby improving the comprehensiveness of file matching.
[0055] In another optional implementation, if there are multiple matched block members, and the matched block members belong to the same cluster block or different cluster blocks, then the communication duration after establishing a link channel with each matched block member is calculated, and the block member with the shortest communication duration is selected as the matched block member.
[0056] like Figure 6 As shown, when a target file is found in the linked block with block identifier B2F1, if the currently matched block member is not online, the matching continues from other cluster blocks. A new block with block identifier BA12 is matched, and four related block members with target files are matched in this new block. At this time, the communication time after the block members corresponding to the four member files establish the link channel is calculated, which are 30ms, 32ms, 10ms and 275ms respectively. At this time, the number corresponding to the shortest communication time of 10ms is selected as BA12N23 as the matched target block member.
[0057] like Figure 7 As shown, when a target file is matched in the link blocks identified as B101 and BA1 respectively, and there are multiple matched block members in each link block, the communication duration after the matched block members establish a link channel is determined, and the block member corresponding to the shortest communication duration is selected as the matched target block member.
[0058] In this embodiment, matching can be performed first from the block transaction pool to obtain all the finally matched block members. Then, the communication duration after establishing a link channel for each block member is determined. The block member with the shortest communication duration is selected as the matched block member, and a link channel is established with it, which can improve the efficiency of file transfer.
[0059] In another alternative implementation, such as Figure 4 As shown, the active block member (i.e. Figure 4 The channel verification result sent by the active member is the result of the active block member verifying the consistency between the number of files actively sent and the file content and the corresponding files stored on the source server before establishing the active link channel.
[0060] The passive block member (i.e.)Figure 4 The channel verification result sent by the passive member is the consistency result of the downloaded file with the active block member's file and the consistency result with the corresponding file stored on the source server after the passive link channel is established and the corresponding file is downloaded.
[0061] Specifically, before establishing an active connection channel with a passive member, the active member will first verify the number of files and the corresponding file content. In this embodiment, the files are read directly into memory instead of from disk files. Then, the files read into memory are compared with the files stored in the source server to obtain the corresponding channel verification result. After the verification is completed, an active connection channel is established with the passive member to transfer files.
[0062] When a passive member receives a file sent by an active member through a passive link channel (the passive link channel and the active link channel are essentially link channels established by the active member and the passive member, but are described from the perspective of different objects; for the active member, the link channel is an active link channel, and for the passive member, the link channel is a passive link channel), the passive member compares the received file with the file stored in the source server and verifies it with the active member to obtain the corresponding channel verification result.
[0063] like Figure 5 The diagram shows two processes for file verification, summarized from the above execution process. One process is: User - Block Transaction Pool - Block Member - Source Server, and the other process is: User - Source Server - Block Transaction Pool - Block Member.
[0064] In another optional implementation, updating the files of the active block members and the passive block members in the block transaction pool based on the channel verification result includes:
[0065] If the verification results of the two channels are consistent, the file of the passive block member is updated according to the file transfer result; otherwise, the block member and its file that caused the inconsistent channel verification results are deleted from the block transaction pool.
[0066] Specifically, if the channel verification result of the passive block member is that the downloaded file matches the file of the active block member but does not match the file of the source server, it means that the data has been tampered with by the active member. At this time, the active block member and its block are marked as abnormal. In an optional implementation, the active block member and its file can be deleted from the block transaction pool.
[0067] For example, if node A (i.e., active block member A) transmits A.EXE and then it is transmitted to node B (i.e., passive block member B), it is also A.EXE. Under normal circumstances, node A has completed data verification during the transmission process. However, after node B downloads A.EXE, the verification result is different from that of the source server, indicating that there is a problem with node A.
[0068] If the channel verification results of the active block member and the passive block member are consistent, then the file of the passive block member is updated, that is, the newly downloaded file is added to its corresponding file list, and the entire file list F is updated synchronously.
[0069] In another alternative implementation, such as Figure 2 As shown, a file transfer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the steps of a file transfer method shown in any of the above embodiments.
[0070] In another alternative embodiment, a computer-readable storage medium stores computer program instructions that, when executed by a processor, implement the steps of a file transfer method as described in any of the alternative embodiments above.
[0071] In summary, the file transfer method, apparatus, and computer-readable storage medium provided by this invention construct a block transaction pool comprising files corresponding to each block member. When a file transfer request is received, corresponding active and passive link channels are established. Channel verification results for the active and passive link channels are received respectively, and the files of the active and passive block members in the block transaction pool are updated according to the channel verification results. By utilizing the block transaction pool, dual-channel verification is achieved during the file transfer process, effectively preventing file tampering during transfer, realizing file legitimacy verification and efficient transfer, thereby improving the security of file transfer. Furthermore, by leveraging the block transaction pool, block clustering, and the communication time of the established link channels, the target file can be quickly and efficiently matched, improving the efficiency of file transfer and ensuring efficient and secure file transfer.
[0072] The above description is merely an embodiment of the present invention and does not limit the patent scope of the present invention. Any equivalent modifications made based on the content of the present invention specification and drawings, or direct or indirect applications in related technical fields, are similarly included within the patent protection scope of the present invention.
Claims
1. A file transfer method, characterized in that, Including the following steps: Construct a block transaction pool, which includes the files corresponding to each block member; Receive file transfer requests sent by block members, and establish corresponding link channels for the block members according to the file transfer requests. The link channels include active link channels and passive link channels. The system receives channel verification results from the active block member corresponding to the active link channel and the passive block member corresponding to the passive link channel, respectively, and updates the files of the active block member and the passive block member in the block transaction pool according to the channel verification results. The channel verification result sent by the active block member is the result of the active block member verifying the consistency between the number of files actively sent and the file content and the corresponding files stored on the source server before establishing the active link channel. The channel verification result sent by the passive block member is the consistency result of the downloaded file with the active block member's file and the consistency result with the corresponding file stored on the source server after the passive link channel is established and the corresponding file is downloaded.
2. The file transfer method according to claim 1, characterized in that, It also includes the following steps: Establish a corresponding source server for each block member of the block transaction pool, and the source server stores the files corresponding to each block member; Once a file stored on the source server has been downloaded, the downloader is identified as a block member.
3. The file transfer method according to claim 1, characterized in that, The archive includes the block identifier of each block member, the block member number, and a list of all files stored in the block; When a file transfer request is received from a block member, the entire file list of the block in which the block member is located is searched according to the file transfer request to determine the matching block member number; Establish a link channel with the block member corresponding to the block member number.
4. The file transfer method according to claim 3, characterized in that, The block transaction pool also stores the name, data content, and verification code corresponding to each file; It also includes the following steps: Based on the name, data content, and checksum of each file, the blocks in the block transaction pool are clustered to form multiple cluster block sets. The similarity of files between cluster blocks in each cluster block set is within a preset value. If the corresponding block member number cannot be matched in the complete file list of the block where the block member is located, or if the matched block member is not online, the search continues in the next cluster block in the cluster block set to which the block member belongs until the corresponding block member is matched.
5. A file transfer method according to claim 4, characterized in that, If there are multiple matched block members, and the matched block members belong to the same cluster block or different cluster blocks, then the communication duration after establishing a link channel with each matched block member is calculated, and the block member with the shortest communication duration is selected as the matched block member.
6. A file transfer method according to any one of claims 1 to 5, characterized in that, The step of updating the files of the active block member and the passive block member in the block transaction pool based on the channel verification result includes: If the verification results of the two channels are consistent, the file of the passive block member is updated according to the file transfer result; otherwise, the block member and its file that caused the inconsistent channel verification results are deleted from the block transaction pool.
7. A file transfer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of a file transfer method as described in any one of claims 1 to 6.
8. A computer-readable storage medium having computer program instructions stored thereon, characterized in that, When the computer program instructions are executed by the processor, they implement the steps of a file transfer method according to any one of claims 1 to 6.
Citation Information
Patent Citations
File sharing method and system based on block chain, electronic equipment and storage medium
CN114650144A
Dynamic content distribution protocol for an enterprise environment
US20200162543A1