A data encryption method and related equipment

By using the Ascon encryption algorithm and the CKKS homomorphic encryption algorithm on terminal devices, the problem of complex encryption processes in existing technologies is solved, achieving low latency, high throughput and secure encrypted transmission, which is suitable for firewall devices.

CN119544284BActive Publication Date: 2025-11-14CHINA TELECOM NETWORK SECURITY TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411629980.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-14
Publication Date
2025-11-14
Estimated Expiration
2044-11-14

AI Technical Summary

Technical Problem

Existing encryption algorithms are complex to use on terminal devices, making it difficult to achieve low latency, high throughput, and security on limited hardware resources. In particular, firewall devices cannot guarantee information security and efficient transmission when handling large amounts of data traffic.

Method used

The system employs the lightweight Ascon encryption algorithm to encrypt login information and combines it with the CKKS homomorphic encryption algorithm to process target messages, achieving fast encryption/decryption and secure transmission.

Benefits of technology

It ensures low latency, high throughput, and information security for terminal devices, and guarantees low latency, high throughput, and security for firewall-type gateway devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119544284B_ABST
    Figure CN119544284B_ABST
Patent Text Reader

Abstract

This application relates to a data encryption method and related equipment for ensuring low latency, high throughput, and security for devices with high traffic volume. The method includes: encrypting login information of a first terminal device using the Ascon encryption algorithm to obtain encrypted login information and an authentication tag, and sending this encrypted login information and authentication tag to a server. The server then verifies the encrypted login information based on the encrypted login information and authentication tag. Once the server verifies the login information, the user logs in to the first terminal device using the login information. Upon receiving a target message from a user, the user encrypts the target message using the CKKS encryption algorithm to obtain an encrypted target message. The encrypted target message is then sent to the server, which forwards it to a second terminal device. The second terminal device then decrypts the encrypted target message using the CKKS decryption algorithm to obtain the target message.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data processing, and in particular to a data encryption method and related equipment. Background Technology

[0002] With the widespread application of IoT technology, the need to protect resource-constrained devices from security threats continues to grow. Therefore, secure communication must be implemented on limited hardware computing resources. For example, when a firewall based on the MQTT (Message Queuing Telemetry Transport) protocol exchanges data with a server, the device-related data involved needs to be encrypted, such as authentication passwords, firewall user information, and URLs. Even with key and certificate authentication, the plaintext passwords and message carriers before authentication may still be vulnerable to differential power analysis attacks.

[0003] To ensure information security and privacy, encrypting user information and message carriers can effectively prevent data interception or tampering during transmission. Existing encryption algorithms are complex, making fast encryption and decryption algorithms particularly important. For terminal devices like firewalls that handle large volumes of data traffic, using efficient and lightweight encryption and decryption algorithms can ensure low latency, high throughput, and security. Therefore, a new data encryption method is urgently needed. Summary of the Invention

[0004] This invention provides a data encryption method based on the lightweight Ascon encryption algorithm and CKKS homomorphic encryption. This method features strong real-time performance and lightweight operation, ensuring information security and efficient transmission when terminal devices publish / subscribe to data. It guarantees low latency, high throughput, and security for terminal devices with high data traffic.

[0005] In a first aspect, this application provides a data encryption method applied in a first terminal device, the method comprising:

[0006] The login information of the first terminal device is encrypted using the Ascon encryption algorithm to obtain encrypted login information and an authentication tag corresponding to the encrypted login information. The login information is related to the user's login to the first terminal device.

[0007] The encrypted login information and the authentication tag are sent to the server so that the server can verify the encrypted login information based on the encrypted login information and the authentication tag, and obtain the verification result.

[0008] The system receives the authentication result sent by the server. Once the authentication result is confirmed to be successful, the system logs in on the first terminal device using the login information.

[0009] When a target message is received from a user, the CKKS encryption algorithm is used to encrypt the target message to obtain the encrypted target message.

[0010] The encrypted target message is sent to the server, so that the server forwards the encrypted target message to the second terminal device, so that the second terminal device can decrypt the encrypted target message using the CKKS decryption algorithm to obtain the target message.

[0011] This embodiment utilizes the lightweight Ascon encryption algorithm with symmetric encryption, enabling fast encryption of application layer data packets. Furthermore, it combines this with the CKKS homomorphic encryption algorithm for floating-point and approximate calculations. Important parts of the target message in the first terminal device are processed using CKKS homomorphic encryption, ensuring secure transmission of client message data. This guarantees information security and efficient transmission when the terminal device publishes and subscribes data. It also ensures low latency, high throughput, and security for firewall-type gateway devices.

[0012] In one possible implementation, the login information includes public data and private data;

[0013] The step of encrypting the login information of the first terminal device using the Ascon encryption algorithm to obtain encrypted login information and an authentication tag corresponding to the encrypted login information includes:

[0014] Using a preset key and a random number, an initial vector generation state is obtained, wherein the initial vector generation state is used to encrypt login information;

[0015] The initial vector generation state is updated using the publicly available data to obtain the updated vector generation state;

[0016] The updated vector generation state is used to encrypt the privacy data to obtain the encrypted login information; and the updated vector generation state is updated using the privacy data to obtain the first target vector generation state.

[0017] Based on the first target vector, a state is generated and the key is used to obtain an authentication tag corresponding to the encrypted login information.

[0018] In one possible implementation, encrypting the target message using the CKKS encryption algorithm to obtain the encrypted target message includes:

[0019] The target message is cleaned to obtain the cleaned target message;

[0020] The cleaned target message is encrypted using a public key to obtain an encrypted intermediate target message;

