Full-process encryption method and device based on large model operation environment
By adopting a full-process encryption method in the large model operation environment, using public key to encrypt training data and instructions, and decrypting it through the sidecar service container, the problem of data leakage risk of large model is solved and the high security of large models is achieved and data integrity.
Patent Information
- Application Number
- CN202411547655.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-01
- Publication Date
- 2025-02-18
AI Technical Summary
The lack of leakage protection for the large model itself and the operating environment in the prior art, resulting in a risk of leakage of the model data output by the large model.
The full-process encryption method based on the large-model operating environment is adopted to generate key pairs through the model encryption platform, and the private key is encrypted through the encryption service program in the side car service container to obtain the encryption private key. Use the public key to encrypt the sample training data and the instructions to be executed, generate the encrypted training data and encrypted model data, and decrypt the encryption private key through the decryption service program to perform decryption processing.
It effectively improves the security of the big model, prevents the tampering and stealing of big model file data, ensures the confidentiality and integrity of the big model, and reduces the risk of model data leakage.
Smart Images

Figure CN119475384A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of information security technology, and in particular to a full-process encryption method and device based on a large model operating environment. Background Art
[0002] A large model, namely a large language model (LLM), refers to a deep learning model trained with a large amount of text data. It is used to process a variety of natural language tasks, such as text classification, question and answer, and dialogue. It is an important path to artificial intelligence.
[0003] At present, encryption of large models mainly focuses on the processing of sample training data to prevent the leakage of sensitive information, but lacks anti-leakage protection and operating environment restrictions for the large models themselves. In traditional technologies, the acquired large models can be run in any environment, which brings risks to the safe operation of the large models and makes the model data output by the large models at risk of leakage.
[0004] Therefore, the present invention proposes a full-process encryption method and device based on a large model operating environment. Summary of the invention
[0005] In order to solve the above technical problems, the present invention provides a full-process encryption method and device based on a large model operating environment to solve the problems in traditional technologies.
[0006] An embodiment of the present invention provides a full-process encryption method based on a large model operating environment, including:
[0007] Build a large pre-trained model;
[0008] The model encryption platform generates a key pair according to the pre-trained large model, and encrypts the private key in the key pair through the encryption service program in the sidecar service container to obtain the encrypted private key;
[0009] Obtaining the public key in the key pair, encrypting the sample training data to generate encrypted training data, training the pre-trained large model, and obtaining the large model;
[0010] Get the instructions to be executed;
[0011] After the public key encrypts the instruction to be executed, it is processed through the large model to obtain the encrypted model data, the encrypted private key is decrypted by the decryption service program in the sidecar service container to obtain the private key, and the encrypted model data is decrypted by the private key to obtain the model data.
[0012] Preferably, the present invention provides a full-process encryption method based on a large model operating environment, the steps of: the model encryption platform generates a key pair according to the pre-trained large model, and encrypts the private key in the key pair through the encryption service program in the sidecar service container to obtain the encrypted private key; including:
[0013] Based on the random search algorithm, select four different prime numbers a, b, c, d;
[0014] Calculate the prime modulus x = a*b*c*d and construct the Euler function
[0015] Randomly select an integer e such that gcd[] is the function for finding the greatest common divisor;
[0016] Calculate the integer e for the Euler function The module inverse element f satisfies mod is the modulus function;
[0017] Integrate and obtain the public key (e, x) and private key (f, x);
[0018] The key management system comprises a plurality of sidecar service containers, an encryption service program is randomly generated in the sidecar service container, and the private key is encrypted by the encryption service program to obtain an encrypted private key;
[0019] According to the private key, a key encryption key is created to process the encryption service program, a secondary encryption key is generated, and the encrypted private key and the secondary encryption key are stored in the sidecar service container.
[0020] Preferably, the present invention provides a full-process encryption method based on a large model operating environment, the steps of: obtaining a public key in the key pair, encrypting sample training data, generating encrypted training data, training the pre-trained large model, and obtaining a large model; including:
[0021] According to the public key, a shared encrypted target file is obtained and loaded into the operating environment of the pre-trained large model;
[0022] According to the shared encrypted target file, the pre-trained model name of the pre-trained large model is set in the model directory, and the write startup script of the pre-trained large model is changed;
[0023] Encrypting the sample training data according to the public key to generate sample encrypted data, and constructing the encrypted training data using the pre-trained model name and the sample encrypted data;
[0024] The pre-trained large model is trained according to the encrypted training data to generate a large model.
[0025] Preferably, the present invention provides a full-process encryption method based on a large model operating environment, the steps of: after the public key encrypts the instruction to be executed, the large model is used to process it to obtain encrypted model data, the encrypted private key is decrypted by the decryption service program in the sidecar service container to obtain the private key, and the encrypted model data is decrypted by the private key to obtain the model data; including:
[0026] According to the public key, a shared encrypted target file is obtained and loaded into the operating environment of the large model;
[0027] According to the shared encryption target file, the model name of the large model is set in the model directory, the write startup script of the large model is changed, and the model name is submitted to the model encryption platform;
[0028] Encrypting the instruction to be executed according to the public key to generate instruction encrypted data, and constructing the encrypted instruction to be executed by using the model name and the instruction encrypted data;
[0029] The large model is processed according to the encryption instruction to be executed to generate the encrypted model data;
[0030] Obtaining the model name in the encrypted model data, constructing a service request instruction and sending it to the model encryption platform;
[0031] The model encryption platform judges the service request instruction based on the model authorization policy, and when the service request instruction meets the authorization requirements, sends the encrypted private key to the operating environment of the large model;
[0032] According to the encrypted private key, a shared decryption target file is obtained, loaded into the operating environment of the large model, and the read startup script of the large model is changed;
[0033] The encrypted private key is decrypted by a decryption service program in the sidecar service container to obtain the private key; the encrypted model data is decrypted by the private key to obtain the model data.
[0034] Preferably, the present invention provides a full-process encryption method based on a large model operating environment, the steps of: encrypting the instructions to be executed according to the public key, generating instruction encrypted data, and constructing the encrypted instructions to be executed through the model name and the instruction encrypted data; including:
[0035] Extracting features of the to-be-executed instructions to obtain feature instruction information; optionally, including:
[0036] Perform data normalization processing on the instructions to be executed to obtain pre-processing instruction data P;
[0037]
[0038] Calculating characteristic instruction information of the preprocessing instruction data;
[0039]
[0040] Among them, the first characteristic parameter in the T1 characteristic instruction information, the second characteristic parameter in the T2 characteristic instruction information, p(i,j) is the sub-data in the i-th row and j-th column of the pre-processing instruction data, and the pre-processing instruction data P is a sub-data matrix of m rows and n columns, with a total of m×n sub-data, is an XOR operation;
[0041] Performing scrambling processing on the pre-processing instruction data to obtain scrambling instruction data;
[0042]
[0043] Wherein, I1 is the first plaintext data in the scrambled instruction data, and I2 is the second plaintext data in the scrambled instruction data. To sum the first row of sub-data in the preprocessing instruction data, To sum the first column of sub-data in the preprocessing instruction data;
[0044] The scrambled instruction data is encrypted by using the public key to obtain instruction ciphertext data;
[0045]
[0046] Among them, I1 ′ is the first ciphertext data in the first instruction ciphertext data, I2 ′ is the second ciphertext data in the second instruction ciphertext data;
[0047] Calculating chaotic mapping parameters according to the instruction ciphertext data, performing chaotic mapping iterative processing, obtaining a chaotic sequence, screening out transient response influencing parameters, and obtaining an encrypted chaotic sequence;
[0048] Perform random movement in row and column directions according to the preprocessing instruction data to obtain disturbance instruction data;
[0049] The disturbance instruction data is diffused according to the encrypted chaotic sequence to obtain instruction encryption data.
[0050] Preferably, the present invention provides a full-process encryption method based on a large model operating environment, the steps of: the model encryption platform judges the request service instruction based on the model authorization policy, and when the request service instruction meets the authorization requirements, sends the encrypted private key to the operating environment of the large model; including:
[0051] Obtain the model name in the service request instruction;
[0052] The model encryption platform obtains the public key issued to the large model according to the model name, determines whether the model IP address sending the request service instruction and receiving the public key are consistent, and when the judgment is consistent, matches the corresponding encryption private key in the model encryption platform;
[0053] The encrypted private key is sent to the operating environment of the large model.
[0054] Preferably, the present invention provides a full-process encryption method based on a large model operating environment, the steps of: the model encryption platform judges the request service instruction based on the model authorization policy, and when the request service instruction meets the authorization requirements, sends the encrypted private key to the operating environment of the large model; and also includes:
[0055] The model encryption platform determines whether the service request instruction is manually authorized. If it is determined that the service request instruction is manually authorized, the corresponding encryption private key is matched in the model encryption platform and sent to the operating environment of the large model.
[0056] Preferably, the present invention provides a full-process encryption method based on a large model operating environment, the steps of: the model encryption platform judges the request service instruction based on the model authorization policy, and when the request service instruction meets the authorization requirements, sends the encrypted private key to the operating environment of the large model; and also includes:
[0057] The model encryption platform judges the service request instruction based on the model authorization policy, and outputs an unauthorized log to the operating environment of the large model when the service request instruction does not meet the authorization requirements.
[0058] Preferably, the present invention provides a full-process encryption method based on a large model operating environment, the steps of: decrypting the encrypted private key through a decryption service program in a sidecar service container to obtain the private key; decrypting the encrypted model data through the private key to obtain the model data; including:
[0059] Obtain the key decryption key in the sidecar service container to decrypt the secondary encryption key and obtain the encryption service program;
[0060] Based on the key management system, according to the encryption service program in the sidecar service container, obtain the corresponding decryption service program;
[0061] Decrypting the encrypted private key according to the decryption service program to obtain the private key;
[0062] Decrypting the encrypted model data using the private key to obtain model decrypted data;
[0063] Obtaining decryption chaotic mapping parameters in the model decryption data, performing chaotic mapping iterative processing, constructing a decryption chaotic sequence, multiplying the internal elements of the decryption chaotic sequence, and obtaining model decryption chaotic data;
[0064] Perform random movement in row and column directions according to the encrypted model data to obtain disturbed encrypted data;
[0065] Performing an XOR operation on the disturbance encrypted data and the model decrypted chaotic data to obtain the model data to be decrypted;
[0066] An inverse scrambling operation is performed on the model data to be decrypted to obtain the model data.
[0067] The present invention provides a full-process encryption device based on a large model operating environment, comprising:
[0068] Model building module, used to build pre-trained large models;
[0069] A model encryption platform, used to generate a key pair according to the pre-trained large model, and encrypt the private key in the key pair through the encryption service program in the sidecar service container to obtain the encrypted private key;
[0070] A model training module is used to obtain the public key in the key pair, encrypt the sample training data, generate encrypted training data, train the pre-trained large model, and obtain the large model;
[0071] The model processing module is used to encrypt the to-be-executed instruction with the public key, process it with the large model, obtain the encrypted model data, obtain the decryption service program in the sidecar service container to decrypt the encrypted private key, obtain the private key, and decrypt the encrypted model data with the private key to obtain the model data.
[0072] Compared with traditional technologies, the beneficial effects of the present invention are: the pre-trained large model is trained through encrypted training data encrypted with a public key, thereby realizing encrypted training of the pre-trained model, obtaining the large model, and encrypting the execution instructions through the public key, inputting the large model for processing, obtaining the encrypted model data for decryption, and generating model data; compared with traditional technologies, the above technical scheme encrypts the operating environment of the large model, so that encrypted files are processed during the training and operation of the large model, effectively improving the security of the large model, preventing tampering and theft of the large model file data, ensuring the confidentiality and integrity of the large model, and greatly reducing the risk of model data leakage while reducing the operation risk of the large model.
[0073] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention can be realized and obtained by the structures particularly pointed out in the written description, claims, and drawings.
[0074] The technical solution of the present invention is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0075] Figure 1 A schematic diagram of a full-process encryption method based on a large model operating environment provided by the present invention;
[0076] Figure 2 This is a schematic diagram of the structure of a full-process encryption device based on a large model operating environment provided by the present invention. DETAILED DESCRIPTION
[0077] The preferred embodiments of the present invention are described below in conjunction with the accompanying drawings. It should be understood that the preferred embodiments described herein are only used to illustrate and explain the present invention, and are not used to limit the present invention.
[0078] Embodiment 1:
[0079] The embodiment of the present invention provides a full-process encryption method based on a large model operating environment, referring to Figure 1 ,include:
[0080] Build a large pre-trained model;
[0081] The model encryption platform generates a key pair based on the pre-trained large model, and encrypts the private key in the key pair through the encryption service program in the sidecar service container to obtain the encrypted private key;
[0082] Obtain the public key in the key pair, encrypt the sample training data, generate encrypted training data, train the pre-trained large model, and obtain the large model;
[0083] Get the instructions to be executed;
[0084] After the public key encrypts the instruction to be executed, it is processed through the large model to obtain the encrypted model data. The encrypted private key is decrypted through the decryption service program in the sidecar service container to obtain the private key. The encrypted model data is decrypted through the private key to obtain the model data.
[0085] In the above embodiments, the model encryption platform generates a key pair according to the constructed pre-trained large model, and encrypts the private key in the key pair through the encryption service program in the sidecar service container to obtain the encrypted private key; obtains the public key in the key pair, encrypts the sample training data, generates encrypted training data, trains the pre-trained large model, and obtains the large model.
[0086] In the above embodiments, the instruction to be executed is encrypted by the public key in the key pair, input into the large model for processing, and the encrypted model data is obtained. The encrypted private key is decrypted by the decryption service program in the sidecar service container to obtain the private key, and the encrypted model data is decrypted by the private key to obtain the model data.
[0087] The beneficial effects of the above technology are: the pre-trained large model is trained through the encrypted training data encrypted with the public key, thereby realizing the encrypted training of the pre-trained model, obtaining the large model, and encrypting the execution instructions through the public key, inputting the large model for processing, obtaining the encrypted model data for decryption processing, and generating model data; compared with traditional technology, the above method encrypts the operating environment of the large model, so that the files processed during the training and operation of the large model are encrypted files, which effectively improves the security of the large model, prevents the tampering and theft of the large model file data, ensures the confidentiality and integrity of the large model, and greatly reduces the risk of model data leakage while reducing the operation risk of the large model.
[0088] Embodiment 2:
[0089] The embodiment of the present invention provides a full-process encryption method based on a large model operating environment, wherein the model encryption platform generates a key pair according to a pre-trained large model, and encrypts the private key in the key pair through an encryption service program in a sidecar service container to obtain an encrypted private key; the method comprises:
[0090] Based on the random search algorithm, select four different prime numbers a, b, c, d;
[0091] Calculate the prime modulus x = a*b*c*d and construct the Euler function
[0092] Randomly select an integer e such that gcd[] is the function for finding the greatest common divisor;
[0093] Calculate the integer e for Euler's function The module inverse element f satisfies mod is the modulus function;
[0094] Integrate and obtain the public key (e, x) and private key (f, x);
[0095] The key management system consists of several sidecar service containers. An encryption service program is randomly generated in the sidecar service container. The private key is encrypted through the encryption service program to obtain the encrypted private key.
[0096] Based on the private key, a key encryption key is created to process the encryption service program, generate a secondary encryption key, and store the encrypted private key and the secondary encryption key in the sidecar service container.
[0097] In the above embodiment, four prime numbers are selected based on a random search algorithm, the prime numbers are calculated modulo to construct the Euler function, and the modular inverse elements of the Euler function are calculated through randomly selected integers to generate public and private keys.
[0098] In the above embodiments, the public key and the private key in the key pair are asymmetric keys.
[0099] In the above embodiments, several sidecar service containers are constructed in the key management system, an encryption service program is randomly generated in the sidecar service container, and the private key is encrypted by the encryption service program to obtain the encrypted private key.
[0100] In the above embodiment, the sidecar service container processes the encryption service program according to the private key to create a key encryption key, generates a secondary encryption key, and stores the encrypted private key and the secondary encryption key.
[0101] In the above embodiments, the asymmetric key and KMS dual encryption mechanism are adopted to effectively improve the security of key management.
[0102] The beneficial effects of the above technology are: by randomly selecting prime numbers to calculate the Euler function and constructing modular inverse elements, the public key and private key can be obtained, and encryption processing is performed through the encryption service program in the sidecar service container, the private key can be encrypted again, and the encrypted private key can be obtained, thereby improving the confidentiality and security of the private key.
[0103] Embodiment 3:
[0104] The embodiment of the present invention provides a full-process encryption method based on a large model operating environment, the steps of: obtaining a public key in a key pair, encrypting sample training data, generating encrypted training data, training a pre-trained large model, and obtaining a large model; including:
[0105] According to the public key, obtain the shared encrypted target file and load it into the running environment of the pre-trained large model;
[0106] According to the shared encrypted target file, set the pre-trained model name of the pre-trained large model in the model directory, and change the write startup script of the pre-trained large model;
[0107] Encrypt the sample training data according to the public key to generate sample encrypted data, and construct the encrypted training data through the pre-trained model name and the sample encrypted data;
[0108] The pre-trained large model is trained based on the encrypted training data to generate a large model.
[0109] In the above embodiment, the shared encrypted target file is downloaded according to the public key, loaded into the operating environment of the pre-trained large model, and the pre-trained model name of the pre-trained large model is set under the model directory, and the write startup script of the pre-trained large model is changed.
[0110] In the above embodiments, the sample training data is encrypted according to the public key to generate sample encrypted data, and the encrypted training data is constructed through the pre-trained model name and the sample encrypted data; the pre-trained large model is trained according to the encrypted training data to generate a large model.
[0111] The beneficial effects of the above technology are: by obtaining the public key in the key pair, obtaining the shared encrypted target file, and changing the write startup script of the pre-trained large model, the encryption processing of the sample training data before training is realized, and then the unsupervised encrypted training of the pre-trained model is realized to obtain the large model; the above technical solution is based on the large model obtained by training with encrypted training data, which has high security. Even if the large model file is leaked, unauthorized users cannot use it directly.
[0112] Embodiment 4:
[0113] The embodiment of the present invention provides a full-process encryption method based on a large model running environment, comprising the following steps: after encrypting the instruction to be executed with a public key, the instruction is processed through the large model to obtain the encrypted model data; the encrypted private key is decrypted by the decryption service program in the sidecar service container to obtain the private key; and the encrypted model data is decrypted by the private key to obtain the model data; including:
[0114] According to the public key, obtain the shared encrypted target file and load it into the operating environment of the large model;
[0115] According to the shared encryption target file, set the model name of the large model in the model directory, change the write startup script of the large model, and submit the model name to the model encryption platform;
[0116] Encrypt the instructions to be executed according to the public key to generate instruction encrypted data, and construct the encrypted instructions to be executed through the model name and instruction encrypted data;
[0117] The large model is processed according to the encryption instructions to be executed to generate encrypted model data;
[0118] Get the model name in the encrypted model data, build a request service instruction and send it to the model encryption platform;
[0119] The model encryption platform judges the service request instruction based on the model authorization policy. When the service request instruction meets the authorization requirements, the encrypted private key is sent to the operating environment of the large model.
[0120] According to the encrypted private key, obtain the shared decryption target file, load it into the operating environment of the large model, and change the read startup script of the large model;
[0121] The encrypted private key is decrypted through the decryption service program in the sidecar service container to obtain the private key; the encrypted model data is decrypted through the private key to obtain the model data.
[0122] In the above embodiment, the shared encrypted target file is obtained through the public key and loaded into the operating environment of the large model; according to the shared encrypted target file, the model name of the large model is set in the model directory, the write startup script of the large model is changed, and the model name is submitted to the model encryption platform.
[0123] In the above embodiments, the shared encrypted target file can be implemented as an encrypted so file.
[0124] In one embodiment, the download link of the encrypted so file is obtained through the public key, the encrypted so file is downloaded to the operating environment of the large model, and the MODEL_NAME or MODE_NAME environment variable is configured in the .env folder of the model directory.
[0125] In one embodiment, the path of the encrypted so file is injected into the LD_PRELOAD environment variable, and the write startup script of the large model is modified.
[0126] In the above embodiments, the instructions to be executed are encrypted according to the public key to generate instruction encrypted data, and the encrypted instructions to be executed are constructed through the model name and the instruction encrypted data; the large model is processed according to the encrypted instructions to be executed to generate encrypted model data.
[0127] In the above embodiments, the format of the encrypted instruction to be executed is (model name, instruction encrypted data format).
[0128] In the above embodiments, after the large model generates encrypted model data, the model name is extracted, and a request service instruction is constructed and sent to the model encryption platform; the model encryption platform judges the request service instruction based on the model authorization policy, and when the request service instruction meets the authorization requirements, the encrypted private key is sent to the operating environment of the large model; according to the encrypted private key, the shared decryption target file is obtained, loaded into the operating environment of the large model, and the read startup script of the large model is changed.
[0129] In one embodiment, the devops platform injects a private key to decrypt the so file through the LD_PRELOAD method, and changes the read startup script of the large model.
[0130] In the above embodiments, encryption and decryption of the large model operating environment are achieved by dynamically injecting encrypted so files and private key decrypted so files. While simplifying the encryption and decryption operations, there is no need to modify the operating code of the large model, thereby realizing transparent operation of the large model based on the operating environment, and training and imperceptible processing of the large model, which effectively improves the flexibility and ease of use of the large model.
[0131] In the above embodiments, the encrypted private key is decrypted by the decryption service program in the sidecar service container to obtain the private key, and the encrypted model data is decrypted by the private key to obtain the model data.
[0132] In the above embodiments, the model encryption platform judges the request service instructions based on the model authorization policy, implements fine-grained access control on the request service instructions, and further ensures that the large model can only be run in a specific and secure authorized environment, thereby reducing the risk of large model leakage and unauthorized use.
[0133] The beneficial effects of the above technology are: through the public key and the encrypted private key, the changes of the write startup script and the read startup script of the large model running environment are realized, and the public key is used to encrypt the instructions before processing the instructions to be executed, and the private key is used to decrypt the encrypted model data after the large model outputs the encrypted model data, which effectively ensures the encrypted calculation of the large model running environment and avoids the risk of data leakage.
[0134] Embodiment 5:
[0135] The embodiment of the present invention provides a full-process encryption method based on a large model operating environment, comprising the steps of: encrypting instructions to be executed according to a public key, generating instruction encrypted data, and constructing encrypted instructions to be executed through a model name and the instruction encrypted data; comprising:
[0136] Extract features of the instructions to be executed and obtain feature instruction information; optional steps include:
[0137] Perform data normalization processing on the instructions to be executed to obtain pre-processed instruction data P;
[0138]
[0139] Calculate characteristic instruction information of preprocessing instruction data;
[0140]
[0141] Among them, the first characteristic parameter in the T1 characteristic instruction information, the second characteristic parameter in the T2 characteristic instruction information, p(i,j) is the sub-data in the i-th row and j-th column in the pre-processing instruction data, and the pre-processing instruction data P is a sub-data matrix with m rows and n columns, with a total of m×n sub-data, is an XOR operation;
[0142] Performing scrambling processing on the preprocessing instruction data to obtain scrambled instruction data;
[0143]
[0144] Wherein, I1 is the first plaintext data in the scrambled instruction data, and I2 is the second plaintext data in the scrambled instruction data. To sum the first row of sub-data in the preprocessing instruction data, To sum the first column of sub-data in the preprocessing instruction data;
[0145] The scrambled instruction data is encrypted by using a public key to obtain instruction ciphertext data;
[0146]
[0147] Among them, I1 ′ is the first ciphertext data in the first instruction ciphertext data, I2 ′ is the second ciphertext data in the second instruction ciphertext data;
[0148] Calculate the chaotic mapping parameters according to the instruction ciphertext data, perform chaotic mapping iterative processing, obtain the chaotic sequence, screen out the transient response influencing parameters, and obtain the encrypted chaotic sequence;
[0149] Perform random movement in row and column directions according to the preprocessing instruction data to obtain disturbance instruction data;
[0150] The disturbance instruction data is diffused according to the encrypted chaotic sequence to obtain the instruction encryption data.
[0151] In the above embodiments, the instructions to be executed are subjected to data normalization processing to obtain preprocessing instruction data, and characteristic instruction information of the preprocessing instruction data is calculated; the preprocessing instruction data is scrambled to obtain scrambled instruction data, the scrambled instruction data is encrypted by a public key to obtain instruction ciphertext data, chaotic mapping parameters are calculated according to the instruction ciphertext data, chaotic mapping iterative processing is performed to obtain a chaotic sequence, transient response influencing parameters are screened out, and an encrypted chaotic sequence is obtained; random movement is performed in the row and column directions according to the preprocessing instruction data to obtain disturbance instruction data; and diffusion operation is performed on the disturbance instruction data according to the encrypted chaotic sequence to obtain instruction encrypted data.
[0152] In the above embodiment, the instructions to be executed are subjected to data normalization processing, and the pre-processed instruction data is obtained to construct a sub-data matrix of m rows and n columns.
[0153] In the above embodiment, the chaotic mapping parameters are calculated according to the instruction ciphertext data, the chaotic mapping is iterated m+n+mn times to obtain the chaotic sequence, the transient response influencing parameters are screened out and the first m+n values are discarded to obtain the encrypted chaotic sequence.
[0154] The beneficial effects of the above technology are: normalizing the data of the instructions to be executed, obtaining the pre-processed instruction data for scrambling operation, encrypting the sub-data therein, and performing chaotic mapping and diffusion processing accordingly, thereby realizing the construction of instruction encrypted data; the above technical scheme performs scrambling, chaotic mapping and diffusion operations on the premise of encrypting the pre-processed instruction data, which effectively improves the encryption complexity of the instruction encrypted data, thereby ensuring the security of the instructions to be executed.
[0155] Embodiment 6:
[0156] The embodiment of the present invention provides a full-process encryption method based on a large model operating environment, comprising the following steps: a model encryption platform judges a request service instruction based on a model authorization policy, and when the request service instruction meets the authorization requirements, sends an encrypted private key to the operating environment of the large model; comprising:
[0157] Get the model name in the request service instruction;
[0158] The model encryption platform obtains the public key issued to the large model based on the model name, and determines whether the model IP address that sends the service request instruction is consistent with the model IP address that receives the public key. If they are consistent, the model encryption platform matches the corresponding encryption private key.
[0159] Send the encrypted private key to the runtime environment of the large model.
[0160] In the above embodiments, the model authorization strategy obtains the model name in the request service instruction, further obtains the public key issued to the large model, and identifies whether the request service instruction meets the authorization requirements by determining whether the model IP address for sending the request service instruction and receiving the public key is consistent.
[0161] The beneficial effect of the above technology is that by judging whether the model IP address for sending the request service instruction and receiving the public key is consistent, and identifying whether the request service instruction meets the authorization requirements, a model authorization strategy is constructed, further realizing automatic judgment of the request service instruction, and when the request service instruction meets the authorization requirements, the encrypted private key is sent to the operating environment of the large model, realizing the judgment of the request service instruction and the issuance of the encrypted private key by the model encryption platform.
[0162] Embodiment 7:
[0163] The embodiment of the present invention provides a full-process encryption method based on a large model operating environment, comprising the steps of: a model encryption platform judges a request service instruction based on a model authorization policy, and when the request service instruction meets the authorization requirements, sends an encrypted private key to the operating environment of the large model; and further comprising:
[0164] The model encryption platform determines whether the service request instruction is manually authorized. If it is determined that the service request instruction is manually authorized, the corresponding encryption private key is matched in the model encryption platform and sent to the operating environment of the large model.
[0165] In the above embodiment, the model encryption platform determines whether the service request instruction is manually authorized. If it is determined that the service request instruction is manually authorized, the corresponding encryption private key is obtained and sent to the operating environment of the large model.
[0166] In the above embodiments, the backend staff can manually authorize the request service instruction on the model encryption platform and issue the encryption private key to the encrypted model data that needs to be decrypted.
[0167] The beneficial effect of the above technology is that by setting manual authorization request service instructions in the model authorization strategy, it is convenient for background staff to control and manage the encryption private key, and further realize the authority control over the decryption processing of encrypted model data.
[0168] Embodiment 8:
[0169] The embodiment of the present invention provides a full-process encryption method based on a large model operating environment, comprising the steps of: a model encryption platform judges a request service instruction based on a model authorization policy, and when the request service instruction meets the authorization requirements, sends an encrypted private key to the operating environment of the large model; and further comprising:
[0170] The model encryption platform judges the service request instructions based on the model authorization policy. When the service request instructions do not meet the authorization requirements, it outputs unauthorized logs to the operating environment of the large model.
[0171] In the above embodiment, when the model encryption platform determines that the service request instruction does not meet the authorization requirements, an unauthorized log is output to the operating environment of the large model.
[0172] The beneficial effect of the above technology is that when it is determined that the service request instruction does not meet the authorization requirements, an unauthorized log is output to the operating environment of the large model to remind the model encryption platform that the large model has not been authorized and has no right to decrypt the encrypted model data.
[0173] Embodiment 9:
[0174] The embodiment of the present invention provides a full-process encryption method based on a large model running environment, comprising the steps of: decrypting an encrypted private key through a decryption service program in a sidecar service container to obtain the private key, decrypting encrypted model data through the private key to obtain the model data; comprising:
[0175] Obtain the key decryption key in the sidecar service container to decrypt the secondary encryption key and obtain the encryption service program;
[0176] Based on the key management system, obtain the corresponding decryption service program according to the encryption service program in the sidecar service container;
[0177] Decrypt the encrypted private key according to the decryption service program to obtain the private key;
[0178] Decrypt the encrypted model data using the private key to obtain the model decrypted data;
[0179] Obtaining decryption chaotic mapping parameters in the model decryption data, performing chaotic mapping iterative processing, constructing a decryption chaotic sequence, multiplying the internal elements of the decryption chaotic sequence, and obtaining model decryption chaotic data;
[0180] Perform random movement in row and column directions according to the encrypted model data to obtain perturbed encrypted data;
[0181] Performing an XOR operation on the disturbed encrypted data and the model decrypted chaotic data to obtain the model data to be decrypted;
[0182] Perform an inverse scrambling operation on the model data to be decrypted to obtain the model data.
[0183] In the above embodiment, the key decryption key in the sidecar service container is obtained to decrypt the secondary encryption key to obtain the encryption service program; the corresponding decryption service program is obtained based on the key management system, and the encrypted private key is decrypted according to the decryption service program to obtain the private key.
[0184] In the above embodiment, the encrypted model data is decrypted by a private key to obtain the model decrypted data, which specifically includes:
[0185] Y=y f mod(x)
[0186] Among them, Y is the model decryption data, and y is the encrypted model data.
[0187] In the above embodiments, the decryption chaotic mapping parameters in the model decryption data are obtained, the chaotic mapping iterative processing is performed, the decryption chaotic sequence is constructed, the internal elements of the decryption chaotic sequence are multiplied, and the model decryption chaotic data are obtained; random movement in the row and column directions is performed according to the encrypted model data to obtain the disturbed encrypted data; and an XOR operation is performed on the disturbed encrypted data and the model decryption chaotic data to obtain the model data to be decrypted, and an inverse scrambling operation is performed to obtain the model data.
[0188] The beneficial effect of the above technology is: based on the sidecar service container in the key management system, the decryption service program is obtained to decrypt the encrypted private key, obtain the private key, and use the private key to process the encrypted model data and perform other data operations, thereby realizing the acquisition of model data.
[0189] Embodiment 10:
[0190] The embodiment of the present invention provides a full-process encryption device based on a large model operating environment, referring to Figure 2 ,include:
[0191] Model building module, used to build pre-trained large models;
[0192] The model encryption platform is used to generate a key pair based on the pre-trained large model, and encrypt the private key in the key pair through the encryption service program in the sidecar service container to obtain the encrypted private key;
[0193] The model training module is used to obtain the public key in the key pair, encrypt the sample training data, generate encrypted training data, train the pre-trained large model, and obtain the large model;
[0194] The model processing module is used to encrypt the instructions to be executed with the public key, process them through the large model, obtain the encrypted model data, obtain the decryption service program in the sidecar service container to decrypt the encrypted private key, obtain the private key, and decrypt the encrypted model data with the private key to obtain the model data.
[0195] In the above embodiments, the model encryption platform generates a key pair based on the pre-trained large model built by the model building module, and encrypts the private key in the key pair through the encryption service program in the sidecar service container to obtain the encrypted private key; the model training module obtains the public key in the key pair, encrypts the sample training data, generates encrypted training data, trains the pre-trained large model, and obtains the large model.
[0196] In the above embodiments, the model processing module encrypts the instruction to be executed by using the public key in the key pair, inputs it into the large model for processing, obtains the encrypted model data, decrypts the encrypted private key by the decryption service program in the sidecar service container, obtains the private key, and decrypts the encrypted model data by using the private key to obtain the model data.
[0197] The beneficial effects of the above technology are: the model training module trains the pre-trained large model through the encrypted training data encrypted by the public key, realizes the encrypted training of the pre-trained model, and obtains the large model; the model processing module encrypts the execution instruction through the public key, inputs the large model for processing, obtains the encrypted model data for decryption processing, and generates model data; compared with traditional technology, the above device encrypts the operating environment of the large model, so that the files processed during the training and operation of the large model are encrypted files, which effectively improves the security of the large model, prevents the tampering and theft of the large model file data, ensures the confidentiality and integrity of the large model, and greatly reduces the risk of model data leakage while reducing the operation risk of the large model.
[0198] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.
Claims
1. A full-process encryption method based on a large model operating environment, characterized in that: include: Build a large pre-trained model; The model encryption platform generates a key pair according to the pre-trained large model, and encrypts the private key in the key pair through the encryption service program in the sidecar service container to obtain the encrypted private key; Obtaining the public key in the key pair, encrypting the sample training data to generate encrypted training data, training the pre-trained large model, and obtaining the large model; Get the instructions to be executed; After the public key encrypts the instruction to be executed, it is processed through the large model to obtain the encrypted model data, the encrypted private key is decrypted by the decryption service program in the sidecar service container to obtain the private key, and the encrypted model data is decrypted by the private key to obtain the model data.
2. According to claim 1, a full-process encryption method based on a large model operating environment is characterized in that: The step: the model encryption platform generates a key pair according to the pre-trained large model, and encrypts the private key in the key pair through the encryption service program in the sidecar service container to obtain the encrypted private key; including: Based on the random search algorithm, select four different prime numbers a, b, c, d; Calculate the prime modulus x = a*b*c*d and construct the Euler function Randomly select an integer e such that gcd[] is the function for finding the greatest common divisor; Calculate the integer e for the Euler function The module inverse element f satisfies mod is the modulus function; Integrate and obtain the public key (e, x) and private key (f, x); The key management system comprises a plurality of sidecar service containers, an encryption service program is randomly generated in the sidecar service container, and the private key is encrypted by the encryption service program to obtain an encrypted private key; According to the private key, a key encryption key is created to process the encryption service program, a secondary encryption key is generated, and the encrypted private key and the secondary encryption key are stored in the sidecar service container.
3. A full-process encryption method based on a large model operating environment according to claim 1, characterized in that: The step of obtaining the public key in the key pair, encrypting the sample training data, generating encrypted training data, training the pre-trained large model, and obtaining the large model includes: According to the public key, a shared encrypted target file is obtained and loaded into the operating environment of the pre-trained large model; According to the shared encrypted target file, the pre-trained model name of the pre-trained large model is set in the model directory, and the write startup script of the pre-trained large model is changed; Encrypting the sample training data according to the public key to generate sample encrypted data, and constructing the encrypted training data using the pre-trained model name and the sample encrypted data; The pre-trained large model is trained according to the encrypted training data to generate a large model.
4. According to claim 1, a full-process encryption method based on a large model operating environment is characterized in that: The step: after the public key encrypts the instruction to be executed, it is processed through the large model to obtain the encrypted model data, the encrypted private key is decrypted by the decryption service program in the sidecar service container to obtain the private key, and the encrypted model data is decrypted by the private key to obtain the model data; including: According to the public key, a shared encrypted target file is obtained and loaded into the operating environment of the large model; According to the shared encryption target file, the model name of the large model is set in the model directory, the write startup script of the large model is changed, and the model name is submitted to the model encryption platform; Encrypting the to-be-executed instruction according to the public key to generate instruction encrypted data, and constructing the to-be-executed encrypted instruction by using the model name and the instruction encrypted data; The large model is processed according to the encryption instruction to be executed to generate the encrypted model data; Obtaining the model name in the encrypted model data, constructing a service request instruction and sending it to the model encryption platform; The model encryption platform judges the service request instruction based on the model authorization policy, and when the service request instruction meets the authorization requirements, sends the encrypted private key to the operating environment of the large model; According to the encrypted private key, a shared decryption target file is obtained, loaded into the operating environment of the large model, and the read startup script of the large model is changed; The encrypted private key is decrypted by a decryption service program in the sidecar service container to obtain the private key; the encrypted model data is decrypted by the private key to obtain the model data.
5. A full-process encryption method based on a large model operating environment according to claim 4, characterized in that: The step of encrypting the instruction to be executed according to the public key to generate instruction encrypted data, and constructing the encrypted instruction to be executed by using the model name and the instruction encrypted data; includes: Extracting features of the to-be-executed instructions to obtain feature instruction information; optionally, including: Perform data normalization processing on the instructions to be executed to obtain pre-processing instruction data P; Calculating characteristic instruction information of the preprocessing instruction data; Among them, the first characteristic parameter in the T1 characteristic instruction information, the second characteristic parameter in the T2 characteristic instruction information, p(i,j) is the sub-data in the i-th row and j-th column of the pre-processing instruction data, and the pre-processing instruction data P is a sub-data matrix of m rows and n columns, with a total of m×n sub-data, is an XOR operation; Performing scrambling processing on the pre-processing instruction data to obtain scrambling instruction data; Wherein, I1 is the first plaintext data in the scrambled instruction data, and I2 is the second plaintext data in the scrambled instruction data. To sum the first row of sub-data in the preprocessing instruction data, To sum the first column of sub-data in the preprocessing instruction data; The scrambled instruction data is encrypted by using the public key to obtain instruction ciphertext data; Among them, I1 ′ is the first ciphertext data in the first instruction ciphertext data, I2 ′ is the second ciphertext data in the second instruction ciphertext data; Calculating chaotic mapping parameters according to the instruction ciphertext data, performing chaotic mapping iterative processing, obtaining a chaotic sequence, screening out transient response influencing parameters, and obtaining an encrypted chaotic sequence; Perform random movement in row and column directions according to the preprocessing instruction data to obtain disturbance instruction data; The disturbance instruction data is diffused according to the encrypted chaotic sequence to obtain instruction encryption data.
6. A full-process encryption method based on a large model operating environment according to claim 4, characterized in that: The step: the model encryption platform judges the service request instruction based on the model authorization policy, and when the service request instruction meets the authorization requirements, sends the encrypted private key to the operating environment of the large model; including: Obtain the model name in the service request instruction; The model encryption platform obtains the public key issued to the large model according to the model name, determines whether the model IP address sending the request service instruction and receiving the public key are consistent, and when the judgment is consistent, matches the corresponding encryption private key in the model encryption platform; The encrypted private key is sent to the operating environment of the large model.
7. A full-process encryption method based on a large model operating environment according to claim 6, characterized in that: The step: the model encryption platform judges the service request instruction based on the model authorization policy, and when the service request instruction meets the authorization requirements, sends the encrypted private key to the operating environment of the large model; and also includes: The model encryption platform determines whether the service request instruction is manually authorized. If it is determined that the service request instruction is manually authorized, the corresponding encryption private key is matched in the model encryption platform and sent to the operating environment of the large model.
8. A full-process encryption method based on a large model operating environment according to claim 7, characterized in that: The step: the model encryption platform judges the service request instruction based on the model authorization policy, and when the service request instruction meets the authorization requirements, sends the encrypted private key to the operating environment of the large model; and also includes: The model encryption platform judges the service request instruction based on the model authorization policy, and outputs an unauthorized log to the operating environment of the large model when the service request instruction does not meet the authorization requirements.
9. A full-process encryption method based on a large model operating environment according to claim 4, characterized in that: The step of: decrypting the encrypted private key by a decryption service program in the sidecar service container to obtain the private key; decrypting the encrypted model data by the private key to obtain the model data; includes: Obtain the key decryption key in the sidecar service container to decrypt the secondary encryption key and obtain the encryption service program; Based on the key management system, according to the encryption service program in the sidecar service container, obtain the corresponding decryption service program; Decrypting the encrypted private key according to the decryption service program to obtain the private key; Decrypting the encrypted model data using the private key to obtain model decrypted data; Obtaining decryption chaotic mapping parameters in the model decryption data, performing chaotic mapping iterative processing, constructing a decryption chaotic sequence, multiplying the internal elements of the decryption chaotic sequence, and obtaining model decryption chaotic data; Perform random movement in row and column directions according to the encrypted model data to obtain disturbed encrypted data; Performing an XOR operation on the disturbance encrypted data and the model decrypted chaotic data to obtain the model data to be decrypted; An inverse scrambling operation is performed on the model data to be decrypted to obtain the model data.
10. A full-process encryption device based on a large model operating environment, characterized in that: include: Model building module, used to build pre-trained large models; A model encryption platform, used to generate a key pair according to the pre-trained large model, and encrypt the private key in the key pair through the encryption service program in the sidecar service container to obtain the encrypted private key; A model training module is used to obtain the public key in the key pair, encrypt the sample training data, generate encrypted training data, train the pre-trained large model, and obtain the large model; The model processing module is used to encrypt the to-be-executed instruction with the public key, process it with the large model, obtain the encrypted model data, obtain the decryption service program in the sidecar service container to decrypt the encrypted private key, obtain the private key, and decrypt the encrypted model data with the private key to obtain the model data.