A privacy encryption method, device, equipment and storage medium

CN122554101APending Publication Date: 2026-08-11BEIJING COCONUT TREE INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-05-20
Publication Date
2026-08-11

AI Technical Summary

Technical Problem

[0004]本申请实施例提供了一种隐私加密方法、装置、设备及存储介质,解决了现有技术中用户与大语言模型交互过程中内存明文数据容易泄露的问题,实现了全流程密文存储及密码授权查看的效果

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122554101A_ABST
    Figure CN122554101A_ABST
Patent Text Reader

Abstract

The application discloses a privacy encryption method and device, equipment and storage medium, the method comprises: obtaining plaintext, initial control surface password and unique identifier corresponding to target session; derive session key and first authentication key based on initial control surface password and unique identifier; encrypt plaintext based on session key, get input ciphertext; input to large language model after decrypting input ciphertext based on session key, get inference result text; encrypt inference result text based on session key, get output ciphertext; in response to the user input to be verified control surface password, derive second authentication key based on to be verified control surface password and unique identifier; based on the first authentication key and the second authentication key, determine the processing mode of the output ciphertext. Thus, the beneficial effects of full-process ciphertext storage and password authorization viewing can be achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a privacy encryption method, apparatus, device, and storage medium. Background Technology

[0002] With the widespread application of large language models, users often need to input sensitive information when using locally deployed large language model services, and the output of the large language model may also contain confidential information. If this data is stored in plaintext in memory or persistent media during the interaction process, sensitive information will be at risk of leakage if the device is maliciously accessed or the process is injected. Therefore, how to implement privacy encryption protection for user input and model output throughout the entire large language model inference process has become an urgent technical problem to be solved.

[0003] In existing technologies, common privacy protection methods mainly rely on transport layer encryption (such as TLS) or full-disk encryption. However, these methods can only protect data during network transmission or disk storage, and cannot prevent theft during memory usage. Therefore, existing technologies suffer from the problem that plaintext data in memory cannot be effectively protected during user interaction with large language models. Summary of the Invention

[0004] This application provides a privacy encryption method, apparatus, device, and storage medium, which solves the problem of easy leakage of plaintext data in memory during user interaction with large language models in the prior art, and achieves the effect of full-process encrypted storage and password-authorized viewing.

[0005] In a first aspect, embodiments of this application provide a privacy encryption method, the method comprising: Obtain the plaintext text, the initial control plane cipher, and the unique identifier corresponding to the target session; The session key and the first verification key are derived based on the initial control plane cipher and the unique identifier; The plaintext text is encrypted using the session key to obtain the input ciphertext; The input ciphertext is decrypted based on the session key and then input into the large language model for inference to obtain the inference result text. The inference result text is encrypted based on the session key to obtain the output ciphertext; In response to the user-input control plane password to be verified, a second verification key is derived based on the control plane password to be verified and the unique identifier; Based on the first verification key and the second verification key, the processing method of the output ciphertext is determined.

[0006] One feasible implementation includes obtaining the plaintext text, the initial control plane cipher, and the unique identifier corresponding to the target session, comprising: In response to the user's operation of initiating a target session, the initial control plane password is set, and a unique identifier corresponding to the target session is generated; The plaintext is obtained in response to the user's input of plaintext text in the target session.

[0007] One feasible implementation, wherein determining the processing method of the output ciphertext based on the first verification key and the second verification key, includes: The second verification key is compared with the first verification key. If the second verification key matches the first verification key, the output ciphertext is decrypted based on the session key, and the inference result text is output. If the second verification key is inconsistent with the first verification key, the output ciphertext will not be decrypted, and a password error message will be output.

[0008] One feasible implementation is that the input ciphertext and the output ciphertext include a random number, a ciphertext body, and an authentication tag.

[0009] One feasible implementation, after encrypting the plaintext text based on a session key to obtain the input ciphertext, further includes: The memory buffer of the plaintext text is overwritten and cleared to zero.

[0010] One feasible implementation, wherein the step of decrypting the input ciphertext based on the session key and then inputting it into a large language model for inference to obtain the inference result text, includes: The integrity of the input ciphertext is verified based on the authentication tag to obtain the integrity verification result. If the integrity verification result passes, the input ciphertext is decrypted based on the session key to obtain the plaintext text; The plaintext text is input into a large language model for inference, and the inference result text is obtained.

