Method, apparatus, device and storage medium for encrypting data packet capture file

HK40137304APending Publication Date: 2026-09-11CHINA MOBILEHANGZHOUINFORMATION TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
HK42026126283
Authority / Receiving Office
HK · HK
Patent Type
Applications
Current Assignee / Owner
Filing Date
2026-07-17
Publication Date
2026-09-11

Smart Images

  • Figure 00000000_0000_ABST
    Figure 00000000_0000_ABST
Patent Text Reader

Abstract

The invention discloses a data packet capture file encryption method and device, equipment and a storage medium, and relates to the technical field of communication. The method comprises the following steps: acquiring a to-be-encrypted data packet capture file, wherein the data packet capture file comprises a global header, a data packet header and a data packet corresponding to the data packet header; inserting an encrypted metadata packet header and a corresponding encrypted metadata packet behind the global header, wherein the encrypted metadata packet comprises encryption algorithm information; encrypting application layer data in a data packet in the data packet capture file according to the encryption algorithm information and a preset encryption key to obtain encrypted application layer data; and updating the data packet capture file according to the encrypted application layer data to obtain an encrypted data packet capture file. According to the embodiment of the invention, the data packet in the standard data packet format including the encryption algorithm information is embedded in the data packet capture file, the format of the data packet capture file is kept unchanged, and the data in the data packet is selectively encrypted, so that the transmission efficiency of the data packet is improved.
Need to check novelty before this filing date? Find Prior Art

Description

(19) State Intellectual Property Office (12) Invention Patent Application (10) Application Publication Number (43) Application Publication Date (21) Application Number 202511773849.7 (22) Application Date 2025.11.27 (71) Applicant China Mobile (Hangzhou) Information Technology Co., Ltd. Address 311100, Building A01, No. 1600, Yuhangtang Road, Wuchang Street, Yuhang District, Hangzhou City, Zhejiang Province Applicant China Mobile Communications Group Co., Ltd. (72) Inventors Pei Chao, Xiao Xu, Dai Yunchuan, He Tingting (74) Patent Agency Beijing Dongfang Yisi Intellectual Property Agency Co., Ltd. 11258 Patent Attorney Zhao Jie (51) Int.Cl. H04L 9 / 40 (2022.01) H04L 9 / 08 (2006.01) (54) Invention Title Data Packet Capture File Encryption Method, Apparatus, Device and Storage Medium (57) Abstract This application discloses a data packet capture file encryption method, apparatus, device and storage medium, which relates to the field of communication technology. This method acquires a packet capture file to be encrypted, which includes a global header, a packet header, and the corresponding packet. An encrypted meta-packet header and a corresponding encrypted meta-packet are inserted after the global header. The encrypted meta-packet includes encryption algorithm information. The application layer data in the packets within the packet capture file is encrypted using the encryption algorithm information and a preset encryption key to obtain encrypted application layer data. The packet capture file is then updated based on the encrypted application layer data to obtain an encrypted packet capture file. This embodiment of the application improves packet transmission efficiency by embedding standard packet formats containing encryption algorithm information into the packet capture file, maintaining the packet capture file's format, and selectively encrypting the data within the packets. Claims 2 pages, Description 11 pages, Drawings 4 pages, CN 121396645 A 2026.01.23 CN 1 21 39 66 45 A 1. A method for encrypting a data packet capture file, characterized in that it includes: obtaining a data packet capture file to be encrypted, the data packet capture file including a global header, a data packet header, and a data packet corresponding to the data packet header; inserting an encrypted meta-data packet header and a corresponding encrypted meta-data packet after the global header, the encrypted meta-data packet including encryption algorithm information; encrypting application layer data in the data packets in the data packet capture file according to the encryption algorithm information and a preset encryption key to obtain encrypted application layer data; updating the data packet capture file according to the encrypted application layer data to obtain an encrypted data packet capture file. 2. The method for encrypting a data packet capture file according to claim 1, characterized in that the encrypted meta-data packet includes: an Ethernet segment, a network interconnection protocol segment, a transmission control protocol segment, and an encrypted data declaration segment, the encrypted data declaration segment...The segment includes encryption algorithm information. 3. The method for encrypting a packet capture file according to claim 2, wherein the Ethernet segment is 14 bytes, the network interconnection protocol segment is 20 bytes, the transmission control protocol segment is 20 bytes, and the encrypted data declaration segment is 3 bytes. 4. The method for encrypting a packet capture file according to claim 1, wherein the encrypted meta-data packet header includes: a timestamp in seconds segment, a timestamp in milliseconds segment, a segment representing the number of bytes captured in the encrypted meta-data packet, and a segment representing the actual number of bytes in the encrypted meta-data packet. 5. The method for encrypting a packet capture file according to claim 4, wherein the timestamp in seconds segment is 4 bytes, the timestamp in milliseconds segment is 4 bytes, the segment representing the number of bytes captured in the encrypted meta-data packet is 4 bytes, and the segment representing the actual number of bytes in the encrypted meta-data packet is 4 bytes. 6. The method for encrypting a packet capture file according to claim 1, wherein updating the packet capture file according to the encrypted application layer data includes: updating the non-application layer data of the corresponding data packet according to the encrypted application layer data; updating the byte data in the header of the corresponding data packet according to the encrypted application layer data. 7. The method for encrypting a packet capture file according to claim 4, characterized in that, updating the non-application layer data of the corresponding packet based on the encrypted application layer data includes: calculating and updating the total number of bytes of the network interconnection protocol segment in the packet based on the number of bytes of the encrypted application layer data; updating the data in the header of the corresponding packet based on the encrypted application layer data includes: calculating and updating the number of captured bytes and the actual number of bytes in the packet header based on the number of bytes of the encrypted application layer data. 8. The method for encrypting a packet capture file according to any one of claims 1-7, characterized in that, the method further includes: parsing the encrypted meta-data packet to obtain encryption algorithm information in the encrypted meta-data packet; decrypting the application layer data in the encrypted packet based on the encryption algorithm information and a preset decryption key to obtain decrypted application layer data; updating the encrypted packet capture file based on the decrypted application layer data to obtain the original packet capture file. 9. The method for encrypting a packet capture file according to claim 8, characterized in that, updating the encrypted packet capture file according to the application layer data decrypted in claim 1 / 2 page 2 CN 121396645 A to obtain the original packet capture file includes: calculating and updating the total number of IP datagram bytes in the packet based on the number of bytes of the decrypted application layer data; calculating and updating the number of captured bytes and the actual number of bytes in the packet header based on the number of bytes of the decrypted application layer data. 10. An apparatus for encrypting a packet capture file, characterized in that the apparatus includes:An acquisition module is used to acquire a packet capture file to be encrypted, the packet capture file including a global header and a packet header and the packet corresponding to the packet header; an insertion module is used to insert an encrypted meta-packet header and a corresponding encrypted meta-packet after the global header, the encrypted meta-packet including encryption algorithm information; an encryption module is used to encrypt the application layer data in the packet in the packet capture file according to the encryption algorithm information to obtain encrypted application layer data; an update module is used to update the non-application layer data of the corresponding packet and the data in the corresponding packet header according to the encrypted application layer data to obtain an encrypted packet capture file. 11. A terminal device, characterized in that the device includes: a processor and a memory storing computer program instructions; the processor executes the computer program instructions to implement the packet capture file encryption method as described in any one of claims 1-9. 12. A computer-readable storage medium, characterized in that the computer-readable storage medium stores computer program instructions, the computer program instructions being executed by a processor to implement the packet capture file encryption method as described in any one of claims 1-9. 13. A computer program product, characterized in that, when the instructions in the computer program product are executed by the processor of an electronic device, the electronic device performs the method of encrypting a packet capture file as described in any one of claims 1-9. Claims 2 / 2 Page 3 CN 121396645 A Method, Apparatus, Device and Storage Medium for Encrypting Packet Capture Files Technical Field