[0021] The encrypted intermediate target message is processed using a preset data processing algorithm to obtain the encrypted target message.

[0022] Secondly, this application provides a data encryption algorithm applied in a server, the method comprising:

[0023] The system receives encrypted login information and authentication tag sent by a first terminal device, wherein the encrypted login information is obtained by encrypting the login information of the first terminal device using the Ascon encryption algorithm, and the login information is related information used to indicate that the user is logging into the first terminal device.

[0024] The encrypted login information and the authentication tag are used to verify the user's identity, and the verification result is obtained.

[0025] The authentication result is sent to the first terminal device so that if the first terminal device determines that the authentication is successful based on the authentication result, it can log in using the login information; and when a target message is received from the user, the target message is encrypted using the CKKS encryption algorithm to obtain the encrypted target message.

[0026] After receiving the encrypted target message sent by the first terminal device, the encrypted target message is forwarded to each of the second terminal devices.

[0027] This embodiment utilizes the lightweight Ascon encryption algorithm with symmetric encryption, enabling fast encryption of application layer data packets. Furthermore, it combines this with the CKKS homomorphic encryption algorithm for floating-point and approximate calculations. Important parts of the target message in the first terminal device are processed using CKKS homomorphic encryption, ensuring secure transmission of client message data. This guarantees information security and efficient transmission when the terminal device publishes and subscribes data. It also ensures low latency, high throughput, and security for firewall-type gateway devices.

[0028] In one possible implementation, the method of receiving encrypted login information and authentication tag sent by the first terminal device further includes:

[0029] The system receives public data, a preset key, and a random number sent by the first terminal device; wherein the public data is the data in the login information.

[0030] The step of verifying authorization using the encrypted login information and the authentication tag to obtain the authorization result includes:

[0031] Using the key and the random number, an initial vector generation state is obtained, wherein the initial vector generation state is used to encrypt the login information;

[0032] The initial vector generation state is updated using the publicly available data to obtain the updated vector generation state;

[0033] The encrypted target message is used to update the updated vector generation state to obtain the second target vector generation state;

[0034] The tag to be authenticated is obtained by generating the state and the key using the second target vector;

[0035] The verification result is obtained based on the authentication label and the label to be authenticated.

[0036] In one possible implementation, obtaining the verification result based on the authentication tag and the tag to be authenticated includes:

[0037] If the authentication label and the label to be authenticated are the same, then the verification result is determined to be successful; or,

[0038] If the authentication label and the label to be authenticated are not the same, then the authentication result is determined to be authentication failure.

[0039] Thirdly, this application provides a data encryption device, the device comprising:

[0040] The first encryption module is used to encrypt the login information of the first terminal device using the Ascon encryption algorithm to obtain encrypted login information and an authentication tag corresponding to the encrypted login information, wherein the login information is related information used to indicate that the user logs into the first terminal device.

[0041] The first sending module is used to send the encrypted login information and the authentication tag to the server, so that the server can verify the encrypted login information based on the encrypted login information and the authentication tag;

[0042] The authentication module is used to log in to the first terminal device using the login information after it is determined that the server authentication is successful.

[0043] The second encryption module is used to encrypt the target message sent by the user using the CKKS encryption algorithm to obtain the encrypted target message when it receives the target message.

[0044] The second sending module is used to send the encrypted target message to the server, so that the server can forward the encrypted target message to the second terminal device, so that the second terminal device can decrypt the encrypted target message using the CKKS decryption algorithm to obtain the target message.

[0045] Fourthly, this application provides a data encryption device, the device comprising:

[0046] The receiving module is used to receive encrypted login information and authentication tag sent by the first terminal device, wherein the encrypted login information is obtained by the first terminal device encrypting the login information of the first terminal device using the Ascon encryption algorithm, and the login information is related to information indicating that the user is logged into the first terminal device.

[0047] The authentication module is used to verify the authentication information and the authentication tag to obtain the authentication result.

[0048] The third sending module is used to send the authentication result to the first terminal device so that if the first terminal device determines that the authentication result is successful, it can log in using the login information; and when it receives a target message sent by the user, it uses the CKKS encryption algorithm to encrypt the target message to obtain the encrypted target message.

[0049] The forwarding module is used to receive the encrypted target message sent by the first terminal device and forward the encrypted target message to the second terminal device.

[0050] Fifthly, embodiments of this application provide a first terminal device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the steps in the data encryption method described above.

[0051] In a sixth aspect, embodiments of this application provide a server, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps in the data encryption method described above.

[0052] In a seventh aspect, embodiments of this application provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps in the data encryption method described above.

[0053] Eighthly, embodiments of this application provide a computer program product, including a computer program stored in a computer-readable storage medium; when a processor of a memory access device reads the computer program from the computer-readable storage medium, the processor executes the computer program, causing the memory access device to perform the steps in the data encryption method described above in this application.

[0054] For the various aspects of the second to eighth aspects mentioned above, and the technical effects that each aspect may achieve, please refer to the above description of the technical effects that the various possible solutions for the first aspect may achieve. They will not be repeated here. Attached Figure Description

[0055] To more clearly illustrate the technical solutions in the embodiments of this application, the drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0056] Figure 1 A schematic diagram illustrating an application scenario provided in an embodiment of this application;

[0057] Figure 2 This is one of the flowcharts illustrating a data encryption method provided in an embodiment of this application;

[0058] Figure 3 This is a schematic diagram illustrating a process for encrypting login information of a first terminal device using the Ascon encryption algorithm, as provided in an embodiment of this application.

[0059] Figure 4 The provided diagram illustrates the verification process for embodiments of this application.