[0011] One feasible implementation of the method further includes: If the target session ends, the session key and the first verification key are overwritten and cleared to zero.

[0012] Secondly, embodiments of this application provide a privacy encryption device, including: The data acquisition module is used to acquire plaintext text, the initial control plane cipher, and the unique identifier corresponding to the target session; The first key generation module is used to derive the session key and the first verification key based on the initial control plane cipher and the unique identifier; The plaintext encryption module is used to encrypt the plaintext text based on the session key to obtain the input ciphertext; The result generation module is used to decrypt the input ciphertext based on the session key and then input it into the large language model for inference to obtain the inference result text. The result encryption module is used to encrypt the inference result text based on the session key to obtain the output ciphertext; The second key generation module is used to derive a second verification key based on the control plane password to be verified and the unique identifier in response to the user input. The ciphertext processing module is used to determine the processing method for the output ciphertext based on the first verification key and the second verification key.

[0013] Thirdly, embodiments of this application provide an electronic device, the device including: a processor, a memory, and a system bus; The processor and the memory are connected via the system bus; The memory is used to store a program, the program including instructions that, when executed by the processor, cause the processor to perform any of the implementation steps of the above-described privacy encryption method.

[0014] Fourthly, embodiments of this application provide a computer-readable storage medium for storing a computer program, which, when executed by a terminal device, implements any of the implementation steps of the above-described privacy encryption method.

[0015] As can be seen from the above technical solutions, the embodiments of this application have the following advantages: As can be seen from the above technical solution, this application provides a privacy encryption method, apparatus, device, and storage medium. The method includes: First, obtaining plaintext text, an initial control plane cipher, and a unique identifier corresponding to the target session, and deriving a session key and a first verification key based on the initial control plane cipher and the unique identifier. Then, encrypting the plaintext text based on the session key to obtain input ciphertext. Next, decrypting the input ciphertext based on the session key and inputting it into a large language model for inference to obtain inference result text, and encrypting the inference result text based on the session key to obtain output ciphertext. Finally, in response to a user-input control plane cipher to be verified, deriving a second verification key based on the control plane cipher to be verified and the unique identifier, and determining the processing method for the output ciphertext based on the first verification key and the second verification key.

[0016] As can be seen, this scheme first derives the session key and the first verification key based on the initial control plane cipher and unique identifier, achieving session-level key isolation. It then encrypts plaintext to obtain input ciphertext, which is then decrypted and sent to the large language model, preventing the user's plaintext input from existing in plaintext form in memory. Simultaneously, the inference result text output by the large language model is encrypted to obtain output ciphertext, preventing the inference result text from being directly exposed in plaintext. Finally, a second verification key, derived from the user-input control plane cipher and unique identifier, is used to determine the processing method for the output ciphertext based on the first and second verification keys. Therefore, this scheme solves the problem of easy leakage of plaintext data in memory during user interaction with the large language model in existing technologies, achieving end-to-end ciphertext storage and password-authorized viewing. Attached Figure Description

[0017] Figure 1 A flowchart illustrating a privacy encryption method provided in this application embodiment; Figure 2 This is a schematic diagram of a privacy encryption device provided in an embodiment of this application. Detailed Implementation

[0018] As mentioned earlier, with the widespread application of large language models, users often need to input sensitive information when using locally deployed large language model services, and the output of the large language model may also contain confidential information. If this data is stored in plaintext in memory or persistent media during the interaction process, sensitive information will be at risk of leakage if the device is maliciously accessed or the process is injected. Therefore, how to achieve privacy encryption protection for user input and model output throughout the entire large language model inference process has become an urgent technical problem to be solved. In existing technologies, common privacy protection methods mainly rely on transport layer encryption (such as TLS) or full-disk encryption, but these methods can only protect the security of data during network transmission or disk storage, and cannot prevent theft during the memory usage stage. Therefore, existing technologies have the problem that plaintext data in memory cannot be effectively protected during the interaction between users and large language models.

[0019] To address the aforementioned issues, this application provides a privacy encryption method, apparatus, device, and storage medium. The method includes: First, obtaining plaintext text, an initial control plane cipher, and a unique identifier corresponding to a target session, and deriving a session key and a first verification key based on the initial control plane cipher and the unique identifier. Then, encrypting the plaintext text based on the session key to obtain input ciphertext. Next, decrypting the input ciphertext based on the session key and inputting it into a large language model for inference to obtain inference result text, and encrypting the inference result text based on the session key to obtain output ciphertext. Finally, in response to a user-input control plane cipher to be verified, deriving a second verification key based on the control plane cipher to be verified and the unique identifier, and determining the processing method for the output ciphertext based on the first and second verification keys.