[0001] This application belongs to the field of communication technology, and particularly relates to a method, apparatus, device and storage medium for encrypting packet capture files. Background Art

[0002] Packet Capture (PCAP) files, as a standard packet storage format widely used in network analysis, security auditing and fault diagnosis, are usually generated by packet capture tools, which record the complete network frame information obtained. However, due to the lack of encryption mechanism in this format itself, PCAP files are at risk of leakage during storage or transmission.

[0003] In the prior art, the entire PCAP file is usually compressed and encrypted to enhance security, but the encrypted file no longer conforms to the PCAP format specification and all the data in the file is encrypted, so it cannot be directly read by standard packet capture tools or network libraries. Therefore, existing packet capture file encryption methods require decryption during transmission to obtain relevant information, resulting in low efficiency during packet capture file transmission.

[0004] This application provides a method, apparatus, device, and storage medium for encrypting packet capture files to...To address the problem that existing packet capture file encryption methods result in low efficiency during packet capture file transmission.

[0005] In a first aspect, embodiments of this application provide a method for encrypting a packet capture file, the method comprising: obtaining a packet capture file to be encrypted, the packet capture file including a global header, a packet header, and a packet corresponding to the packet header; inserting an encrypted meta-packet header and a corresponding encrypted meta-packet after the global header, the encrypted meta-packet including encryption algorithm information; encrypting application layer data in the packet in the packet capture file according to the encryption algorithm information and a preset encryption key to obtain encrypted application layer data; updating the packet capture file according to the encrypted application layer data to obtain an encrypted packet capture file.

[0006] In a second aspect, embodiments of this application provide an apparatus for encrypting a data packet capture file. The apparatus includes: an acquisition module, configured to acquire a data packet capture file to be encrypted, the data packet capture file including a global header and a data packet header and a data packet corresponding to the data packet header; an insertion module, configured to insert an encrypted meta-data packet header and a corresponding encrypted meta-data packet after the global header, the encrypted meta-data packet including encryption algorithm information; an encryption module, configured to encrypt the application layer data in the data packet in the data packet according to the encryption algorithm information to obtain encrypted application layer data; and an update module, configured to update the non-application layer data of the corresponding data packet and the data in the corresponding data packet header according to the encrypted application layer data to obtain an encrypted data packet capture file.

[0007] In a third aspect, embodiments of this application provide a terminal device, the device including: a processor and a memory storing computer program instructions; the processor, when executing the computer program instructions, implements the encryption method as described in the first aspect of the data packet capture file specification, page 1 / 11, CN 121396645 A.

[0008] In a fourth aspect, embodiments of this application provide a computer-readable storage medium storing computer program instructions, which, when executed by a processor, implement the data packet capture file encryption method as described in the first aspect.

[0009] In a fifth aspect, embodiments of this application provide a computer program product, wherein instructions in the computer program product, when executed by a processor of an electronic device, cause the electronic device to perform the data packet capture file encryption method as described in the first aspect.

[0010] Embodiments of this application provide a method, apparatus, device, and storage medium for encrypting data packet capture files. The method obtains a data packet capture file to be encrypted, the data packet capture file including a global header and a data packet header and a data packet corresponding to the data packet header; inserts an encrypted meta-data packet header and a corresponding encrypted meta-data packet after the global header, the encrypted meta-data packet including encryption algorithm information; and inserts encrypted meta-data packets conforming to a standard data packet format inside the file to ensure that the file...The format remains unchanged, and the encrypted metadata stores the encryption algorithm information in plaintext for use in subsequent encryption processes. The application layer data in the data packets in the data packet capture file is encrypted according to the encryption algorithm information and a preset encryption key to obtain encrypted application layer data. By selectively encrypting the application layer data in the data packets, non-application layer data related to the transmitted information can be directly obtained, thereby improving the efficiency of the transmission process. The data packet capture file is updated according to the encrypted application layer data to obtain an encrypted data packet capture file. Adaptation processing is performed on the encrypted data packet capture file to prevent errors caused by data mismatch due to changes in data length after encryption. This application embodiment embeds data packets in a standard data packet format including encryption algorithm information into the data packet capture file, keeping the format of the data packet capture file unchanged, and selectively encrypting the data in the data packets, thereby enabling the data packet capture file to directly read and transmit relevant transmission data during transmission, improving the transmission efficiency of the data packets. Brief Description of the Drawings

[0011] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the embodiments of this application will be briefly introduced below. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0012] Figure 1 is a flowchart illustrating a method for encrypting a data packet capture file according to an embodiment of this application; Figure 2 is a structural diagram of a data packet capture file according to an embodiment of this application; Figure 3 is a structural diagram of a global header according to an embodiment of this application; Figure 4 is a structural diagram of an encrypted metadata packet according to an embodiment of this application; Figure 5 is a structural diagram of a device for encrypting a data packet capture file according to an embodiment of this application; Figure 6 is a structural diagram of a terminal device according to an embodiment of this application. Detailed Description

