A method and system for encrypting data transmission on a large-scale protected server based on the national cryptographic SM4 algorithm.

By collecting hardware fingerprint data in a large-model protection server and generating a session root key using a convolutional neural network, and then encrypting the data using the national standard SM4 algorithm with a hardware encryption engine, the problem of insufficient hardware-level security protection in existing technologies is solved, and the security and processing efficiency of data transmission are improved.

CN123122970APending Publication Date: 2026-11-17BEIJING ORIENTAL SENTAI TECH DEV CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611464837.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-20
Publication Date
2026-11-17

AI Technical Summary

Technical Problem

Existing technologies have low end-to-end hardware-level security for large model data transmission, and key management and protection mechanisms rely on the software layer, making them vulnerable to high-level software attacks and posing a risk of keys being stolen or counterfeited by malicious software.

Method used

Hardware fingerprint data is generated by collecting remote proof data in the protection server, hardware feature vectors are extracted using a convolutional neural network, a session root key is generated based on the hardware feature vectors, and encryption is performed using the national standard SM4 algorithm in a trusted execution environment to ensure that the encryption operation is performed at the hardware level.

Benefits of technology

It improves the security and real-time protection capabilities of data transmission, reduces the exposure time of keys in the software environment, and increases processing throughput and overall protection strength.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123122970A_ABST
    Figure CN123122970A_ABST
Patent Text Reader

Abstract

This application provides a method and system for encrypting large model protection server data transmission based on the national cryptographic algorithm SM4, relating to the field of data security encryption technology. The method includes: first, collecting remote authentication data generated by a remote certification authority after measuring and verifying the protection server processor through a trusted module, and generating hardware fingerprint data accordingly; then, inputting the hardware fingerprint data into a convolutional neural network to extract hardware feature vectors; next, generating a session root key based on the feature vectors using a key derivation algorithm; then, inputting the session root key into a hardware encryption engine in a trusted execution environment to generate a working key; finally, using this working key, encrypting the large model training data or inference request data received by the server using the national cryptographic algorithm SM4 through the hardware encryption engine, thereby obtaining encrypted data. This application improves the end-to-end hardware-level security protection strength for large model data transmission.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data security encryption technology, and in particular to a method and system for encrypting data transmission on a large-scale protected server based on the national cryptographic SM4 algorithm. Background Technology

[0002] With the widespread application of large models in cloud and multi-party collaborative environments, ensuring the security of data transmission during training and inference has become a critical requirement. This has led to the development of encryption methods for data transmission on large model protection servers based on the national cryptographic SM4 algorithm, which has significant application prospects in high-security scenarios such as finance and government affairs.

[0003] In existing technologies, a common approach is to deploy a software encryption module on the server side. This module first encrypts the transmitted data using the SM4 algorithm, and then transmits the ciphertext over the network to a large-scale server for decryption. This type of scheme can achieve basic data confidentiality, but its key management and computation processes primarily rely on a general-purpose operating system environment.

[0004] Furthermore, the key generation and protection mechanisms of existing methods are often independent of the underlying hardware, and their security strength depends on software-level isolation. In actual deployment, they face the risk that keys may be stolen or counterfeited by malicious software, resulting in a lack of deep binding between the encryption process and the trusted hardware environment. Therefore, existing technologies have the technical problem of weak security foundation of encryption links and difficulty in resisting high-level software attacks. Summary of the Invention

[0005] This application provides a method and system for encrypting large model data transmission on a protected server based on the national cryptographic SM4 algorithm, in order to solve the problem of low end-to-end hardware-level security protection strength for large model data transmission in the prior art.

[0006] To address the aforementioned technical problems, firstly, this application provides a method for encrypting data transmission on a large-scale protected server based on the national cryptographic SM4 algorithm, comprising: Remote authentication data is collected from external trust services through a trusted module in the protection server, and hardware fingerprint data corresponding to the remote authentication data is generated. The remote authentication data is generated by a remote certification authority after measuring and verifying the processor of the protection server. The hardware fingerprint data is input into a convolutional neural network, and the hardware feature vector is extracted through the convolutional neural network. Based on the hardware feature vector, a session root key is generated using a key derivation algorithm; In a trusted execution environment, the session root key is input into the hardware encryption engine in the protection server, and the hardware encryption engine generates a working key based on the session root key. The hardware encryption engine uses the working key and the national cryptographic SM4 algorithm to encrypt the data to be processed received by the protection server to obtain encrypted data, wherein the data to be processed includes large model training data or inference request data.

[0007] Optionally, the step of encrypting the data to be processed received by the protection server using the national standard SM4 algorithm based on the working key through the hardware encryption engine to obtain encrypted data includes: The data to be processed is divided into multiple plaintext blocks, and the working key is loaded into the round key cache of the hardware encryption engine. The working key includes the round keys. For each plaintext block, the SM4 encryption process is executed separately: The current plaintext block is divided into multiple sequentially arranged state words, and these state words are used as the initial state. For the current round, the remaining state words after the first one are XORed with the current round key. The XOR result is then subjected to non-linear byte substitution and linear diffusion. Finally, the linear diffusion result is XORed with the first state word to generate a new state word for the current round. Update the state of the current round according to the order of the state words, and iterate the round operation until the number of encryption rounds specified by the national cryptographic SM4 algorithm is reached. Then, reverse the order of the state words of the last round to obtain the ciphertext data block corresponding to the current plaintext block. All plaintext blocks corresponding to ciphertext blocks are concatenated in the order of their segmentation to form encrypted data.

[0008] Optionally, the step of sequentially performing nonlinear byte substitution and linear diffusion on the obtained XOR result, and XORing the linear diffusion result with the state word in the first position to generate a new state word for the current round, includes: The remaining state words after the first one are XORed with the current round key to obtain the round input word; The input word is divided into multiple bytes, and each byte is replaced according to the non-linear byte replacement rule specified by the national cryptographic SM4 algorithm. The replaced bytes are then combined in their original order to form a replacement word. The replacement word is linearly diffused according to the cyclic shift method specified by the national cryptographic SM4 algorithm to obtain a linear transformation result; The linear transformation result is XORed with the state word at the top to obtain the new state word for the current round.