[0020] As can be seen, this scheme first derives the session key and the first verification key based on the initial control plane cipher and unique identifier, achieving session-level key isolation. It then encrypts plaintext to obtain input ciphertext, which is then decrypted and sent to the large language model, preventing the user's plaintext input from existing in plaintext form in memory. Simultaneously, the inference result text output by the large language model is encrypted to obtain output ciphertext, preventing the inference result text from being directly exposed in plaintext. Finally, a second verification key, derived from the user-input control plane cipher and unique identifier, is used to determine the processing method for the output ciphertext based on the first and second verification keys. Therefore, this scheme solves the problem of easy leakage of plaintext data in memory during user interaction with the large language model in existing technologies, achieving end-to-end ciphertext storage and password-authorized viewing.

[0021] It should be noted that the embodiments of this application do not limit the executing entity of the privacy encryption method. For example, the privacy encryption method of this application embodiment can be applied to an intermediate processing layer, specifically, the intermediate processing layer is deployed between the user and the large language model. The intermediate processing layer can run on information processing devices such as servers or terminal devices. The server can be a standalone server, a cluster server, or a cloud server. The terminal device can be an electronic device such as a smartphone, computer, personal digital assistant (PDA), or tablet computer.

[0022] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.

[0023] Figure 1 This is a flowchart illustrating a privacy encryption method provided in an embodiment of this application. (In conjunction with...) Figure 1 As shown, it may specifically include steps S101-S107.

[0024] S101: Obtain the plaintext text, the initial control plane cipher, and the unique identifier corresponding to the target session.

[0025] In this embodiment of the application, in response to the user's operation of initiating the target session, the user is prompted to set an initial control plane password, and the strength of the initial control plane password is verified, for example, requiring the initial control plane password to be at least eight characters long and to contain numbers, letters and special characters.

[0026] Simultaneously, in response to the user's operation of initiating a target session, a unique identifier corresponding to the target session is generated. Specifically, a cryptographically secure random number generator can be used to generate a 128-bit session identifier, which will serve as the salt value for subsequent key derivation.

[0027] Next, after initializing the target session, the plaintext text is obtained in response to the user's input of plaintext text in the target session. It should be noted that the initial control plane cipher and plaintext text in this embodiment only exist briefly in memory and will be immediately used for encryption or derivation processing afterward, while the unique identifier is stored in memory for use by the entire target session.

[0028] S102: Derive the session key and the first verification key based on the initial control plane cipher and the unique identifier.

[0029] In this embodiment, based on the acquired initial control plane cipher and unique identifier, the session key K is obtained through derivation calculation using a key derivation function. Specifically, the Argon2 key derivation function can be used, with the unique identifier SessionID as the salt value, to perform calculations on the initial control plane cipher, outputting a 256-bit session key and a 128-bit first verification key V. Argon2 can be set to have 3 iterations t, 64 megabytes of memory cost m, and 4 degrees of parallelism p, i.e., K = Argon2(P, salt = SessionID, t = 3, m = 64 MB, p = 4), V = Argon2(P, salt = SessionID, t = 3, m = 64 MB, p = 4), to balance security and computational performance.

[0030] After derivation is completed, the session key and the first verification key are stored in memory locked by mlock to prevent key leakage. It should be noted that the session key in this embodiment is used to encrypt and decrypt the plaintext text input by the user and the inference result text output by the subsequent large language model. Furthermore, during the entire target session, the session key and the first verification key exist only in memory and are not persisted to disk or database in any form.

[0031] S103: Encrypt the plaintext text based on the session key to obtain the input ciphertext.

[0032] In this embodiment of the application, plaintext text is encrypted based on the session key. Specifically, a random number with a length of 12 bytes is first generated. This random number is generated by a cryptographically secure random number generator to ensure that the random number for each encryption operation under the same session key is not repeated.

[0033] Then, the AES-256-GCM symmetric encryption algorithm is used to encrypt the plaintext text using the session key and a random number, generating the ciphertext body and a 16-byte authentication tag. Subsequently, the random number, ciphertext body, and authentication tag are combined in sequence to form the final input ciphertext, which can be [12-byte random number] + [ciphertext body] + [16-byte authentication tag].

