A method for implementing a secure encryption token router
Patent Information
- Application Number
- CN202611304749.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-26
- Publication Date
- 2026-10-16
AI Technical Summary
大部分用户对数据的安全要求很高,现有的安全机制主要是使用方身份的一个安全标识符,并没有对推理的输入和输出进行安全处理,所以外界可以通过简单的报文侦听技术在数据传输过程中获取使用方的私有数据,无法满足数据安全要求
本发明通过第一加密操作和第三加密操作,保证会话在任何传输路径大大降低会话被监听的风险,通过第二加密操作,保证推理的过程数据无法被其他用户监听,保证链路中的会话数据不被解密,进而提升了数据的安全性;
Smart Images

Figure CN122933235A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of token router technology, and more specifically, to a method for implementing a securely encrypted token router. Background Technology
[0002] With the development of artificial intelligence technology, more and more enterprises, institutions, and individuals are beginning to use large language models for knowledge retrieval and decision generation, realizing AI reasoning. The core function of Token Router is to distribute user-input tokens to different expert submodules for computation.
[0003] Due to cost considerations, many enterprises, institutions, and individuals typically choose not to purchase computing power equipment. Instead, they subscribe to token services provided by computing power providers, allowing them to utilize cloud computing resources for AI inference services based on large language models. Most users have high data security requirements. Existing security mechanisms primarily use a secure identifier for the user's identity but do not securely process the input and output of the inference. Therefore, external parties can obtain the user's private data during data transmission using simple message interception techniques, failing to meet data security requirements. Furthermore, existing large language models employ general semantic segmentation technology for coded inference, making it possible to obtain private data by intercepting the inference process of large language models.
[0004] Therefore, it is urgent to optimize the existing token service to reduce the risk of data leakage during transmission and inference. Summary of the Invention
[0005] The purpose of this invention is to provide a token router implementation method for secure encryption, which reduces the risk of data leakage during transmission and inference.
[0006] This invention is achieved through the following technical solution: A method for implementing a secure encryption token router involves deploying a secure encryption module at the information sender and a secure word segmentation vector processor at a cloud-based language model, including the following steps: Retrieve the original session from the message sender; The original session is semantically processed by the security encryption module to obtain the original semantic code. The original semantic code includes multiple sub-codes. Each sub-code of the original semantic code is the code of a word segment of the original session. The original semantic code is then encrypted to obtain the reversible semantic code. The reversible semantic code is decrypted by the word segmentation vector security processor to obtain the original semantic code. Then, the original semantic code is encrypted again to obtain the encrypted code to be parsed. The cloud-based language model performs semantic parsing and reasoning based on the encrypted code to be parsed, resulting in a vector. The result vector is decrypted by the word segmentation vector security processor to obtain the original answer corresponding to the original session, and then the original answer is encrypted to obtain the original answer ciphertext; The original ciphertext answer is decrypted using a secure encryption module and then returned to the sender.
[0007] Preferably, the semantic processing includes word segmentation and encoding.
[0008] Preferably, the method for performing the first encryption operation on the original semantic code is as follows: The dynamic transformation parameters are determined based on the identifier of the information sender and the original semantic encoding; The encoding transformation method is determined based on the dynamic transformation parameters, and each bit of the original semantic code is cyclically shifted according to the encoding transformation method to obtain the reversible semantic code.
[0009] Preferably, the method for determining the dynamic transformation parameters based on the identifier of the information sender and the original semantic code is as follows: Obtain the total number L of the original semantic encoding; Obtain each bit of the identifier of the information sender and sum them to obtain the identifier bit sum; The identifier bits are modulo 7 and then added to obtain the shift number T. Add a total of T bits to the header of the original semantic encoding. The sub-encoding of N as the padding item yields the padding semantic code, where N is a positive integer greater than 1, the end of the sub-encoding as the padding item is L, and the remaining bits are random padding codes. If the number of shift bits T is even, the encryption shift direction is to the left; if the number of shift bits T is odd, the encryption shift direction is to the right. The padding items in the padding semantic encoding and the encoding corresponding to each word are cyclically shifted according to the number of shifts and the direction of encryption shift.
[0010] Preferably, the method for decrypting the reversible semantic code is as follows: Obtain each bit of the identifier and sum them to obtain the identifier bit sum; The identifier bits are modulo 7 and then added to obtain the shift number T. If the number of shifts T is even, the decryption shift direction is to the right; if the number of shifts T is odd, the decryption shift direction is to the left. Each sub-encoder of the reversible semantic code is subjected to a cyclic shift transformation according to the number of shift bits and the decryption shift direction to obtain the inverse shift sub-encoder; Extract the value L' of the last bit of the first sub-encoder of the inverse shift sub-encoder and the total number L'' of the sub-encoders in the inverse shift sub-encoder. If L' and L''-1 are the same, delete the first sub-encoder of the inverse shift sub-encoder to obtain the original semantic code. If L' and L''-1 are not the same, issue an error warning.
[0011] Preferably, the method for the second encryption operation is as follows: The original semantic code is encrypted using a vector key to achieve the same length.
[0012] Preferably, the method for decrypting the result vector is as follows: The result vector is decrypted using the vector key with an equal length.
[0013] Preferably, the method for encrypting the original answer to obtain the ciphertext of the original answer is as follows: The original answer is semantically processed to obtain the original answer code, which includes multiple sub-codes. Each sub-code of the original answer code is the code for a word segment of the original answer. The original answer is encrypted using a third encryption operation to obtain the ciphertext of the original answer.
[0014] Preferably, the method of the third encryption operation is the same as the method of the first encryption operation.
[0015] Preferably, the method for decrypting the original answer ciphertext is the same as the method for decrypting the reversible semantic code.
[0016] The technical solution of the present invention has at least the following advantages and beneficial effects: This invention ensures that the session is greatly reduced from being eavesdropped on any transmission path through the first and third encryption operations, and ensures that the inference process data cannot be eavesdropped on by other users through the second encryption operation, and ensures that the session data in the link cannot be decrypted, thereby improving the security of the data. The word segmentation vector security processor of the present invention is an independent security component that does not need to intrude into the core operators of the large language model. It only connects to existing inference services through front-end and back-end interception, which is easy to deploy and has a low cost. This invention sends the original, securely processed session to a cloud-based large language model for inference, enabling users to perform semantic reasoning using the cloud-based large language model while reducing the risk of data exposure through input, output, and reasoning. Attached Figure Description
[0017] Figure 1 This is a flowchart illustrating the secure encryption token router implementation method provided in Embodiment 1 of the present invention. Detailed Implementation
[0018] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.
[0019] Example This embodiment provides a method for implementing a secure encryption token router. See [link / reference]. Figure 1 Deploying a secure encryption module at the information sender's location and a word segmentation vector security processor at the cloud-based language model includes the following steps: Step S1: Obtain the original conversation from the information sender, which is usually a question asked by the information sender, such as "What is the capital of China?"
[0020] Step S2: The original session is segmented using a secure encryption module, and then each segment is encoded. The purpose is to map the segment to a semantic vector of a preset dimension. The semantic vectors of all segments are combined sequentially to form the original semantic encoding. "Where is the capital of China?" is typically divided into 5 segments, i.e., "China / of / capital / is / where". The original semantic encoding is usually an embedding vector sequence, for example... Embedding vector sequence Each element in the array is the encoding of a word segment from the original session.
[0021] After obtaining the original semantic code, the security encryption module performs a first encryption operation on the original semantic code to obtain the reversible semantic code. Under the first encryption operation, the reversible semantic code can be restored to the original semantic code through the reverse decryption operation relative to the first encryption operation, that is, the data is restored while encrypting.
[0022] In this embodiment, the method for performing the first encryption operation on the original semantic encoding is as follows: Step S201: Determine the dynamic transformation parameters based on the identifier of the information sender and the original semantic code. The dynamic transformation parameters include the number of shift bits and the encryption shift direction. The method for obtaining these parameters is as follows: The total number of word segments obtained from the original semantic encoding is L=5; Obtain each bit of the sender's identifier (ID) and sum them to get the identifier bit sum. For example, if the sender's identifier is 123456789, then the identifier bit sum is the sum of all the numbers from 1 to 9, which is 45. Take the identifier bit and 45 modulo 7 and add 1 (mod(45,7)+1) to get the shift bit T=4; Add a total of T bits to the header of the original semantic encoding. The sub-encoding of N as the padding item yields the padding semantic encoding, where N is a positive integer greater than 1, and the end of the sub-encoding as the padding item is L. Therefore, T can be determined. N needs to be a number of bits greater than L, and the remaining bits are random padding codes. Here, N can be 2. If the number of shift bits T is even, the encryption shift direction is to the left; if the number of shift bits T is odd, the encryption shift direction is to the right.
[0023] Step S202: Determine the encoding transformation method according to the dynamic transformation parameters, and perform cyclic shift transformation on the padding items in the filling semantic encoding and the encoding corresponding to each word according to the shift number and encryption shift direction to obtain the reversible semantic encoding.
[0024] Cyclic shift transformation means treating the first and second bits of the code as connected, that is, treating the entire code as a ring. The encryption shift direction is to the right, which is equivalent to a clockwise shift, and to the left, which is equivalent to a counterclockwise shift.
[0025] The reversible semantic encoding obtained in this step will be sent to the secure tokenization vector processor for processing, rather than being sent directly to the large cloud model.
[0026] Step S3: After the reversible semantic code reaches the secure word segmentation vector processor, it is first decrypted by the secure word segmentation vector processor in reverse order of the first encryption operation to restore the reversible semantic code to the original semantic code, thus obtaining the original semantic code. The method is as follows: Obtain each bit of the identifier and sum them to obtain the identifier bit sum; The identifier bits are modulo 7 and then added to obtain the number of bits to be shifted, T. If the number of shifts T is even, the decryption shift direction is to the right; if the number of shifts T is odd, the decryption shift direction is to the left. Each sub-encoder of the reversible semantic code is subjected to a cyclic shift transformation according to the number of shift bits and the decryption shift direction to obtain the inverse shift sub-encoder; Extract the value L' of the last bit of the first sub-encoder of the inverse shift sub-encoder and the total number L'' of the sub-encoders in the inverse shift sub-encoder. If L' and L''-1 are the same, delete the first sub-encoder of the inverse shift sub-encoder to obtain the original semantic code. If L' and L''-1 are not the same, issue an error warning.
[0027] Next, the original semantic code is encrypted using a word segmentation vector security processor. This involves using a vector key to perform equal-length encryption on the original semantic code, resulting in the encrypted code to be parsed.
[0028] The vector key for performing equal-length encryption is a vector with the same dimension as the original semantic code. Vector operations are performed between this vector and the original semantic code. This encryption does not change the sequence length or the vector dimension of a single sub-code, achieving a reversible confusion transformation in the vector domain.
[0029] The encrypted code obtained in this step can then be sent to the cloud-based language model for processing.
[0030] Step S4: Perform semantic parsing and reasoning based on the encrypted code to be parsed using the cloud-based language big model to obtain the result vector.
[0031] Based on the second encryption operation in step S3, the word segmentation vectors are encrypted and decrypted at the same length while following the existing large language model inference and training. This allows for the direct reuse of the existing large language model and avoids the cost of model training.
[0032] Step S5: Using a word segmentation vector security processor, the result vector is decrypted using an equal-length decryption based on the vector key to obtain the original answer corresponding to the original session. Then, semantic processing is performed on the original answer to obtain the original answer encoding. The original answer encoding includes multiple sub-encodings, each of which is the encoding of a word segment of the original answer. A third encryption operation is performed on the original answer encoding to obtain the ciphertext of the original answer. The method of the third encryption operation is the same as the method of the first encryption operation.
[0033] In other words, the original ciphertext of the answer obtained through the third encryption operation can be restored by the reverse decryption operation relative to the third encryption operation.
[0034] Step S6: Decrypt the original ciphertext of the answer through the security encryption module and then return it to the information sender. The method for decrypting the original ciphertext of the answer is the same as the method for decrypting the reversible semantic encoding.
[0035] Based on the technical solution of this embodiment, the internal operations of the security encryption module and the word segmentation vector security processor are essentially black-box processes invisible to the outside world. Through the operation of this security encryption module and word segmentation vector security processor, the original session from the information sender is encrypted throughout the entire processing flow, including in any transmission chain and during the inference process of the language large model, thus solving the data privacy problem.
[0036] The above are merely preferred embodiments of the present invention and are not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for implementing a secure encryption token router, characterized in that, Deploying a secure encryption module at the information sender's location and a secure word segmentation vector processor at the cloud-based language model includes the following steps: Retrieve the original session from the message sender; The original session is semantically processed by the security encryption module to obtain the original semantic code. The original semantic code includes multiple sub-codes. Each sub-code of the original semantic code is the code of a word segment of the original session. The original semantic code is then encrypted to obtain the reversible semantic code. The reversible semantic code is decrypted by the word segmentation vector security processor to obtain the original semantic code, and then the original semantic code is encrypted again to obtain the encrypted code to be parsed. The cloud-based language model performs semantic parsing and reasoning based on the encrypted code to be parsed, resulting in a vector. The result vector is decrypted by the word segmentation vector security processor to obtain the original answer corresponding to the original session, and then the original answer is encrypted to obtain the original answer ciphertext; The original ciphertext answer is decrypted using a secure encryption module and then returned to the sender.
2. The method for implementing a secure encryption token router according to claim 1, characterized in that, The semantic processing includes word segmentation and encoding.
3. The method for implementing a secure encryption token router according to claim 1, characterized in that, The method for performing the first encryption operation on the original semantic code is as follows: The dynamic transformation parameters are determined based on the identifier of the information sender and the original semantic encoding; The encoding transformation method is determined based on the dynamic transformation parameters, and each bit of the original semantic code is cyclically shifted according to the encoding transformation method to obtain the reversible semantic code.
4. The method for implementing a secure encryption token router according to claim 3, characterized in that, The method for determining the dynamic transformation parameters based on the identifier of the information sender and the original semantic code is as follows: Obtain the total number L of the original semantic encoding; Obtain each bit of the identifier of the information sender and sum them to obtain the identifier bit sum; The identifier bits are modulo 7 and then added to obtain the number of bits to be shifted, T. Add a total of T bits to the header of the original semantic encoding. The sub-encoding of N as the padding item yields the padding semantic code, where N is a positive integer greater than 1, the end of the sub-encoding as the padding item is L, and the remaining bits are random padding codes. If the number of shift bits T is even, the encryption shift direction is to the left; if the number of shift bits T is odd, the encryption shift direction is to the right. The padding items in the padding semantic encoding and the encoding corresponding to each word are cyclically shifted according to the number of shifts and the direction of encryption shift.
5. The method for implementing a secure encryption token router according to claim 4, characterized in that, The method for decrypting the reversible semantic code is as follows: Obtain each bit of the identifier and sum them to obtain the identifier bit sum; The identifier bits are modulo 7 and then added to obtain the number of bits to be shifted, T. If the number of shifts T is even, the decryption shift direction is to the right; if the number of shifts T is odd, the decryption shift direction is to the left. Each sub-encoder of the reversible semantic code is subjected to a cyclic shift transformation according to the number of shift bits and the decryption shift direction to obtain the inverse shift sub-encoder; Extract the value L' of the last bit of the first sub-encoder of the inverse shift sub-encoder and the total number L'' of the sub-encoders in the inverse shift sub-encoder. If L' and L''-1 are the same, delete the first sub-encoder of the inverse shift sub-encoder to obtain the original semantic code. If L' and L''-1 are not the same, issue an error warning.
6. The method for implementing a secure encryption token router according to claim 5, characterized in that, The method for the second encryption operation is as follows: The original semantic code is encrypted using a vector key to perform equal-length encryption.
7. A method for implementing a secure encryption token router according to claim 6, characterized in that, The method for decrypting the result vector is as follows: The result vector is decrypted using the vector key with an equal length.
8. The method for implementing a secure encryption token router according to claim 1, characterized in that, The method for encrypting the original answer to obtain the ciphertext of the original answer is as follows: The original answer is semantically processed to obtain the original answer code, which includes multiple sub-codes. Each sub-code of the original answer code is the code for a word segment of the original answer. The original answer is encrypted using a third encryption operation to obtain the ciphertext of the original answer.
9. A method for implementing a secure encryption token router according to claim 8, characterized in that, The method of the third encryption operation is the same as the method of the first encryption operation.
10. A method for implementing a secure encryption token router according to claim 9, characterized in that, The method for decrypting the original ciphertext is the same as the method for decrypting the reversible semantic encoding.