[0009] Secondly, this application provides a large-scale protection server data transmission encryption system based on the national cryptographic SM4 algorithm, comprising: The acquisition module is used to acquire remote authentication data from external trust services through the trusted module in the protection server, and generate hardware fingerprint data corresponding to the remote authentication data. The remote authentication data is generated by the remote authentication authority after measuring and verifying the processor of the protection server. The extraction module is used to input the hardware fingerprint data into a convolutional neural network and extract hardware feature vectors through the convolutional neural network. The generation module is used to generate a session root key based on the hardware feature vector using a key derivation algorithm. The input module is used to input the session root key into the hardware encryption engine in the protection server in a trusted execution environment, and the hardware encryption engine generates a working key based on the session root key. The encryption module is used to encrypt the data to be processed received by the protection server using the working key and the national cryptographic SM4 algorithm through the hardware encryption engine to obtain encrypted data, wherein the data to be processed includes large model training data or inference request data.

[0010] Thirdly, this application provides an electronic device, comprising: Memory, used to store computer programs; A processor, configured to execute the computer program to implement the steps of the large-scale protection server data transmission encryption method based on the national cryptographic SM4 algorithm as described in the first aspect above.

[0011] Fourthly, this application provides a computer-readable storage medium storing a computer program that, when executed by a processor, can implement the steps of the large-scale protection server data transmission encryption method based on the national cryptographic SM4 algorithm described in the first aspect above.

[0012] The large-scale protection server data transmission encryption method based on the national cryptographic SM4 algorithm provided in this application has the following beneficial effects: First, hardware fingerprint data corresponding to this authentication challenge and arranged in the order of hardware response units is generated through remote proof data, so that the key derivation input is simultaneously associated with the server hardware status and this authentication process. Second, a one-dimensional convolutional neural network is used to perform local aggregation and stabilization processing on repeated response samples of the same hardware to obtain a repeatable hardware feature vector. Then, the hardware feature vector and the random number data generated by the trusted module are jointly input into the key derivation process, so that the session root key simultaneously contains hardware binding information and session randomness. Afterward, key expansion and SM4 national standard calculation are completed within the trusted execution environment and hardware encryption engine to reduce the scope of key materials exposed to the general software environment.

[0013] Furthermore, this method can efficiently complete batch data encryption that conforms to national cryptographic standards by segmenting large data blocks and using a hardware engine for pipelined round operations. At the same time, since the core encryption operations are completed continuously in the hardware, the plaintext exposure time of the data in the system memory is reduced, thereby improving the overall processing throughput and real-time protection capabilities.

[0014] These or other aspects of this application will become more apparent from the description of the following embodiments. Attached Figure Description

[0015] To more clearly illustrate the technical solutions in the embodiments of this application 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 this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0016] Figure 1 A flowchart illustrating a method for encrypting data transmission on a large-scale protected server based on the national cryptographic SM4 algorithm, provided in this application embodiment; Figure 2 This application provides a schematic diagram illustrating a specific implementation of a large-scale protection server data transmission encryption method based on the national cryptographic SM4 algorithm. Figure 3 This is a schematic diagram of the structure of a large-scale protection server data transmission encryption system based on the national cryptographic SM4 algorithm, provided in an embodiment of this application. Detailed Implementation

[0017] To address the problems existing in the prior art, this application provides a method for encrypting data transmission on a large-scale protected server based on the national cryptographic algorithm SM4. This method first collects and verifies the trusted status of the hardware through the trusted module built into the server, thereby generating a unique hardware fingerprint. Then, a neural network is used to extract deep feature vectors from the fingerprint to derive a session key. Finally, in a hardware-isolated trusted execution environment, a dedicated encryption engine is used to complete the data encryption and decryption based on the national cryptographic algorithm SM4.

[0018] Therefore, this scheme uses the hardware state verified remotely as a prerequisite for key derivation, and completes hardware response sampling, feature stabilization and key processing within a trusted module or trusted execution environment. This enables changes in server hardware state to be reflected in the key derivation input and reduces the risk of critical key materials being exposed to a general operating system environment.

[0019] To enable those skilled in the art to better understand the present application, the present application will be further described in detail below with reference to the accompanying drawings and specific embodiments. Obviously, the described embodiments are merely some embodiments of the present application, and not all embodiments. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0020] The core of this application is to provide a method for encrypting data transmission on a large-scale protected server based on the national cryptographic SM4 algorithm. A flowchart of one specific implementation is shown below. Figure 1 As shown, the method includes: Step 101: Collect remote authentication data from external trust services through the trusted module in the protection server, and generate hardware fingerprint data corresponding to the remote authentication data. The remote authentication data is generated by the remote certification authority after measuring and verifying the processor of the protection server.

[0021] In step 101, the remote certification authority refers to a trusted third-party service that performs integrity checks and verifications on the server's hardware configuration and software status; the remote certification data is an electronic certificate generated by the authority, which contains the results of measuring the firmware code and runtime status of key hardware components such as the server's central processing unit and graphics processor, and is used to prove that the server platform is in a trusted and tamper-proof state. Hardware fingerprint data is a repeatable hardware response sampling sequence generated by physically unclonable functional circuits within a trusted module under a specified challenge. The sequence is arranged in a fixed order of challenge number and response unit address; the sequence position corresponds to a fixed circuit response unit or group of response units, and the sequence value is the delay difference, frequency difference, or response bit quantized from the delay difference or frequency difference of the corresponding unit. This hardware fingerprint data is used to characterize the stable response of the same server hardware in repeated sampling and is not used as a true random number.

[0022] In this embodiment, the trusted module integrated in the protection server requests and receives a metric verification report (i.e., remote authentication data) for the server's processor from a remote authentication authority. The trusted module extracts the authentication random number and processor metric digest from the remote authentication data and forms a collection challenge according to a preset encoding order. Inside the trusted module, a physically unclonable functional circuit performs M response samplings for the collection challenge, recording M sample values ​​for each response unit. These values ​​are then arranged sequentially according to the response unit address to generate hardware fingerprint data corresponding to the current remote authentication data, where M is a preset positive integer not less than 3. The original response sample values ​​are stored within the trusted module or trusted execution environment and are not transmitted to external trusted services.

[0023] Step 102: Input the hardware fingerprint data into a convolutional neural network and extract the hardware feature vector through the convolutional neural network.

[0024] In this application, the convolutional neural network adopts a one-dimensional structure suitable for processing ordered hardware response sampling sequences. Specifically, the first one-dimensional convolutional layer uses 32 convolutional kernels of length 5 with a stride of 1, and pads the sequence with zeros at both ends to maintain sequence length; the second activation layer uses the ReLU non-linear activation function; the third pooling layer uses a one-dimensional average pooling window of length 2 with a stride of 2; the fourth flattening layer unfolds the one-dimensional feature sequences of each channel in channel order; the fifth fully connected layer has 128 neurons and uses the Tanh activation function, and then binarizes each dimension according to the reliability threshold determined in the registration stage, outputting a 128-bit hardware feature vector.