[0034] It should be noted that after the encryption operation is completed, this embodiment of the application needs to immediately overwrite and clear the memory buffer that originally stored the plaintext text, so that the plaintext text data will not remain in memory. At this point, the plaintext text entered by the user has been completely converted into ciphertext and stored in ciphertext form, and the plaintext will not be directly accessed in subsequent processes.

[0035] S104: After decrypting the input ciphertext based on the session key, input it into the large language model for inference to obtain the inference result text.

[0036] In this embodiment, firstly, a random number, the ciphertext body, and an authentication tag are extracted from the input ciphertext. Then, the integrity of the input ciphertext is verified based on the authentication tag, and an integrity verification result is obtained. If the integrity verification result fails, it indicates that the input ciphertext has been tampered with or corrupted, and further processing will be refused, with an error message output.

[0037] If the integrity verification result passes, the input ciphertext is decrypted based on the session key to obtain the plaintext text, which is then input into the large language model for inference calculation. The output of the large language model is the inference result text.

[0038] It should be noted that throughout the entire decryption and inference process, the decrypted plaintext only exists in a temporary buffer and is immediately overwritten and cleared to zero after being sent into the large language model, and will not remain in memory for a long time. At the same time, the large language model's own KV cache is only used for this inference and will not be retained across sessions.

[0039] S105: Encrypt the inference result text based on the session key to obtain the output ciphertext.

[0040] In this embodiment, the inference result text is encrypted based on the session key to obtain the output ciphertext. Specifically, a random number of 12 bytes in length is first generated. This random number is generated by a cryptographically secure random number generator, ensuring that the random number generated for each encryption operation under the same session key is unique.

[0041] Then, the AES-256-GCM symmetric encryption algorithm is used to encrypt the inference result text using the session key and the random number, generating the ciphertext body and a 16-byte authentication tag. Subsequently, the random number, ciphertext body and authentication tag are combined in sequence to form the final output ciphertext, that is, the output ciphertext can be [12-byte random number] + [ciphertext body] + [16-byte authentication tag].

[0042] It should be noted that after the encryption operation is completed, the memory buffer that originally stored the inference result text is immediately overwritten and cleared to zero, ensuring that the inference result text output by the large language model does not remain in memory. Simultaneously, the inference result text output by the large oracle model is converted into ciphertext, which can only be decrypted and viewed after successful user password verification in subsequent processes.

[0043] S106: In response to the user-input control plane cipher to be verified, derive a second verification key based on the control plane cipher to be verified and the unique identifier.

[0044] In this embodiment of the application, in response to the user's input of the control plane password to be verified, the control plane password to be verified is obtained. Then, the unique identifier corresponding to the target session is used as the salt value, and the control plane password to be verified is calculated using the same key derivation function (e.g., Argon2) as the first verification key to derive the second verification key.

[0045] Furthermore, the control plane password to be verified is only entered when the user attempts to unlock and view the output ciphertext, and the derived second verification key is only used for this verification and is immediately cleared from memory after verification is completed.

[0046] It should be noted that the second verification key is used to compare with the first verification key in the future to determine whether the control plane password currently entered by the user is consistent with the initial control plane password set at the beginning.

[0047] S107: Based on the first verification key and the second verification key, determine the processing method for the output ciphertext.

[0048] In this embodiment, the derived second verification key is compared with the previously generated first verification key. If the second verification key matches the first verification key, it indicates that the control plane password entered by the user is the same as the initially set control plane password. At this time, the output ciphertext is decrypted based on the session key to obtain the plaintext of the reasoning result text, and the reasoning result text is output to the user.

[0049] If the second verification key is inconsistent with the first verification key, it indicates that the control plane password entered by the user is inconsistent with the initially set control plane password. At this time, the output ciphertext is not decrypted, its ciphertext state is maintained, and a password error message is output to prompt the user to re-enter the password.

[0050] It should be noted that after successful verification and presentation of the plaintext of the reasoning result to the user, the temporary plaintext buffer used for decryption is immediately overwritten and cleared to zero, ensuring that no plaintext remains in memory. Regardless of whether the verification succeeds or fails, all temporary data generated during this verification process is promptly cleared after the operation is completed.