[0060] Figure 5 This is a schematic diagram illustrating the process of encrypting a target message using the CKKS encryption algorithm, as provided in an embodiment of this application.

[0061] Figure 6 One of the schematic diagrams of a data encryption device provided in the embodiments of this application;

[0062] Figure 7 A second schematic diagram of a data encryption device provided in the embodiments of this application;

[0063] Figure 8 This is a schematic diagram of an electronic device provided in an embodiment of this application. Detailed Implementation

[0064] To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings. The specific operating methods in the method embodiments can also be applied to the device embodiments or system embodiments.

[0065] In the description of this application, "multiple" is understood as "at least two". "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. A connected to B can represent: A and B directly connected, or A and B connected through C. Furthermore, in the description of this application, terms such as "first" and "second" are used only for descriptive purposes and should not be construed as indicating or implying relative importance or order.

[0066] Existing encryption algorithms are complex, making fast encryption and decryption algorithms particularly important. For gateway devices like firewalls that handle massive amounts of data traffic, efficient and lightweight encryption and decryption algorithms are crucial to ensuring low latency, high throughput, and security. Therefore, a new data encryption method is urgently needed.

[0067] To address this issue, this application provides a data encryption method that utilizes the lightweight Ascon encryption algorithm, a symmetric encryption method, for fast encryption of application layer data packets. Furthermore, it combines this with the CKKS homomorphic encryption algorithm to handle floating-point numbers and approximate calculations. Important parts of the target message in the first terminal device are processed using CKKS homomorphic encryption, ensuring secure transmission of client message data. This guarantees information security and efficient transmission when the terminal device publishes and subscribes data. It also ensures low latency, high throughput, and security for firewall-type gateway devices.

[0068] like Figure 1 As shown, an application scenario of a data encryption method is presented, which includes a first terminal device 110, a server 120, and a second terminal device 130.

[0069] In one possible application scenario, the first endpoint device 110 uses the Ascon encryption algorithm to encrypt the login information of the first terminal device, obtaining encrypted login information and an authentication tag corresponding to the encrypted login information. The login information is information indicating that a user is logging into the first terminal device. Then, the first terminal device sends the encrypted login information and the authentication tag to the server 120. The server 120 verifies the encrypted login information based on the encrypted login information and the authentication tag, obtains the verification result, and sends the verification result back to the first terminal device 110. When terminal device 110 determines that the authentication result sent by the server is successful, it logs in on the first terminal device using the login information; and when it receives a target message sent by the user, it encrypts the target message using the CKKS encryption algorithm to obtain the encrypted target message; then, the first terminal device 110 sends the encrypted target message to the server 120, so that the server 120 forwards the encrypted target message to the second terminal device 130, so that the second terminal device 130 decrypts the encrypted target message using the CKKS decryption algorithm to obtain the target message.

[0070] in, Figure 1 The first terminal device 110 and the server 120, as well as the server 120 and the second terminal device 130, can interact with each other through a communication network. The communication network can be either wireless or wired.

[0071] For example, the first terminal device 110 and the second terminal device 130 can access the network and communicate with the server 120 through cellular mobile communication technology, wherein the cellular mobile communication technology includes, for example, 5th Generation Mobile Networks (5G) technology.

[0072] Optionally, the first terminal device 110 and the second terminal device 130 can access the network and communicate with the server 120 through short-range wireless communication, wherein the short-range wireless communication method includes, for example, Wireless Fidelity (Wi-Fi) technology.

[0073] In this application, only a single first terminal device 110, a single server 120, and a single second terminal device 130 are described in detail. However, those skilled in the art should understand that the illustrated first terminal device 110, server 120, and second terminal device 130 are intended to illustrate the operation of the first terminal device 110, server 120, and second terminal device 130 involved in the technical solution of this application, and do not imply any limitation on the number, type, or location of the first terminal device 110, server 120, and second terminal device 130. It should be noted that adding additional modules to or removing individual modules from the illustrated environment will not change the underlying concept of the exemplary embodiments of this application.

[0074] It should be noted that the data encryption method proposed in this application is not only applicable to... Figure 1 The application scenarios shown are also applicable to any device with data encryption.

[0075] The data encryption method in an exemplary embodiment of this application will be described below with reference to the accompanying drawings and the application scenarios described above. It should be noted that the application scenarios described above are only shown to facilitate understanding of the methods and principles of this application, and the implementation of this application is not limited in any way in this respect.

[0076] The present application will now be described in further detail with reference to the accompanying drawings. See also: Figure 1 The diagram shown is a flowchart of a data encryption method provided in an embodiment of this application. The specific implementation process of this method is as follows:

[0077] Step 201: The first terminal device uses the Ascon encryption algorithm to encrypt the login information of the first terminal device to obtain encrypted login information and an authentication tag corresponding to the encrypted login information, wherein the login information is related information used to indicate that the user logs into the first terminal device;

[0078] The login information in this embodiment includes public data and private data. Public data includes the username. Private data includes the user's password, certificate, key path, and other similar information.

[0079] The following describes how to encrypt the login information of the first terminal device using the Ascon encryption algorithm, such as... Figure 3 The diagram illustrates the process of encrypting login information of a first terminal device using the Ascon encryption algorithm, which may include the following steps:

[0080] Step 301: Using a preset key and a random number, obtain the initial vector generation state, wherein the initial vector generation state is used to encrypt the login information;

[0081] The following is a detailed explanation of how the initial vector is generated in step 301:

[0082] Step 1: Construct a 64-bit initialization vector IV based on Ascon-128, where the initialization vector IV can be obtained through formula (1):

[0083] IV=k‖r‖a‖b‖0...(1);