[0025] The hardware feature vector is a fixed-length bit vector obtained by the convolutional neural network after denoising, local aggregation, and stabilization of repeated response samples from the same hardware. The hardware feature vector preserves the local measurement relationships corresponding to the sequence of response units and serves as hardware binding material in key derivation; the unpredictability required for key derivation is provided by subsequently acquired random number data.

[0026] In this embodiment, step 102 includes the following process: Step 1021: Input the hardware fingerprint data into the convolutional layer of the convolutional neural network, and perform convolution calculation between the hardware fingerprint data and the first weight parameter in the convolutional layer to obtain the first intermediate tensor.

[0027] In step 1021, the first weight parameters are a set of one-dimensional feature filter parameters trained by the convolutional neural network using multiple batches of hardware response samples locally collected by the trusted module of the server during the server registration phase. These parameters are used to identify local difference patterns between adjacent response units and stable components when the same response unit is sampled multiple times, rather than to analyze the correlation between random numbers.

[0028] The first intermediate tensor is a set of multi-channel feature sequences formed by one-dimensional convolution. Each channel sequentially provides a convolution response on a fixed response unit address axis, which is used to represent the local combined features of adjacent response units and their repeated sampled values.

[0029] In this embodiment, hardware fingerprint data is fed into a one-dimensional convolutional layer using the response unit address as the sequence position and M sampled values ​​from the same response unit as the input channel. The one-dimensional convolutional kernel slides along the response unit address axis, performing weighted combination of sampled values ​​from several consecutive response units to extract the difference relationship between adjacent physical response units and the consistency of repeated sampling, thereby generating a first intermediate tensor. The object of convolution processing is the measurement sequence organized according to the physical response unit order, not cryptographic random numbers or decryption of hardware fingerprints.

[0030] In practical applications, convolutional neural networks are trained locally during the initial trusted registration or maintenance calibration phase of the server. Within permissible temperature and load conditions, the trusted module repeatedly samples the same set of acquisition challenges to form training samples. For each response unit, a registration reference response is formed using the median or multiple values ​​from the multiple samples. The deviation of each training sample from the registration reference response is used as the training objective, ensuring the network output remains stable across repeated sampling on the same server. Both training samples and registration reference responses are encapsulated and stored within the trusted module or trusted execution environment of the server, eliminating the need to aggregate, access, or publicly expose real hardware fingerprint datasets from different trusted platform modules.

[0031] After training, the first weight parameter is used to suppress sampling noise in the server's hardware response. In one example, the hardware fingerprint data contains 256 response units arranged by address, each with 4 repeated sample values; the one-dimensional convolutional layer takes 4 sampling channels as input, uses 32 convolutional kernels of length 5 to compute along the 256 response positions, and outputs 32 one-dimensional feature sequences of length 256, which together constitute the first intermediate tensor.

[0032] Step 1022: Input the first intermediate tensor into the activation layer of the convolutional neural network, and perform a nonlinear mapping on the first intermediate tensor in the activation layer to obtain a second intermediate tensor corresponding to the hardware security features.

[0033] In step 1022, the nonlinear mapping transforms the first intermediate tensor element by element through an activation function to preserve the positive convolutional response that reflects the local difference and resampling stability of the response unit, and to suppress responses below the activation threshold.

[0034] The second intermediate tensor is a set of multi-channel one-dimensional feature sequences obtained after nonlinear activation, which is used to provide local features arranged according to the address of the response unit for subsequent pooling.

[0035] In this embodiment, the activation layer uses the ReLU activation function to set the negative values ​​in the first intermediate tensor to zero and retain the non-negative values, so as to reduce the influence of low response components on subsequent local aggregation and obtain the second intermediate tensor.

[0036] In practical applications, if the convolution responses of two adjacent positions in the first intermediate tensor are -0.05 and 1.5 respectively, they will be 0 and 1.5 after ReLU processing. This processing only changes the numerical representation of the convolutional layer output and does not change the arrangement order of the response units in the hardware fingerprint data.

[0037] Step 1023: Input the second intermediate tensor into the pooling layer of the convolutional neural network, and perform dimensionality reduction on the second intermediate tensor in the pooling layer to obtain the third intermediate tensor.

[0038] In step 1023, the dimensionality reduction process involves performing one-dimensional pooling on the second intermediate tensor along the address axis of the response unit. The pooling window aggregates the convolutional responses of adjacent response units to shorten the feature sequence and reduce the impact of single-sample fluctuations on subsequent fully connected computations.

[0039] The third intermediate tensor is a set of multi-channel one-dimensional feature sequences obtained after pooling. Its sequence length is smaller than that of the second intermediate tensor, while preserving the arrangement relationship of each channel along the address axis of the response unit.

[0040] In this embodiment, the pooling layer employs a one-dimensional average pooling operation with a length of 2 and a stride of 2. For each feature channel, the pooling layer divides the responses of two adjacent convolutions into a window according to their address order and calculates the average value to obtain a third intermediate tensor.

[0041] In practical applications, if the eigenvalues ​​of two adjacent positions in a certain channel of the second intermediate tensor are 0.92 and 0.88, the corresponding pooling window output is 0.90. By performing the same operation on each channel in sequence, the feature sequence of length 256 can be compressed into a feature sequence of length 128.

[0042] Step 1024: Input the third intermediate tensor into the flattening layer of the convolutional neural network, and convert the third intermediate tensor into a linear data sequence in the flattening layer.

[0043] In step 1024, the flattening layer reads all elements of the third intermediate tensor according to the predetermined channel order and the response position order within each channel, and arranges them into a one-dimensional data sequence for unified calculation by the connection layer.

[0044] A linear data sequence is a data list formed by concatenating the one-dimensional feature sequences of each channel after pooling in a fixed order; the fixed unfolding order allows each data position to be traced back to the corresponding feature channel and response position.

[0045] In this embodiment, the flattening layer first reads all elements from the first to the last response position in the first feature channel, and then reads the remaining feature channels in sequence according to the channel number to form a continuous one-dimensional array.

[0046] In practical applications, continuing from the previous example, the third intermediate tensor consists of 32 one-dimensional feature sequences of length 128; the flattened layer extracts 32×128 values ​​in channel order to form a linear data sequence of length 4096.