[0051] Furthermore, in this embodiment, when the user actively closes the target session, the target session times out without operation (default 15 minutes), or the user manually triggers a destruction operation, a full-link security zeroing is immediately performed. Specifically, the session key and the first verification key are overwritten multiple times and then the memory is released to ensure that the keys cannot be recovered. Simultaneously, a forced zeroing is performed on the KV Cache of the large language model in the CPU and GPU to eliminate intermediate states generated during inference, and all temporary plaintext buffers, including user-input plaintext and decrypted plaintext, are overwritten, zeroed, and released. All temporary keys and verification values ​​related to the current target session are also cleared.

[0052] It should be noted that after the above clearing operation is completed, the session key and the first verification key in this application embodiment have been completely destroyed. The input ciphertext and output ciphertext cannot be decrypted in a cryptographic sense because they have lost the valid key, thereby realizing the instant destruction of sensitive data after reading.

[0053] In specific application scenarios, this application provides an exemplary user interaction flow. When the target session starts, the intermediate processing layer prompts the user to set an initial control plane password for this target session. The password must be at least eight characters long and contain numbers, letters, and special characters. After the user enters the initial control plane password, the intermediate processing layer verifies the password strength and requires secondary confirmation. Once the confirmation is successful, the target session initialization is complete, and the intermediate processing layer indicates that the initial control plane password has been set successfully.

[0054] Next, after entering the target dialogue process, the user enters plaintext text in the input box and clicks send. The input box content is immediately cleared. At this time, the intermediate processing layer encrypts the plaintext text into input ciphertext based on the session key. After the large language model infers, it outputs the inference result text. The intermediate processing layer encrypts the inference result text into output ciphertext based on the session key. The interactive interface only displays the output ciphertext gibberish and displays an unlock and view button next to the ciphertext. The plaintext cannot be obtained without the password.

[0055] When a user needs to view the inference result text, they must click the "Unlock View" button. The intermediate processing layer will then prompt the user to enter the control plane password to be verified. Based on the control plane password and the unique identifier, a second verification key is derived and compared with the first verification key. If they match, the verification is successful. The intermediate processing layer then decrypts the output ciphertext based on the session key and displays the plaintext of the inference result text on the interactive interface. If the verification fails, an incorrect password message will be displayed, along with the remaining number of attempts.

[0056] To enhance user experience, the middleware layer supports two unlocking modes: a "remember password" mode, where subsequent outputs within the current target session are automatically decrypted without requiring repeated entry of the control plane password, but this memory expires after the target session ends; and a "confirm each time" mode, where the control plane password must be entered each time output is viewed, thus enhancing security.

[0057] Regarding session operations, users can actively click the "Destroy Session Now" button, at which point the intermediate processing layer immediately performs a secure zeroing, ensuring all content is undecryptable. If there is no activity for fifteen consecutive minutes, the intermediate processing layer will automatically trigger session destruction and display a pop-up notification that the session has timed out. When the user normally closes the interactive interface, the intermediate processing layer also automatically performs a secure zeroing, ensuring no data remains.

[0058] In addition, this solution does not provide a password retrieval function because the password is strongly bound to the key, and the intermediate processing layer does not store any password or backup. If the password is forgotten, no content can be decrypted, thus avoiding the privacy leakage risk that the password retrieval mechanism may bring.

[0059] It should be noted that the intermediate processing layer in this application embodiment can be implemented using one of the following three methods. For Python-based inference engines such as Transformers, Ollama, and LLaMA.cpp, the input parameters and return values ​​of the model's `generate` method are rewritten to perform encryption before the input enters the large language model and after the output is returned. All encryption and decryption operations are performed in an independent memory space. For large model services based on REST APIs, such as FastAPI and Flask-deployed models, an interception middleware is added to the API gateway layer to encrypt user input and the output of the large language model's response. The interception process is transparent and does not affect the original API call logic. For inference engines running in command-line mode, standard input and standard output are redirected to perform encryption before the input is written to standard input and after the output is read from standard output, thus adapting to native inference engines without API encapsulation.

[0060] Furthermore, this intermediate processing layer can run as an independent process or thread, is memory isolated from the inference engine, avoids cross-access of memory data, and all encryption and decryption operations are performed in the memory area locked by mlock, where data cannot be swapped out to the swap partition. It can also have a built-in integrity verification mechanism to verify the authenticity and integrity of the ciphertext and prevent it from being tampered with.