[0084] Where k is the length of the key, r is the length of the input data speed preset, a is the number of confidence operations preset, b is the number of permutation operations preset, and || represents data concatenation.

[0085] In this embodiment, k = 128, r = 60, a = 12, and b = 6. However, this embodiment does not limit the specific values ​​of the key length k, the input data speed length r, and the number of permutation operations a and b. The specific values ​​of the key length k, the input data speed length r, and the number of permutation operations a and b can be set according to the specific actual situation.

[0086] Step 2: Concatenate the initial vector, key, and random number to obtain an intermediate vector, where the intermediate vector S can be obtained through formula (2). ′ :

[0087] S ′ =IV‖K‖N……(2);

[0088] Where K is the key and N is the random number.

[0089] Step 3: Perform a round of confidence operations on the intermediate vector using a pre-set permutation algorithm to obtain the permuted intermediate vector. Perform an XOR operation between the permuted intermediate vector and the key to obtain the initial vector generation state.

[0090] In this embodiment, the initial vector, intermediate vector, and initial vector generation state are all 320 bits long. Therefore, when performing an XOR operation between the intermediate vector and the key, 320-k zeros need to be padded before the key. The initial vector generation state can be obtained using formula (3):

[0091] S = p a (S ′ )⊕(0 320-k ∥K)……(3);

[0092] Where, p a (S ′ ) represents the intermediate vector S ′ Perform a round A swap operation, 0320-k It represents 320-k zeros.

[0093] Step 302: Update the initial vector generation state using the publicly available data to obtain the updated vector generation state;

[0094] Step 1: Divide the public data into blocks at intervals of a first specified length to obtain the divided data blocks.

[0095] In this embodiment, the first specified length is the length r of the speed of the input data that was pre-set as described above. Since r is 64 as described above. Before dividing the public data, it is necessary to determine whether the length of the public data is less than the first specified length. If it is, and is not 0, then the target number of 0s needs to be padded after the public data; if it is, and is 0, then the public data is not divided; if not, then the public data is divided using the above-mentioned method of dividing the data. The target number can be obtained by formula (4):

[0096] n = L-1 - (l mod L)……(4);

[0097] Where n is the target quantity, L is the first specified length, and l is the length of the public data.

[0098] In this embodiment, L = r, but the specific value of the first specified length is not limited in this embodiment; it can be set according to the specific actual situation.

[0099] Step 2: For any data block, perform a data XOR operation between the data block and the i-th data block in the initial vector generation state to obtain the target data block. Replace the i-th data block in the initial vector generation state with the target data block to obtain the first intermediate vector generation state. Perform b rounds of permutation operations on the first intermediate vector generation state using a permutation algorithm to obtain the second intermediate vector generation state.

[0100] In this embodiment, the number of bits and the length of the data block in the initial vector generation state are the same as those of the data block in the public data. For example, the first data block in the public data is XORed with the first data block in the initial vector generation state, where the first data block in the initial vector generation state is the data block composed of the data corresponding to the first specified length.

[0101] For example, if the initial vector generation state is xaxbxnxxmxxtxxrxxvxu, and the first specified length is 4, then the first data block in the initial vector generation state is xaxb, the second data block is xnxx, the third data block is mxxt, the fourth data block is xxrx, and the fifth data block is xvxu.

[0102] The second intermediate vector generation state can be obtained through formula (5):

[0103]

[0104] in, S″ represents the data block corresponding to the i-th first specified length n in the initial vector generation state, and AD represents the second intermediate vector generation state. i For the i-th data block in the public data, S c To generate the initial vector, p represents the data in the state other than the data block corresponding to the i-th first specified length n. b () indicates that a round b replacement operation will be performed.

[0105] It should be noted that the permutation algorithm in this embodiment is not limited, and the permutation algorithm in this embodiment can be set according to the specific actual situation.

[0106] Step 3: Perform an XOR operation between the second intermediate vector generation state and the specified data to obtain the updated vector generation state.

[0107] In this embodiment, the specified data is 0…01, where the number of 0 bits is 319. The updated vector generation state can be obtained using formula (6):

[0108]

[0109] Among them, S * For the updated vector generation state, 0 319 It represents 319 zeros.

[0110] Step 303: Encrypt the privacy data using the updated vector generation state to obtain the encrypted login information; and update the updated vector generation state using the privacy data to obtain the first target vector generation state;

[0111] The following section details the methods for encrypting privacy data and determining the first target vector generation state in step 303:

[0112] Step 1: Determine whether the length of the privacy data is the first specified length. If yes, divide the privacy data into multiple privacy data blocks every first specified length. If no, fill the privacy data to obtain privacy data blocks, wherein the length of the filled privacy data is the first specified length.

[0113] Step 2: Traverse each privacy data block. For any traversed privacy data block, determine if it is the last privacy data block. If not, perform an XOR operation between the privacy data block and the target data block in the updated vector generation state to obtain the ciphertext corresponding to the privacy data block. Replace the target data block in the updated vector generation state with the ciphertext to obtain the replaced vector generation state. Perform b rounds of permutation operations on the replaced vector generation state and determine the vector generation state after the permutation operation as the updated vector generation state. If yes, perform an XOR operation between the privacy data block and the target data block in the updated vector generation state to obtain target ciphertext data. Determine the first target length of the target ciphertext data as the ciphertext corresponding to the privacy data block. Replace the target data block with the target ciphertext data to obtain the replaced vector generation state and determine the replaced vector generation state as the first target vector generation state. Obtain the encrypted login information based on the ciphertext corresponding to each privacy data block.