[0013] The features and exemplary embodiments of various aspects of this application will be described in detail below. To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are intended only to explain this application and not to limit it. For those skilled in the art, this application can be implemented without some of these specific details. The following description of the embodiments is merely to provide a better understanding of this application by showing examples of this application.

[0014] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover...Non-exclusive inclusion means that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprises..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0015] Packet Capture (PCAP) files, as a standard packet capture information storage format widely used in network analysis, network security, network debugging and fault diagnosis, and security auditing, are typically generated by packet capture tools such as Wireshark and tcpdump. Most network analysis tools and programming languages ​​provide libraries and tools for reading and processing these files. They record rich network packet information, including source and destination MAC addresses, IP addresses, port numbers, protocol types, packet timestamps, and complete network frame information such as raw binary data. However, because PCAP files lack encryption mechanisms, sensitive or confidential information contained within them faces the risk of leakage during storage or transmission. Furthermore, files scattered outside a secure environment may lead to sensitive data leakage and replay attacks. Existing technologies typically use compression and encryption of the entire PCAP file to enhance its security. However, this encryption method causes the encrypted file to no longer conform to the PCAP format specification. This not only prevents existing packet capture tools and network libraries from directly reading the data in the file but also alters the file's metadata, making it difficult to read the source IP address, port number, protocol type, packet timestamp, and raw binary data of the network data. Information such as target IP address, port number, protocol type, and data packet timestamp needs to be decompressed before it can be viewed. This is not conducive to the confirmation and initial screening of files by auditors during file circulation, and also requires the data packet capture file to be decrypted before relevant information can be obtained during transmission, resulting in low transmission efficiency.

[0016] In order to solve the problems of the prior art, this application provides a method, apparatus, device and storage medium for encrypting data packet capture files. The method obtains a data packet capture file to be encrypted, which includes a global header and a data packet header and the data packet corresponding to the data packet header; an encrypted meta-data packet header and a corresponding encrypted meta-data packet are inserted after the global header. The encrypted meta-data packet includes encryption algorithm information; encrypted meta-data packets conforming to the standard data packet format are inserted into the file to ensure that the file format remains unchanged. The encrypted meta-data packets store the encryption algorithm information in plaintext for use in the subsequent encryption process. The application layer data in the data packet in the data packet capture file is encrypted according to the encryption algorithm information and a preset encryption key to obtain encrypted application layer data; by selecting the application layer data in the data packet...Selective encryption allows non-application layer data related to the transmitted information to be directly obtained, thereby improving the efficiency of the transmission process. The data packet capture file is updated according to the encrypted application layer data to obtain an encrypted data packet capture file; the encrypted data packet capture file is adapted to prevent errors caused by data mismatch due to changes in data length after encryption. This application embodiment embeds data packets in a standard data packet format including encryption algorithm information into the data packet capture file, keeping the format of the data packet capture file unchanged, and selectively encrypting the data in the data packets, so that the data packet capture file can directly read and transmit relevant transmission data during transmission, improving the transmission efficiency of data packets.

[0017] The method for encrypting data packet capture files provided by the embodiments of this application will be introduced below.

[0018] Figure 1 shows a flowchart of a method for encrypting data packet capture files provided by an embodiment of this application. As shown in Figure 1, the method may include the following steps: S101 to S104.

[0019] S101, Obtain the data packet capture file to be encrypted. The data packet capture file includes a global header, a data packet header, and the data packet corresponding to the data packet header.

[0020] Wherein, the packet capture file refers to the file generated after capturing network transmission data through a packet capture tool; the header is the starting part of the packet capture file, used to describe the overall format information of the file; the packet header is the metadata header before the packet, recording the capture time, length and other information of the packet; the packet is the actual network data corresponding to the packet header, including Ethernet frames, address packets and other hierarchical structures.

[0021] In some embodiments, the packet capture file format may include the Packet Capture (PCAP) file format and the PCAP Next Generation Dump File Format (PCAPNG) file format, etc. In the following embodiments of this application, the PCAP format is used as an example, but the method of the embodiments of this application can be applied to different packet capture file formats accordingly.

[0022] In some embodiments, as shown in FIG2, the packet capture file may include a global header, multiple packet headers and multiple packets corresponding to each other.

[0023] In some embodiments, the global header of the packet capture file format has a fixed length of 24 bytes, as shown in Figure 3, which includes the magic number, major version number, minor version number, time zone, timestamp, snapshot length, and link layer header type. The magic number can include 0xA1B2C3D4 little-endian or 0xA1B23C4D big-endian. There are 196 link layer header types, with Ethernet being a common type.The network LINKTYPE_ETHERNET and the wireless LAN LINKTYPE_IEEE802_11. The magic number and major version number have a fixed bit length of 32 bits, the minor version number has a fixed bit length of 16 bits, the time zone has a fixed bit length of 16 bits, the timestamp has a fixed bit length of 32 bits, the snapshot length has a fixed bit length of 32 bits, and the link layer header type has a fixed bit length of 32 bits.

[0024] The fixed length of the data packet header is 16 bytes, which may include a timestamp-seconds segment, a timestamp-milliseconds segment, a captured byte segment, and an actual byte segment. The data packet is concatenated after the data packet header and contains byte data from various protocol layers, including data from the physical link layer, network layer, transport layer, and application layer.

[0025] This application embodiment clarifies the structure of the data packet capture file by obtaining the data packet capture file to be encrypted, providing an operational basis for subsequent encryption operations and avoiding file corruption caused by misoperation of the global header or data packet header.

[0026] S102, after the global header, insert an encrypted metadata header and a corresponding encrypted metadata packet. The encrypted metadata packet includes encryption algorithm information.

[0027] The encrypted metadata header is a header used to describe the encrypted metadata packet. Its format is consistent with that of the ordinary data packet header, with added identifier bits to distinguish it from the ordinary data packet. For example, the encrypted metadata association identifier field can be set to 0xFFFF, while the corresponding field for the ordinary data packet is 0x0000. The encrypted metadata packet is a special data packet that stores encryption-related metadata. Similar to the ordinary data packet, it includes data from the physical link layer, network layer, transport layer, and application layer. The application layer data of the encrypted metadata packet contains encryption algorithm information. The encryption algorithm information describes the type and parameter information of the encryption algorithm used.