[0061] Therefore, it can be seen that the embodiments of this application are implemented in pure software, without relying on any special hardware such as TPM, and the encryption and decryption logic is deployed independently through the intermediate processing layer, decoupled from the large language model inference engine, without needing to modify any code of the large language model inference engine, and is compatible with all mainstream local inference backends such as Transformers, Ollama, and LLaMA.cpp, with low performance loss (less than 5% in actual tests) and low deployment cost.

[0062] Based on the relevant content of steps S101-S107 above, it can be seen that: First, the plaintext text, the initial control plane cipher, and the unique identifier corresponding to the target session are obtained, and the session key and the first verification key are derived based on the initial control plane cipher and the unique identifier. Then, the plaintext text is encrypted based on the session key to obtain the input ciphertext. Next, the input ciphertext is decrypted based on the session key and input into the large language model for inference to obtain the inference result text. The inference result text is then encrypted based on the session key to obtain the output ciphertext. Finally, in response to the user-input control plane cipher to be verified, the second verification key is derived based on the control plane cipher to be verified and the unique identifier. Based on the first verification key and the second verification key, the processing method of the output ciphertext is determined. It can be seen that this scheme first derives the session key and the first verification key based on the initial control plane cipher and the unique identifier, achieving session-level key isolation. By encrypting the plaintext text to obtain the input ciphertext, and then decrypting it before sending it into the large language model, it avoids the user-input plaintext text existing in plaintext form in memory. Simultaneously, the inference result text output by the large language model is encrypted to obtain ciphertext, preventing the inference result text from being directly exposed in plaintext form. Finally, a second verification key is derived from the user-input control plane password to be verified and the unique identifier. Based on the first verification key and the second verification key, the processing method for the ciphertext is determined. Therefore, this solution solves the problem of easy leakage of plaintext data in memory during user interaction with the large language model in existing technologies, achieving end-to-end ciphertext storage and password-authorized viewing.

[0063] Furthermore, Figure 2 This is a schematic diagram of a privacy encryption device provided in an embodiment of this application. (In conjunction with...) Figure 2 As shown, the privacy encryption device 200 provided in this application embodiment may include: Data acquisition module 201 is used to acquire plaintext text, initial control plane password and unique identifier corresponding to target session; The first key generation module 202 is used to derive a session key and a first verification key based on the initial control plane cipher and the unique identifier; Plaintext encryption module 203 is used to encrypt the plaintext text based on the session key to obtain the input ciphertext; The result generation module 204 is used to decrypt the input ciphertext based on the session key and then input it into the large language model for inference to obtain the inference result text. The result encryption module 205 is used to encrypt the inference result text based on the session key to obtain the output ciphertext; The second key generation module 206 is used to derive a second verification key based on the control plane password to be verified and the unique identifier in response to the user input. The ciphertext processing module 207 is used to determine the processing method for the output ciphertext based on the first verification key and the second verification key.

[0064] Optionally, the data acquisition module 201 is specifically used for: In response to the user's operation of initiating a target session, the initial control plane password is set, and a unique identifier corresponding to the target session is generated; The plaintext is obtained in response to the user's input of plaintext text in the target session.

[0065] Optionally, the ciphertext processing module 207 is specifically used for: The second verification key is compared with the first verification key. If the second verification key matches the first verification key, the output ciphertext is decrypted based on the session key, and the inference result text is output. If the second verification key is inconsistent with the first verification key, the output ciphertext will not be decrypted, and a password error message will be output.

[0066] Optionally, the input ciphertext and the output ciphertext include a random number, a ciphertext body, and an authentication tag.

[0067] Optionally, the privacy encryption device 200 may include: The memory clearing module is used to overwrite and clear the memory buffer of the plaintext text.

[0068] Optionally, the result generation module 204 is specifically used for: The integrity of the input ciphertext is verified based on the authentication tag to obtain the integrity verification result. If the integrity verification result passes, the input ciphertext is decrypted based on the session key to obtain the plaintext text; The plaintext text is input into a large language model for inference, and the inference result text is obtained.

[0069] Optionally, the privacy encryption device 200 may include: The key clearing module is used to overwrite and clear the session key and the first verification key when the target session ends.