[0114] The updated vector generation state is also divided according to a first specified length to obtain data blocks. The number of bits in the target data block corresponding to any privacy data block in the updated vector generation state is the same. If a privacy data block is the first data block in the privacy data, then its corresponding target data block is also the first data block in the updated vector generation state.

[0115] In this embodiment of the application, the target length is the length of the last privacy data block.

[0116] Step 304: Generate a state and a key based on the first target vector to obtain an authentication tag corresponding to the encrypted login information.

[0117] In one embodiment, step 304 can be specifically implemented as follows: XORing the first target vector generation state and the key to obtain fused data; performing a rounds of permutation on the fused data using a permutation algorithm to obtain permuted fused data; and obtaining the authentication tag corresponding to the encrypted login information based on the permuted fused data and the key. The permuted fused data can be obtained using formula (7):

[0118]

[0119] Among them, S τ The fused data after the permutation, K is the key, k is the length of the key, and S 1 Generate a state for the first target vector, 0 r Represents r zeros, 0 320-r-k ∥ represents 320-rk zeros, and ∥ represents splicing.

[0120] In one embodiment, obtaining the authentication tag corresponding to the encrypted login information based on the permuted fused data and the key can be specifically implemented as follows:

[0121] The second specified length of the fused data after the permutation is XORed with the second specified length of the data in the key to obtain the authentication tag corresponding to the encrypted login information.

[0122] Step 202: The first terminal device sends the encrypted login information and the authentication tag to the server;

[0123] Step 203: The server verifies the encrypted login information based on the encrypted login information and the authentication tag, and obtains the verification result;

[0124] In this embodiment of the application, the first terminal device sends public data, a key, and a random number while sending the encrypted login information and the authentication tag.

[0125] The following explains the verification steps in step 203, such as... Figure 4 The diagram shown illustrates the verification process, which may include the following steps:

[0126] Step 401: Using the key and the random number, obtain the initial vector generation state, wherein the initial vector generation state is used to encrypt the login information;

[0127] In this embodiment, the method of determining the initial vector generation state in step 401 is the same as the method of determining the initial vector generation state in step 301 described above, and will not be repeated here.

[0128] Step 402: Update the initial vector generation state using the publicly available data to obtain the updated vector generation state;

[0129] In this embodiment, the updated vector generation state obtained in step 402 is the same as that in step 302, and will not be described again here.

[0130] Step 403: Update the updated vector generation state using the encrypted target message to obtain the second target vector generation state;

[0131] In this embodiment of the application, the encrypted target message includes multiple ciphertexts.

[0132] In one embodiment, step 403 can be specifically implemented as follows:

[0133] The ciphertexts are traversed. For any ciphertext encountered, it is determined whether the ciphertext is the last ciphertext. If not, the ciphertext is XORed with the first target data block in the updated vector generation state to obtain the privacy data block corresponding to the ciphertext. The position of the first target data block in the updated vector generation state is the same as the position of the ciphertext in the encrypted target message, and the length of the first target data block is the same as the length of the ciphertext. The target data block in the updated vector generation state is replaced with the ciphertext. The replaced vector generation state is then subjected to b rounds of permutation operations, and the vector generation state after the permutation operations is determined as the updated vector generation state.

[0134] If so, the ciphertext is XORed with the data of the previous target length in the second target data block in the updated vector generation state to obtain a privacy data block corresponding to the ciphertext. The second target data block is the last data block in the updated vector generation state, and the target length is the same as the length of the ciphertext. The privacy data block is then padded to a specified length to obtain a padded privacy data block. The padded privacy data block is XORed with the target data block to obtain a third target data block. The third data block is used to replace the second target data block in the updated vector generation state to obtain the second target vector generation state.

[0135] In this embodiment, the privacy data block is padded by adding multiple zeros to the end of the privacy data block so that the length of the privacy data block is a specified length, which is the length of all ciphertexts except the last ciphertext.

[0136] Step 404: Generate the state and the key using the second target vector to obtain the tag to be authenticated;

[0137] In this embodiment, the method of generating the tag to be authenticated is the same as the method of generating the authenticated tag described above, except that the second target vector generation state is replaced with the first target vector generation state. All other methods are the same, and will not be described again in this embodiment.

[0138] Step 405: Obtain the verification result based on the authentication label and the label to be authenticated.

[0139] In one embodiment, step 405 can be specifically implemented as follows:

[0140] If the authentication label and the label to be authenticated are the same, the verification result is determined to be successful; or, if the authentication label and the label to be authenticated are different, the verification result is determined to be unsuccessful.

[0141] Step 204: The server sends the authentication result to the first terminal device;

[0142] Step 205: If the authentication result is successful, the first terminal device logs in using the login information.

[0143] In this embodiment of the application, the username and password in the login information can be used to log in. The specific method will not be described in detail here.

[0144] Step 206: When the first terminal device receives the target message sent by the user, it uses the CKKS encryption algorithm to encrypt the target message to obtain the encrypted target message;

[0145] The following describes the method of encrypting the target message using the CKKS encryption algorithm in step 206, such as... Figure 5 The diagram illustrates the process of encrypting a target message using the CKKS encryption algorithm, which may include the following steps:

[0146] Step 501: Perform data cleaning on the target message to obtain the cleaned target message;

[0147] Data cleaning can be performed according to a pre-set format, such as retaining timestamp fields and device interface traffic fields. The settings can be configured according to specific needs, and this embodiment does not impose limitations on them.

[0148] Step 502: Encrypt the cleaned target message using the public key to obtain the encrypted intermediate target message;

[0149] The encryption method in step 502 is described below:

[0150] 1. Key Generation

