An edge node-based installation package dynamic encryption and transmission method
By employing a collaborative mechanism of pre-encryption by the central server and blind writing by edge nodes, the problem of dynamic encryption and transmission of installation packages in untrusted edge node environments is solved, achieving dynamic differentiation and security of installation packages and ensuring the effectiveness of terminal verification.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- XIAMEN ANJIEYUN NETWORK CO LTD
- Filing Date
- 2026-04-20
- Publication Date
- 2026-07-14
Smart Images

Figure CN122389093A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of secure information distribution, and more specifically, to a method for dynamic encryption and transmission of installation packages based on edge nodes. Background Technology
[0002] In mobile internet application distribution scenarios, application installation packages are typically transmitted through edge nodes in a content delivery network (CDN) to reduce bandwidth pressure on central servers and improve download speeds for users. To prevent malicious reverse engineering, tampering, or repackaging of the installation packages, distributors usually encrypt and obfuscate the original code. Existing related technologies are constantly emerging. For example, Chinese Patent Publication No. CN115632857A, entitled "Dynamic Encryption Method and Medium for APK Files Based on CDN Edge Computing," discloses a process of acquiring and dynamically encrypting application files upon receiving a download request, utilizing the edge computing capabilities of a node network. Another example is Chinese Patent Publication No. CN107483432A, entitled "File Encryption Processing Method and Apparatus," which discloses a technology that, upon receiving a download request from a terminal, generates an encryption key by combining the terminal number and the current time, and then dynamically encrypts and transmits the file.
[0003] However, current dynamic encrypted distribution mechanisms face an irreconcilable contradiction. Edge nodes are typically deployed widely in third-party data centers with uncontrolled physical environments, creating semi-trusted or even untrusted environments. If edge nodes are required to deliver installation packages with different internal binary structures each time for dynamic protection against cracking, the traditional approach requires sending plaintext code and complex decryption algorithms to the edge nodes simultaneously. The edge nodes then decrypt the program locally and reconstruct the entire file. This not only leads to the edge nodes' computing resources being instantly exhausted during peak download periods, causing widespread network timeouts, but more critically, if a hacker physically breaches an edge node, they can directly extract the original plaintext code from memory, causing the entire security defense to collapse from within. In short, how to enable edge nodes to leverage their distributed computing power advantages to perform dynamic obfuscation of highly differentiated installation packages at low cost and with absolute security, without granting them decryption capabilities, is a pressing technical challenge that needs to be addressed. Summary of the Invention
[0004] The technical problem to be solved by the present invention is to provide a method for dynamic encryption and transmission of installation packages based on edge nodes, so as to solve the problems mentioned in the background art.
[0005] To achieve the above objectives, the present invention adopts the following technical solution: A method for dynamic encryption and transmission of installation packages based on edge nodes includes the following steps: The central server uses a preset encryption key to perform encryption operations on the original code of the installation package to be processed to obtain ciphertext code. It selects at least one insertion position in the continuous byte sequence of the ciphertext code and writes placeholder byte data at each of the selected insertion positions to generate corresponding blank placeholders. The central server will send the encrypted code of each of the blank placeholders and the interference instruction dictionary to the edge nodes. The interference instruction dictionary contains multiple interference instruction sequences. The edge node receives the installation package download request sent by the terminal, triggers the random number generator to generate a random index value, uses the random index value to extract the target interference instruction sequence from the interference instruction dictionary, and writes the target interference instruction sequence into the insertion position corresponding to each of the blank placeholders to generate the target installation package. The edge node establishes a communication connection with the terminal and transmits the target installation package to the terminal via the communication connection.
[0006] Specifically, the central server selects at least one insertion position in the continuous byte sequence of the ciphertext code, including: The central server divides the continuous byte sequence of the ciphertext code into a sequence of ciphertext data blocks; The central server inputs the sequence of encrypted data blocks into a trained location prediction machine learning model; The location prediction machine learning model outputs a set of splicing breakpoint coordinates for the ciphertext data block sequence; The central server determines the insertion position for each splicing breakpoint position coordinate in the set of splicing breakpoint position coordinates.
[0007] Specifically, the training steps of the location prediction machine learning model include: Construct a training sample set, which contains multiple sets of training samples. Each set of training samples contains a sequence of encrypted data blocks and a set of labels for the corresponding security breakpoint coordinates. The sequence of encrypted sample data blocks is input into the initial neural network model, which outputs a set of predicted breakpoint coordinates. Calculate the loss function value between the predicted breakpoint location coordinate set and the safe breakpoint location coordinate set labels, update the network parameters of the initial neural network model using the backpropagation algorithm, until the loss function value converges, and obtain the location prediction machine learning model.
[0008] Specifically, the steps for generating the interference instruction sequences contained in the interference instruction dictionary include: The central server extracts no-operation instructions, empty loop instructions, and jump-back-to-source address instructions from the standard instruction opcode set. The central server randomly combines the no-operation instruction, the empty loop instruction, and the jump back to the source address instruction into an initial interference instruction segment. The central server uses the preset encryption key to encrypt the initial interference command segment, obtains the interference command sequence, and stores the interference command sequence in the interference command dictionary.
[0009] Specifically, the interference instruction dictionary includes a basic interference dictionary and a time seed sequence; the central server sends the ciphertext code carrying each of the blank placeholders and the interference instruction dictionary to the edge nodes, including: The central server generates a time seed sequence and a basic interference dictionary; The central server will package and send the ciphertext code of each of the blank placeholders, the basic interference dictionary, and the time seed sequence to the edge node.
[0010] Specifically, the edge node uses the random index value to extract the target interference command sequence from the interference command dictionary, including: The edge node obtains the current system timestamp data; The edge node performs a bitwise XOR operation between the time seed sequence and the current system timestamp data to generate a random displacement vector. The edge node uses the value in the random displacement vector as the displacement step size to perform a cyclic shift operation on the byte sequence stored in the basic interference dictionary to obtain a dynamic interference dictionary; The edge node uses the random index value to extract the target interference instruction sequence from the dynamic interference dictionary.
[0011] Specifically, the method further includes a dynamic update step: The edge node starts a timer with a preset period; When the timer reaches the preset period, the edge node reacquires the current system timestamp data; The edge node generates a new random displacement vector based on the reacquired current system timestamp data and the time seed sequence; The edge node uses the new random displacement vector to re-perform a cyclic shift operation on the byte sequence stored in the basic interference dictionary to generate an updated dynamic interference dictionary for subsequent extraction of the target interference instruction sequence.
[0012] Specifically, after the central server writes placeholder byte data at each selected insertion position and generates corresponding blank placeholders, it also includes: The central server extracts the physical byte offset start address and the corresponding occupied byte length value of each blank placeholder, and writes the physical byte offset start address and the occupied byte length value into the placeholder mask table. The central server removes the region indicated by the starting address of each physical byte offset and the corresponding occupied byte length value from the continuous byte sequence of the ciphertext code, extracts the remaining continuous byte sequence, performs hash calculation, and generates the core ciphertext hash value. The central server uses a preset signature private key to perform a signature calculation on the core ciphertext hash value to generate a digital signature file. The central server sends the digital signature file and the placeholder mask table to the edge node.
[0013] Specifically, the edge node generates the target installation package, including: The edge node combines and encapsulates the ciphertext code containing the target interference instruction sequence, the digital signature file, and the placeholder mask table to generate the target installation package.
[0014] Specifically, after the edge node transmits the target installation package to the terminal, it also includes: The terminal decompresses the target installation package and extracts the ciphertext code containing the target interference instruction sequence, the digital signature file, and the placeholder mask table. The terminal reads the starting address of the offset of each physical byte and the length value of the occupied byte recorded in the placeholder mask table; The terminal skips the byte range indicated by the starting address of each physical byte offset and the corresponding occupied byte length value in the ciphertext code after the target interference instruction sequence is written, and extracts the remaining byte data; The terminal performs a hash calculation on the remaining bytes of data to generate a local verification hash value; The terminal uses a preset signature public key to decrypt the digital signature file and restore the core ciphertext hash value. If it is determined that the data content of the local verification hash value is consistent with that of the core ciphertext hash value, the terminal writes the target installation package into the local storage for installation.
[0015] The advantage of this invention over existing technologies lies in its effective solution to the risk of plaintext code leakage in untrusted edge environments and the computing power bottleneck in high-concurrency scenarios through a collaborative interaction mechanism between a central server and edge nodes. In the entire technical architecture, edge nodes play a crucial role as a blind assembly workshop and a concurrency pressure sharer. Specifically, the central server pre-encrypts the original code statically and uses the physical offset rules of the underlying binary file to select insertion positions and reserve blank placeholders in the continuous byte sequence of the ciphertext code. When edge nodes receive download requests from a massive number of users, they do not need to perform any computationally intensive decryption operations, nor do they have access to the core key. Instead, they directly and mechanically extract the target interference instruction sequence from the interference instruction dictionary and write it into these blank placeholders in the ciphertext field. This blind-filling operation at the edge nodes ensures that each user's downloaded installation package has a unique underlying binary file appearance. It perfectly leverages the distributed processing capabilities of the edge nodes to achieve dynamic physical mutation of the installation package. The advantage of this dynamic physical mutation is that it allows for differences between installation packages, preventing security issues in other installation packages caused by the cracking of a single package. This invention strips the edge nodes of their access to program logic parsing, making the original plaintext absolutely invisible to the edge nodes, fundamentally eliminating the risk of core code leakage due to lax control in lower-level data centers.
[0016] Building upon this foundation, this invention further addresses the security vulnerability of hackers using large-sample comparison techniques to reverse-engineer interference commands filled in by edge nodes. By introducing a time seed sequence and performing a bitwise XOR operation with the current system timestamp data to generate a random displacement vector, edge nodes use this vector as the displacement step size to perform cyclic shift operations on the basic interference dictionary. This allows the interference data used by the edge nodes to fill in the interference data to undergo periodic morphological evolution over time. This dynamically derived technical feature breaks the fixed patterns of static dictionaries, resulting in hackers obtaining drastically different interference code characteristics even if they download a large number of installation packages in a short period for comparison, exponentially increasing the difficulty of targeted reverse analysis and signature extraction.
[0017] Furthermore, this invention cleverly resolves the underlying system conflict between the dynamically modified files by edge nodes and the terminal's native anti-tampering verification mechanism. Since edge nodes arbitrarily modify files, conventional hash signatures inevitably fail. Therefore, this invention constructs a placeholder mask table by extracting the physical byte offset starting address and occupied byte length of blank placeholders from the central server. During hash calculation and digital signature file generation, the region indicated by this mask table is actively removed. When the terminal receives the combined installation package from the edge node, it also precisely skips the byte range randomly corrupted by the edge node based on this placeholder mask table, extracting only the remaining core encrypted data for skip-style local hash verification. This spatial decoupling feature allows installation packages with randomly modified internal physical structures by edge nodes to still perfectly pass extremely stringent digital signature verification, establishing a closed loop between zero-trust edge distribution and terminal security verification. Attached Figure Description
[0018] Figure 1 This is a memory distribution diagram of the encrypted code and blank placeholders of this invention.
[0019] Figure 2 This is a diagram of the machine learning model architecture for location prediction in this invention.
[0020] Figure 3 This is a diagram showing the internal combination and storage structure of the interference instruction dictionary of this invention.
[0021] Figure 4 This is a physical view of the dynamic dictionary cyclic shift mechanism of this invention.
[0022] Figure 5 This is a physical data mapping diagram of the placeholder mask table of the present invention.
[0023] Figure 6 This is a diagram of the core encrypted text extraction and digital signature assembly components of this invention.
[0024] Figure 7 This is a diagram showing the overall file space encapsulation structure of the target installation package of this invention.
[0025] Figure 8 This is a structural diagram of the internal security verification scenario of the terminal device. Detailed Implementation
[0026] The specific embodiments of the present invention will now be described with reference to the accompanying drawings.
[0027] For ease of explanation, this embodiment is based on the scenario where the installation package contains a protected code payload. The protected code payload may be the application's bytecode file, native library file, script intermediate code file, or a continuous code data area formed by merging these files.
[0028] This invention does not limit the packaging format of the installation package, as long as it can contain the code data area, digital signature file, and placeholder mask table. The central server, edge nodes, and terminals work collaboratively, with the central server located in a trusted environment, the edge nodes in a semi-trusted or untrusted environment, and the terminal being the user device that receives and installs the target installation package. The focus of this invention is not on the transmission protocol itself, but on the entire collaborative mechanism whereby the central server performs strong encryption and placeholder planning, the edge nodes perform blind write filling without decryption, and the terminal performs skip-step verification based on the placeholder mask table.
[0029] In one embodiment, the central server first obtains the original code from the installation package to be processed. This original code can be a complete code file or one or more code segments extracted from the installation package. To prevent edge nodes from accessing plaintext, the central server encrypts the original code using a preset encryption key within a trusted environment to obtain ciphertext code. Preferably, an encryption method supporting random access by offset is used, or a segmented encryption method allowing independent decryption of segments is employed, ensuring that the ciphertext code can still be correctly restored according to the corresponding offset or segment during the legitimate decryption stage after subsequent partial replacement. Furthermore, a length-preserving encryption method is preferred, ensuring that the total length of the corresponding code area remains unchanged before and after encryption, thus facilitating subsequent planning of placeholder areas by physical byte offset and execution of mask verification. The central server holds the preset encryption key, while edge nodes do not hold this key and lack decryption capabilities, thus architecturally limiting plaintext access to the central trusted domain.
[0030] After obtaining the ciphertext code, the central server does not directly distribute it. Instead, it first selects at least one insertion position in the continuous byte sequence of the ciphertext code and writes placeholder bytes at each insertion position, generating blank placeholders, such as... Figure 1 As shown. The blank placeholders here are essentially variable byte areas reserved in the ciphertext field. To avoid changes in the total file length caused by subsequent edge node writes, each blank placeholder is preferably a fixed-length slot. The central server writes placeholder byte data equal to the slot length in this slot, and the target interference instruction sequence subsequently written by the edge nodes is also equal to the slot length. In other words, the edge nodes perform equal-length overwrite, rather than inserting new bytes, thus not changing the overall byte layout already determined by the central server. The reason why the central server reserves the space first, rather than allowing the edge nodes to allocate it themselves, is that if the insertion position were freely determined by the edge side, it would mean that the edge nodes must understand the file organization method and even participate in the reconstruction logic, which would expose the code structure to untrusted nodes again. This invention fixes the structural planning power in the central server, allowing the edge nodes to only perform mechanical byte overwrite operations, fundamentally stripping them of their parsing permissions.
[0031] To ensure the simplicity and reliability of the subsequent blind writing process, the central server preferably records three basic attributes for each blank placeholder: the physical byte offset starting address of the placeholder in the ciphertext code, the length of the byte occupied by the placeholder, and the slot identifier corresponding to the placeholder. The placeholder byte data can use uniform preset values, such as consecutive 0x00, 0xFF, or other predefined marker sequences, as long as the central server and terminal treat this area as negligible during subsequent verification. The placeholder length can be pre-designed based on the length of the interference instruction sequence to be inserted. In actual deployment, the placeholder length can be set between 8 bytes and 512 bytes, with 16 bytes, 32 bytes, 64 bytes, or 128 bytes being commonly used. Too short a length will weaken the differentiation between each distribution; too long a length will increase the packet size and mask management cost. Therefore, it is usually determined based on a combination of the installation packet size and the target security level. For larger installation packages, the number of placeholders can be set from 1 to 128; for small to medium-sized installation packages, a number of 4 to 32 is usually sufficient to balance performance and cost.
[0032] In one embodiment, the central server does not manually specify the insertion position, but automatically determines the secure breakpoint through a position prediction machine learning model. The secure breakpoint referred to here is a byte coordinate position suitable for arranging fixed-length placeholder slots. This position, after arranging the placeholder slots, will not disrupt the container organization, offset management, or subsequent skip-checking process of the ciphertext payload, and also facilitates edge nodes writing at fixed addresses. The term "set of splicing breakpoint coordinates" used in the invention description is a term used for ease of model representation; essentially, it represents the set of boundary coordinates suitable for setting placeholder slots in a continuous ciphertext byte stream, and does not require an actual file splicing operation. The central server first divides the continuous byte sequence of the ciphertext code into a sequence of ciphertext data blocks. The length of each ciphertext data block can be set from 64 bytes to 4096 bytes, with 256 bytes or 512 bytes being common values. An overlap area of 16 bytes to 64 bytes can also be set between adjacent data blocks to allow the model to more accurately perceive the contextual features near the boundaries. Subsequently, the central server inputs the sequence of encrypted data blocks into a trained machine learning model for location prediction. The model outputs a set of splicing breakpoint coordinates, and then determines the insertion position for each splicing breakpoint coordinate in the set, such as... Figure 2 As shown.
[0033] To enable those skilled in the art to understand the implementation of this model, a feasible implementation is presented below. The location prediction machine learning model can employ a structure combining one-dimensional convolutional networks and temporal networks, such as... Figure 2As shown, the model's front end utilizes one-dimensional convolutional layers to extract local byte patterns, local entropy changes, and local statistical fluctuations. The middle layers employ bidirectional gated recurrent unit networks, bidirectional long short-term memory networks, or lightweight Transformer encoders to model the contextual relationships between adjacent data blocks. The final layer provides a safe probability value for each candidate breakpoint through a fully connected output layer. Considering that breakpoints are essentially selected from multiple candidate boundaries for insertion, the model preferably uses a boundary classification output method, i.e., outputting a score between 0 and 1 for each candidate boundary, and then selecting the final coordinates based on a threshold. This threshold can be set between 0.60 and 0.95. A lower threshold yields more insertion points, suitable for high-variability scenarios; a higher threshold provides more stable security, suitable for scenarios with high requirements for encapsulation stability. The set of spliced breakpoint coordinates can be selected from the first 1 to 64 breakpoints after probability sorting, or filtered using minimum interval constraints to avoid placeholders overlapping or being too concentrated.
[0034] The training of the location prediction machine learning model is also completed in a trusted training environment on the central server. During training, a training sample set is first constructed. Each training sample contains a sequence of encrypted data blocks and corresponding labels for the coordinates of secure breakpoint locations. Label generation can be achieved using a combination of rule engines and offline verification. Specifically, candidate secure breakpoints can be generated based on rules such as file container constraints, offset table constraints, retention of extended regions, minimum interval constraints, and prohibition of crossing critical metadata areas. These candidate locations are then subjected to offline placeholder simulation, encapsulation availability verification, and terminal verification consistency verification to retain truly stable locations as the coordinates of the secure breakpoint locations. Subsequently, the sequence of encrypted data blocks is input into the initial neural network model, which outputs the predicted set of breakpoint coordinates. During training, weighted cross-entropy loss, focus loss, or other loss strategies suitable for imbalanced samples can be used to reduce training bias when the proportion of secure breakpoint samples is low. The central server updates the network parameters of the initial neural network model using the backpropagation algorithm until the loss function converges, resulting in the location prediction machine learning model. The batch size for training can be set to 16 to 256, the learning rate can be set to 0.0001 to 0.01, and the number of training epochs can be set to 10 to 200 epochs, combined with a validation set early stopping mechanism to avoid overfitting. To improve generalization ability, the training samples are preferably designed to cover different application types, different package sizes, different code organization structures, and different encryption segmentation strategies.
[0035] In the core link, the central server also generates a interference instruction dictionary and sends it along with ciphertext code carrying blank placeholders to the edge nodes. This interference instruction dictionary is not a regular plaintext dictionary, but rather a set of ciphertext byte sequences that edge nodes can directly write into placeholder slots. The reason for this design is that if directly parseable plaintext interference instructions are sent to the edge nodes, although the edge nodes do not know the original code, they may still be able to make inferences about the overall construction logic through the instruction semantics, which is not conducive to completely eliminating the edge's ability to understand. This invention limits the data that edge nodes can access to to the ciphertext byte fragments to be written, without exposing their corresponding plaintext.
[0036] In one embodiment, the central server extracts no-operation instructions, empty loop instructions, and jump-back-to-source address instructions from a standard instruction opcode set. This standard instruction opcode set corresponds to the runtime environment of the code to be protected. When the code to be protected is native library code, the opcode set corresponds to the machine instruction set of the target processor architecture; when the code to be protected is bytecode, the opcode set corresponds to the bytecode instruction set of the corresponding virtual machine. No-operation instructions are used to construct empty-operation segments that do not produce effective semantic changes after execution; empty loop instructions are used to construct redundant control flow segments with definite exit conditions; and jump-back-to-source address instructions are used to construct loop segments that can return to the original predetermined flow entry point. These three types of basic instructions are chosen because they offer both controllability and low side effects in protecting code, obfuscating control flow, and constructing differentiated samples. The central server randomly combines these instructions into initial interference instruction segments. During random combination, length constraints, jump pairing constraints, and termination constraints can be introduced to ensure that each initial interference instruction segment is semantically closed and length manageable. The plaintext length of the initial interference instruction segment can be set from 8 bytes to 512 bytes, and it can be bucketed into lengths of 16 bytes, 32 bytes, 64 bytes, etc., to match different blank placeholder lengths.
[0037] To ensure that the expected target interference command sequence can be restored during the subsequent legitimate decryption stage after the edge nodes are overwritten, rather than generating random garbled characters, the central server, when generating the interference command dictionary, does not simply use the same preset encryption key to perform ordinary encryption on all initial interference command segments. Instead, for each slot identifier, it calls the offset key stream segment or segmented encryption context corresponding to that slot to perform encryption operations on the initial interference command segment adapted to that slot. In other words, interference command segments of the same length can have different encryption results if they correspond to different slots. Preferably, the interference command dictionary is stored according to both slot identifier and length, with each slot corresponding to one or more length buckets, and each length bucket storing multiple interference command sequences of equal length, such as... Figure 3As shown. In this way, the edge nodes only need to extract from the corresponding sub-dictionary based on the slot identifier and placeholder length of the placeholder. Since each candidate sequence in this sub-dictionary matches the decryption context of the corresponding slot, although the edge nodes only overwrite the ciphertext field, the target installation package can still be restored to the correct target interference instruction sequence during the legitimate decryption stage. This addition makes the entire technical solution completely closed on the encrypted link.
[0038] When the central server sends the ciphertext code carrying each blank placeholder and the interference instruction dictionary to the edge nodes, it can organize it using a basic interference dictionary plus a time seed sequence. That is, the central server first generates the time seed sequence and the basic interference dictionary, and then packages the ciphertext code carrying blank placeholders, the basic interference dictionary, and the time seed sequence together and sends them to the edge nodes, as shown below. Figure 3 As shown, the basic interference dictionary stores multiple encrypted interference byte sequences organized hierarchically by slot identifier and length. The time seed sequence drives the periodic evolution of this basic interference dictionary locally on the edge nodes. The length of the time seed sequence can be set from 8 bytes to 64 bytes, preferably 16 bytes or 32 bytes, to balance computational simplicity and flexibility. With this design, the central server does not need to frequently issue new dictionaries to the edge nodes, allowing the edge nodes to dynamically change candidate data without decryption.
[0039] When an edge node receives a download request for an installation package from a terminal, it triggers a random number generator to generate a random index value. To ensure the quality of randomness, a cryptographically secure pseudo-random number generator is preferred, with the seed sourced from one or more of the edge node's startup entropy, time entropy, network entropy, and hardware entropy. The range of the random index value is determined by the number of interference instruction sequences in the current target sub-dictionary. If a bucket of a certain length in a slot contains N candidate sequences, the index value can be selected between 0 and N-1. The edge node then uses this random index value to extract the target interference instruction sequence from the interference instruction dictionary and writes the target interference instruction sequence into the insertion positions corresponding to each blank placeholder, combining them to generate the target installation package. The write operation here is preferably a direct byte overwrite or block copy operation based on offset addresses, without decryption, disassembly, relocation analysis, or plaintext recovery. Because the edge node only performs pure physical replacement, in high-concurrency scenarios, the computational pressure is almost entirely reflected in memory copying and a small amount of index location, far lower than traditional edge re-encryption and edge re-obfuscation schemes.
[0040] In practical implementation, there are two approaches for handling multiple blank placeholders. One is to generate a random index value for each placeholder and extract the target interference instruction sequence from the corresponding slot and length bucket. This approach offers greater differentiation. The other is to generate only one main random index value in a single download request, and then derive sub-index values by combining the placeholder sequence number, slot identifier, length bucket number, or offset address. This reduces the overhead of random number generation. Regardless of the approach, edge nodes do not need to know the plaintext semantics of the target interference instruction sequence; they only need to ensure that the written sequence matches the slot and length of the target placeholder. If a slot is configured to only allow candidate sequences from its sub-dictionary to participate in overwriting, the edge node strictly selects from that slot's sub-dictionary. If multiple slots share the same decryption context, they can also be configured to share a sub-dictionary, but this is an optional implementation.
[0041] To further enhance the complexity of large-sample comparative analysis, this invention introduces a time-driven dynamic interference dictionary. Before extracting the target interference instruction sequence using random index values, the edge node first obtains the current system timestamp data. The timestamp can be a system clock value with second, millisecond, or higher precision, but second or millisecond precision is commonly used. Subsequently, the edge node performs a bitwise XOR operation between the time seed sequence and the current system timestamp data to generate a random displacement vector. This random displacement vector can be understood as a set of step values used to drive the cyclic shift of the dictionary. For example, if the time seed sequence is 16 bytes long, 16 basic displacement components can be generated; then, based on the number of candidate entries in each sub-dictionary, these basic components are mapped using a modulo operation to obtain the displacement step size of the corresponding sub-dictionary. The displacement step size preferably applies to the logical arrangement order of candidate entries within the sub-dictionary without changing the internal byte content of each candidate ciphertext byte sequence itself. The reason for this is that the internal byte content of the candidate ciphertext byte sequence usually strictly matches the decryption context of the corresponding slot. If arbitrarily performing byte circular shifts within a single ciphertext byte sequence, it may affect the subsequent legitimate decryption results. Therefore, in this embodiment, it is preferable to limit the cyclic shift to an entry-level shift, that is, to change the index mapping relationship of the candidate sequence without changing the byte arrangement of a single candidate sequence.
[0042] In a preferred embodiment, the edge node uses the value in the random displacement vector as the displacement step size to perform a cyclic shift operation on the candidate entry sequence of each sub-dictionary in the basic interference dictionary, thereby obtaining a dynamic interference dictionary, such as... Figure 4As shown. This processing ensures that the actual target interference command sequence hit by the same random index value changes within different time windows, thus preventing hackers from establishing a stable mapping relationship through large-scale sampling in a short period. To balance the rate of change with the stability of the edge cache, the preset period of the timer can be set from 1 second to 3600 seconds, with 30 seconds to 300 seconds being a common setting. A period that is too short will increase the local update frequency of the edge nodes, which is detrimental to cache hits; a period that is too long will reduce the sample differentiation effect. After the edge node starts the timer, when the timer reaches the preset period, it re-acquires the current system timestamp data, generates a new random displacement vector based on the new timestamp and time seed sequence, and uses this new random displacement vector to re-perform the entry-level cyclic shift operation on the basic interference dictionary, generating an updated dynamic interference dictionary for subsequent extraction of target interference command sequences.
[0043] In a further embodiment, to avoid different edge nodes generating completely identical dynamic interference dictionaries at the same time, edge nodes can also use node identifiers, data center identifiers, or link session identifiers as additional perturbation factors in displacement vector generation. That is, after XORing the time seed sequence with the current system timestamp data, it is then mixed again with the local perturbation factor on the node side. This does not change the basic principle of the invention, but only further improves the cross-node sample difference. Of course, in some scenarios where predictable network-wide behavior is required, node perturbation factors can be omitted, and evolution can be driven solely by the time seed.
[0044] After writing the blank placeholders, the central server constructs a placeholder mask table and generates a digital signature file based on this table. Specifically, the central server extracts the physical byte offset start address and corresponding occupied byte length of each blank placeholder and writes this information into the placeholder mask table, such as... Figure 5 As shown, the placeholder mask table can be stored in ascending order of starting address, with each record containing at least two fields: starting offset and length. In practice, slot identifier, version number, and integrity verification fields can also be added for edge nodes and terminals to parse. The reason for introducing the placeholder mask table is that the areas subsequently written by edge nodes are inherently mutable. If these areas were still included in the hash and signature, each edge write would cause the signature to become invalid, making dynamic mutation impossible to coexist with the terminal's native security verification. This invention separates the mutable and immutable core areas at the verification level through spatial stripping, thereby granting edge nodes constrained mutation permissions without affecting the terminal's judgment of the authenticity of the core content.
[0045] When generating a signature, the central server removes the region indicated by the starting address of each physical byte offset and the corresponding byte length from the continuous byte sequence of the ciphertext code. It then extracts the remaining continuous byte sequence, performs hash calculations, and generates the core ciphertext hash value, such as... Figure 6 As shown. The core ciphertext hash value here reflects the stable core content after removing all placeholder areas. The hash algorithm can be SHA-256, SHA-384, SM3, or other secure hash algorithms. Subsequently, the central server uses a preset signing private key to perform a signature calculation on the core ciphertext hash value, generating a digital signature file. To match the terminal's method of restoring the core ciphertext hash value using the signing public key, this implementation preferably adopts a signature system that supports public key recovery of the digest. In other words, the digital signature file carries the signature result obtained by applying the signing private key to the core ciphertext hash value. The terminal can use the corresponding signing public key to recover the core ciphertext hash value from the digital signature file, and then perform a consistency comparison with the local verification hash value, such as... Figure 6 As shown.
[0046] After the central server sends the digital signature file and placeholder mask table to the edge nodes, the edge nodes, when generating the target installation package, combine and encapsulate the ciphertext code containing the target interference instruction sequence, the digital signature file, and the placeholder mask table to generate the target installation package, such as... Figure 7 As shown. The signature file and placeholder mask table can be stored as independent metadata files in the installation package, or written to the predefined manifest area within the package. The edge node does not need to participate in signature calculation or verify the signature content during this process. It is only responsible for combining and encapsulating the stable metadata provided by the central server with the ciphertext code after this blind write. Therefore, the edge node's permissions are always limited to byte writing within the variable area. Even if the edge node is physically compromised, the attacker can only access the strongly encrypted core ciphertext, the encrypted interference dictionary, and the write logic that lacks decryption capabilities; the original plaintext code cannot be directly recovered from the edge side.
[0047] After the edge node transmits the target installation package to the terminal, the terminal first decompresses the target installation package and extracts the ciphertext code containing the target interference instruction sequence, the digital signature file, and the placeholder mask table. Then, the terminal reads the starting address of each physical byte offset and the corresponding occupied byte length value recorded in the placeholder mask table, such as... Figure 8As shown. To ensure the robustness of the verification process, the terminal preferably performs a validity check on the placeholder mask table first, including checking whether each record is arranged in ascending order of its starting offset, whether different placeholder intervals overlap, and whether any interval exceeds the total length boundary of the ciphertext code. After the validity check passes, the terminal skips the byte range jointly indicated by the starting address of each physical byte offset and the corresponding occupied byte length value in the ciphertext code after writing the target interference instruction sequence, and extracts the remaining byte data. This skipping can be done by sequential scanning plus interval filtering, or by constructing a list of valid intervals first and then concatenating them into segments. To ensure that the hash input of the terminal is consistent with that of the central server, the terminal should maintain the same interval order and concatenation order as the central server when extracting the remaining byte data, and then perform hash calculation on the remaining byte data to generate a local verification hash value.
[0048] The terminal then uses a preset public key to restore the digital signature file, recovering the core ciphertext hash value, and compares this core ciphertext hash value with the local verification hash value. Figure 8 As shown. If the data content of the local verification hash value is determined to be consistent with the core ciphertext hash value, it means that although the edge node has randomly written to the placeholder area, it has not damaged the core ciphertext area that should remain stable. The terminal can then write the target installation package to its local storage for installation. Otherwise, the installation will be rejected, and the abnormal installation package can be further deleted, an alarm log can be recorded, or the central server can be notified. Through this mechanism, the random writing of the placeholder area by the edge node will not compromise the terminal's verification of the authenticity of the core ciphertext, and dynamic obfuscation capability and terminal secure installation capability can coexist.
[0049] In a further embodiment, the central server can add a version field and a policy field to the metadata sent to the edge nodes. The version field is used to identify the version of the location prediction machine learning model, the version of the basic interference dictionary, and the version of the mask table, facilitating local cache updates by the edge nodes. The policy field can indicate the use of strategies such as independent randomization per placeholder, shared randomization by time window, and randomization bound to user session within the same download request. This allows for optimization for different business scenarios without changing the overall architecture of the invention. For example, in high-concurrency delivery scenarios of hot versions, a combination of shared randomization by time window and timed dynamic dictionary can be used to improve cache reuse; in high-security-level version delivery scenarios, independent randomization per placeholder and a shorter dynamic update cycle can be used to improve the degree of packet body differentiation.
[0050] Furthermore, the blind write padding operation performed by the edge nodes in this invention is essentially a mechanical filling of the placeholder area without understanding its semantics. Because the insertion position is pre-planned by the central server, the placeholder length is pre-set by the central server, the write sequence is pre-constructed and encrypted according to the corresponding slot by the central server, the mask area is pre-defined by the central server, and the signature is also pre-generated by the central server, the edge nodes do not need any cognitive ability related to the original code. They only need to retrieve the equal-length ciphertext byte fragment matching the slot from the dynamic interference dictionary based on the placeholder address, placeholder length, slot identifier, and random index value, and overwrite it to the corresponding offset. This design directly reduces the complex decryption, rearrangement, and re-signature processes in traditional edge reconstruction to a low-cost offset addressing and memory copy process, avoiding peak computing power crashes and minimizing plaintext leakage.
[0051] In summary, a complete embodiment of the present invention can be summarized as the following continuous process: The central server performs strong encryption on the original code within the trusted domain, uses a position prediction machine learning model to find suitable security breakpoints for setting fixed-length slots in the continuous byte sequence of the ciphertext, and writes equal-length placeholder bytes of data at the corresponding positions to form blank placeholders, such as... Figure 1 and Figure 2 As shown. The central server simultaneously constructs a dictionary of encrypted interference instructions organized hierarchically by slot identifier and length, generates a time seed sequence, establishes a placeholder mask table, and calculates the hash and digital signature based on the core ciphertext bytes after removing the placeholder areas, such as... Figure 3 , Figure 5 and Figure 6 As shown. Subsequently, the central server sends the encrypted code carrying blank placeholders, the basic interference dictionary, the time seed sequence, the digital signature file, and the placeholder mask table to the edge nodes. After receiving the terminal download request, the edge nodes generate a random displacement vector based on the current system timestamp and time seed sequence, perform entry-level cyclic shifting on the basic interference dictionary to form a dynamic interference dictionary, and then use random index values to extract the target interference instruction sequence from the length bucket corresponding to the target slot, blindly write it into each blank placeholder, complete the target installation package encapsulation, and send it to the terminal, as shown. Figure 4 and Figure 7 As shown. After receiving the target installation package, the terminal skips the variable byte region according to the placeholder mask table, performs local hashing only on the core ciphertext region, and uses the signing public key to restore the core ciphertext hash value from the digital signature file for consistency verification. If the verification is successful, the installation is executed, as shown. Figure 8 As shown. This achieves the unification of three objectives: no plaintext at edge nodes, low computational power for dynamic mutations, and terminal signatures.
[0052] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any equivalent substitutions or modifications made by those skilled in the art within the scope of the technology disclosed in the present invention, based on the technical solution and inventive concept of the present invention, should be covered within the scope of protection of the present invention.
Claims
1. A method for dynamic encryption and transmission of installation packages based on edge nodes, characterized in that, Includes the following steps: The central server uses a preset encryption key to perform encryption operations on the original code of the installation package to be processed to obtain ciphertext code. It selects at least one insertion position in the continuous byte sequence of the ciphertext code and writes placeholder byte data at each of the selected insertion positions to generate corresponding blank placeholders. The central server will send the encrypted code of each of the blank placeholders and the interference instruction dictionary to the edge nodes. The interference instruction dictionary contains multiple interference instruction sequences. The edge node receives the installation package download request sent by the terminal, triggers the random number generator to generate a random index value, uses the random index value to extract the target interference instruction sequence from the interference instruction dictionary, and writes the target interference instruction sequence into the insertion position corresponding to each of the blank placeholders to generate the target installation package. The edge node establishes a communication connection with the terminal and transmits the target installation package to the terminal via the communication connection.
2. The method according to claim 1, characterized in that, The central server selects at least one insertion position in the continuous byte sequence of the ciphertext code, including: The central server divides the continuous byte sequence of the ciphertext code into a sequence of ciphertext data blocks; The central server inputs the sequence of encrypted data blocks into a trained location prediction machine learning model; The location prediction machine learning model outputs a set of splicing breakpoint coordinates for the ciphertext data block sequence; The central server determines the insertion position for each splicing breakpoint position coordinate in the set of splicing breakpoint position coordinates.
3. The method according to claim 2, characterized in that, The training steps of the location prediction machine learning model include: Construct a training sample set, which contains multiple sets of training samples. Each set of training samples contains a sequence of encrypted data blocks and a set of labels for the corresponding security breakpoint coordinates. The sequence of encrypted sample data blocks is input into the initial neural network model, which outputs a set of predicted breakpoint coordinates. Calculate the loss function value between the predicted breakpoint location coordinate set and the safe breakpoint location coordinate set labels, update the network parameters of the initial neural network model using the backpropagation algorithm, until the loss function value converges, and obtain the location prediction machine learning model.
4. The method according to claim 1, characterized in that, The steps for generating the interference instruction sequences contained in the interference instruction dictionary include: The central server extracts no-operation instructions, empty loop instructions, and jump-back-to-source address instructions from the standard instruction opcode set. The central server randomly combines the no-operation instruction, the empty loop instruction, and the jump back to the source address instruction into an initial interference instruction segment. The central server uses the preset encryption key to encrypt the initial interference command segment, obtains the interference command sequence, and stores the interference command sequence in the interference command dictionary.
5. The method according to claim 1, characterized in that, The interference instruction dictionary includes a basic interference dictionary and a time seed sequence; The central server will send the ciphertext code of each of the blank placeholders and a dictionary of interference instructions to the edge nodes, including: The central server generates a time seed sequence and a basic interference dictionary; The central server will package and send the ciphertext code of each of the blank placeholders, the basic interference dictionary, and the time seed sequence to the edge node.
6. The method according to claim 5, characterized in that, The edge node uses the random index value to extract the target interference command sequence from the interference command dictionary, including: The edge node obtains the current system timestamp data; The edge node performs a bitwise XOR operation between the time seed sequence and the current system timestamp data to generate a random displacement vector. The edge node uses the value in the random displacement vector as the displacement step size to perform a cyclic shift operation on the byte sequence stored in the basic interference dictionary to obtain a dynamic interference dictionary; The edge node uses the random index value to extract the target interference instruction sequence from the dynamic interference dictionary.
7. The method according to claim 6, characterized in that, The method also includes a dynamic update step: The edge node starts a timer with a preset period; When the timer reaches the preset period, the edge node reacquires the current system timestamp data; The edge node generates a new random displacement vector based on the reacquired current system timestamp data and the time seed sequence; The edge node uses the new random displacement vector to re-perform a cyclic shift operation on the byte sequence stored in the basic interference dictionary to generate an updated dynamic interference dictionary for subsequent extraction of the target interference instruction sequence.
8. The method according to claim 1, characterized in that, After the central server writes placeholder byte data at each selected insertion position and generates corresponding blank placeholders, it also includes: The central server extracts the physical byte offset start address and the corresponding occupied byte length value of each blank placeholder, and writes the physical byte offset start address and the occupied byte length value into the placeholder mask table. The central server removes the region indicated by the starting address of each physical byte offset and the corresponding occupied byte length from the continuous byte sequence of the ciphertext code, extracts the remaining continuous byte sequence, performs hash calculation, and generates the core ciphertext hash value. The central server uses a preset signature private key to perform a signature calculation on the core ciphertext hash value to generate a digital signature file. The central server sends the digital signature file and the placeholder mask table to the edge node.
9. The method according to claim 8, characterized in that, The edge node generates the target installation package, including: The edge node combines and encapsulates the ciphertext code containing the target interference instruction sequence, the digital signature file, and the placeholder mask table to generate the target installation package.
10. The method according to claim 9, characterized in that, After the edge node transmits the target installation package to the terminal, it also includes: The terminal decompresses the target installation package and extracts the ciphertext code containing the target interference instruction sequence, the digital signature file, and the placeholder mask table. The terminal reads the starting address of the offset of each physical byte and the length value of the occupied byte recorded in the placeholder mask table; The terminal skips the byte range indicated by the starting address of each physical byte offset and the corresponding occupied byte length value in the ciphertext code after the target interference instruction sequence is written, and extracts the remaining byte data; The terminal performs a hash calculation on the remaining bytes of data to generate a local verification hash value; The terminal uses a preset signature public key to decrypt the digital signature file and restore the core ciphertext hash value. If it is determined that the data content of the local verification hash value is consistent with that of the core ciphertext hash value, the terminal writes the target installation package into the local storage for installation.
Citation Information
Patent Citations
File encryption processing method and device
CN107483432A