[0070] Furthermore, embodiments of this application also provide an electronic device, including: a processor, a memory, and a system bus; The processor and the memory are connected via the system bus; The memory is used to store one or more programs, the one or more programs including instructions that, when executed by the processor, cause the processor to perform any of the implementation steps of the above-described privacy encryption method.

[0071] Furthermore, embodiments of this application also provide a computer-readable storage medium for storing a computer program, which, when executed by a terminal device, implements any of the implementation steps of the above-described privacy encryption method.

[0072] As can be seen from the above description of the embodiments, those skilled in the art can clearly understand that all or part of the steps in the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, a server, or a network communication device such as a media gateway, etc.) to execute the methods described in various embodiments or some parts of the embodiments of this application. It should be noted that the various embodiments in this specification are described in a progressive manner, and each embodiment focuses on describing the differences from other embodiments. The same or similar parts between the various embodiments can be referred to mutually.

[0073] The system disclosed in the embodiments is described in a relatively simple manner because it corresponds to the method disclosed in the embodiments. For relevant details, please refer to the method section.

[0074] It should also be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0075] The above description of the disclosed embodiments enables those skilled in the art to make or use this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A privacy encryption method characterized by, The method includes: Obtain the plaintext text, the initial control plane cipher, and the unique identifier corresponding to the target session; The session key and the first verification key are derived based on the initial control plane cipher and the unique identifier; The plaintext text is encrypted using the session key to obtain the input ciphertext; The input ciphertext is decrypted based on the session key and then input into the large language model for inference to obtain the inference result text. The inference result text is encrypted based on the session key to obtain the output ciphertext; In response to the user-input control plane password to be verified, a second verification key is derived based on the control plane password to be verified and the unique identifier; Based on the first verification key and the second verification key, the processing method of the output ciphertext is determined.

2. The method of claim 1, wherein, The process of obtaining the plaintext text, the initial control plane cipher, and the unique identifier corresponding to the target session includes: In response to the user's operation of initiating a target session, the initial control plane password is set, and a unique identifier corresponding to the target session is generated; The plaintext is obtained in response to the user's input of plaintext text in the target session.

3. The method of claim 1, wherein, The step of determining the processing method for the output ciphertext based on the first verification key and the second verification key includes: The second verification key is compared with the first verification key. If the second verification key matches the first verification key, the output ciphertext is decrypted based on the session key, and the inference result text is output. If the second verification key is inconsistent with the first verification key, the output ciphertext will not be decrypted, and a password error message will be output.

4. The method of claim 1, wherein, The input ciphertext and the output ciphertext include a random number, a ciphertext body, and an authentication tag.

5. The method of claim 1, wherein, After encrypting the plaintext text based on the session key to obtain the input ciphertext, the method further includes: The memory buffer of the plaintext text is overwritten and cleared to zero.

6. The method of claim 4, wherein, The input ciphertext, after being decrypted based on the session key, is input into a large language model for inference, yielding an inference result text, including: The integrity of the input ciphertext is verified based on the authentication tag to obtain the integrity verification result. If the integrity verification result passes, the input ciphertext is decrypted based on the session key to obtain the plaintext text; The plaintext text is input into a large language model for inference, and the inference result text is obtained.

7. The method of claim 1, wherein, The method further includes: If the target session ends, the session key and the first verification key are overwritten and cleared to zero.

8. A privacy encryption device, characterized by include: The data acquisition module is used to acquire plaintext text, the initial control plane cipher, and the unique identifier corresponding to the target session; The first key generation module is used to derive the session key and the first verification key based on the initial control plane cipher and the unique identifier; The plaintext encryption module is used to encrypt the plaintext text based on the session key to obtain the input ciphertext; The result generation module is used to decrypt the input ciphertext based on the session key and then input it into the large language model for inference to obtain the inference result text. The result encryption module is used to encrypt the inference result text based on the session key to obtain the output ciphertext; The second key generation module is used to derive a second verification key based on the control plane password to be verified and the unique identifier in response to the user input. The ciphertext processing module is used to determine the processing method for the output ciphertext based on the first verification key and the second verification key.

9. An electronic device, comprising: The device includes: a processor, a memory, and a system bus; The processor and the memory are connected via the system bus; The memory is used to store a program, the program including instructions that, when executed by the processor, cause the processor to perform the steps of the privacy encryption method according to any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium is used to store a computer program, which, when executed by a terminal device, implements the steps of the privacy encryption method according to any one of claims 1-7.