Safety encryption storage and breakpoint resume method and system of head-mounted law enforcement recorder
Patent Information
- Application Number
- CN202611257517.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-19
- Publication Date
- 2026-09-22
AI Technical Summary
[0004]然而,上述中的相关技术中断点定位仅依赖本地时间戳,无法验证已传数据的完整性与真实性;发送端与接收端状态不一致,易导致“已发未收”的数据丢失;加密与断点续传相互独立,缺乏可独立校验的数据单元及加密上下文恢复机制;无数据块间关联校验,无法防御篡改、重排等攻击;恢复传输时缺乏自适应调整能力,弱网下易再次失败
1.本发明通过提取设备身份信息与任务时间信息生成会话标识,并结合设备侧密钥材料执行密钥派生,构建了基于动态会话的独立加密机制。这种机制使得每次记录任务均采用独立的会话密钥与认证信息,减少了固定密钥带来的安全隐患,增强了执法记录数据在网络传输与本地存储过程中的机密性与防篡改能力。
Smart Images

Figure CN122802153A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of digital information transmission and network communication security technology, and in particular to a secure encrypted storage and breakpoint resume method and system for head-mounted law enforcement recorders. Background Technology
[0002] Currently, head-mounted law enforcement recorders are widely used in various duty scenarios as core equipment for mobile law enforcement and on-site evidence collection. Their main function is to collect audio and video media data streams from the scene in real time and transmit them to a remote command center. In the field of digital information transmission, these devices need to ensure the secure transmission and complete recording of media data in complex network environments to prevent sensitive information from being eavesdropped on or tampered with in the communication link.
[0003] In related technologies, Chinese invention patent CN117527793B discloses a method, apparatus, terminal, and medium for resuming interrupted data transmission based on the bandwidth of an encryption protocol. The method includes: acquiring the transmission status of the data transmission process; recording abnormal time information when the transmission status is abnormal, the abnormal time information reflecting the time when the abnormal status occurred; determining, based on the abnormal time information, the first data transmitted before the abnormal time information, and determining the missing data based on the transmitted first data, wherein the missing data is data that was not fully transmitted; and controlling the data transmission process to continue transmitting the missing data when the transmission status is normal.
[0004] However, the aforementioned technologies rely solely on local timestamps for interruption point location, making it impossible to verify the integrity and authenticity of transmitted data; inconsistencies between the sending and receiving ends can easily lead to the loss of "sent but not received" data; encryption and interruption resumption are independent of each other, lacking independently verifiable data units and encryption context recovery mechanisms; there is no data block correlation verification, making it impossible to defend against attacks such as tampering and rearrangement; and there is a lack of adaptive adjustment capabilities when resuming transmission, making it prone to failure again under weak network conditions. Summary of the Invention
[0005] To address the aforementioned issues, this invention provides a secure encrypted storage and breakpoint resume method and system for head-mounted law enforcement recorders. It employs a dynamic session key derivation and authenticated media segmentation encryption mechanism, combined with chain-based verification sequence and state difference comparison technology, enabling tamper-proof transmission and precise breakpoint resume of digital information in complex network environments.
[0006] The above objectives can be achieved through the following approach: A secure encrypted storage and breakpoint resume method for wearable law enforcement recorders includes: acquiring the start event of a recording task and extracting device identity information and task time information to generate a session identifier; acquiring device-side key materials and verifying their availability, performing key derivation based on the session identifier to generate a session key, initialization information, and authentication information, forming session encryption parameters; acquiring media data streams, detecting keyframes and timestamps for segmentation, writing segment numbers and boundary markers for each segment, and organizing them sequentially according to the session identifier to generate a media segment sequence; performing authenticated encryption processing based on the media segment sequence and the session encryption parameters to generate encrypted segments and authentication information, encapsulating them into an encrypted segment sequence; and based on... The encrypted segment sequence performs verification calculations and preorder association processing on each encrypted segment to generate chained verification values and bind them to segment numbers, forming a chained verification sequence. Based on the chained verification sequence, segment numbers and corresponding chained verification values are extracted, a segment status digest is generated, and written to the local storage medium. The segment status digest is obtained, and a status query request is sent to the receiving end to obtain a received status digest. A consistency comparison is performed between the segment status digest and the received status digest to generate a status difference. Based on the status difference, a set of encrypted segments to be sent is selected, and segments are sent. Receipts are received, and the consistency of the chained verification values is verified. The segment status digest is updated, and breakpoint resumption is performed.
[0007] Optionally, generating a session identifier includes: acquiring device identity information and task time information and performing normalization processing to generate session input information; generating a session fingerprint based on the session input information and performing irreversible mapping processing; and generating a session identifier based on the session fingerprint through encoding and encapsulation.
[0008] Optionally, the process of forming session encryption parameters includes: obtaining device-side key materials and performing key availability verification to generate a key validity marker; performing key derivation processing based on the key validity marker and the session identifier to generate a session key; and performing key derivation and parameter separation based on the session key to generate initialization information and authentication information required for segmented encryption, thereby obtaining session encryption parameters.
[0009] Optionally, generating the media segment sequence includes: acquiring media data stream and detecting keyframe information and timestamp information to generate segmentation reference information; performing segmentation processing based on the segmentation reference information to generate media segments; and writing the media segments into segment numbers and segment boundary markers to generate a media segment sequence.
[0010] Optionally, the encapsulation into an encrypted segment sequence includes: generating a segment random factor for each media segment based on the media segment sequence and the session encryption parameters to obtain segment encryption input; performing authenticated encryption processing based on the segment encryption input to generate encrypted segments and segment authentication information; and encapsulating segment metadata based on the encrypted segments and the segment authentication information to encapsulate into an encrypted segment sequence.
[0011] Optionally, forming a chain verification sequence includes: obtaining an encrypted fragment sequence and performing a digest calculation on each encrypted fragment to generate a fragment verification value sequence; obtaining the current fragment verification value and the previous chain verification value, and combining them with the fragment verification value sequence to generate a chain verification value; and binding the chain verification value with the corresponding fragment number to form a chain verification sequence.
[0012] Optionally, generating a fragment state summary and writing it to a local storage medium includes: obtaining a chained check sequence, extracting the last consecutive fragment number and its corresponding chained check value, as well as the corresponding chained check values of adjacent non-consecutive fragment numbers, performing a bitwise XOR fusion of the two to obtain a state compression certificate; and writing the state compression certificate, the last consecutive fragment number, and the corresponding chained check value together into two different physical areas of the local storage medium to generate a fragment state summary.
[0013] Optionally, generating the state difference includes: extracting the sequence number of the confirmed segment and the chain check value of the receiving end based on the received state digest to generate a receiving end state vector; extracting the sequence number of the locally completed segment and the local chain check value based on the segment state digest to generate a local state vector; and performing a consistency determination based on the receiving end state vector and the local state vector to generate a state difference.
[0014] Optionally, receiving segment receipts and updating the segment status digest includes: performing difference comparison and segment filtering based on the status differences to generate a segment index to be sent; reading the encrypted segment set based on the segment index to be sent to generate a sending queue; obtaining link status information and adjusting the sending window in conjunction with the sending queue to generate a windowed sending queue and sending encrypted segments according to segment sequence numbers; receiving segment receipts to generate a receipt sequence; generating a receipt confirmation result based on the receipt sequence and verifying the consistency of the chain checksums corresponding to the receipts; and generating an updated segment status digest based on the receipt confirmation result and only advancing the segment status digest for successfully confirmed segments.
[0015] Based on the same inventive concept, this invention also provides a secure encrypted storage and breakpoint resume system for a head-mounted law enforcement recorder. The system includes: a startup extraction module, used to acquire the startup event of a recording task and extract device identity information and task time information, generating a session identifier; a key derivation module, used to acquire device-side key materials and verify their availability, perform key derivation in conjunction with the session identifier, generate a session key and initialization and authentication information, forming session encryption parameters; a segmentation module, used to acquire media data streams, detect keyframes and timestamps for segmentation, write segment numbers and boundary markers to each segment, and organize them sequentially according to the session identifier to generate a media segment sequence; and an encryption encapsulation module, used to perform authenticated encryption processing based on the media segment sequence and the session encryption parameters, generating encrypted segments and authentication information. The system is encapsulated into an encrypted fragment sequence; a chain verification module is used to perform verification calculations and preorder association processing on each encrypted fragment based on the encrypted fragment sequence, generate chain verification values and bind fragment sequence numbers to form a chain verification sequence; a status digest module is used to extract fragment sequence numbers and corresponding chain verification values based on the chain verification sequence, generate fragment status digests and write them to local storage media; a difference comparison module is used to obtain the fragment status digests and send a status query request to the receiving end to obtain a received status digest, perform a consistency comparison based on the fragment status digests and the received status digests, and generate status differences; a breakpoint resume module is used to select a set of encrypted fragments to be sent based on the status differences, send them in segments, receive receipts and verify the consistency of the chain verification values, update the fragment status digests, and perform breakpoint resume.
[0016] Compared with the prior art, the present invention has the following advantages: 1. This invention generates a session identifier by extracting device identity information and task time information, and performs key derivation by combining the device-side key material, thus constructing an independent encryption mechanism based on dynamic sessions. This mechanism ensures that each recording task uses an independent session key and authentication information, reducing the security risks associated with fixed keys and enhancing the confidentiality and tamper-proof capability of law enforcement record data during network transmission and local storage.
[0017] 2. This invention employs a chained verification sequence to perform pre-sequence correlation processing on encrypted segments, combining the verification value of the current segment with the cumulative features of the preceding sequence. This processing method establishes a strict mathematical dependency between discrete data segments, ensuring that any tampering, forgery, or deletion of intermediate data blocks will disrupt the verification consistency of subsequent segments, thereby guaranteeing the overall integrity of continuous media data streams during digital information transmission.
[0018] 3. This invention utilizes fragment state digests to record the data processing progress at both the local and receiving ends, and accurately locates missing data fragments through state difference comparison. By dynamically adjusting the transmission window in conjunction with link state information, it can adaptively perform data retransmission and breakpoint resumption in weak network environments, reducing the repeated transmission of entire data segments and improving the transmission efficiency and reliability of digital information in complex network environments.
[0019] Other features and advantages of the invention will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the invention. The objects and other advantages of the invention may be realized and obtained by means of the structures pointed out in the description, claims and drawings. Attached Figure Description
[0020] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0021] Figure 1 This is a flowchart illustrating the secure encrypted storage and breakpoint resume method for a head-mounted law enforcement recorder according to an embodiment of the present invention.
[0022] Figure 2 This is a comparison diagram of the plaintext and ciphertext lengths in an embodiment of the present invention.
[0023] Figure 3 This is a schematic diagram of adaptive transmission window adjustment based on link state according to an embodiment of the present invention.
[0024] Figure 4 This is a schematic diagram of the secure encrypted storage and breakpoint resume system of the head-mounted law enforcement recorder according to an embodiment of the present invention. Detailed Implementation
[0025] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0026] Reference Figure 1One embodiment of the present invention proposes a secure encrypted storage and breakpoint resume method for head-mounted law enforcement recorders. It adopts a dynamic session key derivation and authenticated media segmentation encryption mechanism, combined with chain-based verification sequence and state difference comparison technology, which can realize tamper-proof transmission of digital information and accurate breakpoint resume in complex network environments.
[0027] The method described in this embodiment specifically includes: Obtain the start event of the recording task and extract the device identity information and task time information to generate a session identifier; Optionally, the generated session identifier includes: Obtain device identity information and task time information, perform normalization processing, and generate session input information; Based on the session input information and performing irreversible mapping processing, a session fingerprint is generated; The session fingerprint is encoded and encapsulated to generate a session identifier.
[0028] Specifically, in response to the task initiation event, the device identity information is read from the device's built-in security element, and the task time information corresponding to the instant the initiation event occurs is obtained. Device identity information is a unique identifier sequence injected into the device at the factory, composed of the manufacturer code, product model code, and unique serial number. It typically exists as a binary byte array in the hardware security area, and its original length fluctuates between 12 and 20 bytes depending on the production batch. Task time information is a time value recording the task initiation moment, using a 64-bit unsigned integer, directly read from the register of the real-time clock chip. The obtained device identity information and task time information are sent to the normalization processing stage, where the binary length of the device identity information is adjusted to 16 bytes. The specific adjustment rule is based on the statistical distribution of device identity information lengths collected by 200 sets of industrial sensors. The statistics show that the length of all samples falls within the range of 12 to 20 bytes. Using 16 bytes as a uniform length can completely preserve the main identifier content and avoid excessive redundancy. During processing, if the original device identity information is less than 16 bytes, a byte with the value 0x00 is appended to the end of the byte sequence until the total length is 16 bytes; if the original device identity information is more than 16 bytes, the first 16 bytes starting from the low address are retained, and the excess bytes are discarded. The normalized 16-byte device identity information sequence is concatenated with the 8-byte task time information sequence in chronological order, and the concatenation result forms a fixed-length binary sequence of 24 bytes, which is defined as the session input information. The session input information generated after normalization is... ,have: ; in, This represents the raw byte sequence of device identity information read from the secure element; The length normalization function splits the 64-bit unsigned integer value of the task time information into 8 independent bytes according to big-endian byte order, with the most significant byte placed at the beginning of the sequence and the least significant byte placed at the end of the sequence; Output 16 bytes of normalized device identity information; A 64-bit unsigned integer value representing task time information, in seconds; Output an 8-byte big-endian time byte sequence; symbol This represents the sequential concatenation operation of byte sequences. The normalization function internally relies on... The actual length Make a judgment: If ,but ;like ,but Cut The first 16 bytes. Indicates continuity The sequence contains 24 bytes with a value of zero. An irreversible mapping is then performed on this 24-byte sequence. This irreversible mapping utilizes a cryptographic one-way hash function, which compresses input data of arbitrary length into a fixed-length output digest. Furthermore, it is computationally infeasible to deduce the input value from the output value; the output hash value is the session fingerprint. The process for calculating this session fingerprint is as follows: ,have: ; in, The SM3 cryptographic hash algorithm is used. After generating the session fingerprint, the process enters the encoding and encapsulation stage. Encapsulation converts the binary form of the session fingerprint into a printable string suitable for use in logs, network headers, or stored identifiers, and appends a fixed prefix to its header to indicate its intended use. The prefix is defined as the three-character letter sequence "SID" followed by a hyphen "-". The binary-to-string conversion uses Base16 encoding, splitting each byte of the session fingerprint into high 4 bits and low 4 bits, mapping them to the corresponding symbols in the characters '0'-'9' and 'A'-'F' respectively. The high-order mapped characters come first, followed by the low-order mapped characters, resulting in 64 hexadecimal characters across 32 bytes. The encoded result is the final session identifier. For this session identifier... ,have: ; For example, when a recording task is initiated, the device identity information is read from the secure element. The byte sequence is 0x4D, 0x53, 0x4E, 0x30, 0x30, 0x31, and its length is... This indicates the model number MSN001. After processing with a length normalization function, 10 0x00 bytes are appended to the end, resulting in a 16-byte normalized sequence: 0x4D534E303031000000000000000000. If the task time information obtained from the real-time clock is 1672531200, this integer value is processed... Serialized to 8 bytes big-endian 0x00, 0x00, 0x00, 0x00, 0x63, 0xB0, 0x2D, 0x00. This forms the session input information. It is 24 bytes: 0x4D534E3030310000000000000000000000000063B02D00. The SM3 hash function is used to calculate the 32-byte session fingerprint. Finally, after encoding and encapsulation, the Base16 encoded result of the session fingerprint is "8A2E1F9CD37B44A506F081E65C1AD2973B6F4E882C091DA375E49B00FC317A5D", which, combined with the prefix, generates the session identifier. For "SID-8A2E1F9CD37B44A506F08" 1E65C1AD2973B6F4E882C091DA375E49B00FC317A5D". This session identifier is uniquely determined within the lifecycle of a single recording task.
[0029] Obtain the device-side key material and verify its availability. Combine the session identifier to perform key derivation, generate the session key, initialization information and authentication information, and form the session encryption parameters. Optionally, the session encryption parameters include: Obtain the device-side key materials and perform key availability verification to generate a key validity marker; Based on the key validity marker and the session identifier, perform key derivation processing to generate a session key; Based on the session key, key derivation and parameter separation are performed to generate the initialization information and authentication information required for segmented encryption, thus obtaining the session encryption parameters.
[0030] Specifically, during the factory initialization phase, the device writes the key seed and integrity check value together into the secure storage area, forming the device-side key material. The device-side key material is a binary data structure occupying 48 bytes of contiguous storage space. The first 32 bytes are the key seed, and the last 16 bytes are the integrity check code obtained by hashing the key seed using SM3. When retrieving the device-side key material, 48 bytes of data are read continuously from a fixed address in the secure storage area. The read byte stream is then parsed sequentially into two parts: the first 32 bytes are recorded as a temporary key seed, and the last 16 bytes are recorded as a temporary check code. Next, a key availability check is performed to obtain a key validity flag. The key validity flag is an unsigned integer, taking only the value 1 or 0, used to determine whether the subsequent key derivation process is allowed to continue. This key validity flag... ,have: ; in, This indicates the first 32 bytes of temporary key seed read from the secure storage area; This indicates the last 16 bytes of temporary checksum that have been read. It is a hash value of 32 bytes in length; This represents a 16-byte truncation operation starting from the high-order bits; symbol This indicates a byte-level complete equivalence comparison. After completing the key availability verification and obtaining the key validity flag, it checks if the key validity flag is 1. If it is 0, subsequent steps are stopped and a key invalidity alarm is issued; if it is 1, key derivation processing is initiated. Key derivation processing extracts the session fingerprint from the session identifier. The prefix character "SID-" is removed from this string, and the remaining 64 characters, forming a hexadecimal string, are Base16 decoded to obtain a 32-byte binary sequence. This sequence is the session fingerprint corresponding to this session. Using this session fingerprint and the verified key seed as input, key derivation processing uses a single-step key derivation function based on SM3 to generate a unique session key. The specific execution process of the single-step key derivation function is as follows: a concatenated message is constructed, concatenating the 32 bytes of the key seed, a single-byte counter with a value of 0x01, and the 32 bytes of the session fingerprint in that order. This concatenation forms a data block of 65 bytes in total length. This data block is then fed into the SM3 hash function to obtain a 32-byte hash value, which is the session key. The generated session key is then calculated. ,have: ; in, This refers to the temporary key seed that has passed the integrity verification. This is a single byte with a fixed value of 1, used to distinguish different derivation purposes. After the session key is generated, the next stage is key derivation and parameter separation. The purpose of this stage is to extract the encryption key, authentication key, and initialization vector base value used for segmented encryption from the session key. The parameter separation process yields a 16-byte encryption key. Authentication key with a length of 16 bytes Initialization information with a length of 12 bytes ,have: ; These three parameters, together with the session key, constitute the session encryption parameters used for segmented encryption and authentication of the media stream in this recording task. The session encryption parameters are temporarily stored in memory in the form of structured data.
[0031] For example, continuing with the session identifier example above, the session identifier is obtained, decoded, and after removing the prefix, the hexadecimal string "8A2E1F9CD37B44A506F081E65C1AD2973B6F4E882C091DA375E49B00FC317A5D" is obtained. After Base16 decoding, the 32-byte session fingerprint is recovered. The key seed, originally written to the device-side key material, is stored in the secure storage area inside the device. It is fixed at 32 bytes, all 0x01 values, i.e., 0x010101...01. Its corresponding integrity check code is calculated at the factory and is used for... The result of performing an SM3 hash and truncating the first 16 bytes is 0x7D, 0x9A, 0x3E, 0xB1, 0x5C, 0x8F, 0x22, 0x64, 0x1D, 0x07, 0xA2, 0xF9, 0x4B, 0xC4, 0x6D, 0x8E. This is the temporary key seed used when reading device-side key materials. With temporary check code All are the same as this fixed value, resulting in Established, therefore Assign a value of 1. Perform key derivation processing and concatenate the keys. 0x01, in the example The session key is derived from SM3. Then, parameter separation is performed. The encryption key is calculated according to the formula. Concatenating 0x02, Ksess, and Hsess, and hashing them using SM3, then taking the first 16 bytes, yields 0xA30x710x0F0xE80x5C0x290x4D0xB60x110x900x7F0x260x3A0xE50xD10x48. Similarly, using the 0x03 distinguisher, the authentication key yields 0xF00x2B0x6D0x190x8E0x440x570xA30x0C0x120x970xE40x5F0x8B0x360x1D. Initialization information. Using the 0x04 distinguisher, the first 12 bytes are taken to obtain 0x8C0x3D0x510xAE0x740xBF0x290x080x6E0x1F0xD20x43. The above encryption key, authentication key, and initialization information constitute the session encryption parameters.
[0032] The media data stream is acquired, keyframes and timestamps are detected and segmented, segment number and boundary marker are written for each segment, and the segments are organized in order according to the session identifier to generate a media segment sequence. Optionally, the generated media segment sequence includes: Acquire media data streams and detect keyframe and timestamp information to generate segmentation reference information; Based on the segmentation reference information, segmentation processing is performed to generate media segments; The media segments are written with segment numbers and segment boundary markers to generate a media segment sequence.
[0033] Specifically, after establishing the session and preparing encryption parameters, the device reads the real-time generated media data stream from the audio input interface. The media data stream is a continuous sequence of binary bytes, carrying encoded video frames or audio sample blocks arranged in chronological order. Each frame or sample block is timestamped by the hardware at the moment of acquisition. An internal stream parser is activated, scanning byte by byte along the media data stream's path. By recognizing the syntax elements specified by the encoding format, it extracts keyframe information and timestamp information. In H.264 encoded video streams, keyframes refer to real-time decoded refresh frames. These frames contain complete image data and do not rely on previous frames during decoding. They are identified in the bitstream as slices with a network abstraction layer unit type value of 5. Keyframe information is the set of all real-time decoded refresh frames detected in the bitstream. Each record contains the frame's starting byte offset in the stream and a display timestamp value obtained from the timestamp information, represented as an unsigned integer in milliseconds. Timestamp information refers to the display timestamp value carried by each frame in the media data stream. It can be obtained by parsing supplementary enhancement information, packet transmission timestamp fields, or container layer timestamps, and its unit is also milliseconds. Keyframe information extraction and timestamp information extraction are performed simultaneously. The parser organizes the offsets and timestamps corresponding to the keyframes into an ordered list, which serves as the data basis for the segmentation reference information. After obtaining the ordered list of keyframe offsets and timestamps, a fixed time window strategy is used to generate segmentation reference information. Segmentation reference information is a sequence of segmentation points, each indicating the starting boundary position of a media segment in the media data stream. The process of generating segmentation reference information follows a point-by-point progression rule: the offset of the first keyframe in the list is taken as the first segmentation point, and the timestamp of that frame is recorded as the current segmentation timing start point; subsequently, each subsequent keyframe is traversed sequentially. Whenever the difference between the timestamp of a traversed keyframe and the timestamp of the current segmentation timing start point reaches or exceeds a preset segmentation duration threshold, such as 2000 milliseconds, the offset of that keyframe is established as the next segmentation point, and the current segmentation timing start point is updated with the timestamp of that keyframe. After the traversal is completed, the last offset of the media data stream is appended as the last item in the segmentation point sequence, forming a complete segmentation point sequence, which is the segmentation reference information. For the first keyframe in the media data stream... Offset of each split point ,have: ; in, This represents the starting byte offset of the k-th keyframe in the media data stream. This indicates the timestamp of the keyframe's display, in milliseconds. The timestamp value represents the starting point of the current segment timing. The initial value is the timestamp of the first keyframe, and it is updated to the timestamp of the keyframe that triggered the segment after each segmentation. The preset segmentation duration threshold is in milliseconds. Segmentation point sequence. And let Always the offset of the first keyframe. The position, marked by adding 1 to the end offset of the media data stream, is used to mark the end boundary of the last segment. During segmentation based on segmentation reference information, the media data stream is segmented according to adjacent offsets in the segmentation point sequence. For the i-th segment, starting from the offset... Start reading, up to offset The end, the consecutive block of bytes read is the media segment. The segmentation operation will produce n media segments, denoted as ns. They are arranged naturally according to the segmentation order. Next, a segment number is assigned to each media segment and segment boundary markers are written. Segment boundary markers are two predefined sets of fixed byte sequences used to display the header and tail of the segment during storage or transmission. The start boundary marker is a 4-byte sequence 0x4D534547, which corresponds to the hexadecimal expression of the ASCII string "MSEG", and the end boundary marker is a 4-byte sequence 0x454F5345, which corresponds to the ASCII string "EOSE". The selection of these two sets of data has undergone 10,000 sets of random data block misidentification tests, and no positive mismatches have occurred. The start boundary markers, segment numbers, segment payload lengths, and original media segment data are concatenated in sequence, and the end boundary marker is appended to the end of the data to form the media segment structure with boundary markers. The process of forming the media segment sequence is to store all the structured media segments in ascending order of their sequence numbers into a linear container. In addition to containing an ordered set of segments, the container also has a session identifier field written at the beginning. The content of the session identifier field is directly copied from the aforementioned session identifier string. In this way, the media segment sequence contains complete information about the session binding.
[0034] For example, continuing the session identifier "SID-8A2E1F9CD37B44A506F081E6" established above. The video stream "5C1AD2973B6F4E882C091DA375E49B00FC317A5D" was recorded during a task where the device's camera output an H.264 encoded video stream. The stream parser detected that the first frame was an instant-decoded refresh frame with a starting offset of 0 and a display timestamp of 0 milliseconds. Offset 0 was used as the split point. , The scan continued, and the next instant-decoded refresh frame was identified at offset 12840 bytes, with a display timestamp of 2150 milliseconds. Because... The segmentation condition is met, therefore... Established as 12840, and updated. Subsequently, at offset 24820 bytes, another real-time decoded refresh frame is encountered, with a timestamp of 4160 milliseconds, satisfying the condition. ,establish Update the timing start point. The stream end offset is 36100, therefore append... The segmentation reference information segmentation point sequence is now complete. Perform segmentation processing on media clips. Composed of bytes from offset 0 to 12839, length byte; Composed of offsets from 12840 to 24819, with a length of byte; Composed of offsets from 24820 to 36099, with a length of Bytes. Allocate segment number 0, write start marker 0x4D534547, 4-byte encoding of segment number 0 (0x00000000), 4-byte encoding of length 12840 (0x00003228), and raw data. End marker 0x454F5345, resulting in a structured fragment. Similarly, Sequence number 1, length 11980 corresponds to 0x00002ECC, thus... ; Sequence number 2, length 11280 corresponds to 0x00002C10, thus... The obtained session identifier string is placed at the beginning of the sequence, and then concatenated sequentially to generate a media segment sequence. The size of this sequence is the sum of the 68-byte session identifier string and the three structured segments.
[0035] Based on the media segment sequence and the session encryption parameters, perform authenticated encryption processing to generate encrypted segments and authentication information, and encapsulate them into an encrypted segment sequence; Optionally, the encapsulation into an encrypted fragment sequence includes: Based on the media segment sequence and the session encryption parameters, a segment random factor is generated for each media segment to obtain the segment encryption input; Based on the encrypted input of the fragment, perform encrypted processing with authentication to generate encrypted fragments and fragment authentication information; Based on the encrypted fragment and the fragment authentication information, the fragment metadata is encapsulated into an encrypted fragment sequence.
[0036] Specifically, the media segment sequence is first parsed. The start of the data area is determined by locating the end of the session identifier field. Then, a loop scan is performed, using the start boundary marker 0x4D534547 and the end boundary marker 0x454F5345 to locate each complete structured media segment. For each located segment, its segment number and original media segment payload are extracted. The segment number is obtained by parsing bytes 5 to 8 of the structured segment header in big-endian order, and the payload length is obtained by parsing bytes 9 to 12. The original media segment payload is then truncated from subsequent bytes based on this length. For each media segment, a unique segment random factor is generated. The segment random factor for the i-th segment is... ,have: ; in, A function to encode segment number i into a 4-byte binary sequence in big-endian byte order; This involves a bitwise XOR operation on two equal-length byte sequences. The fragment random factor is then combined with the fragment number and the original media fragment payload to form the fragment encryption input. This input is a triplet structure containing a random initialization factor, a fragment identifier, and the plaintext data to be encrypted. Next, authenticated encryption is performed based on this input. Authenticated encryption combines encryption and message integrity verification into a single cryptographic operation, generating ciphertext and a tamper-proof authentication token. The cryptographic operation uses the national commercial cryptographic algorithm SM4 operating in Galois counter mode, constructed as an authenticated encryption scheme with associated data. During encryption, the encryption key is taken from the session encryption parameters and is 16 bytes long. The initialization vector is directly provided by the fragment random factor and is 12 bytes long. The plaintext input for the encryption process is the original media fragment payload. Additionally, associated data is required; this data is unencrypted but needs to participate in authentication and integrity protection. Here, the big-endian 4-byte encoding of the fragment number i is used as the unique associated data. After the encryption operation is performed, two parts are output: the first part is the ciphertext of the same length as the plaintext, and the second part is a 16-byte authentication token. The ciphertext has the same number of bytes as the original media segment's payload. For the ciphertext of segment i... With certification mark ,have: ; in, For the key Initialization vector Plain text and related data The input SM4 Galois Counter mode authentication encryption function is used. After obtaining the encrypted fragment and fragment authentication information, the encapsulation stage begins. The encapsulated objects include the encrypted fragment ciphertext and fragment authentication information. Additional fragment metadata includes the fragment sequence number, ciphertext length, fragment random factor, and encryption algorithm identifier. The fragment metadata is organized in a fixed format, with the fields arranged sequentially: a start marker (multiplexed media fragment start boundary marker 0x4D534547), followed by a 2-byte encryption algorithm identifier (fixedly 0x0102 indicating SM4-GCM mode), then 4 bytes of big-endian encoding for the fragment sequence number i, 4 bytes of big-endian encoding for the ciphertext length, 12 bytes of fragment random factor, 16 bytes of fragment authentication information, followed by the ciphertext payload, and finally ending with a fragment-specific end marker 0x43455345, i.e., the ASCII string "CESE", resulting in the encapsulated encrypted fragment. All encrypted fragments are then encapsulated. Segment sequences are arranged in ascending order by segment number, with a session identifier field added at the beginning to form an encrypted segment sequence. For example... Figure 2 As shown in the figure, the data states of five media segments, namely segments 0 to 4, are compared in the form of a three-dimensional bar chart before and after encryption.
[0037] For example, the media clip sequence contains 3 media clips. , , The session identifier, encryption key, and initialization information remain the same as described above. Now we process the first media segment, segment number i=0, whose original media segment payload... length Byte. Calculate the fragment random factor. First, concatenate the session identifier with the 4-byte big-endian encoding of fragment sequence number 0 (0x00000000), resulting in a 16-byte sequence 0x8C3D51AE74BF29086E1FD24300000000. Perform an SM3 hash on this sequence, yielding a 32-byte output. Take the first 12 bytes, denoted as 0xA10xB20xC30xD40xE50xF60x070x180x290x3A0x4B0x5C. XOR these 12 bytes bit by bit with the session identifier to obtain... The fragment encryption input is... ,0, Perform authenticated encryption to For key, For initializing vectors, Using plaintext and 0x00000000 as associated data, the SM4-GCM authentication encryption function is called to obtain the ciphertext. It is 12840 bytes, along with fragment authentication information. The result, consisting of 16 bytes, is 0xF10xE20xD30xC40xB50xA60x970x880x790x6A0x5B0x4C0x3D0x2E0x1F0x0E. This is used to encapsulate and encrypt a fragment. Repeat the same process for i=1 and i=2. Finally, use the session identifier as a prefix and concatenate them sequentially. , , This forms an encrypted fragment sequence.
[0038] Based on the encrypted segment sequence, each encrypted segment is subjected to verification calculation and preceding sequence association processing to generate a chain of verification values and bind them to the segment sequence number, thus forming a chain of verification sequences. Optionally, forming the chained verification sequence includes: Obtain the encrypted fragment sequence and perform digest calculation on each encrypted fragment to generate a fragment check value sequence; Obtain the current segment check value and the preceding chain check value, and combine them with the segment check value sequence to generate a chain check value; The chained check values are bound to the corresponding segment numbers to form a chained check sequence.
[0039] Specifically, when parsing the encrypted fragment sequence, the boundary of the session identifier is first located. The session identifier consists of a "SID-" prefix and 64 hexadecimal characters, with a fixed total length of 68 bytes. Based on this, the 68-byte offset can be skipped directly to find the starting position of the first encrypted fragment. Starting from this position, by identifying the common start marker 0x4D534547 and end marker 0x43455345 in the encrypted fragment sequence, each complete encrypted fragment is extracted cyclically, while retaining its fragment sequence number information. The fragment sequence number can be read from a fixed offset at the beginning of the encrypted fragment, that is, after skipping 2 bytes of encryption algorithm identifier after the start marker, the following 4 bytes of big-endian integer are read as the fragment sequence number. For each extracted encrypted fragment, a digest calculation is performed to generate a fixed-length checksum uniquely corresponding to it. For this i-th encrypted fragment, the fragment checksum is 32 bytes long. ,have: ; The fragment check value sequence is composed of , The sequence is formed, where the position of each element strictly corresponds to the segment number of the encrypted segment. After generating the segment checksum sequence, the chain-association calculation stage begins. This stage links the independent segment checksums into a tamper-proof logical chain. The chain-association calculation relies on combining the current segment checksum with a chain checksum from a previous segment. The result of the combination operation is used as the chain checksum of the current segment and passed forward. For the first encrypted segment, i.e., segment number i=0, there is no chain checksum for the previous segment. In this case, a predefined initial pre-order chain checksum needs to be introduced. The initial pre-order chain checksum is derived from the session identifier information carried in the header of the encrypted segment sequence. Specifically, the session identifier string is extracted, converted into a byte sequence using UTF-8 encoding, and fed into the SM3 hash function. The resulting 32-byte hash value is directly assigned to the initial pre-order chain checksum. ,have: ; in, Indicates the string The encoding is a UTF-8 byte stream. For fragment index i ≥ 0, the current fragment checksum and the preceding chain checksum are obtained. These are then concatenated byte-wise in order from the preceding to the current segment, forming a 64-byte data block. This block is then fed into the SM3 hash function for combination calculation, yielding a new 32-byte hash value, which is the chain checksum of the current fragment. The chain checksum of fragment index i... ,have: ; in, This represents the preceding chain check value, taken when i=0. Each time a chain check value is calculated, it is immediately bound to the corresponding segment number i, and the binding takes the form of a tuple. Arrange all the pairs in ascending order of their segment numbers; this list of ordered pairs constitutes a chained check sequence.
[0040] For example, based on the above example of encrypted fragment sequence, the session identifier remains "SID-8A2E1F9CD37B44A506F081E65C1AD2973B6F4E882C091DA375E49B00FC317A5D", and the encrypted fragment sequence contains 3 encrypted fragments. , , These correspond to segment numbers 0, 1, and 2, respectively. First, the session identifier string is encoded into a 68-byte array using UTF-8, then input into an SM3 hash, yielding a 32-byte result. Subsequently, the encrypted segments are... Perform a summary calculation, All bytes are sent to SM3 to obtain the fragment checksum. For example: 0x11... , Similarly, the calculations yielded the following results: , The sequence of fragment check values is... Calculate the chain checksum: For , ,Will and After concatenating the 64 bytes, input them into SM3 to get ,for , ,get Similarly, we can obtain After binding, a chained verification sequence is formed: , , .
[0041] Extraction is performed based on the chained check sequence to obtain the fragment number and corresponding chained check value, and a fragment status summary is generated and written to the local storage medium. Optionally, generating a fragment state summary and writing it to a local storage medium includes: Obtain the chained verification sequence, extract the last consecutive segment number and its corresponding chained verification value, as well as the corresponding chained verification value of the adjacent non-consecutive segment number, and perform bitwise XOR fusion on the two to obtain the state compression certificate. The state compression certificate, the last consecutive segment number, and the corresponding chain check value are written together into two different physical areas of the local storage medium to generate a segment state summary.
[0042] Specifically, the process iterates through all tuples in the linked check sequence to identify consecutive segment number intervals. A consecutive segment number is a set of segment numbers starting from 0, incrementing sequentially without any missing numbers. Number 0 must exist, followed by number 1, and so on, until a number k exists but k+1 is not in the linked check sequence, or the linked check sequence has reached its end. Within this consecutive interval, the largest number is the last consecutive segment number, and the linked check value carried in the tuple corresponding to this number is the linked check value for the last consecutive segment, with a length of 32 bytes. Further checks are performed to see if there are any non-consecutive segment numbers adjacent to this consecutive interval in the linked check sequence. An adjacent non-consecutive segment number is defined as the smallest segment number immediately following the last consecutive segment number and adjacent to it in terms of number. If a tuple consisting of the sequence number of the adjacent non-contiguous segment and its corresponding checksum exists in the chain check sequence, the checksum within that tuple is extracted. If no entry with the sequence number of the adjacent non-contiguous segment exists in the chain check sequence, a substitute constant sequence of 32 bytes is constructed, with all bytes set to 0x00. This all-zero sequence is assigned the checksum corresponding to the aforementioned adjacent non-contiguous segment sequence number and participates in subsequent calculations. This logic ensures that the state compression operation can be performed normally regardless of whether there are breakpoints in the chain check sequence. Subsequently, the two 32-byte binary sequences are XORed bit-by-bit to obtain the state compression credential. The state compression credential compresses and merges the terminal state of a continuous segment and the adjacent state of a non-contiguous segment into a fixed-length token. Using this token and sequence number information, the continuity and breakpoint location of the transport stream can be quickly determined. The calculation of this state compression credential... ,have: ; in, This represents the chain check value corresponding to the last consecutive segment number; The status compression certificate is generated by chaining checksums or using a pre-defined zero-filling sequence for adjacent non-contiguous segment numbers. After generating the status compression certificate, the process proceeds to the local storage medium stage. The local storage medium refers to the onboard non-volatile memory of the device, such as NOR flash memory or solid-state memory chips, whose physical address space can be divided into several independent blocks. The local storage medium is divided into regions, identifying two physically non-adjacent storage regions, separated by at least one complete erase block. These two regions are designated as the first physical region and the second physical region, respectively. When writing the segment status digest to the local storage medium, the content includes three fields: the last consecutive segment number, the chained checksum corresponding to that number, and the status compression certificate. These three fields are sequentially concatenated into a 68-byte data block, which is the segment status digest. The segment status digest is used as a data unit, and identical copies are written to both the first and second physical regions. That is, each of the first and second physical regions stores an identical 68-byte segment status digest. The dual-region redundancy write strategy is set based on the statistical probability of single-region bit flipping during abnormal power loss in industrial-grade flash memory devices. The fragment state digest is written to memory locations in the first physical region with address ranges from 0x00000 to 0x00043 and the second physical region with address ranges from 0x10000 to 0x10043.
[0043] For example, based on the aforementioned session identifier, the encrypted fragment sequence contains three encrypted fragments, and a chained checksum sequence, traversing the chained checksum sequence, it is found that the sequence numbers 0, 1, and 2 appear sequentially and consecutively. Therefore, the last consecutive fragment sequence number is 2, corresponding to the chained checksum value. Check if an entry with index 3 exists in the chained check sequence. Since this entry does not exist, then... Retrieve a 32-byte all-zero value (0x00...00). Perform a bitwise XOR merge to compress the status credential. Directly equal to The sequence number 2 is encoded as 4 bytes 0x00000002, followed by 32 bytes. and 32 bytes A 68-byte fragment state digest is synthesized and written to both the first and second physical regions. Thereafter, the device can read the digest from either physical region whenever it needs to restore the transmission state.
[0044] Obtain the fragment status summary and send a status query request to the receiving end to obtain the received status summary. Based on the fragment status summary and the received status summary, perform a consistency comparison to generate a status difference. Optionally, the generated state differences include: Based on the received status summary, extract the sequence number of the confirmed segment from the receiver and the chain check value from the receiver to generate the receiver status vector. Based on the fragment state summary, extract the local completed fragment number and local chain check value to generate a local state vector; A consistency determination is performed based on the receiver state vector and the local state vector to generate a state difference.
[0045] Specifically, after encrypting and performing chained verification on the local media data, the device selects a readable area from either of the two physical regions of the local storage medium and reads the written fragment state digest. During parsing, the first 4 bytes are decoded into an unsigned integer in big-endian order to obtain the local completed fragment sequence number; the following 32 bytes are the bound local chained verification value; and the last 32 bytes are the state compression credential. This set of parsed data is organized into a tuple called the local state vector. ,have: ; in, The maximum sequence number of consecutive segments that have completed encryption and chain verification from the local perspective. This is the chain checksum of the sequence number. The device sends a status query request to the receiver via the established communication link. The status query request is a short control message, the body of which contains a session identifier string. Upon receiving the request, the receiver reads the receiver segment status digest for the corresponding session from its own non-volatile storage. The receiver encapsulates this into a status query response message and returns it to the sender along the original link. Upon receiving the response, the sender extracts the receiver status digest carried in the message payload. The parsing method for the receiver status digest is the same as that for the local segment status digest. The first 4 bytes are decoded into an unsigned integer, which serves as the sequence number of the received segment that has been acknowledged by the receiver, representing the largest sequence number of consecutive segments that the receiver has successfully received, decrypted, and verified through chain checksum. The following 32 bytes are the receiver chain checksum. After parsing, the receiver status vector is also constructed. ,have: ; in, The sequence number of the segment that has been confirmed by the receiving end; This is the receiver's chained checksum. After obtaining the receiver's state vector and the local state vector, a consistency check is immediately performed to generate a state difference. This state difference... ,have: ; in, An empty set means that the state difference is empty, which means that the progress of both parties is completely consistent and no further fragments need to be sent. This means that the progress claimed by the receiving end is ahead of the local record of the sending end, which is an abnormal state. This abnormality will trigger the device to report a state inconsistency alarm to the management module, and the device can choose to reset the receiving end state or suspend the transmission process. The state difference is finally output in the form of a set of fragment sequence numbers, which contains all the encrypted fragment sequence numbers that should be sent to the receiving end in ascending order.
[0046] For example, after obtaining the aforementioned session identifier and encrypted fragment sequence, the sender sends a status query request containing the session identifier to the receiver. Assuming the receiver has previously successfully received and verified fragments 0 and 1, and its internally calculated chained checksum sequence is completely identical to that of the sender, the received status digest maintained by the receiver will contain the session identifier. , Equal to the sender's chained check sequence The sending end parses the receiving end's state vector. Local state vector .because According to the consistency determination formula, state differences This indicates that only the encrypted fragment with sequence number 2 needs to be sent. Based on this, a generator containing only... The transmission queue is configured such that acknowledged segments 0 and 1 are omitted, thus enabling resume transmission from where it was interrupted. If the receiver returns a reception status digest... For some reason and Inconsistent, even At this point, state differences will still be generated. When the receiving end receives fragment 2, it will reject it because the chain check cannot be connected. The sending end can then handle the exception at a higher level.
[0047] Based on the state differences, select the set of encrypted segments to be sent, send them in segments, receive receipts and verify the consistency of the chain check values, update the state digest of the segments, and resume transmission from breakpoints.
[0048] Optionally, receiving the segment receipt and updating the segment status summary includes: Based on the state differences, difference comparison and fragment filtering are performed to generate a fragment index to be sent. Based on the fragment index to be sent, the encrypted fragment set is read to generate a sending queue. Obtain link status information and adjust the sending window in conjunction with the sending queue, generate a windowed sending queue and send encrypted segments according to segment sequence number, receive segment receipts and generate receipt sequence; Based on the receipt sequence and verifying the consistency of the chain check values corresponding to the receipts, a receipt confirmation result is generated. Based on the confirmation receipt, and only for the successfully confirmed segments, an updated segment status summary is generated.
[0049] Specifically, if the consistency determination result is that both parties are in the same state, the state difference is empty, and the sending process ends directly. If the determination result indicates that retransmission or supplementary transmission is required, the fragment numbers of all encrypted fragments to be sent are arranged in ascending order within the state difference set. These sequence numbers are filled into a linear index table, the number of entries in which equals the number of elements in the state difference. This index table is defined as the fragment index to be sent. The encrypted fragment sequence is accessed, and a matching encrypted fragment is retrieved one by one from the encrypted fragment sequence according to the sequence number recorded in the fragment index to be sent. The retrieval is based on the fragment sequence number field stored in bytes 7 to 10 of the encrypted fragment. If a match is found, the complete byte data of that encrypted fragment is retrieved. The retrieved encrypted fragments are sequentially placed into a temporary queue according to the sequence number in the index table. This queue is the sending queue. When the state difference set is empty, no sending operation is performed.
[0050] Link state information is a set of parameters read in real time from the underlying wireless communication module, with core components including the estimated round-trip time (RTD) and instantaneous packet loss rate (SPR). The RTD, measured in milliseconds, is calculated by a moving average of the arrival time differences of the four most recent link-layer acknowledgment frames. The SPR is the percentage of data frames that have not received acknowledgment within the last 200 milliseconds, expressed as a per mille (‰). Based on channel fluctuation tests of 200 industrial sensors deployed indoors, it was found that when the RTD is below 80 milliseconds and the SPR is below 20 per mille, sending four segments achieves a balance between throughput and reliability. When the RTD is between 80 and 300 milliseconds or the SPR is between 20 and 100 per mille, the concurrent transmission window should be reduced to 2. When the link quality deteriorates further, exceeding the above thresholds, the concurrent transmission window should be set to 1. These thresholds and mapping relationships are directly built into the adjustment logic. When adjusting the transmission window in conjunction with the transmission queue, the number of remaining segments to be transmitted in the transmission queue is first obtained, and then the transmission window size is determined based on the current link state information. The sending window size is a positive integer, taking values of 1, 2, or 4. The windowed sending queue is generated by starting from the head of the queue and sequentially taking encrypted fragments up to the maximum size of the sending window to form a sending batch. The set of fragment sequence numbers to which these fragments belong constitutes the sending sequence number group within this window. The encrypted fragments within this batch are sent to the receiving end one by one via the wireless link. After transmission, the sending end starts a retransmission timer with a duration set to three times the estimated round-trip time of the current link plus an additional 200 milliseconds margin. Upon receiving an encrypted fragment, the receiving end independently performs decryption and chain checksum verification on each fragment. After successful verification, a fragment receipt is generated and sent back using the fragment sequence number as the key. The fragment receipt is a fixed-format acknowledgment message. The message body contains the acknowledged fragment sequence number, the chain checksum value calculated by the receiving end for that fragment, and the maximum sequence number of the currently acknowledged consecutive fragments. Each time the sending end receives a fragment receipt, it appends the three parsed fields as a triple to a dedicated receipt list. This list of triples arranged in chronological order of reception constitutes the receipt sequence.
[0051] After obtaining the receipt sequence, the consistency of the chain checksum corresponding to each receipt is verified one by one. For each entry in the receipt sequence, the chain checksum of the locally maintained confirmed segment number is extracted from the aforementioned chain checksum sequence and compared byte by byte. If they are equal, it indicates that the encrypted segment received by the receiver is completely consistent with the one generated by the sender, the segment was successfully transmitted, and the receipt is marked as a successful confirmation. If they are not equal, it indicates that the data received by the receiver is corrupted or tampered with, and the receipt is marked as a failed confirmation. If the retransmission timer expires and no receipt is received for some segments within a certain window, these segments are also marked as failed confirmations. All marking results are summarized to generate a binary list called the receipt confirmation result. Based on the receipt confirmation result, only the segment status digest is advanced for the successfully confirmed segments. The specific operation involves checking all successfully confirmed segment numbers, identifying new confirmed segment numbers that increment consecutively from the end of the existing consecutive numbers, updating the last consecutive segment number to the largest consecutive number in this batch of successfully confirmed segments, extracting the chain check value corresponding to the largest consecutive number from the chain check sequence, XORing it bit-by-bit with the chain check values of adjacent non-consecutive numbers, recalculating the status compression certificate, assembling a new 68-byte segment status digest, and simultaneously overwriting two different physical areas written to the local storage medium to generate an updated segment status digest. For segments that failed to be confirmed, the segment number serves as input for the next round of windowed transmission. Figure 3 As shown in the figure, the bar chart compares the sending window size and retransmission timer configuration under four different link conditions. Good links use window 4 and 240ms timer to maximize throughput, medium links use window 2 and 400ms timer to balance efficiency and reliability, and degraded links and weak network environments use window 1 and 600-800ms timer to prioritize transmission reliability.
[0052] For example, based on state differences This means that only the encrypted segment with sequence number 2 needs to be sent. The segment to be sent has an index of 2, which is extracted from the encrypted segment sequence. The sending queue is obtained, with one segment to be sent. At this time, the link status information shows an estimated round-trip latency of 62 milliseconds and a packet loss rate of 12 per thousand. Based on the threshold mapping, the sending window size is determined to be 4, but since the number of segments to be sent is less than 4, the actual window size is 1. The device will... The data segment is encapsulated into a data packet and sent to the receiving end, and a retransmission timer is started. The receiving end successfully decrypts and verifies segment 2, and its chain checksum matches that of the sending end. It then sends back a segment receipt. After receiving the receipt, the sending end generates a receipt sequence. In the local chained check sequence, Since the chained checksum values carried in the receipt are byte-by-byte equal, segment 2 in the receipt confirmation result is confirmed as successful. This triggers the segment status summary advancement; the maximum sequence number of the new consecutive segments is 2. Since there is no segment with sequence number 3, Taking the all-zero sequence, the new state compression certificate result is: The process is the same as before, but the timestamp written to storage is refreshed, the entire breakpoint resume process ends, and the local and receiving states are consistent again.
[0053] Based on the same inventive concept, such as Figure 4 As shown, the present invention also provides a secure encrypted storage and breakpoint resume method system for head-mounted law enforcement recorders, the system comprising: The startup extraction module is used to obtain the startup event of the recorded task and extract the device identity information and task time information to generate a session identifier; The key derivation module is used to obtain key materials from the device side and verify their availability. It combines the session identifier to perform key derivation, generate session keys, initialization information and authentication information, and form session encryption parameters. The segmentation module is used to collect media data streams, detect keyframes and timestamps to segment them, write segment numbers and boundary markers to each segment, and organize them in order according to the session identifier to generate a media segment sequence. An encryption encapsulation module is used to perform authenticated encryption processing based on the media segment sequence and the session encryption parameters, generate encrypted segments and authentication information, and encapsulate them into an encrypted segment sequence; The chain verification module is used to perform verification calculations and preceding sequence association processing on each encrypted segment based on the encrypted segment sequence, generate chain verification values and bind segment numbers to form a chain verification sequence. The status summary module is used to extract based on the chain check sequence, obtain the segment number and the corresponding chain check value, generate the segment status summary and write it to the local storage medium. The difference comparison module is used to obtain the fragment state summary and send a state query request to the receiving end to obtain the received state summary, and perform a consistency comparison based on the fragment state summary and the received state summary to generate a state difference. The breakpoint resume module is used to select a set of encrypted segments to be sent based on the state differences, send them in segments, receive receipts and verify the consistency of the chain check values, update the segment state digest, and perform breakpoint resume.
[0054] It should be noted that the electrical connections between the various units described above do not necessarily represent direct or indirect connections. Any indirect connection method can be applied to the embodiments of the present invention as long as it achieves the purpose of the present invention. The above descriptions are merely exemplary embodiments of the present invention and should not be construed as limiting the scope of the present invention.
[0055] All equivalent changes and modifications made in accordance with the teachings of this invention are still within the scope of this invention. Those skilled in the art will readily conceive of other embodiments of this invention upon considering the specification and the disclosure of practical truth. This application is intended to cover any variations, uses, or adaptations of this invention that follow the general principles of this invention and include common knowledge or conventional techniques in the art not described herein.
Claims
1. A method for secure encrypted storage and breakpoint resume transmission of a head-mounted law enforcement recorder, characterized in that, The method includes: Obtain the start event of the recording task and extract the device identity information and task time information to generate a session identifier; Obtain the device-side key material and verify its availability. Combine the session identifier to perform key derivation, generate the session key, initialization information and authentication information, and form the session encryption parameters. The media data stream is acquired, keyframes and timestamps are detected and segmented, segment number and boundary marker are written for each segment, and the segments are organized in order according to the session identifier to generate a media segment sequence. Based on the media segment sequence and the session encryption parameters, perform authenticated encryption processing to generate encrypted segments and authentication information, and encapsulate them into an encrypted segment sequence; Based on the encrypted segment sequence, each encrypted segment is subjected to verification calculation and preceding sequence association processing to generate a chain of verification values and bind them to the segment sequence number, thus forming a chain of verification sequences. Extraction is performed based on the chained check sequence to obtain the fragment number and corresponding chained check value, and a fragment status summary is generated and written to the local storage medium. Obtain the fragment status summary and send a status query request to the receiving end to obtain the received status summary. Based on the fragment status summary and the received status summary, perform a consistency comparison to generate a status difference. Based on the state differences, select the set of encrypted segments to be sent, send them in segments, receive receipts and verify the consistency of the chain check values, update the state digest of the segments, and resume transmission from breakpoints.
2. The secure encrypted storage and breakpoint resume method for head-mounted law enforcement recorders according to claim 1, characterized in that, The generated session identifier includes: Obtain device identity information and task time information, perform normalization processing, and generate session input information; Based on the session input information and performing irreversible mapping processing, a session fingerprint is generated; The session fingerprint is encoded and encapsulated to generate a session identifier.
3. The secure encrypted storage and breakpoint resume method for head-mounted law enforcement recorders according to claim 1, characterized in that, The session encryption parameters include: Obtain the device-side key materials and perform key availability verification to generate a key validity marker; Based on the key validity marker and the session identifier, perform key derivation processing to generate a session key; Based on the session key, key derivation and parameter separation are performed to generate the initialization information and authentication information required for segmented encryption, thus obtaining the session encryption parameters.
4. The secure encrypted storage and breakpoint resume method for head-mounted law enforcement recorders according to claim 1, characterized in that, The generated media segment sequence includes: Acquire media data streams and detect keyframe and timestamp information to generate segmentation reference information; Based on the segmentation reference information, segmentation processing is performed to generate media segments; The media segments are written with segment numbers and segment boundary markers to generate a media segment sequence.
5. The secure encrypted storage and breakpoint resume method for head-mounted law enforcement recorders according to claim 1, characterized in that, The encapsulation into an encrypted fragment sequence includes: Based on the media segment sequence and the session encryption parameters, a segment random factor is generated for each media segment to obtain the segment encryption input; Based on the encrypted input of the fragment, perform encrypted processing with authentication to generate encrypted fragments and fragment authentication information; Based on the encrypted fragment and the fragment authentication information, the fragment metadata is encapsulated into an encrypted fragment sequence.
6. The secure encrypted storage and breakpoint resume method for head-mounted law enforcement recorders according to claim 1, characterized in that, The formation of the chained verification sequence includes: Obtain the encrypted fragment sequence and perform digest calculation on each encrypted fragment to generate a fragment check value sequence; Obtain the current segment check value and the preceding chain check value, and combine them with the segment check value sequence to generate a chain check value; The chained check values are bound to the corresponding segment numbers to form a chained check sequence.
7. The secure encrypted storage and breakpoint resume method for head-mounted law enforcement recorders according to claim 1, characterized in that, The process of generating a fragment state summary and writing it to a local storage medium includes: Obtain the chained verification sequence, extract the last consecutive segment number and its corresponding chained verification value, as well as the corresponding chained verification value of the adjacent non-consecutive segment number, and perform bitwise XOR fusion on the two to obtain the state compression certificate. The state compression certificate, the last consecutive segment number, and the corresponding chain check value are written together into two different physical areas of the local storage medium to generate a segment state summary.
8. The secure encrypted storage and breakpoint resume method for head-mounted law enforcement recorders according to claim 1, characterized in that, The differences in the generated states include: Based on the received status summary, extract the sequence number of the confirmed segment from the receiver and the chain check value from the receiver to generate the receiver status vector. Based on the fragment state summary, extract the local completed fragment number and local chain check value to generate a local state vector; A consistency determination is performed based on the receiver state vector and the local state vector to generate a state difference.
9. The secure encrypted storage and breakpoint resume method for head-mounted law enforcement recorders according to claim 1, characterized in that, The receiving segment receipt and updating the segment status summary includes: Based on the state differences, difference comparison and fragment filtering are performed to generate a fragment index to be sent. Based on the fragment index to be sent, the encrypted fragment set is read to generate a sending queue. Obtain link status information and adjust the sending window in conjunction with the sending queue, generate a windowed sending queue and send encrypted segments according to segment sequence number, receive segment receipts and generate receipt sequence; Based on the receipt sequence and verifying the consistency of the chain check values corresponding to the receipts, a receipt confirmation result is generated. Based on the confirmation receipt, and only for the successfully confirmed segments, an updated segment status summary is generated.
10. A secure encrypted storage and breakpoint resume system for a head-mounted law enforcement recorder, applied to the secure encrypted storage and breakpoint resume method for a head-mounted law enforcement recorder as described in any one of claims 1-9, characterized in that, The system includes: The startup extraction module is used to obtain the startup event of the recorded task and extract the device identity information and task time information to generate a session identifier; The key derivation module is used to obtain key materials from the device side and verify their availability. It combines the session identifier to perform key derivation, generate session keys, initialization information and authentication information, and form session encryption parameters. The segmentation module is used to collect media data streams, detect keyframes and timestamps to segment them, write segment numbers and boundary markers to each segment, and organize them in order according to the session identifier to generate a media segment sequence. An encryption encapsulation module is used to perform authenticated encryption processing based on the media segment sequence and the session encryption parameters, generate encrypted segments and authentication information, and encapsulate them into an encrypted segment sequence; The chain verification module is used to perform verification calculations and preceding sequence association processing on each encrypted segment based on the encrypted segment sequence, generate chain verification values and bind segment numbers to form a chain verification sequence. The status summary module is used to extract based on the chain check sequence, obtain the segment number and the corresponding chain check value, generate the segment status summary and write it to the local storage medium. The difference comparison module is used to obtain the fragment state summary and send a state query request to the receiving end to obtain the received state summary, and perform a consistency comparison based on the fragment state summary and the received state summary to generate a state difference. The breakpoint resume module is used to select a set of encrypted segments to be sent based on the state differences, send them in segments, receive receipts and verify the consistency of the chain check values, update the segment state digest, and perform breakpoint resume.
Citation Information
Patent Citations
Breakpoint-resume transmission method, device, terminal and medium based on encryption protocol bandwidth
CN117527793B