[0028] In one example, the encryption algorithm information may include information such as Algorithm ID: 0x0001 indicating AES-256, encryption mode: Cipher-block chaining (CBC), and initial vector length: 16 bytes.

[0029] Since each byte in the packet capture file structure has its corresponding meaning, this embodiment inserts a packet header and a packet after the global header to describe the corresponding encryption algorithm information, which conforms to the overall format specification of the packet capture file and prevents damage to the standard format of the packet capture file. Furthermore, the encrypted metadata is separated from ordinary data, and during decryption, the algorithm information can be quickly obtained by reading the encrypted metadata packet after the global header without traversing all packets, thus improving decryption efficiency.

[0030] S103, the application layer data in the packet in the packet capture file is encrypted according to the encryption algorithm information and the preset encryption key to obtain encrypted application layer data.

[0031] Among them, the preset encryption key is a pre-configured key for encryption, stored at the encryption end and the decryption end; the application layer data is the actual business data transmitted over the network.

[0032] In one example, the application layer data may include the HTTP request method (POST) or the resource path (login) message body of the HTTP request in the Hypertext Transfer Protocol (HTTP) request, the file content transmitted by the File Transfer Protocol (FTP), etc.

[0033] In some embodiments, encrypting the application layer data in the data packets in the data packet capture file according to the encryption algorithm information and the preset encryption key to obtain encrypted application layer data may include: obtaining the algorithm type according to the encryption algorithm information, and encrypting the application layer data of each data packet according to the preset encryption key corresponding to the algorithm type.

[0034] By encrypting the application layer data, the encryption scope is limited to the application layer, which protects the actual business data in the application layer and retains the plaintext state of the non-application layer data, so that the encrypted file can still obtain the meta-information required for network analysis by parsing the unencrypted non-application layer data.

[0035] In some embodiments, the encryption algorithm information may include algorithm information such as symmetric encryption algorithm and asymmetric encryption algorithm.

[0036] In one example, when the encryption algorithm information is a symmetric encryption algorithm, encrypting the application layer data in the data packet in the data packet capture file according to the encryption algorithm information and the preset encryption key may include: obtaining the specific parameters of the symmetric encryption algorithm from the encryption meta data packet, which may include the algorithm type, such as Advanced Encryption Standard (AES) and SM4 block cipher algorithm; the encryption mode, such as Cipher Block Chaining (CBC), Galois / Counter Mode (GCM) and Electronic Codebook (ECB); the initial vector length and generation rules, such as randomly generating 16 bytes or generating a fixed length based on the timestamp.

[0037] Verify whether the preset symmetric encryption key meets the key length requirements of the algorithm, for example, the Advanced Encryption Standard AES-128 corresponds to a 16-byte key and the Advanced Encryption Standard AES-256 corresponds to a 32-byte key; For the application layer data in each data packet, preprocess it according to the requirements of the encryption mode, and fill in the application layer data whose length does not meet the algorithm block size to ensure that the data length is an integer multiple of the block size, so as to obtain the preprocessed application layer data;Using a preset symmetric key and the specific parameters of the extracted encryption algorithm, a symmetric encryption operation is performed on the preprocessed application layer data to generate encrypted application layer data. Ultimately, this ensures that the application layer data of each data packet is encrypted using the same set of symmetric keys and algorithm parameters.

[0038] In one example, when the encryption algorithm information is an asymmetric encryption algorithm, encrypting the application layer data in the data packet in the data packet capture file according to the encryption algorithm information and the preset encryption key may include: extracting the specific parameters of the asymmetric encryption algorithm from the encrypted meta-data packet, including the algorithm type, such as the number theory-based asymmetric encryption algorithm (Rivest-Shamir-Adleman, RSA) and elliptic curve cryptography (ECC); the key length, such as RSA-2048 and ECC-256; the public key format, such as the Distinguished Encoding Rules (DER) encoding format and the encryption padding method, such as the 256-bit secure hash algorithm (SHA-256 Padding for RSA-OAEP); verifying whether the key used for encryption in the preset public key asymmetric encryption conforms to the format requirements of the algorithm; and determining whether the data length of the application layer data in each data packet exceeds the single encryption data limit of the current asymmetric algorithm. If the data length exceeds the upper limit, a temporary symmetric key is first randomly generated, and the application layer data is symmetrically encrypted using the temporary symmetric key to obtain the data ciphertext; the temporary symmetric key is asymmetrically encrypted using the preset public key to obtain the key ciphertext, and finally the data ciphertext, key ciphertext, and the encryption algorithm identifier used by the temporary symmetric key are combined to form the final encrypted application layer data; if the data length does not exceed the upper limit, the application layer data is directly encrypted using the preset public key and the extracted padding method to generate the encrypted application layer data, ensuring that all encryption operations are completed based on the public key of the asymmetric algorithm.

[0039] S104, update the data packet capture file according to the encrypted application layer data to obtain the encrypted data packet capture file.

[0040] In some embodiments, updating the data packet capture file according to the encrypted application data may include replacing the application layer data in the original data packet with the encrypted application layer data and adjusting the relevant metadata, such as the length information in the data packet header, so that the structure of the data packet capture file remains intact.

[0041] In this embodiment, the packet capture file is updated with encrypted application layer data, ensuring that the updated file strictly conforms to the format specifications of packet capture files and can be normally read and parsed by tools such as packet capture software, thereby improving the transmission efficiency of packet capture files.

[0042] In some embodiments, during the generation of the encrypted packet capture file, the source Media Access Control (MAC) address, source Internet Protocol (IP) address, source port, destination MAC address, destination IP address, and destination port can be dynamically modified. Specifically, the modification process involves performing protocol layering parsing on each packet. Based on the hierarchical structure of the network protocol stack, such as Ethernet layer, network layer, and transport layer, key fields identifying the communicating parties, such as source MAC address, destination MAC address, source IP address, destination IP address, source port, and destination port, are located at specific positions within the packet. Virtual replacement information, matching the original protocol format of these fields but unrelated to the actual communication entity, is generated based on preset rules at these specific locations. The original field values ​​are updated to the generated virtual replacement information through an overwrite replacement operation. Simultaneously, during the replacement process, it is ensured that the modified fields still conform to the format specifications of the corresponding network protocol to maintain the overall parsability and protocol consistency of the packet. Ultimately, the modified packet no longer contains identification information pointing to the actual communication entity, achieving desensitization of non-application layer data.

