Video stream non-perception encryption and decryption method and system based on IP protocol
The IP protocol-based encryption and decryption method addresses the inefficiencies of traditional video stream encryption by using UDP, forward error correction, and ChaCha20-Poly1305, ensuring secure, real-time, and high-quality video transmission.
Patent Information
- Application Number
- CN202411030438.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-30
- Publication Date
- 2024-12-17
AI Technical Summary
Traditional video stream encryption and decryption technologies require additional computing and storage resources, increasing network latency and bandwidth, affecting video stream quality and stability, and are susceptible to network attacks, leading to data leakage.
Implement a method and system for imperceptible encryption and decryption based on the IP protocol, using UDP protocol, forward error correction coding, network traffic feature extraction, load optimization, and encryption with ChaCha20-Poly1305 algorithm, to ensure real-time and secure video stream transmission.
The method improves data security, reduces network latency and bandwidth load, maintains real-time and continuity of video streams, and prevents network attacks, enhancing overall video transmission quality and efficiency.
Smart Images

Figure CN119155483A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of video stream transmission encryption and decryption, and in particular to a method and system for video stream imperceptible encryption and decryption based on an IP protocol. Background Art
[0002] With the development of Internet networks, video streaming has become a very important data transmission method. In the Internet, video streaming has also attracted more and more attention from users. However, in actual applications, due to the increasing demand for confidential transmission, traditional encryption and decryption technologies are difficult to meet the needs of enhancing data security. For example, symmetric encryption and asymmetric encryption often require complex key management and exchange processes, which increases the complexity and computing overhead of the system. At the same time, the encryption and decryption processing will also have a certain impact on the real-time and continuity of the video stream. With the widespread application of video applications, video traffic is increasing, and the processing capacity of traditional encryption technology has been difficult to meet the needs of real-time video streaming. This requires finding more efficient encryption and decryption technologies. Many video applications need to achieve non-perceptual encryption and decryption of content to ensure the security and privacy of video content. However, traditional encryption technology usually needs to be processed at the video encoding and decoding level, which increases the complexity of the system. Since the video stream itself is a real-time data stream, the requirements for latency and bandwidth are very high. Traditional encryption and decryption technologies require additional computing and storage resources, which will increase network latency and bandwidth, affecting the quality and stability of video stream transmission. At the same time, traditional encryption and decryption technologies are also vulnerable to network attacks during application, leading to data leakage and other security issues.
[0003] Therefore, the realization of IP-based video stream imperceptible encryption and decryption technology has attracted wide attention. This technology can improve data security without affecting video stream transmission, and can also meet the requirements of real-time and continuity of video streams. It can enhance data security through encryption and decryption methods at the IP layer without interfering with video stream transmission. Compared with traditional application layer encryption, it does not affect the real-time and continuity of video, and provides a good foundation for secure transmission. Video stream transmission has high requirements for real-time performance, and traditional encryption methods often increase delays and interruptions. Imperceptible encryption and decryption based on the IP layer can minimize the impact on video stream transmission and meet users' needs for real-time performance. Summary of the invention
[0004] In view of the above-mentioned problems, the present invention is proposed.
[0005] Therefore, the technical problem solved by the present invention is: the present invention solves the problem that traditional video stream encryption and decryption technology requires additional computing and storage resources, which will increase network latency and bandwidth, affect the quality and stability of video stream transmission, and is also susceptible to network attacks during application, leading to data leakage and other security issues.
[0006] In order to solve the above technical problems, the present invention provides the following technical solutions:
[0007] In a first aspect, the present invention provides a video stream imperceptible encryption and decryption method based on IP protocol, comprising:
[0008] Obtain a plaintext data stream, split the plaintext data stream into data packets, transmit the data packets using the UDP protocol, introduce forward error correction coding into the data packets, reassemble the transmitted data packets, and generate an original plaintext video stream;
[0009] Performing network traffic feature extraction on the plaintext data stream to obtain a network traffic feature, performing load optimization on the network traffic feature to obtain a first network traffic feature, encrypting the first network traffic feature using an encryption algorithm, and attaching an authentication tag to the end of the encrypted first network traffic feature to obtain a second authentication tag, and embedding the encrypted first network traffic feature into a data packet of the original plaintext video stream to obtain an encrypted data packet;
[0010] The authentication tag is recalculated and compared with the second authentication tag, and the encrypted data packet is decrypted using the corresponding key to obtain the reconstructed original plaintext video stream.
[0011] As a preferred solution of the IP protocol-based video stream imperceptible encryption and decryption method described in the present invention, wherein: the data packet is transmitted using the UDP protocol, and forward error correction coding is introduced into the data packet, and the transmitted data packet is reassembled including:
[0012] Determine the size of the data packet according to the network bandwidth, split the plaintext data stream according to the set data packet size, add header information to the data packet, and introduce forward error correction coding to add redundant information that can be self-repaired when errors occur during transmission and there is no retransmission request;
[0013] The generated data packets are transmitted through the UDP protocol, and the UDP socket is used to transmit the data packets. The transmitted data packets are reassembled according to the sequence and timestamp. During the reassembly process, each data packet is verified to obtain the original plaintext video stream.
[0014] As a preferred solution of the IP protocol-based video stream imperceptible encryption and decryption method described in the present invention, wherein: network traffic feature extraction is performed on the plaintext data stream, and the network traffic feature obtained includes:
[0015] Monitor the usage of network bandwidth, determine the available bandwidth of the network, determine the scope and accuracy of the network traffic features to be extracted based on the available bandwidth, analyze network environmental factors, and obtain the influencing factors of network traffic features;
[0016] Extract features from the plaintext video stream according to the determined network traffic features to obtain network traffic features, quantify the network traffic features, and convert the network traffic features into numerical data that can be processed by the algorithm;
[0017] Analyze the statistical characteristics of numerical data and embed the statistical characteristics into the original plaintext video stream during the encryption process.
[0018] As a preferred solution of the IP protocol-based video stream imperceptible encryption and decryption method described in the present invention, wherein: load optimization is performed on the network traffic feature to obtain the first network traffic feature including:
[0019] Traverse each network traffic feature, compress each network traffic feature using a data compression algorithm to obtain a compressed byte sequence, and add all compressed byte sequences to a compression value list;
[0020] Set an empty byte sequence as the first compressed value, traverse each compressed value in the compressed value list, if the previous compressed value is empty, directly use the current compressed value as the differential value, if the previous compressed value is not empty, calculate the difference between the current compressed value and the previous compressed value, add the differential value to the differential value list, and update the previous compressed value as the current compressed value;
[0021] Traverse each differential value in the differential value list, convert the differential value into binary form, remove leading zeros from the binary form, compress the binary data using variable-length encoding to obtain optimized binary data, concatenate the optimized binary into a byte sequence, and use the byte sequence as the optimized payload.
[0022] As a preferred solution of the IP protocol-based video stream imperceptible encryption and decryption method described in the present invention, wherein: encrypting the first network traffic feature using an encryption algorithm includes:
[0023] Encrypting the first network traffic feature by using the ChaCha20-Poly1305 algorithm, converting the first network traffic feature into an internal state matrix, performing a ChaCha transformation on the internal state matrix to generate a pseudo-random number stream, performing an XOR operation on the pseudo-random number stream and the plaintext data stream to obtain encrypted data;
[0024] The Poly1305 algorithm is used to calculate the authentication tag on the ciphertext, and the authentication tag is appended to the end of the encrypted data, and the encrypted data and the authentication tag are output.
[0025] As a preferred solution of the IP protocol-based video stream imperceptible encryption and decryption method described in the present invention, it also includes:
[0026] Different data packets are classified into different levels according to the type of data packet and the size of the data packet timestamp;
[0027] Set the type of data packet: 0x01 is a high-level data packet, 0x02 is a medium-level data packet, and 0x03 is a low-level data packet;
[0028] If the judgment is 0x01, it is directly classified as high level;
[0029] If the judgment is 0x02 / 0x03, further judge the timestamp of the data packet. If the timestamp is less than the first threshold, it is classified as a high level; if the timestamp is greater than or equal to the first threshold and less than the second threshold, it is classified as a medium level; if the timestamp is greater than or equal to the second threshold, it is classified as a low level;
[0030] Develop corresponding encryption strategies for data packets of different levels and dynamically adjust encryption strategies.
[0031] As a preferred solution of the IP protocol-based video stream imperceptible encryption and decryption method described in the present invention, decrypting the encrypted data packet using the corresponding key includes:
[0032] Use the Poly1305 message authentication code algorithm to verify the encrypted data packet, use the same key to calculate the authentication tag value, and compare it with the second authentication tag. If the recalculated authentication tag is consistent with the second authentication tag, decryption is performed. If they are inconsistent, decryption is stopped and the error mechanism is used to request reconstruction of the lost data.
[0033] After the authentication tag is verified, the data is decrypted using the ChaCha20 stream cipher algorithm, a pseudo-random number stream is generated using the key, and the pseudo-random number stream is XORed with the encrypted data to obtain the decrypted data.
[0034] In a second aspect, the present invention provides a system for imperceptible encryption and decryption of video streams based on IP protocol, comprising:
[0035] A reassembly module is used to obtain a plaintext data stream, split the plaintext data stream into data packets, transmit the data packets using the UDP protocol, introduce forward error correction coding into the data packets, reassemble the transmitted data packets, and generate an original plaintext video stream;
[0036] An encryption module is used to extract network traffic features from the plaintext data stream to obtain network traffic features, perform load optimization on the network traffic features to obtain a first network traffic feature, encrypt the first network traffic feature using an encryption algorithm, attach an authentication tag to the end of the encrypted first network traffic feature to obtain a second authentication tag, and embed the encrypted first network traffic feature into a data packet of an original plaintext video stream to obtain an encrypted data packet;
[0037] The decryption module is used to recalculate the authentication tag and compare it with the second authentication tag, and decrypt the encrypted data packet using the corresponding key to obtain the reconstructed original plaintext video stream.
[0038] In a third aspect, the present invention provides a computing device, comprising:
[0039] Memory and processor;
[0040] The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions. When the computer-executable instructions are executed by the processor, the steps of the IP-based video stream imperceptible encryption and decryption method are implemented.
[0041] In a fourth aspect, the present invention provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, can implement the steps of the method for imperceptible encryption and decryption of video streams based on the IP protocol.
[0042] Beneficial effects of the present invention: The IP-based video stream imperceptible encryption and decryption method proposed by the present invention improves data security, protects video content through IP layer encryption and authentication mechanisms, does not affect the real-time and continuity of video streams, and meets the performance requirements of video transmission; adopts network traffic feature optimization, can dynamically adjust encryption strength, improves system flexibility; unloads encryption and decryption calculations to the edge of the network, reduces the load on terminal devices, improves overall performance, and avoids the burden of traditional encryption and decryption technology on network delay and bandwidth, and improves the quality and efficiency of video stream transmission. At the same time, while ensuring data security, this technology can also effectively prevent network attacks and ensure the security of video transmission. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for describing the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative labor. Among them:
[0044] Figure 1The present invention provides an overall flow chart of a method for imperceptible encryption and decryption of video streams based on IP protocol. DETAILED DESCRIPTION
[0045] In order to make the above-mentioned purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are described in detail below in conjunction with the drawings of the specification. Obviously, the described embodiments are part of the embodiments of the present invention, but not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary persons in the art without creative work should fall within the scope of protection of the present invention.
[0046] In the following description, many specific details are set forth to facilitate a full understanding of the present invention, but the present invention may also be implemented in other ways different from those described herein, and those skilled in the art may make similar generalizations without violating the connotation of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.
[0047] Secondly, the term "one embodiment" or "embodiment" as used herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present invention. The term "in one embodiment" that appears in different places in this specification does not necessarily refer to the same embodiment, nor does it refer to a separate or selective embodiment that is mutually exclusive with other embodiments.
[0048] The present invention is described in detail with reference to schematic diagrams. When describing the embodiments of the present invention, for the sake of convenience, the cross-sectional diagrams showing the device structure will not be partially enlarged according to the general scale, and the schematic diagrams are only examples, which should not limit the scope of protection of the present invention. In addition, in actual production, the three-dimensional dimensions of length, width and depth should be included.
[0049] At the same time, in the description of the present invention, it should be noted that the directions or positional relationships indicated by the terms "upper, lower, inner and outer" are based on the directions or positional relationships shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific direction, be constructed and operated in a specific direction, and therefore cannot be understood as limiting the present invention. In addition, the terms "first, second or third" are only used for descriptive purposes and cannot be understood as indicating or implying relative importance.
[0050] In the present invention, unless otherwise clearly specified and limited, the terms "install, connect, connect" should be understood in a broad sense, for example: it can be a fixed connection, a detachable connection or an integral connection; it can also be a mechanical connection, an electrical connection or a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0051] Example 1
[0052] Reference Figure 1 , is an embodiment of the present invention, and provides a video stream imperceptible encryption and decryption method based on IP protocol, comprising:
[0053] S100: Obtain a plaintext data stream, split the plaintext data stream into data packets, transmit the data packets using the UDP protocol, introduce forward error correction coding into the data packets, reassemble the transmitted data packets, and generate an original plaintext video stream;
[0054] Furthermore, the size of the data packet is determined according to the network bandwidth, the plaintext data stream is split according to the set data packet size, header information is added to the data packet, and forward error correction coding is introduced to add redundant information that can self-repair when errors occur during transmission and there is no retransmission request;
[0055] The generated data packets are transmitted through the UDP protocol, and the UDP socket is used to transmit the data packets. The transmitted data packets are reassembled according to the sequence and timestamp. During the reassembly process, each data packet is verified to obtain the original plaintext video stream.
[0056] Specifically, the size of each data packet is determined according to the network bandwidth and the network environment. For example, when the network bandwidth is sufficient, each data packet is set to about 2KB. If the network bandwidth is small, the size of the data packet is reduced; the plaintext video stream is divided according to the set data packet size to generate multiple smaller data packets, and some additional header information is added to each data packet, such as source address, destination address, sequence number, and timestamp, which are used for data packet transmission, reorganization and repair. After adding necessary header information to multiple data packets, forward error correction coding is introduced into the data packet, which can detect and repair errors in the data transmission process and improve the reliability of data transmission. In order to ensure the integrity of the data packet, a check is added to each data packet; the generated data packet is transmitted through the UDP protocol. UDP is a connectionless communication protocol. No signaling establishment link is required before transmitting data. Therefore, the transmission speed is faster and does not cause transmission and reordering delays like the TCP protocol.
[0057] It should be noted that video stream transmission can use TCP protocol, UDP protocol, and RTR protocol. Preferably, UDP protocol is used for transmission. UDP does not need to establish and disconnect connections like TCP, so it can reduce delays when transmitting data. TCP protocol may reorder data packets during transmission, which will cause problems in real-time video stream transmission. UDP will not produce such reordering due to its connectionless nature. UDP protocol has a fast transmission speed and does not require the execution of signaling establishment links. Therefore, it can improve the transmission efficiency of video streams. The introduction of forward error correction coding improves the reliability of data transmission and reduces the impact of packet loss on video quality. This shows that the use of UDP protocol combined with forward error correction coding can effectively solve the packet loss problem and further improve the transmission quality of video streams.
[0058] It should also be noted that after splitting the plaintext video stream into multiple data packets and adding the necessary header information, forward error correction coding is introduced into the data packets in order to ensure the integrity and accuracy of the data packets even under unfavorable network conditions. Forward error correction coding can add additional redundant information during data transmission. This redundant information allows the receiving end to detect errors that occur during transmission and to repair these errors by itself without a retransmission request. The commonly used forward error correction coding method is Reed-Solomon coding, which achieves error detection and correction by adding redundant check symbols to the data. Reed-Solomon coding is particularly suitable for handling burst errors because it can correct multiple errors in one data block.
[0059] The received multiple data packets are reassembled according to the sequence number and timestamp to generate the original plaintext video stream. At the same time, during the reassembly and repair process, each data packet needs to be verified to ensure the integrity and accuracy of the data.
[0060] S200: extracting network traffic features from the plaintext data stream to obtain network traffic features, performing load optimization on the network traffic features to obtain a first network traffic feature, encrypting the first network traffic feature using an encryption algorithm, and attaching an authentication tag to the end of the encrypted first network traffic feature to obtain a second authentication tag, and embedding the encrypted first network traffic feature into a data packet of the original plaintext video stream to obtain an encrypted data packet;
[0061] Furthermore, the usage of network bandwidth is monitored to determine the available bandwidth of the network, and based on the available bandwidth, the scope and accuracy of the network traffic features to be extracted are determined, and the network environment factors are analyzed to obtain the influencing factors of the network traffic features;
[0062] Extract features from the plaintext video stream according to the determined network traffic features to obtain network traffic features, quantify the network traffic features, and convert the network traffic features into numerical data that can be processed by the algorithm;
[0063] Analyze the statistical characteristics of numerical data and embed the statistical characteristics into the original plaintext video stream during the encryption process.
[0064] Specifically, the method of extracting traffic features is determined by analyzing the network bandwidth and network environment. Common network traffic features include packet size, packet, data flow duration, transmission speed, and delay; based on the determined network traffic features, feature extraction is performed on the plaintext video stream, and traffic feature information of the video stream is obtained by analyzing and extracting the video data packets. For example, the size of the video frame, time interval, data flow duration, and transmission rate are calculated respectively; the collected network traffic features need to be quantified and converted into numerical data that can be processed by the algorithm. This process can usually be performed using clustering or other machine learning techniques; by analyzing the statistical features of the clustered samples such as the mean, standard deviation, and skewness, the distribution of the sample is obtained, providing a basis for embedding the statistical features into the original plaintext video stream during the encryption process.
[0065] It should be noted that according to the bandwidth usage of the network in different time periods, the peak and underestimated periods of bandwidth usage are identified, and the currently used bandwidth is subtracted from the total bandwidth to obtain the available bandwidth of the network. Network environmental factors include delay, packet loss rate, jitter, network topology, network protocol, etc. Before encryption, the network traffic statistics method is used to analyze and extract the network traffic characteristics of the plaintext video stream. In order to analyze and extract the network traffic characteristics of the plaintext video stream before encryption, and encrypt the extracted features and embed them into the data packets of the original video stream, this is one of the key links to achieve imperceptible encryption.
[0066] Furthermore, each network traffic feature is traversed, and each network traffic feature is compressed using a data compression algorithm to obtain a compressed byte sequence, and all compressed byte sequences are added to a compression value list;
[0067] Set an empty byte sequence as the first compressed value, traverse each compressed value in the compressed value list, if the previous compressed value is empty, directly use the current compressed value as the differential value, if the previous compressed value is not empty, calculate the difference between the current compressed value and the previous compressed value, add the differential value to the differential value list, and update the previous compressed value as the current compressed value;
[0068] Traverse each differential value in the differential value list, convert the differential value into binary form, remove leading zeros from the binary form, compress the binary data using variable-length encoding to obtain optimized binary data, concatenate the optimized binary into a byte sequence, and use the byte sequence as the optimized payload.
[0069] It should be noted that the goal of payload optimization is to effectively store encrypted feature values without increasing the size of the data packet. By combining compressed feature values, differential encryption, and binary optimization, the size of the data packet can be reduced, reducing bandwidth requirements and transmission time.
[0070] Before encryption, the extracted network traffic features are compressed to reduce their size. Various data compression algorithms can be used, such as Huffman coding or LZ77 compression. If consecutive data packets have similar features, only the changing part of the feature value, that is, the differential data, can be encrypted instead of the complete feature value. This can reduce the size of the encrypted data. The feature value is converted into binary form and the storage is optimized to obtain the first network traffic feature, which is the optimized payload. Unnecessary leading zeros can be removed or variable-length coding can be used to reduce the number of bits required to represent the feature value. A structured storage format is designed to compactly embed the encrypted feature value into the payload of the data packet to reduce additional padding and far data.
[0071] Furthermore, the first network traffic feature is encrypted using the ChaCha20-Poly1305 algorithm, the first network traffic feature is converted into an internal state matrix, the internal state matrix is subjected to a ChaCha transformation to generate a pseudo-random number stream, and the pseudo-random number stream is subjected to an XOR operation with the plaintext data stream to obtain encrypted data;
[0072] The Poly1305 algorithm is used to calculate the authentication tag on the ciphertext, and the authentication tag is appended to the end of the encrypted data, and the encrypted data and the authentication tag are output.
[0073] It should be noted that the encryption algorithm can also use the AES encryption algorithm, the DES encryption algorithm, the RSA encryption algorithm, and preferably the ChaCha20-Poly1305 algorithm is combined with the message authentication code to encrypt the first network traffic feature, providing high security and high efficiency. ChaCha20 is a stream cipher algorithm that provides good security and can resist a variety of known cryptanalysis attacks. Poly1305 is an efficient MAC algorithm used to ensure data integrity and authentication; the ChaCha20-Poly1305 combination is particularly suitable for processing large amounts of data because high-speed encryption and decryption operations can be achieved in both software and hardware, which is particularly important for the transmission of real-time video streams; it can achieve imperceptible encryption and decryption, that is, users will not feel obvious delays or performance degradation when watching video streams, which is crucial to improving user experience; the ChaCha20-Poly1305 algorithm requires regular replacement of keys, and the keys need to be securely stored and transmitted, which helps to overcome the risks of key leakage or abuse in traditional encryption technology; the integration of the Poly1305 algorithm provides a message authentication function to ensure that data has not been tampered with during transmission, which overcomes the problem of difficult to ensure data integrity in traditional encryption technology; the ChaCha20-Poly1305 algorithm can adapt to different security needs, and by adjusting the key length and encryption parameters, it can meet different levels of security requirements.
[0074] Specifically, a 256-bit key and a 96-bit initialization vector are used as input, the key is the initialization vector expanded into the internal state matrix required by the ChaCha20 algorithm, 20 rounds of ChaCha transformation are performed on the internal state matrix to generate a pseudo-random number stream, the pseudo-random number stream is XORed with the plaintext video stream to obtain the ciphertext; the Poly1305 algorithm is used to calculate the 16-byte authentication tag for the ciphertext and the additional verification data. The ciphertext and the Poly1305 authentication tag are output.
[0075] Furthermore, different data packets are classified into different levels according to the type of data packet and the size of the data packet timestamp;
[0076] Set the type of data packet: 0x01 is a high-level data packet, 0x02 is a medium-level data packet, and 0x03 is a low-level data packet;
[0077] If the judgment is 0x01, it is directly classified as high level;
[0078] If the judgment is 0x02 / 0x03, further judge the timestamp of the data packet. If the timestamp is less than the first threshold, it is classified as a high level; if the timestamp is greater than or equal to the first threshold and less than the second threshold, it is classified as a medium level; if the timestamp is greater than or equal to the second threshold, it is classified as a low level;
[0079] Develop corresponding encryption strategies for data packets of different levels and dynamically adjust encryption strategies.
[0080] In one possible embodiment, 0x01 is a key control data packet, 0x02 is an ordinary video data packet, and 0x03 is a metadata and configuration information data packet. A timestamp is added to the data packet header to determine time sensitivity. If it is a 0x01 key control data packet, it is directly classified as a high level. If it is a 0x02 ordinary video data packet or a 0x03 metadata and configuration information data packet, the timestamp is further determined. If the timestamp < 20ms, it is classified as a high-level data packet; if 20ms≤timestamp<100ms, it is classified as a medium-level data packet; if the timestamp ≥100ms, it is classified as a low-level data packet. High-level data packets should use widely verified strong encryption algorithms, such as AES-256 or ChaCha20-Poly1305; medium-level data packets can use standard encryption algorithms, such as AES-128; low-level data packets can use simpler encryption algorithms, such as AES-128 or ChaCha20.
[0081] It should be noted that different levels of data packets use different encryption strengths. Multi-level encryption means that different levels of encryption strategies are applied according to the importance and sensitivity of the data packets, which can optimize the use of computing resources while ensuring security. According to the importance of the data and the need for security, the data packets are divided into different levels, and corresponding encryption strategies are formulated for each level of data packets. For high-level data packets, stronger encryption algorithms or longer keys are used; for low-level data packets, simpler encryption methods can be used, and encryption strategies can be dynamically adjusted according to changes in network conditions and security requirements. For example, when the network conditions are poor or security threats increase, the encryption level of all data packets can be increased. During the encryption process, computing resources are reasonably allocated to ensure that high-level data packets are adequately encrypted, while avoiding excessive encryption of low-level data packets, which causes waste of resources.
[0082] Through these optimization measures, a more efficient, flexible and secure video stream non-perceptual encryption and decryption technology can be realized, improving the performance and security of data transmission.
[0083] S300: recalculating the authentication tag and comparing it with the second authentication tag, decrypting the encrypted data packet using the corresponding key, and obtaining the reconstructed original plaintext video stream;
[0084] Furthermore, the encrypted data packet is verified using the Poly1305 message authentication code algorithm, the authentication tag value is calculated using the same key, and compared with the second authentication tag. If the recalculated authentication tag is consistent with the second authentication tag, the decryption operation is performed. If they are inconsistent, the decryption is stopped and the error mechanism is used to request the reconstruction of the lost data;
[0085] After the authentication tag is verified, the data is decrypted using the ChaCha20 stream cipher algorithm, a pseudo-random number stream is generated using the key, and the pseudo-random number stream is XORed with the encrypted data to obtain the decrypted data.
[0086] It should be noted that before starting the decryption process, the receiver needs to ensure that it has the correct key. This usually involves the generation, distribution, storage and regular replacement of keys. Key management is a critical security link and requires ensuring the security and availability of keys. After receiving the encrypted data packet, the receiver first uses the Poly1305 message authentication code to verify it. This step ensures that the data has not been tampered with during transmission. If the verification fails, the data packet will be discarded to prevent potential security threats. Once the message authentication code verification is passed, the receiver will use the ChaCha20 stream cipher algorithm to decrypt the data. The ChaCha20 algorithm requires the same key and initialization vector as the sender to restore the original data.
[0087] It should also be noted that if the sender compresses the characteristic values, the receiver needs to decompress these characteristic values after decryption in order to restore the original network traffic characteristics. According to the sequence number and timestamp of the data packet, the receiver correctly sorts and reassembles the decrypted data packets to reconstruct the original video stream. This process may involve handling network delays and packet loss to ensure the continuity and integrity of the video stream. Due to the use of a multi-level encryption strategy, the receiver needs to decrypt according to the level of each data packet and the corresponding encryption strategy. This means that for high-level data packets, a stronger decryption algorithm or a longer key may be required. If a data packet is found to be lost or damaged during the reassembly process, the receiver needs to use an error recovery mechanism to request retransmission or use other recovery techniques such as forward error correction coding to reconstruct the lost data. The entire decryption process needs to be performed efficiently and securely to ensure the real-time and confidentiality of the video stream. The decryption system at the receiver needs to have high-performance processing capabilities and be able to adapt to changes in network conditions and adjustments in security requirements.
[0088] The above is a schematic scheme of a method for imperceptible encryption and decryption of video streams based on IP protocol in this embodiment. It should be noted that the technical scheme of the device for imperceptible encryption and decryption of video streams based on IP protocol and the technical scheme of the method for imperceptible encryption and decryption of video streams based on IP protocol above belong to the same concept. The details of the technical scheme of the device for imperceptible encryption and decryption of video streams based on IP protocol in this embodiment that are not described in detail can be found in the description of the technical scheme of the method for imperceptible encryption and decryption of video streams based on IP protocol above.
[0089] The device for imperceptible encryption and decryption of a video stream based on the IP protocol in this embodiment includes:
[0090] A reassembly module is used to obtain a plaintext data stream, split the plaintext data stream into data packets, transmit the data packets using the UDP protocol, introduce forward error correction coding into the data packets, reassemble the transmitted data packets, and generate an original plaintext video stream;
[0091] An encryption module is used to extract network traffic features from the plaintext data stream to obtain network traffic features, perform load optimization on the network traffic features to obtain a first network traffic feature, encrypt the first network traffic feature using an encryption algorithm, attach an authentication tag to the end of the encrypted first network traffic feature to obtain a second authentication tag, and embed the encrypted first network traffic feature into a data packet of an original plaintext video stream to obtain an encrypted data packet;
[0092] The decryption module is used to recalculate the authentication tag and compare it with the second authentication tag, and decrypt the encrypted data packet using the corresponding key to obtain the reconstructed original plaintext video stream.
[0093] This embodiment further provides a computing device, which is applicable to the case of imperceptible encryption and decryption of a video stream based on an IP protocol, including:
[0094] Memory and processor; the memory is used to store computer-executable instructions, and the processor is used to execute computer-executable instructions to implement the IP protocol-based video stream imperceptible encryption and decryption method proposed in the above embodiment.
[0095] This embodiment also provides a storage medium on which a computer program is stored. When the program is executed by a processor, the method for realizing IP-based video stream imperceptible encryption and decryption as proposed in the above embodiment is implemented.
[0096] The storage medium proposed in this embodiment and the method for realizing IP protocol-based video stream imperceptible encryption and decryption proposed in the above embodiment belong to the same inventive concept. The technical details not described in detail in this embodiment can be referred to the above embodiment, and this embodiment has the same beneficial effects as the above embodiment.
[0097] Through the above description of the implementation methods, the technicians in the relevant field can clearly understand that the present invention can be implemented by means of software and necessary general hardware, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as a computer floppy disk, read-only memory (ReadOnly, Memory, ROM), random access memory (RandomAccess Memory, RAM), flash memory (FLASH), hard disk or optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform the methods of various embodiments of the present invention.
[0098] Example 2
[0099] Referring to Table 1, an embodiment of the present invention provides a method for imperceptible encryption and decryption of video streams based on IP protocol, in order to verify and illustrate the technical effects adopted in the method.
[0100] The acquired video source: 1080p high-definition video stream, with a bit rate of about 5Mbps;
[0101] Network environment: simulate different network conditions, including high-bandwidth and low-bandwidth environments;
[0102] Encryption technology: ChaCha20-Poly1305 encryption algorithm and traditional AES encryption algorithm;
[0103] Performance indicators: encryption / decryption speed, network latency, packet loss rate, video quality (PSNR);
[0104] The video stream is encrypted using the ChaCha20-Poly1305 encryption algorithm combined with the Poly1305 algorithm, and the encryption speed, network delay, and packet loss rate are recorded. The encrypted video stream is transmitted through the model network, the encrypted data is decrypted at the receiving end, and the decryption speed and video quality are recorded.
[0105] The same experimental steps are performed using the traditional AES encryption algorithm to obtain the experimental comparison results, as shown in Table 1.
[0106] Table 1 Experimental comparison results of the present invention and the traditional method
[0107] Parameters / Effects The present invention Traditional method (AES) Encryption speed (Mbps) 4.5 3.0 Decryption speed (Mbps) 4.8 3.2 Network delay (ms) 10 20 Packet loss rate (%) 2 5 Video quality (PSNR, dB) 45 42
[0108] As can be seen from the above table, the encryption speed of the present invention is 4.5Mbps, while the traditional AES method is 3.0Mbps, which is 50% higher; the decryption speed of the present invention is 4.8Mbps, while the traditional AES method is 3.2Mbps, which is 50% higher. The present invention is more efficient in encryption and decryption processing and can better support the needs of real-time video transmission;
[0109] From the perspective of network delay, the network delay of the present invention is 10ms, while the traditional AES method is 20ms, which is reduced by half. Lower network delay can improve the real-time and smoothness of video streams and reduce problems such as freezes.
[0110] From the perspective of packet loss rate, the packet loss rate of the present invention is 2%, while that of the traditional AES method is 5%, which is reduced by 60%. The lower packet loss rate means that more complete data packets will be retained in the video stream, thereby improving the video quality;
[0111] From the perspective of video quality, the video quality (PSNR) of the present invention is 45dB, while that of the traditional AES method is 42dB, which is improved by 7.1%. A higher PSNR value indicates that the video quality is better and closer to the original image quality.
[0112] In summary, the present invention is superior to the traditional AES encryption method in key indicators such as encryption and decryption speed, network delay, data packet loss rate and video quality, which shows that the present invention is more suitable for application in real-time video transmission scenarios and can provide a better user experience.
[0113] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit the present invention. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention, which should all be included in the scope of the claims of the present invention.
Claims
1. A video stream imperceptible encryption and decryption method based on IP protocol, characterized in that: include: Obtain a plaintext data stream, split the plaintext data stream into data packets, transmit the data packets using the UDP protocol, introduce forward error correction coding into the data packets, reassemble the transmitted data packets, and generate an original plaintext video stream; Performing network traffic feature extraction on the plaintext data stream to obtain a network traffic feature, performing load optimization on the network traffic feature to obtain a first network traffic feature, encrypting the first network traffic feature using an encryption algorithm, and attaching an authentication tag to the end of the encrypted first network traffic feature to obtain a second authentication tag, and embedding the encrypted first network traffic feature into a data packet of the original plaintext video stream to obtain an encrypted data packet; The authentication tag is recalculated and compared with the second authentication tag, and the encrypted data packet is decrypted using the corresponding key to obtain the reconstructed original plaintext video stream.
2. The IP protocol-based video stream imperceptible encryption and decryption method as claimed in claim 1, characterized in that: The data packet is transmitted using the UDP protocol, and forward error correction coding is introduced into the data packet, and the transmitted data packet is reassembled, including: Determine the size of the data packet according to the network bandwidth, split the plaintext data stream according to the set data packet size, add header information to the data packet, and introduce forward error correction coding to add redundant information that can be self-repaired when errors occur during transmission and there is no retransmission request; The generated data packets are transmitted through the UDP protocol, and the UDP socket is used to transmit the data packets. The transmitted data packets are reassembled according to the sequence and timestamp. During the reassembly process, each data packet is verified to obtain the original plaintext video stream.
3. The IP-based video stream imperceptible encryption and decryption method as claimed in claim 2, characterized in that: The network traffic features are extracted from the plaintext data stream, and the network traffic features obtained include: Monitor the usage of network bandwidth, determine the available bandwidth of the network, determine the scope and accuracy of the network traffic features to be extracted based on the available bandwidth, analyze network environmental factors, and obtain the influencing factors of network traffic features; Extract features from the plaintext video stream according to the determined network traffic features to obtain network traffic features, quantify the network traffic features, and convert the network traffic features into numerical data that can be processed by the algorithm; Analyze the statistical characteristics of numerical data and embed the statistical characteristics into the original plaintext video stream during the encryption process.
4. The IP-based video stream imperceptible encryption and decryption method as claimed in claim 3, characterized in that: The network traffic characteristics are load optimized to obtain the first network traffic characteristics including: Traverse each network traffic feature, compress each network traffic feature using a data compression algorithm to obtain a compressed byte sequence, and add all compressed byte sequences to a compression value list; Set an empty byte sequence as the first compressed value, traverse each compressed value in the compressed value list, if the previous compressed value is empty, directly use the current compressed value as the differential value, if the previous compressed value is not empty, calculate the difference between the current compressed value and the previous compressed value, add the differential value to the differential value list, and update the previous compressed value as the current compressed value; Traverse each differential value in the differential value list, convert the differential value into binary form, remove leading zeros from the binary form, compress the binary data using variable-length encoding to obtain optimized binary data, concatenate the optimized binary into a byte sequence, and use the byte sequence as the optimized payload.
5. The IP-based video stream imperceptible encryption and decryption method as claimed in claim 4, characterized in that: Encrypting the first network traffic feature using an encryption algorithm includes: Encrypting the first network traffic feature by using the ChaCha20-Poly1305 algorithm, converting the first network traffic feature into an internal state matrix, performing a ChaCha transformation on the internal state matrix to generate a pseudo-random number stream, performing an XOR operation on the pseudo-random number stream and the plaintext data stream to obtain encrypted data; The Poly1305 algorithm is used to calculate the authentication tag on the ciphertext, and the authentication tag is appended to the end of the encrypted data, and the encrypted data and the authentication tag are output.
6. The IP-based video stream imperceptible encryption and decryption method according to any one of claims 2 to 5, characterized in that: Also includes: Different data packets are classified into different levels according to the type of data packet and the size of the data packet timestamp; Set the type of data packet: 0x01 is a high-level data packet, 0x02 is a medium-level data packet, and 0x03 is a low-level data packet; If the judgment is 0x01, it is directly classified as high level; If the judgment is 0x02 / 0x03, further judge the timestamp of the data packet. If the timestamp is less than the first threshold, it is classified as a high level; if the timestamp is greater than or equal to the first threshold and less than the second threshold, it is classified as a medium level; if the timestamp is greater than or equal to the second threshold, it is classified as a low level; Develop corresponding encryption strategies for data packets of different levels and dynamically adjust encryption strategies.
7. The IP-based video stream imperceptible encryption and decryption method as claimed in claim 6, characterized in that: Decrypting the encrypted data packet using the corresponding key includes: Use the Poly1305 message authentication code algorithm to verify the encrypted data packet, use the same key to calculate the authentication tag value, and compare it with the second authentication tag. If the recalculated authentication tag is consistent with the second authentication tag, decryption is performed. If they are inconsistent, decryption is stopped and the error mechanism is used to request reconstruction of the lost data. After the authentication tag is verified, the data is decrypted using the ChaCha20 stream cipher algorithm, a pseudo-random number stream is generated using the key, and the pseudo-random number stream is XORed with the encrypted data to obtain the decrypted data.
8. A system for video stream imperceptible encryption and decryption method based on IP protocol, characterized in that: include: A reassembly module is used to obtain a plaintext data stream, split the plaintext data stream into data packets, transmit the data packets using the UDP protocol, introduce forward error correction coding into the data packets, reassemble the transmitted data packets, and generate an original plaintext video stream; An encryption module is used to extract network traffic features from the plaintext data stream to obtain network traffic features, perform load optimization on the network traffic features to obtain a first network traffic feature, encrypt the first network traffic feature using an encryption algorithm, attach an authentication tag to the end of the encrypted first network traffic feature to obtain a second authentication tag, and embed the encrypted first network traffic feature into a data packet of an original plaintext video stream to obtain an encrypted data packet; The decryption module is used to recalculate the authentication tag and compare it with the second authentication tag, and use the corresponding key to decrypt the encrypted data packet to obtain the reorganized original plaintext video stream.
9. An electronic device, characterized in that: The device comprises: processor; a memory for storing processor-executable instructions; The processor is configured to call the instructions stored in the memory to execute the method according to any one of claims 1 to 7.
10. A computer-readable storage medium having computer program instructions stored thereon, characterized in that: When the computer program instructions are executed by a processor, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Cited By
Concealed communication path construction method and system based on distributed model optimization path
CN120546991A
Covert communication path construction method and system based on distributed model optimization path
CN120546991B
Video stream coding and decoding method and system based on Morse coding encryption
CN121842427A