[0047] Step 1025: Input the linear data sequence into the connection layer of the convolutional neural network, and calculate the linear data sequence according to the second weight parameter in the connection layer to obtain the hardware feature vector.

[0048] In step 1025, the second weight parameter is a parameter matrix learned by the connection layer during the local training phase, which is used to map a linear data sequence of length 4096 into a 128-dimensional output and to make the output obtained by repeated sampling on the same server under allowed environmental conditions close to the registered reference response.

[0049] In this embodiment, the connection layer multiplies the second weight parameter matrix with the linear data sequence and adds a bias to obtain a 128-dimensional intermediate vector, which is then processed by the Tanh activation function to obtain a 128-dimensional output. Based on the reliability threshold determined for each dimension during the registration phase, each dimension is quantized to 0 or 1 to obtain a 128-bit hardware feature vector. For dimensions whose stability does not meet the requirements during the registration phase, other stable dimensions can be selected through a reliability mask to supplement the 128 bits.

[0050] In practical applications, local training uses hardware fingerprint data from the same server across different sampling batches as input, aiming to register a reference response. It optimizes the first and second weight parameters, enabling the network to learn and correct for minor fluctuations caused by temperature, load, and sampling noise. After training, the network parameters and the registered reference response are sealed and stored together by a trusted module and bound to the current server. During runtime, only the quantized hardware feature vector is output, not the original hardware response sample values. This training process is used to stabilize repeated responses from the same hardware, not to recover random number patterns or distinguish external devices.

[0051] Through the above processing, the repeatable hardware measurement sequence organized by the response unit address is transformed into a stable hardware feature vector after one-dimensional convolution, pooling and quantization, thereby providing verifiable hardware binding material for the session root key and avoiding the misinterpretation of true random numbers as spatially correlated convolution inputs.

[0052] Step 103: Based on the hardware feature vector, generate the session root key using a key derivation algorithm.

[0053] The session root key refers to a temporarily generated cryptographic key seed used to protect the current single large model data processing session. In this application, the key is derived from the hardware feature vector representing the uniqueness of the hardware and the source of random entropy. Its core purpose is to ensure that the key is only valid for the current session and the current verified trusted hardware environment, thereby establishing a strong binding relationship between the encryption operation and the specific hardware trust root.

[0054] In this embodiment, step 103 includes the following process: Step 1031: Obtain random number data and concatenate the hardware feature vector with the random number data to obtain combined key data.

[0055] In step 1031, random number data refers to a sequence of unpredictable bits generated by the true random number generator inside the trusted module of the protection server. This sequence introduces an additional source of entropy into the key derivation process, with the aim of enhancing the randomness and unpredictability of the derived key. Combined key data refers to a longer data block formed by concatenating the hardware feature vector and the random number data in bit order. Its function is to integrate deterministic hardware features and uncertain random numbers into a unified input for key derivation.

[0056] In this embodiment of the application, the random number generation unit inside the trusted module is first invoked to generate a fixed-length random number data in real time; then, the hardware feature vector representing the hardware identity is concatenated with the generated random number data. Specifically, the bits of the random number data are appended to the bits of the hardware feature vector to form a new data block containing hardware information and random information, namely the combined key data.

[0057] In practical applications, the hardware feature vector is a 128-bit sequence obtained by reliability threshold quantization, and the random number data generated by the trusted module can also be set to 128 bits; the two are concatenated in a predetermined order to obtain a combined key data with a length of 256 bits.

[0058] Step 1032: Based on the combined key data, perform multiple rounds of iterative calculations using a preset key derivation function to generate an initial key.

[0059] In step 1032, the key derivation function is a deterministic derivation function based on the SM3 hash operation, used to compress the combined key data and round count value into a fixed-length pseudo-random key material. The input encoding, round counting method, and output truncation order of this function are consistent between the protection server and the corresponding decryption end.

[0060] In this embodiment, Z(0) = SM3(D||C) is first calculated, where D is the combined key data and C is the context identifier used to distinguish between large model training data and inference request data; then, for the j-th round, Z(j) = SM3(Z(j-1)||D||C||j) is calculated, where j is an integer from 1 to R, and R is a preset number of derived rounds not less than 2; Z(R) is used as the 256-bit initial key. The symbol || indicates that the fields are concatenated in order, and each field uses a fixed-length encoding.

[0061] In practical applications, if the combined key data D is 256 bits, the context identifier C is a fixed 32-bit encoding, and the number of derived rounds R is set to 2, then Z(0), Z(1), and Z(2) are calculated sequentially. Each SM3 operation outputs 256 bits of data, and Z(2) is used as the initial key. This process does not require calling or disclosing the original hardware response sample values.

[0062] Step 1033: Perform a length adjustment operation on the initial key to obtain the session root key.

[0063] In this embodiment of the application, the initial key is truncated or expanded according to the 128-bit key length required by the national cryptographic SM4 algorithm. Specifically, the length of the initial key is checked. If its length is greater than 128 bits, the first 128 bits are taken as the session root key. If its length is less than 128 bits, a key derivation function is used to derive another 128-bit key as the session root key using the initial key as a seed.

[0064] In practical applications, continuing from the previous example, the initial key is 256 bits of data output by the SM3 algorithm; since a 128-bit session root key needs to be generated, the first 128 bits of the 256 bits of data are directly extracted as the final session root key.

[0065] Through the above steps, the hardware feature vector is used to provide hardware binding information, and the random number data generated in real time by the trusted module is used to provide session randomness. The two are then used to form the session root key after fixed encoding and SM3 hash iteration, thereby reducing the exposure risk caused by relying solely on the software environment to store the fixed key.

[0066] Step 104: In a trusted execution environment, input the session root key into the hardware encryption engine in the protection server, and generate a working key based on the session root key through the hardware encryption engine.

[0067] The Trusted Execution Environment (TEX) refers to a secure isolation area created within the central processing unit of the protection server using hardware isolation technology. Code execution and data access within this area are protected at the hardware level. Its purpose in this application is to provide a secure execution space that is free from external software snooping or tampering for the conversion of the root key to the working key.

[0068] The hardware encryption engine refers to a dedicated cryptographic coprocessor unit integrated inside the motherboard or central processing unit of the protection server. This unit contains dedicated circuitry for high-speed execution of the SM4 national cryptographic algorithm and its key expansion logic.