[0043] This application embodiment embeds standard data packets including encryption algorithm information into the data packet capture file, keeping the format of the data packet capture file unchanged, and selectively encrypts the data in the data packets. This allows the data packet capture file to directly read and transmit relevant transmission data during transmission, improving the transmission efficiency of the data packets. Specifically, the data in the original data packet capture file does not have encryption measures, while the encrypted data packet capture file of this application embodiment cannot be cracked even if it is scattered outside the secure environment, effectively improving data security. Compared with the method of encrypting PCAP files by compression, the encrypted PCAP file of this invention still conforms to the PCAP data format, and unencrypted non-application layer data can be directly read using packet capture tools and network library files.

[0044] In one example, as shown in Table 1, the global header of the encrypted packet capture file is constructed as follows: magic number 0xA1B2C3D4 occupies 4 bytes, major version number 0x0002 occupies 2 bytes, minor version number 0x0004 occupies 2 bytes, time zone and time 0x0000 occupies 8 bytes, snapshot length 0xFFFF occupies 4 bytes, Ethernet identifier 0x0001 occupies 4 bytes, totaling 24 bytes.

[0045] Table 1 Global header structure of encrypted packet capture file In some embodiments, as shown in Table 2, the encrypted metadata header may include: a 4-byte timestamp seconds field, a 4-byte timestamp milliseconds field, a 4-byte encrypted metadata packet capture byte field, and a 4-byte encrypted metadata packet actual byte field. Specification 6 / 11 Page 9 CN 121396645 A

[0046] Table 2The encrypted metadata header structure of the encrypted data packet capture file in this embodiment defines the format of the encrypted metadata header, adopting the same field length and structure as the ordinary data packet header. This ensures that the data packet capture file after adding the encrypted metadata header still conforms to the original standard specifications and can be directly recognized by existing packet capture tools and other software, avoiding compatibility issues caused by other formats.

[0047] In one example, the constructed encrypted metadata header uses the Transmission Control Protocol (TCP). Specifically, it can be calculated as follows: the number of milliseconds M between the current time and 00:00:00:00 on January 1, 1970 is M / 1000, which occupies 4 bytes; the number of milliseconds M%1000 is M%1000, which occupies 4 bytes. The number of captured bytes is X bytes of encrypted data declaration segment + 14 bytes of Ethernet segment + 20 bytes of IP protocol segment + 20 bytes of TCP protocol segment, that is, the number of captured bytes is Y bytes, which occupies 4 bytes. The actual number of bytes is also Y bytes, which occupies 4 bytes, for a total of 16 bytes.

[0048] In some embodiments, as shown in Table 3, the encrypted metadata packet may include: a 14-byte Ethernet segment, a 20-byte network interconnection protocol segment, a 20-byte transmission control protocol segment, and a 3-byte encrypted data declaration segment, wherein the encrypted data declaration segment includes encryption algorithm information.

[0049] This application embodiment defines the format of the encrypted metadata packet, adopts the same structure as ordinary data packets, and only replaces the data in the application layer data with encryption algorithm information, so that the data packet capture file after adding the encrypted metadata packet still conforms to the original standard specifications and can be directly recognized by existing packet capture tools and other software, avoiding compatibility issues caused by other formats.

[0050] In one example, as shown in Figure 4, the encrypted metadata packet is a TCP data packet, which consists of an Ethernet segment, an IP segment, a TCP segment, and an encrypted data declaration segment. The Ethernet segment occupies 14 bytes, which are filled with a 6-byte destination MAC address, a 6-byte source MAC address, and a 2-byte IP layer protocol type (IPv4 and IPv6) in sequence. The IP segment occupies 20 bytes, filled sequentially with: 1 byte for the IP version number, 1 byte for the Type-of-Service (TOS) value (this field describes the IP packet's priority and Quality of Service (QoS) options), 2 bytes for the total IP datagram size (IP segment size 20 + TCP segment size 20 + encrypted data declaration segment size X), 2 bytes for the datagram identifier, 2 bytes for fragmentation and fragment offset, 1 byte for Time-to-Live (TTL), 1 byte for the transport layer protocol identifier (e.g., UDP, TCP), 2 bytes for the IP checksum, 4 bytes for the source IP, and 4 bytes for the destination IP. The TCP segment occupies 20 bytes, filled sequentially with: 2 bytes for the IP version number, 1 byte for the Type-of-Service (TOS) value (describing the IP packet's priority and Quality of Service (QoS) options), 2 bytes for the total IP datagram size (IP segment size 20 + TCP segment size 20 + encrypted data declaration segment size X), 2 bytes for the datagram identifier, 2 bytes for the fragmentation and fragment offset, 1 byte for the Time-to-Live (TTL) value, 1 byte for the transport layer protocol identifier (e.g., UDP, TCP), 2 bytes for the IP checksum, 4 bytes for the source IP, and 4 bytes for the destination IP.The source port number of the segment, the destination port number (2 bytes), the sequence number (SEQ) field (4 bytes), the acknowledgment number (ACK) field (4 bytes), the flag bit (2 bytes), the window size (2 bytes), the TCP checksum (2 bytes), and the urgent pointer offset (2 bytes). The encrypted data declaration segment occupies 3 bytes, which is filled with 1 byte of encrypted traffic identifier and 2 bytes of encryption algorithm description (symmetric encryption algorithms may include Data Encryption Standard (DES), Triple Data Encryption Standard (3DES), Advanced Encryption Standard (AES), etc.; asymmetric algorithms may include RSA, Digital Signature Algorithm (DSA), etc.; hash algorithms may include Secure Hash Algorithm (SHA-1), Message Digest Algorithm (MD5), etc.), totaling 57 bytes.

[0051] In some embodiments, updating the packet capture file according to the encrypted application layer data may include: updating the non-application layer data of the corresponding data packet according to the encrypted application layer data; ensuring that the protocol layer information of the data packet is consistent with the actual data length, and avoiding errors caused by data mismatch by the parsing tool.

[0052] Updating the byte data in the header of the corresponding data packet according to the encrypted application layer data; ensuring that the header information of the data packet is consistent with the actual length of the data packet and conforms to the format specification.