[0151] Key generation is divided into the generation of private and public keys and the generation of CKKS keys for auxiliary calculation. The public key is used for encryption on the client side, and the private key is generated on the receiving end (i.e., the second terminal device in this application). The CKKS key for auxiliary calculation will be used in the subsequent calculation of average traffic, and the CKKS key should be held during data processing.

[0152] Step 1: Instantiate the private key distribution χ s Obtain the first intermediate value s; instantiate the plaintext space R. Q The second intermediate value d is obtained; the error distribution χ is instantiated. e The third intermediate value e is obtained; the private key is obtained based on the first intermediate value; and the public key is obtained based on the first, second, and third intermediate values. Formula (8) represents the instantiation of the private key distribution χ. s Plaintext space R Q and error distribution χ e The formula:

[0153] s←χ s ,d←R Q ,e←χ e …(8);

[0154] The private key sk can be obtained through formula (9):

[0155] sk←(1,s)……(9);

[0156] The public key pk can be obtained through formula (10):

[0157] b = (-d·s + e) ​​mod Q

[0158]

[0159] Where b is the fourth intermediate value and Q is the pre-set first weight value.

[0160] Step 2: Instantiate the modulus range distribution R PQ The fifth intermediate value is obtained, and the error distribution χ is instantiated. e The sixth intermediate value is obtained; the CKKS key is obtained based on the fifth and sixth intermediate values. The fifth and sixth intermediate values ​​can be obtained using formula (11):

[0161] a ′ ←R PQ e ′ ←χ e ……(11);

[0162] Among them, a ′ e is the fifth intermediate value. ′ This is the sixth intermediate value.

[0163] The CKKS key can be obtained through formula (12):

[0164] b ′ =(-a ′ ·s+e ′ +P·s 2 )mod P·Q

[0165]

[0166] Among them, b ′ P is the seventh intermediate value, and P is the pre-set second weight value.

[0167] 2. Data encryption:

[0168] For any data in the target message, instantiate a random distribution to obtain an eighth intermediate value; instantiate an error distribution to obtain a ninth intermediate value; based on the eighth intermediate value, the ninth intermediate value, the public key, and any data, obtain the encrypted data; based on the encrypted data, obtain the encrypted target message. The encrypted data can be obtained using formula (13):

[0169] c=f·pk+(m+e0)mod Q……(13);

[0170] Where c is the encrypted data, f is the eighth intermediate value, pk is the public key, m is the target message, and e0 is the ninth intermediate value.

[0171] The encrypted target message in this application embodiment includes encrypted data.

[0172] Step 503: Use a preset data processing algorithm to process the encrypted intermediate target message to obtain the encrypted target message.

[0173] The data processing algorithm in this embodiment can be addition or multiplication, that is, adding or multiplying the encrypted data of the same field. For example, the data corresponding to the device interface traffic field can be added together to obtain the total traffic. The specific data processing algorithm can be set according to the specific actual situation, and this embodiment does not limit it.

[0174] In this embodiment of the application, the encrypted target message obtained after data processing is sent to the server.

[0175] Step 207: The first terminal device sends the encrypted target message to the server;

[0176] Step 208: The server forwards the encrypted target message to the second terminal device;

[0177] The second terminal device can be a device that has subscribed to the first terminal device, or it can be a device where a display platform is located, where all users logged in can receive the encrypted target message.

[0178] Step 209: After receiving the encrypted target message, the second terminal device decrypts the encrypted target message using the CKKS decryption algorithm to obtain the target message.

[0179] In one embodiment, step 209 can be specifically implemented as follows:

[0180] For any encrypted data in the encrypted target message, the encrypted data is decrypted using the private key to obtain the decrypted data; based on each encrypted data, the target message is obtained. The decrypted data can be obtained using formula (14):

[0181] m ′ =<c,sk> mod Q……(14);

[0182] Where, m ′ is the decrypted data, c is the encrypted data, and sk is the private key.

[0183] In this embodiment, the private key is generated in the second terminal device, but the generation method is described together with the public key generation method. For details, please refer to formula (9), which will not be repeated here. The target message in this embodiment includes decrypted data, and the target message is obtained by obtaining the decrypted data.

[0184] In this application, a sufficiently large Q can be set, thereby reducing errors during the encryption process. A larger Q provides more space for storing and processing encrypted data, thus reducing the impact of errors on the result. Based on this formula, decrypting JSON data yields the decrypted result obtained after sending encrypted addition and encrypted multiplication.

[0185] Based on the same inventive concept, this application also provides a data encryption device 600, see [link to relevant documentation]. Figure 6 The device includes:

[0186] The first encryption module 601 is used to encrypt the login information of the first terminal device using the Ascon encryption algorithm to obtain encrypted login information and an authentication tag corresponding to the encrypted login information, wherein the login information is related information used to indicate that the user logs into the first terminal device.

[0187] The first sending module 602 is used to send the encrypted login information and the authentication tag to the server, so that the server can verify the encrypted login information based on the encrypted login information and the authentication tag, and obtain the verification result;

[0188] The authentication module 603 is used to receive the authentication result sent by the server. When the authentication result is determined to be successful, the login information is used to log in on the first terminal device.

[0189] The second encryption module 604 is used to encrypt the target message using the CKKS encryption algorithm when it receives the target message sent by the user, so as to obtain the encrypted target message.

[0190] The second sending module 605 is used to send the encrypted target message to the server, so that the server can forward the encrypted target message to the second terminal device, so that the second terminal device can decrypt the encrypted target message using the CKKS decryption algorithm to obtain the target message.

[0191] In one possible implementation, the login information includes public data and private data;