[0069] The working key is a key set consisting of multiple round keys arranged in sequence. It is derived from the session root key by the hardware encryption engine according to the key extension specification of the national cryptographic SM4 algorithm, and is directly used to perform multiple rounds of encryption or decryption operations on data blocks.

[0070] In this embodiment, step 104 includes the following process: Step 1041: Write the session root key into the key register of the hardware encryption engine.

[0071] In step 1041, the key register is a set of dedicated storage circuits inside the hardware encryption engine for temporarily storing key materials. The register is located inside the hardware encryption engine, and its access rights are protected by the hardware isolation mechanism of the trusted execution environment. In this application, the register is used to securely receive and temporarily store the session root key from outside the trusted execution environment, providing initial input for subsequent key expansion.

[0072] In this embodiment of the application, firstly, under the protection of the trusted execution environment, the session root key is directly transferred from the memory area of ​​the trusted execution environment and written into the key register specified by the hardware encryption engine through a protected write instruction.

[0073] In practical applications, assuming the session root key is a 128-bit binary sequence, for example, represented in hexadecimal as 0x0123456789ABCDEFFEDCBA9876543210, the trusted execution environment writes this 128-bit data block completely into the key register of the engine through a special "secure store" instruction that points to a specific address of the hardware encryption engine.

[0074] Step 1042: Trigger the key expansion unit of the hardware encryption engine, and the key expansion unit reads the session root key in the key register.

[0075] In step 1042, the key expansion unit is a dedicated logic circuit module inside the hardware encryption engine. This module has embedded the key expansion algorithm of the national cryptographic SM4 algorithm. Its function is to automatically calculate and output the round keys required for all rounds according to the input root key and predetermined rules.

[0076] In this embodiment of the application, after the session root key is written, a control command to start key expansion is sent to the hardware encryption engine, thereby triggering the key expansion unit inside it to start working; after receiving the trigger signal, the key expansion unit reads the stored session root key from the adjacent key register as the initial seed for the key expansion process.

[0077] In practical applications, the software layer executes a "start key expansion" instruction in the trusted execution environment, which sends a specific signal to the control port of the hardware encryption engine. After detecting the signal, the key expansion unit in the engine immediately reads all 128 bits of the session root key from the data bus connected to the key register inside it.

[0078] Step 1043: The key expansion unit divides the session root key into four 32-bit master key words, XORs them with the system parameters specified by the national cryptographic SM4 algorithm to obtain four initial expansion words. For the i-th round, the (i+1)-th, (i+2)-th, and (i+3)-th expansion words are XORed with the i-th fixed parameter. The XOR results are then subjected to S-box nonlinear transformation and cyclic left shift by 13 bits and 23 bits linear transformation, and XORed with the i-th expansion word to obtain the (i+4)-th expansion word. The (i+4)-th expansion word is used as the i-th round key. The process iteratively generates 32 round keys and combines them in round order to form the working key.

[0079] In step 1043, the session root key is represented as four 32-bit master key words MK(0) to MK(3). The four master key words are XORed with the system parameters FK(0) to FK(3) specified by the national cryptographic SM4 algorithm to obtain the initial extension words K(0) to K(3); the fixed parameter CK(i) is a 32-bit constant used in the i-th round of key expansion.

[0080] In this embodiment, for i = 0 to 31, the key expansion unit first calculates K(i+1)⊕K(i+2)⊕K(i+3)⊕CK(i), performs S-box substitution byte by byte on the resulting 32-bit word, then cyclically shifts the substituted 32-bit word left by 13 bits and 23 bits respectively, and XORs it with the substitution word to obtain the key linear transformation result; XOR the key linear transformation result with K(i) to obtain K(i+4), and sets rk(i) = K(i+4). After obtaining rk(0) to rk(31) in sequence, they are combined in round order to form the working key.

[0081] This application, through the above steps, securely and efficiently extends the root key bound to the session and hardware into a working key directly usable by the national cryptographic SM4 algorithm in a hardware-isolated trusted environment using dedicated hardware circuitry. This process is completed in a closed loop within the hardware, ensuring that the working key generation is not affected by the software environment, and providing secure and efficient key support for subsequent high-speed data encryption and decryption.

[0082] Step 105: The hardware encryption engine encrypts the data to be processed received by the protection server using the national cryptographic SM4 algorithm based on the working key to obtain encrypted data, wherein the data to be processed includes large model training data or inference request data.

[0083] The data to be processed refers to the original business data transmitted from the data provider or user to the protection server via the network, and the encrypted data refers to the ciphertext result output after the data to be processed has been fully processed by the hardware encryption engine.

[0084] In this embodiment, step 105 includes the following process: Step 1051: Divide the data to be processed into multiple plaintext blocks and load the working key into the round key cache of the hardware encryption engine. The working key includes the round keys.

[0085] In step 1051, a plaintext block refers to multiple independent data blocks obtained by dividing the data to be processed according to the fixed length required by the national cryptographic SM4 algorithm, and a round key cache is a fast storage area inside the hardware encryption engine used to temporarily store all round keys.

[0086] In this embodiment, the data preprocessor of the protection server processes the data to be processed according to the 128-bit block length of the national cryptographic SM4 algorithm. When the data length is not an integer multiple of 128 bits, the last block is first padded according to a preset padding rule, and the padding length is recorded. Subsequently, the working key, which consists of 32 round keys in sequence, is loaded into the round key cache inside the hardware encryption engine.

[0087] In practical applications, assuming the data to be processed is a training sample data of a large model with a total length of 1024 bytes, or 8192 bits; divided into 128-bit (16-byte) blocks, 8192 divided by 128 equals 64 plaintext blocks; at the same time, the 32 round keys of the working key are loaded as a whole into the on-chip static memory of the hardware encryption engine.

[0088] For each plaintext block, the SM4 encryption process is executed separately: Step 1052: Divide the current plaintext block into four 32-bit state words X(0), X(1), X(2) and X(3), and use the four state words as the initial state.

[0089] In step 1052, status words X(0) to X(3) are formed in byte order in the plaintext block, and each status word is 32 bits. The status words generated in subsequent rounds are denoted as X(4) to X(35) in sequence.

[0090] In this embodiment of the application, the data preprocessor divides the 128-bit plaintext block into four consecutive 32-bit words in order from the most significant bit to the least significant bit, and writes the four words into the status register of the hardware encryption engine as the initial state before the 0th round of operation.

[0091] In practical applications, if the plaintext block is 0x00112233445566778899AABBCCDDEEFF, then X(0)=0x00112233, X(1)=0x44556677, X(2)=0x8899AABB, X(3)=0xCCDDEEFF; the 32-bit round key of the current round is not directly XORed with the entire 128-bit plaintext block.