[0053] The length of application layer data usually changes after encryption, and the protocol headers of the network layer and transport layer in the data packet, as well as the byte data in the data packet header, contain fields related to the data length. This application embodiment recalculates and updates these fields based on the new length of the encrypted application layer data (page 7 / 11, CN 121396645 A), ensuring that the protocol header information matches the actual data and maintaining the protocol legitimacy of the data packet.

[0054] In some embodiments, updating the non-application layer data of the corresponding data packet according to the encrypted application layer data may include: calculating and updating the total number of bytes of the network interconnection protocol segment in the data packet based on the number of bytes of the encrypted application layer data; wherein the total number of bytes of the network interconnection protocol segment is the total length field in the network layer protocol header, used to record the total number of bytes of the entire network layer message.

[0055] Updating the data in the corresponding data packet header according to the encrypted application layer data may include: calculating and updating the captured byte count and the actual byte count in the data packet header based on the number of bytes of the encrypted application layer data; the captured byte count is the total number of bytes of the data packet actually stored in the file as recorded in the data packet header; the actual byte count is the original total number of bytes of the data packet during network transmission.

[0056] In one example, the number of bytes Z occupied by the encrypted data is calculated, and the number of bytes captured in the data packet header is modified to Z + 14 bytes for the Ethernet segment + 20 bytes for the IP protocol segment + 20 bytes for the TCP protocol segment, occupying 4 bytes. The actual byte count is the same as the captured byte count, occupying 4 bytes. The data packet is modified so that the total number of bytes of the IP datagram is 20 bytes occupied by the IP segment + 20 bytes occupied by the TCP segment.The encrypted data occupies 20 bytes (Z) and the encrypted data occupies 2 bytes. Then, the encrypted application layer data replaces the unencrypted application layer data, and this step is repeated for subsequent data packet headers and data packets.

[0057] This application embodiment further limits the data in non-application layer data and data packet headers to ensure that the total number of bytes, captured bytes, and actual bytes of the network interconnection protocol segment are strictly consistent with the actual length of the data packet, so that the parsing tool can correctly read the complete data packet data.

[0058] In some embodiments, the method may further include: parsing the encrypted meta-data packet to obtain the encryption algorithm information in the encrypted meta-data packet.

[0059] Decrypting the application layer data in the encrypted data packet according to the encryption algorithm information and a preset decryption key to obtain the decrypted application layer data; wherein, the preset decryption key is a key pre-configured by the decryption end that corresponds to the encryption key.

[0060] Updating the encrypted data packet capture file according to the decrypted application layer data to obtain the original data packet capture file.

[0061] In one example, it may include: extracting the first pair of data packets, the first three bytes of data starting from the 54th byte (14 bytes for the Ethernet segment + 20 bytes for the IP segment + 20 bytes for the TCP segment), the first byte being the encryption identifier, and the second and third bytes being the encryption algorithm description. If it does not conform, it is an unencrypted PCAP file, and the decryption process is exited. If it conforms, the first pair of data packets is an encrypted metadata header and an encrypted metadata packet. Continue to extract the second pair of data packets, extract the total number of bytes of the IP datagram, and decrypt the encrypted data segment according to the previously parsed encryption algorithm. The encrypted data segment is N bytes of data starting from the 54th byte (N = total number of bytes of the IP datagram - (14 bytes for the Ethernet segment + 20 bytes for the IP segment + 20 bytes for the TCP segment)).

[0062] In this embodiment, the application layer data is decrypted based on algorithm information and key. When parsing the encrypted metadata packet, it ensures compatibility with the standard file structure; when decrypting the application layer data, it strictly matches the algorithm parameters during encryption to ensure that the data content is not distorted. Furthermore, when updating the file, the byte count-related fields are updated to ensure that the decrypted file conforms to the format specification of the packet capture file, thus ensuring a complete conversion from the encrypted file to the original file.

[0063] In some embodiments, updating the encrypted packet capture file according to the decrypted application layer data to obtain the original packet capture file includes: calculating and updating the total number of IP datagram bytes in the packet according to the number of bytes of the decrypted application layer data; calculating and updating the number of captured bytes and the actual number of bytes in the packet header according to the number of bytes of the decrypted application layer data. Specification 8 / 11 pages 11 CN 121396645 A

[0064] In one example, it may include: modifying the number of captured bytes in the packet header to the number of bytes of the decrypted data + 14 bytes.The Ethernet segment (20 bytes) + IP segment (20 bytes) + TCP segment (20 bytes) occupy 4 bytes. The actual number of bytes is the same as the captured number of bytes, occupying 4 bytes. The data packet is modified; the total number of bytes in the IP datagram (20 bytes occupied by the IP segment + 20 bytes occupied by the TCP segment + Z bytes of data after decryption) occupies 2 bytes.

[0065] This embodiment restores all length-related fields modified during the encryption process, restoring the total number of bytes in the IP datagram, the number of captured bytes in the data packet header, and the actual number of bytes to their original values ​​before encryption. This ensures that the original data packet capture file after decryption is completely consistent with the file before encryption in terms of content, structure, and protocol information.

[0066] FIG5 illustrates a data packet capture file encryption device 500 provided in an embodiment of this application. The device may include: an acquisition module 501, configured to acquire a data packet capture file to be encrypted, the data packet capture file including a global header and a data packet header and the data packet corresponding to the data packet header; an insertion module 502, configured to insert an encrypted meta-data packet header and a corresponding encrypted meta-data packet after the global header, the encrypted meta-data packet including encryption algorithm information; an encryption module 503, configured to encrypt the application layer data in the data packet in the data packet in the data packet capture file according to the encryption algorithm information, to obtain encrypted application layer data; and an update module 504, configured to update the non-application layer data of the corresponding data packet and the data in the corresponding data packet header according to the encrypted application layer data, to obtain an encrypted data packet capture file.

[0067] In some embodiments, the encrypted meta-data packet in the insertion module 502 includes a 14-byte Ethernet segment, a 20-byte Network Interconnection Protocol segment, a 20-byte Transmission Control Protocol segment, and a 3-byte encrypted data declaration segment, the encrypted data declaration segment including encryption algorithm information.

[0068] In some embodiments, the encrypted metadata header in the insertion module 502 includes: a 4-byte timestamp in seconds, a 4-byte timestamp in milliseconds, a 4-byte segment representing the number of bytes captured in the encrypted metadata, and a 4-byte segment representing the actual number of bytes in the encrypted metadata.