[0192] The first encryption module 601 is specifically used for:

[0193] Using a preset key and a random number, an initial vector generation state is obtained, wherein the initial vector generation state is used to encrypt login information;

[0194] The initial vector generation state is updated using the publicly available data to obtain the updated vector generation state;

[0195] The updated vector generation state is used to encrypt the privacy data to obtain the encrypted login information; and the updated vector generation state is updated using the privacy data to obtain the first target vector generation state.

[0196] Based on the first target vector, a state is generated and the key is used to obtain an authentication tag corresponding to the encrypted login information.

[0197] In one possible implementation, the second encryption module 604 is specifically used for:

[0198] The target message is cleaned to obtain the cleaned target message;

[0199] The cleaned target message is encrypted using a public key to obtain an encrypted intermediate target message;

[0200] The encrypted intermediate target message is processed using a preset data processing algorithm to obtain the encrypted target message.

[0201] Based on the same inventive concept, this application also provides a data encryption device 700, such as... Figure 7 As shown, the device includes:

[0202] The receiving module 701 is used to receive encrypted login information and authentication tag sent by the first terminal device, wherein the encrypted login information is obtained by the first terminal device encrypting the login information of the first terminal device using the Ascon encryption algorithm, and the login information is related information used to indicate that the user logs in to the first terminal device.

[0203] The authentication module 702 is used to perform authentication using the encrypted login information and the authentication tag to obtain the authentication result.

[0204] The third sending module 703 is used to send the authentication result to the first terminal device so that if the first terminal device determines that the authentication is successful based on the authentication result, it can log in to the first terminal device using the login information; and when it receives a target message sent by the user, it uses the CKKS encryption algorithm to encrypt the target message to obtain the encrypted target message.

[0205] The forwarding module 704 is used to receive the encrypted target message sent by the first terminal device and forward the encrypted target message to the second terminal device.

[0206] In one possible implementation, the receiving module 701 is further configured to:

[0207] The system receives public data, a preset key, and a random number sent by the first terminal device; wherein the public data is the data in the login information.

[0208] The verification module 702 is specifically used for:

[0209] Using the key and the random number, an initial vector generation state is obtained, wherein the initial vector generation state is used to encrypt the login information;

[0210] The initial vector generation state is updated using the publicly available data to obtain the updated vector generation state;

[0211] The encrypted target message is used to update the updated vector generation state to obtain the second target vector generation state;

[0212] The tag to be authenticated is obtained by generating the state and the key using the second target vector;

[0213] The verification result is obtained based on the authentication label and the label to be authenticated.

[0214] In one possible implementation, the verification module 702 is specifically used for:

[0215] If the authentication label and the label to be authenticated are the same, then the verification result is determined to be successful; or,

[0216] If the authentication label and the label to be authenticated are not the same, then the authentication result is determined to be authentication failure.

[0217] Based on the same inventive concept, this application also provides an electronic device, which can be one of a first terminal device, a server, and a second terminal device. The electronic device can perform the function of the aforementioned data storage device, see reference... Figure 8 The electronic device includes:

[0218] At least one processor 801 and a memory 802 connected to at least one processor 801. In this embodiment, the specific connection medium between the processor 801 and the memory 802 is not limited. Figure 8 The example shown is the connection between processor 801 and memory 802 via bus 800. Bus 800 is... Figure 8 The connections between other components are indicated by thick lines and are for illustrative purposes only, not as limiting information. The 800 bus can be divided into address bus, data bus, control bus, etc., for ease of representation. Figure 8 The term is represented by a single thick line, but this does not imply that there is only one bus or one type of bus. Alternatively, the processor 801 can also be called a controller; there is no restriction on the name.

[0219] In this embodiment, the memory 802 stores instructions executable by at least one processor 801. By executing the instructions stored in the memory 802, the at least one processor 801 can perform the data encryption method described above. The processor 801 can implement... Figure 6 The functions of each module in the device shown.

[0220] The processor 801 is the control center of the device. It can connect to various parts of the control device through various interfaces and lines. By running or executing instructions stored in memory 802 and calling data stored in memory 802, the processor can perform various functions and process data, thereby monitoring the device as a whole.

[0221] In one possible design, processor 801 may include one or more processing units. Processor 801 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understood that the modem processor may also not be integrated into processor 801. In some embodiments, processor 801 and memory 802 may be implemented on the same chip; in some embodiments, they may also be implemented on separate chips.

[0222] The processor 801 can be a general-purpose processor, such as a central processing unit (CPU), digital signal processor, application-specific integrated circuit, field-programmable gate array or other programmable logic device, discrete gate or transistor logic device, or discrete hardware component, capable of implementing or executing the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the data encryption method disclosed in the embodiments of this application can be directly manifested as being executed by a hardware processor, or executed by a combination of hardware and software modules within the processor.

[0223] Memory 802, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules. Memory 802 may include at least one type of storage medium, such as flash memory, hard disk, multimedia card, card-type memory, random access memory (RAM), static random access memory (SRAM), programmable read-only memory (PROM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), magnetic storage, magnetic disk, optical disk, etc. Memory 802 can be any other medium capable of carrying or storing desired program code in the form of instructions or data structures that can be accessed by a computer, but is not limited thereto. In the embodiments of this application, memory 802 can also be a circuit or any other device capable of implementing storage functions for storing program instructions and / or data.

[0224] By designing and programming the processor 801, the code corresponding to the data encryption method described in the foregoing embodiments can be embedded into the chip, enabling the chip to execute it during operation. Figure 2The steps of the data encryption method in the illustrated embodiment are as follows. How to design and program the processor 801 is a technique well-known to those skilled in the art and will not be described further here.