[0092] Step 1053: For the i-th round, perform an XOR operation on the state words X(i+1), X(i+2), X(i+3) and the current round key rk(i). Perform an S-box nonlinear transformation and a linear transformation on the XOR result in sequence, and perform an XOR operation on the linear transformation result with the state word X(i) to obtain the state word X(i+4), where i is an integer from 0 to 31.

[0093] Step 1053 may specifically include the following steps, such as Figure 2 As shown: A1: Perform an XOR operation on the status words X(i+1), X(i+2), X(i+3) and the current round key rk(i) to obtain the 32-bit round input word.

[0094] In step A1, all four data involved in the XOR operation are 32 bits; the XOR result is also 32 bits and is used as the input for the current round of synthetic permutation.

[0095] In this embodiment, the hardware encryption engine reads three consecutive status words from the status register and reads the current round key from the round key cache, and calculates B=X(i+1)⊕X(i+2)⊕X(i+3)⊕rk(i) through a 32-bit XOR circuit.

[0096] In practical applications, the round input word B is calculated by reading X(1), X(2), X(3) and rk(0) in round 0; this calculation does not require expanding the 32-bit round key to 128 bits.

[0097] A2: Divide the round input word into four 8-bit bytes, and perform non-linear replacement byte by byte according to the S-box replacement rule defined by the national cryptographic SM4 algorithm to obtain a 32-bit replacement word.

[0098] In step A2, the input word B is divided into b(0), b(1), b(2) and b(3) from the high bit to the low bit. The S boxes specified by the national cryptographic SM4 algorithm are searched to obtain Sbox(b(0)) to Sbox(b(3)), and then combined into a 32-bit replacement word B' according to the original byte order.

[0099] In this embodiment, the hardware encryption engine completes byte replacement in parallel through four-way 8-bit S-box lookup logic, and the four outputs are written to the 32-bit register according to the original byte position.

[0100] In practical applications, if the input word contains four bytes b(0), b(1), b(2) and b(3) in sequence, the replacement word is represented as Sbox(b(0))||Sbox(b(1))||Sbox(b(2))||Sbox(b(3)); the symbol || indicates that the bytes are connected in byte order.

[0101] A3: Circularly shift the 32-bit replacement word to the left by 2, 10, 18, and 24 bits respectively, and perform an XOR operation between each circular left shift result and the 32-bit replacement word to obtain the linear transformation result.