[0069] In some embodiments, the update module 504 is further configured to update the non-application layer data of the corresponding data packet according to the encrypted application layer data; the update module 504 is further configured to update the byte data in the header of the corresponding data packet according to the encrypted application layer data.

[0070] In some embodiments, the data packet capture file encryption device 500 may further include: a calculation module, configured to calculate and update the total number of bytes of the network interconnection protocol segment in the data packet according to the number of bytes of the encrypted application layer data; a calculation module, configured to calculate and update the number of captured bytes and the actual number of bytes in the data packet header according to the number of bytes of the encrypted application layer data.

[0071] In some embodiments, the data packet capture file encryption device 500 may further include:The parsing module is used to parse the encrypted metadata data packet to obtain the encryption algorithm information in the encrypted metadata data packet; the decryption module is used to decrypt the application layer data in the encrypted metadata data packet according to the encryption algorithm information and the preset decryption key to obtain the decrypted application layer data; the update module 504 is also used to update the encrypted data packet capture file according to the decrypted application layer data to obtain the original data packet capture file.

[0072] In some embodiments, the calculation module is also used to recalculate and update the total number of bytes of IP datagrams in the data packet according to the number of bytes of the decrypted application layer data; the calculation module is also used to calculate and update the number of captured bytes and the actual number of bytes in the data packet header according to the number of bytes of the decrypted application layer data.

[0073] The various modules in the device shown in FIG5 can implement the various steps in FIG1 and achieve the corresponding technical effects, which will not be described in detail here for the sake of brevity.

[0074] FIG6 shows a schematic diagram of the hardware structure of the terminal device provided in the embodiment of this application.

[0075] The terminal device may include a processor 601 and a memory 602 storing computer program instructions.

[0076] Specifically, the processor 601 described above may include a central processing unit (CPU), or an application-specific integrated circuit (ASIC), or one or more integrated circuits that can be configured to implement the embodiments of this application.

[0077] The memory 602 may include a mass storage device for data or instructions. For example, and not limitingly, the memory 602 may include a hard disk drive (HDD), a floppy disk drive, flash memory, optical disk, magneto-optical disk, magnetic tape, or a Universal Serial Bus (USB) drive, or a combination of two or more of these. In one instance, the memory 602 may include removable or non-removable (or fixed) media, or the memory 602 may be a non-volatile solid-state memory. The memory 602 may be internal or external to the integrated gateway disaster recovery device.

[0078] In one instance, the memory 602 may include a read-only memory (ROM), a random access memory (RAM), a disk storage medium device, an optical storage medium device, a flash memory device, or an electrical, optical, or other physical / tangible memory storage device. Therefore, typically, a memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., memory devices) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the method of encrypting a packet capture file according to this disclosure.

[0079] The processor 601 reads and executes computer program instructions stored in the memory 602 to implement the data packet capture file encryption method in the embodiment shown in FIG1. ​​

[0080] In one example, the terminal device may further include a communication interface 603 and a bus 604. As shown in FIG6, the processor 601, memory 602, and communication interface 603 are connected through the bus 604 and complete communication between them.

[0081] The communication interface 603 is mainly used to realize communication between various modules, devices, units and / or equipment in the embodiments of this application.

[0082] The bus 604 includes hardware, software or both, and couples the components of the terminal device together. For example, and not as a limitation, the bus may include an Accelerated Graphics Port (AGP) or other graphics bus, an Extended Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a Hyper Transport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an Infinite Bandwidth Interconnect, a Low Pin Count (LPC) bus, a memory bus, a Microchannel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local (VLB) bus, or other suitable buses, or a combination of two or more of these. Where appropriate, bus 604 may include one or more buses. Although specific buses are described and illustrated in the embodiments of this application, this application contemplates any suitable bus or interconnect.

[0083] In addition, in conjunction with the packet capture file encryption method in the above embodiments, embodiments of this application may provide a computer storage medium for implementation. The computer storage medium stores computer program instructions; when the computer program instructions are executed by the processor, they implement any of the data packet capture file encryption methods in the above embodiments.

[0084] This application embodiment also provides a computer program product, including a computer program, which, when processed, implements any of the data packet capture file encryption methods in the above embodiments. Specification 10 / 11 pages 13 CN 121396645 A

[0085] It should be clarified that this application is not limited to the specific configurations and processes described above and shown in the figures. For the sake of brevity, detailed descriptions of known methods are omitted here. In the above embodiments, several specific methods are described and shown.The steps of the body are given as examples. However, the method process of this application is not limited to the specific steps described and shown. Those skilled in the art can make various changes, modifications and additions, or change the order between steps after understanding the spirit of this application.

[0086] The functional blocks shown in the above structural block diagram can be implemented as hardware, software, firmware or a combination thereof. When implemented in hardware, it can be, for example, an electronic circuit, an application-specific integrated circuit (ASIC), appropriate firmware, a plug-in, a function card, etc. When implemented in software, the elements of this application are programs or text segments used to perform the required tasks. The programs or text segments can be stored in a machine-readable medium or transmitted over a transmission medium or communication link via data signals carried in a carrier wave. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, read-only memory (ROM), flash memory, erasable read-only memory (EROM), floppy disks, compact disc read-only memory (CD-ROM), optical disks, hard disks, fiber optic media, radio frequency (RF) links, and so on. Text segments can be downloaded via computer networks such as the Internet, intranets, etc.

[0087] It should also be noted that the exemplary embodiments mentioned in this application describe some methods or systems based on a series of steps or apparatus. However, this application is not limited to the order of the above steps, that is, the steps can be performed in the order mentioned in the embodiments, or in a different order than in the embodiments, or several steps can be performed simultaneously.

[0088] The aspects of this disclosure have been described above with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this disclosure. It should be understood that each block in the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that these instructions, executable by the processor of the computer or other programmable data processing apparatus, enable the implementation of functions / actions specified in one or more blocks of the flowchart and / or block diagram. Such a processor may be, but is not limited to, a general-purpose processor, a special-purpose processor, a special-application processor, or a field-programmable logic circuit. It is also understood that each block of the block diagram and / or flowchart, and combinations of blocks in the block diagram and / or flowchart, may also be implemented by dedicated hardware that performs the specified functions or actions.This can be implemented using components, or by a combination of dedicated hardware and computer instructions.