[0225] This application also provides a computer-readable storage medium storing computer-executable instructions required to execute the processor, including a program required to execute the processor.

[0226] In some possible implementations, various aspects of the data encryption method provided in this application can also be implemented as a program product, which includes program code. When the program product is run on an electronic device, the program code is used to cause the electronic device to perform the steps in the data encryption method according to the various exemplary embodiments of this application described above.

[0227] Those skilled in the art will understand that embodiments of this application can be provided as methods, apparatus, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0228] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (devices), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0229] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0230] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0231] Although preferred embodiments of this application have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of this application.

[0232] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.

Claims

1. A data encryption method, characterized in that, Applied in a first terminal device, the method includes: The login information of the first terminal device is encrypted using the Ascon encryption algorithm to obtain encrypted login information and an authentication tag corresponding to the encrypted login information. The login information is used to represent information related to the user logging into the first terminal device. The encrypted login information and the authentication tag are sent to the server so that the server can verify the encrypted login information based on the encrypted login information and the authentication tag, and obtain the verification result. The system receives the authentication result sent by the server. Once the authentication result is confirmed to be successful, the system logs in on the first terminal device using the login information. When a target message is received from a user, the CKKS encryption algorithm is used to encrypt the target message to obtain the encrypted target message. The encrypted target message is sent to the server, so that the server forwards the encrypted target message to the second terminal device, so that the second terminal device can decrypt the encrypted target message using the CKKS decryption algorithm to obtain the target message.

2. The method according to claim 1, characterized in that, The login information includes public data and private data; The step of encrypting the login information of the first terminal device using the Ascon encryption algorithm to obtain encrypted login information and an authentication tag corresponding to the encrypted login information includes: Using a preset key and a random number, an initial vector generation state is obtained, wherein the initial vector generation state is used to encrypt the login information; The initial vector generation state is updated using the publicly available data to obtain the updated vector generation state; The updated vector generation state is used to encrypt the privacy data to obtain the encrypted login information; and the updated vector generation state is updated using the privacy data to obtain the first target vector generation state. Based on the first target vector, a state is generated and the key is used to obtain an authentication tag corresponding to the encrypted login information.

3. The method according to claim 1, characterized in that, The step of encrypting the target message using the CKKS encryption algorithm to obtain the encrypted target message includes: The target message is cleaned to obtain the cleaned target message; The cleaned target message is encrypted using a public key to obtain an encrypted intermediate target message; The encrypted intermediate target message is processed using a preset data processing algorithm to obtain the encrypted target message.

4. A data encryption method, characterized in that, When applied to a server, the method includes: The system receives encrypted login information and authentication tag sent by a first terminal device, wherein the encrypted login information is obtained by encrypting the login information of the first terminal device using the Ascon encryption algorithm, and the login information is used to represent the relevant information of the user logging into the first terminal device. The encrypted login information and the authentication tag are used to verify the user's identity, and the verification result is obtained. The authentication result is sent to the first terminal device so that if the first terminal device determines that the authentication result is successful, it can log in using the login information. After receiving the encrypted target message sent by the first terminal device, the encrypted target message is forwarded to the second terminal device. The encrypted target message is obtained by the first terminal device encrypting the target message using the CKKS algorithm.

5. The method according to claim 4, characterized in that, The method further includes: The system receives public data, a preset key, and a random number sent by the first terminal device; wherein the public data is the data in the login information. The step of verifying authorization using the encrypted login information and the authentication tag to obtain the authorization result includes: Using the key and the random number, an initial vector generation state is obtained, wherein the initial vector generation state is used to encrypt the login information; The initial vector generation state is updated using the publicly available data to obtain the updated vector generation state; The encrypted target message is used to update the updated vector generation state to obtain the second target vector generation state; The state and the key are generated using the second target vector to obtain the tag to be authenticated; The verification result is obtained based on the authentication label and the label to be authenticated.

6. The method according to claim 5, characterized in that, The step of obtaining the verification result based on the authentication label and the label to be authenticated includes: If the authentication label and the label to be authenticated are the same, then the verification result is determined to be successful; or, If the authentication label and the label to be authenticated are not the same, then the authentication result is determined to be authentication failure.

7. A data encryption device, characterized in that, The device includes: The first encryption module is used to encrypt the login information of the first terminal device using the Ascon encryption algorithm to obtain encrypted login information and an authentication tag corresponding to the encrypted login information, wherein the login information is used to represent the relevant information of the user logging into the first terminal device; The first sending module is used to send the encrypted login information and the authentication tag to the server, so that the server can verify the encrypted login information based on the encrypted login information and the authentication tag; The authentication module is used to log in to the first terminal device using the login information after it is determined that the server authentication is successful. The second encryption module is used to encrypt the target message sent by the user using the CKKS encryption algorithm to obtain the encrypted target message when it receives the target message. The second sending module is used to send the encrypted target message to the server, so that the server can forward the encrypted target message to the second terminal device, so that the second terminal device can decrypt the encrypted target message using the CKKS decryption algorithm to obtain the target message.

8. A first terminal device, characterized in that, include: Memory, used to store computer programs; A processor, when executing a computer program stored in the memory, implements the method of any one of claims 1-3.

9. A server, characterized in that, include: Memory, used to store computer programs; A processor, when executing a computer program stored in the memory, implements the method of any one of claims 4-6.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the method described in any one of claims 1-6.

Citation Information

Patent Citations

  • Data protection method and system based on homomorphic encryption

    CN103036884A

  • Platform software having video monitoring and intelligent image analysis functions

    CN106817562A