[0102] In step A3, let the 32-bit replacement word be B', then the linear transformation result L(B') = B'⊕(B'<<<2)⊕(B'<<<10)⊕(B'<<<18)⊕(B'<<<24), where <<< indicates that a circular left shift is performed on the 32-bit word.

[0103] In this embodiment of the application, the hardware encryption engine forms four cyclic left shift results through fixed wiring, and uses an XOR tree to merge the four cyclic left shift results with the original replacement word to obtain a 32-bit linear transformation result.

[0104] A4: Perform an XOR operation between the linear transformation result and the state word X(i) to obtain the state word X(i+4).

[0105] In step A4, the output of this round satisfies X(i+4)=X(i)⊕L(B'). Therefore, each round generates only a new 32-bit state word, which together with the other three state words constitutes the four-word state required for the next round.

[0106] In this embodiment of the application, after obtaining X(i+4), the status register retains X(i+1), X(i+2) and X(i+3), and writes X(i+4) into the next status position for reading in the (i+1)th round.

[0107] In practical application, in round 0, X(4) is obtained from X(0) to X(3) and rk(0), and in round 1, X(5) is obtained from X(1) to X(4) and rk(1), and so on until round 31 to obtain X(35).

[0108] Step 1054: Iterate through 32 rounds of operations to obtain status words X(32) to X(35), and arrange them in the order of X(35), X(34), X(33), X(32) to obtain the ciphertext data block corresponding to the current plaintext block.

[0109] In step 1054, the national cryptographic SM4 algorithm performs 32 rounds of iteration on each 128-bit plaintext block; after the 32 rounds, the last four 32-bit status words are reversed to form a 128-bit ciphertext data block.

[0110] In this embodiment of the application, the control unit of the hardware encryption engine increments i from 0 to 31, reads rk(i) in each round and executes step 1053; after the 31st round, it outputs X(35)||X(34)||X(33)||X(32) as a ciphertext data block, where || indicates sequential concatenation.

[0111] In practical applications, the pipeline circuit can process different plaintext blocks in parallel while maintaining the above 32 rounds of data dependency and reverse output relationship; the input and output width of the round function of each plaintext block is 32 bits, and the final ciphertext block length is 128 bits.

[0112] Step 1055: Concatenate the ciphertext data blocks corresponding to all plaintext blocks according to the segmentation order to form encrypted data.

[0113] In this embodiment of the application, the data post-processor collects each ciphertext data block output by the hardware encryption engine in sequence and forms encrypted data; if the last group is padded before encryption, the encrypted data also records the padded length so that the decryption end can remove the padded data after decryption.

[0114] In practical applications, for the 64 plaintext blocks previously segmented, the hardware encryption engine encrypts them sequentially and outputs 64 ciphertext data blocks; the data post-processor concatenates these 64 128-bit blocks end to end to form a bit stream with a total length of 8192 bits, which is the final encrypted data.

[0115] In this embodiment, after step 105, the following process is also included: B1: Input the encrypted data into a pre-trained sequence analysis model, analyze the data packet sequence characteristics of the encrypted data through the sequence analysis model, and generate evaluation data.

[0116] In step B1, the sequence analysis model refers to a machine learning model that has been pre-trained using labeled encrypted traffic data. This model can learn the patterns of encrypted data streams in terms of statistical features. Furthermore, this application does not impose specific limitations on the structural design of the internal structure of the sequence analysis model, such as the layers, and can set them according to the actual situation.

[0117] Packet sequence characteristics refer to the statistical properties of encrypted data at the traffic level, such as timing, size, and interval. Evaluation data is a numerical vector used to quantify the degree of similarity between the characteristic patterns of the current encrypted data stream and the normal pattern.

[0118] In this embodiment of the application, after obtaining the encrypted data, it is first sampled at the transmission layer to extract a series of statistical features, such as the mean and variance of the data packet size, the distribution of the packet arrival time interval, and the byte entropy value. Then, these features are combined into a feature vector and input into the pre-trained sequence analysis model. The model calculates the feature vector using algorithms such as multi-layer neural networks or decision trees, and finally outputs one or more values, which constitute the evaluation data.

[0119] In practical applications, the sequence analysis model can be a long short-term memory network model; the encrypted data is simulated as network transmission and divided into a series of fixed-size data packets; the packet size sequence [s1, s2, ..., s100] of the most recent 100 data packets is extracted as input features; the LSTM model processes the sequence step by step, and the hidden state of the last time step is passed through a fully connected layer to output a vector with a dimension of 10, which is the evaluation data.

[0120] B2: Input the evaluation data into a preset neural network, and use the preset neural network to identify the security status of the evaluation data and generate a security status label.

[0121] In step B2, the preset neural network is a neural network for binary classification or fine-grained classification, which maps the evaluation data to a category label representing a security status. Furthermore, this application does not specifically limit the structural design of the internal structure of the preset neural network, such as the layers, and can set them according to the actual situation. The security status label is a discrete category identifier, such as "safe" or "suspicious".

[0122] In this embodiment, the evaluation data is used as input and fed into a preset fully connected neural network classifier. The classifier contains several hidden layers, which perform nonlinear transformations on the input data and finally obtain the probability distribution of each security state category through a Softmax output layer. The category with the highest probability is taken as the final security state label.

[0123] In practical applications, assume that the evaluation data is a 10-dimensional vector [e1, e2, ..., e10]; the preset neural network has three layers, with 64 neurons in the first layer, 32 neurons in the second layer, and 2 neurons in the output layer corresponding to "safe" and "suspicious"; the network calculates the 10-dimensional input vector sequentially through each layer, and finally outputs a two-dimensional probability vector, for example [0.92, 0.08], indicating that the probability of "safe" is 0.92 and the probability of "suspicious" is 0.08, so the generated safety status is marked as "safe".

[0124] B3: Match the security status flag with the preset security policy database.

[0125] In step B3, the security policy database is a rule base stored locally on the protection server, which defines the processing actions that should be taken under different security states.

[0126] In this embodiment of the application, the security policy database is queried to find one or more processing rules associated with the security status flag.

[0127] B4: If the matching result is successful, the large model is processed accordingly based on the encrypted data; or, if the matching result fails, an alarm instruction is generated and the use of the data is stopped.

[0128] In step B4, the corresponding processing refers to sending the encrypted data to the large model server, where the SM4 encryption is decrypted sequentially using the decryption round keys corresponding to the working key within the trusted execution environment of the large model server, and then the recovered data to be processed is handed over to the large model training or inference process. The large model does not directly use the SM4 ciphertext as training samples or inference request content. The alarm command is a signal used to notify the system administrator of any transmission risks.

[0129] In this embodiment, a branch operation is performed based on the matching result; if the security status flag matches the "allow" rule in the security policy database, the system transmits the encrypted data to the large model service unit, and delivers the large model after decryption in the trusted execution environment of the unit; if the matching fails, the system generates an alarm log and interrupts the transmission of encrypted data to the large model service unit.

[0130] In practical applications, when the security status is marked as "secure" and a successful match is made, the encrypted data enters the trusted execution environment of the large model server. After being decrypted and padded using the national cryptographic standard SM4, the original inference request data is obtained and then handed over to the inference process. When the security status is marked as "suspicious" and there are no allowed rules, the system suspends the request and retains the alarm record.

[0131] Through the above steps, this application not only achieves high-speed and secure encryption of business data according to national cryptographic standards at the hardware level, but also performs intelligent security assessment and policy control on the data stream itself based on machine learning after encryption, realizing dual protection from cryptographic security to application-layer behavioral security, and improving the overall trustworthy control capability of data transmission and use.

[0132] Figure 3 A schematic diagram of a large-scale protection server data transmission encryption system based on the national cryptographic SM4 algorithm provided in this application embodiment is shown below. Figure 3 As shown, the system includes: The acquisition module 31 is used to acquire remote authentication data from an external trust service through a trusted module in the protection server, and generate hardware fingerprint data corresponding to the remote authentication data. The remote authentication data is generated by a remote authentication authority after measuring and verifying the processor of the protection server.

[0133] The extraction module 32 is used to input the hardware fingerprint data into a convolutional neural network and extract hardware feature vectors through the convolutional neural network.

[0134] The generation module 33 is used to generate a session root key based on the hardware feature vector using a key derivation algorithm.

[0135] Input module 34 is used to input the session root key into the hardware encryption engine in the protection server in a trusted execution environment, and generate a working key based on the session root key through the hardware encryption engine.

[0136] The encryption module 35 is used to encrypt the data to be processed received by the protection server based on the working key and using the national cryptographic SM4 algorithm through the hardware encryption engine to obtain encrypted data, wherein the data to be processed includes large model training data or inference request data.

[0137] The large-scale protection server data transmission encryption system based on the national cryptographic SM4 algorithm in this application embodiment is used to implement the aforementioned large-scale protection server data transmission encryption method based on the national cryptographic SM4 algorithm. Therefore, the specific implementation of the large-scale protection server data transmission encryption system based on the national cryptographic SM4 algorithm can be found in the embodiment section of the large-scale protection server data transmission encryption method based on the national cryptographic SM4 algorithm above. The specific implementation can be referred to the description of the corresponding embodiment, and will not be repeated here.

[0138] This application also provides an electronic device, comprising: a memory for storing a computer program; and a processor for executing the computer program to implement the steps of the above-described method for encrypting data transmission of a large-scale protected server based on the national cryptographic SM4 algorithm.

[0139] This application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of any of the above-described methods for encrypting data transmission in a large-scale protected server based on the national cryptographic SM4 algorithm.

[0140] In one exemplary embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as USB flash drives, read-only memory, random access memory, portable hard drives, magnetic disks, or optical disks.

[0141] The embodiments of this application also provide a computer program product, which includes a computer program that, when executed by a processor, implements the steps in any of the embodiments of the large-scale protection server data transmission encryption method based on the national cryptographic SM4 algorithm.

[0142] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0143] The foregoing has provided a detailed description of a method and system for encrypting data transmission on a large-scale protected server based on the SM4 national cryptographic algorithm. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the embodiments above are merely for the purpose of helping to understand the method and its core ideas. It should be noted that those skilled in the art can make various improvements and modifications to this application without departing from its principles, and these improvements and modifications also fall within the protection scope of this application.

Claims

1. A method for encrypting data transmission on a large-scale protected server based on the national cryptographic SM4 algorithm, characterized in that, include: Remote authentication data is collected from external trust services through a trusted module in the protection server, and hardware fingerprint data corresponding to the remote authentication data is generated. The remote authentication data is generated by a remote certification authority after measuring and verifying the processor of the protection server. The hardware fingerprint data is input into a convolutional neural network, and the hardware feature vector is extracted through the convolutional neural network. Based on the hardware feature vector, a session root key is generated using a key derivation algorithm; In a trusted execution environment, the session root key is input into the hardware encryption engine in the protection server, and the hardware encryption engine generates a working key based on the session root key. The hardware encryption engine uses the working key and the national cryptographic SM4 algorithm to encrypt the data to be processed received by the protection server to obtain encrypted data, wherein the data to be processed includes large model training data or inference request data.

2. The method according to claim 1, characterized in that, The process involves using the hardware encryption engine based on the working key and employing the national standard SM4 algorithm to encrypt the data to be processed received by the protection server, thereby obtaining encrypted data, including: The data to be processed is divided into multiple plaintext blocks, and the working key is loaded into the round key cache of the hardware encryption engine. The working key includes the round keys. For each plaintext block, the SM4 encryption process is executed separately: The current plaintext block is divided into multiple sequentially arranged state words, and these state words are used as the initial state. For the current round, the remaining state words after the first one are XORed with the current round key. The XOR result is then subjected to non-linear byte substitution and linear diffusion. Finally, the linear diffusion result is XORed with the first state word to generate a new state word for the current round. Update the state of the current round according to the order of the state words, and iterate the round operation until the number of encryption rounds specified by the national cryptographic SM4 algorithm is reached. Then, reverse the order of the state words of the last round to obtain the ciphertext data block corresponding to the current plaintext block. All plaintext blocks corresponding to ciphertext blocks are concatenated in the order of their segmentation to form encrypted data.

3. The method according to claim 2, characterized in that, The process of sequentially performing nonlinear byte replacement and linear diffusion on the obtained XOR result, and then XORing the linear diffusion result with the state word at the top to generate a new state word for the current round, includes: The remaining state words after the first one are XORed with the current round key to obtain the round input word; The input word is divided into multiple bytes, and each byte is replaced according to the non-linear byte replacement rule specified by the national cryptographic SM4 algorithm. The replaced bytes are then combined in their original order to form a replacement word. The replacement word is linearly diffused according to the cyclic shift method specified by the national cryptographic SM4 algorithm to obtain a linear transformation result; The linear transformation result is XORed with the state word at the top to obtain the new state word for the current round.

4. The method according to claim 1, characterized in that, The step of inputting the hardware fingerprint data into a convolutional neural network and extracting hardware feature vectors through the convolutional neural network includes: The hardware fingerprint data is input into the convolutional layer of the convolutional neural network, and the hardware fingerprint data is convolved with the first weight parameter in the convolutional layer to obtain the first intermediate tensor. The first intermediate tensor is input into the activation layer of the convolutional neural network, and a nonlinear mapping is performed on the first intermediate tensor in the activation layer to obtain a second intermediate tensor corresponding to the hardware security features. The second intermediate tensor is input into the pooling layer of the convolutional neural network, and the second intermediate tensor is dimensionality reduced in the pooling layer to obtain the third intermediate tensor. The third intermediate tensor is input into the flattening layer of the convolutional neural network, where the third intermediate tensor is converted into a linear data sequence. The linear data sequence is input into the connection layer of the convolutional neural network, and the hardware feature vector is obtained by calculating the linear data sequence according to the second weight parameter in the connection layer.

5. The method according to claim 1, characterized in that, The step of generating a session root key based on the hardware feature vector using a key derivation algorithm includes: Obtain random number data, and concatenate the hardware feature vector with the random number data to obtain combined key data; Based on the combined key data, multiple rounds of iterative calculations are performed using a preset key derivation function to generate an initial key; The initial key is length-adjusted to obtain the session root key.

6. The method according to claim 1, characterized in that, The step of inputting the session root key into the hardware encryption engine in the protection server, and generating a working key based on the session root key by the hardware encryption engine, includes: Write the session root key into the key register of the hardware encryption engine; The key expansion unit of the hardware encryption engine is triggered, and the key expansion unit reads the session root key from the key register; The key expansion unit divides the session root key into multiple master key words according to the key expansion order specified by the national cryptographic SM4 algorithm, and generates initial expansion words based on system parameters. For the current key expansion round, adjacent expansion words are XORed with their corresponding fixed parameters. The XOR results are then subjected to nonlinear byte substitution and key linear transformation in sequence. The key linear transformation results are XORed with the corresponding expansion words to generate the current round key. The round keys are iteratively generated and combined into working keys according to the round order.

7. The method according to claim 1, characterized in that, After obtaining the encrypted data, it also includes: The encrypted data is input into a pre-trained sequence analysis model, which analyzes the data packet sequence characteristics of the encrypted data to generate evaluation data. The evaluation data is input into a preset neural network, and the preset neural network is used to identify the security status of the evaluation data and generate a security status label. The security status marker is matched with a preset security policy database; If the matching result is successful, the large model is processed accordingly based on the encrypted data; otherwise, if the matching result fails, an alarm instruction is generated and the use of the data is stopped.

8. A large-scale protection server data transmission encryption system based on the national cryptographic SM4 algorithm, characterized in that, include: The acquisition module is used to acquire remote authentication data from external trust services through the trusted module in the protection server, and generate hardware fingerprint data corresponding to the remote authentication data. The remote authentication data is generated by the remote authentication authority after measuring and verifying the processor of the protection server. The extraction module is used to input the hardware fingerprint data into a convolutional neural network and extract hardware feature vectors through the convolutional neural network. The generation module is used to generate a session root key based on the hardware feature vector using a key derivation algorithm. The input module is used to input the session root key into the hardware encryption engine in the protection server in a trusted execution environment, and the hardware encryption engine generates a working key based on the session root key. The encryption module is used to encrypt the data to be processed received by the protection server using the working key and the national cryptographic SM4 algorithm through the hardware encryption engine to obtain encrypted data, wherein the data to be processed includes large model training data or inference request data.

9. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor, configured to implement the steps of the large-scale protection server data transmission encryption method based on the national cryptographic SM4 algorithm as described in any one of claims 1 to 7 when executing the computer program.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, enables the data transmission encryption method for a large-scale protection server based on the national cryptographic SM4 algorithm as described in any one of claims 1 to 7.