[0089] The above are merely specific embodiments of this application. Those skilled in the art can clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, modules, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here. It should be understood that the scope of protection of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and these modifications or substitutions should all be covered within the scope of protection of this application. Instruction Manual 11 / 11 Page 14 CN 121396645 A Figure 1 Figure 2 Instruction Manual Appendix 1 / 4 Page 15 CN 121396645 A Figure 3 Instruction Manual Appendix 2 / 4 Page 16 CN 121396645 A Figure 4 Instruction Manual Appendix 3 / 4 Page 17 CN 121396645 A Figure 5 Figure 6 Instruction Manual Appendix 4 / 4 Page 18 CN 121396645 A Abstract The present application discloses a method, apparatus, device and storage medium for encrypting packet capture files, and relates to the field of communication technology. The method includes: obtaining a to-be-encrypted packet capture file, where the packet capture file includes a global header, a packet header, and a packet corresponding to the packet header; inserting an encryption metadata packet header and a corresponding encryption metadata packet after the global header, where the encryption metadata packet includes encryption algorithm information; encrypting application layerdata in the packet of the packet capture file based on the encryption algorithm information and a preset encryption key, to obtain encrypted application layer data; and updating the packet capture file based on the encrypted application layer data to obtain an encrypted packet capture file. In the embodiments of the present application, by embedding a packet in a standard packet format, which includes encryption algorithm information, into the packet capture file, the format of the packet capture file is maintained unchanged, and selective encryption is performed on the data in the packets, thereby improving transmission efficiency of the packets. obtaining a to-be-encrypted packet capture file, where the packet capture file includes a global header, a packet header, and a packet corresponding to the packet header inserting an encryption metadata packet header and a corresponding encryption metadata packet after the global header, where the encryption metadata packet includesencryption algorithm information encrypting application layer data in the packet of the packet capture file through sensors arranged on press-fitting tooling of the wind turbine blade based on the encryption algorithm information and a preset encryption key, to obtain encrypted application layer data and obtain real-time positioning data updating the packet capture file based on the encrypted application layer data to obtain an encrypted packet capture file S101 S102 S103 S104

Claims

1. A method of data packet capture file encryption, characterized by, The method comprises the following steps: obtain a data packet capture file to be encrypted, the data packet capture file comprising a global header, a data packet header and a data packet corresponding to the data packet header; insert an encrypted metadata packet header and a corresponding encrypted metadata packet after the global header, the encrypted metadata packet comprising encryption algorithm information; encrypt application layer data in the data packet in the data packet capture file according to the encryption algorithm information and a preset encryption key, to obtain encrypted application layer data; update the data packet capture file according to the encrypted application layer data, to obtain an encrypted data packet capture file.

2. The method of data packet capture file encryption of claim 1, wherein, The encrypted metadata packet comprises an Ethernet segment, an Internet Protocol segment, a Transmission Control Protocol segment and an encrypted data declaration segment, and the encrypted data declaration segment comprises encryption algorithm information.

3. The method of data packet capture file encryption of claim 2, wherein, The Ethernet segment is 14 bytes, the Internet Protocol segment is 20 bytes, the Transmission Control Protocol segment is 20 bytes and the encrypted data declaration segment is 3 bytes.

4. The method of data packet capture file encryption of claim 1, wherein, The encrypted metadata packet header comprises a timestamp second segment, a timestamp millisecond segment, an encrypted metadata packet capture byte number segment and an encrypted metadata packet actual byte number segment.

5. The method of data packet capture file encryption of claim 4, wherein, The timestamp second segment is 4 bytes, the timestamp millisecond segment is 4 bytes, the encrypted metadata packet capture byte number segment is 4 bytes and the encrypted metadata packet actual byte number segment is 4 bytes.

6. The method of data packet capture file encryption of claim 1, wherein, The updating of the data packet capture file according to the encrypted application layer data comprises: updating non-application layer data of the corresponding data packet according to the encrypted application layer data; updating byte data in the corresponding data packet header according to the encrypted application layer data.

7. The method of data packet capture file encryption of claim 4, wherein, The updating of the non-application layer data of the corresponding data packet according to the encrypted application layer data comprises: calculating and updating the total byte number of the Internet Protocol segment in the data packet according to the byte number of the encrypted application layer data. The updating of the data in the corresponding data packet header according to the encrypted application layer data comprises: calculating and updating the capture byte number and the actual byte number in the data packet header according to the byte number of the encrypted application layer data.

8. The method of data packet capture file encryption according to any of claims 1-7, characterized in that, The method further comprises: parsing the encrypted metadata packet to obtain the encryption algorithm information in the encrypted metadata packet; decrypting the application layer data in the encrypted data packet according to the encryption algorithm information and a preset decryption key, to obtain decrypted application layer data; updating the encrypted data packet capture file according to the decrypted application layer data, to obtain an original data packet capture file.

9. The method of data packet capture file encryption of claim 8, wherein, The updating of the encrypted data packet capture file according to the decrypted application layer data to obtain an original data packet capture file comprises: calculating and updating the total IP datagram byte number in the data packet according to the byte number of the decrypted application layer data; calculating and updating the capture byte number and the actual byte number in the data packet header according to the byte number of the decrypted application layer data.

10. An apparatus for data packet capture file encryption, the apparatus comprising: The device comprises: an obtaining module, configured to obtain a data packet capture file to be encrypted, the data packet capture file comprising a global header, a data packet header and a data packet corresponding to the data packet header; The inserting module is configured to insert an encrypted metadata packet header and a corresponding encrypted metadata packet after the global header, wherein the encrypted metadata packet comprises encryption algorithm information; The encryption module is configured to encrypt application layer data in the data packet in the data packet capture file according to the encryption algorithm information, to obtain encrypted application layer data; The updating module is configured to update non-application layer data of the corresponding data packet and data in the corresponding data packet header according to the encrypted application layer data, to obtain an encrypted data packet capture file.

11. A terminal device, comprising: The device comprises a processor and a memory storing computer program instructions; the processor executes the computer program instructions to implement the method for encrypting the data packet capture file according to any one of claims 1-9.

12. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer program instructions; the computer program instructions are executed by the processor to implement the method for encrypting the data packet capture file according to any one of claims 1-9.

13. A computer program product, characterised in that, The instructions in the computer program product are executed by the processor of the electronic device, so that the electronic device executes the method for encrypting the data packet capture file according to any one of claims 1-9.