Quantum encryption method, quantum decryption method and device
Patent Information
- Application Number
- CN202610596544.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-04-30
- Publication Date
- 2026-08-04
AI Technical Summary
[0006]本发明提供一种量子加密方法、量子解密方法及装置,用以解决现有技术中密钥存储安全性低的缺陷,实现密钥的安全存储
[0017] The quantum encryption method, quantum decryption method, and apparatus provided by this invention generate a public matrix through interaction between the client and server. Each party generates its own private key fragment and public key component, which are then synthesized into a complete public key, achieving distributed storage of the private key. Based on this, the client uses the synthesized public key to encrypt plaintext, ensuring the security of the encryption process. This scheme does not rely on additional hardware security devices; it only requires software collaboration to distribute the private key across both ends, effectively avoiding the risk of the private key being easily stolen when stored in a single terminal's memory. Even if the client device is lost or the server is attacked, attackers cannot obtain the complete private key, improving the security of private key storage while also ensuring user convenience. Furthermore, the decryption operation is completed collaboratively by the client and server. The server uses its private key fragment to partially decrypt the ciphertext, obtaining a partial decryption result which is sent to the client. The client then uses its private key fragment to complete the final decryption, recovering the plaintext message. This solution requires no additional hardware and enhances the security of encrypted storage and transmission while ensuring user convenience. Even if a single point of attack occurs on the client device or server, attackers will not be able to obtain plaintext information, effectively preventing data security risks caused by single point leakage of private keys.
Smart Images

Figure CN122513085A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of information security technology, and in particular to a quantum encryption method, a quantum decryption method, and a device. Background Technology
[0002] With the widespread adoption of smart terminals and the rapid development of mobile internet technology, a series of new business models have emerged, such as mobile payment, mobile office, and e-government. These services typically require operation on mobile terminals such as smartphones and tablets, involving sensitive operations such as user authentication, transaction authorization, and data encryption. Therefore, cryptographic technology has become an indispensable core technical means to ensure user privacy and business security.
[0003] Currently, cryptographic technology on mobile terminals primarily employs software implementation, storing sensitive information such as user keys in the terminal's memory. However, this software storage method presents security vulnerabilities: the terminal's operating system and application software may have vulnerabilities, allowing malicious programs to steal keys stored in memory through viruses, Trojans, and other means; furthermore, if the terminal device is lost or acquired by others, the keys stored within it may also be extracted, leading to consequences such as user identity theft and financial theft.
[0004] To enhance the security of key storage, existing technologies propose using hardware security devices (such as USB keys) to store keys, physically isolating them from terminal devices. However, hardware security devices have drawbacks in practical applications: firstly, users need to carry additional hardware, which is inconvenient and reduces the user experience; secondly, the hardware devices require corresponding interfaces and drivers, making it difficult to guarantee compatibility with different terminal devices; and thirdly, the procurement and maintenance of hardware security devices increase usage costs, hindering large-scale deployment.
[0005] Therefore, how to improve the security of key storage on mobile terminals and prevent keys from being stolen by a single attack point without the need for additional hardware devices has become a technical problem that urgently needs to be solved in this field. Summary of the Invention
[0006] This invention provides a quantum encryption method, a quantum decryption method, and an apparatus to address the shortcomings of low key storage security in existing technologies and achieve secure key storage.
[0007] This invention provides a quantum encryption method for application on a client side, comprising the following steps: Interact with the server to generate a common matrix, and send the common matrix to the server; Based on the public matrix, client private key fragmentation, and first noise, the first public key component of the client is generated; Receive the second public key component sent by the server; the second public key component is generated based on the public matrix, server private key fragmentation, and second noise. Generate a complete public key based on the first public key component and the second public key component; Based on the public matrix and the complete public key, the plaintext message is encrypted to generate ciphertext.
[0008] According to a quantum encryption method provided by the present invention, the step of encrypting a plaintext message based on the public matrix and the complete public key to generate ciphertext includes: Based on a preset random number generation method, first encryption noise and second encryption noise are generated; Based on the first encryption noise, the complete public key, and the plaintext message, a first part of the ciphertext is generated; A second part of the ciphertext is generated based on the first encryption noise, the common matrix, and the second encryption noise. The first part of the ciphertext and the second part of the ciphertext are compressed and encoded respectively to obtain the ciphertext.
[0009] According to a quantum encryption method provided by the present invention, the step of interacting with the server to generate a public matrix includes: Generate a first random matrix and calculate the first hash value of the first random matrix; Send the first hash value to the server; Receive the second hash value sent by the server; Send the first random matrix to the server; Receive the second random matrix sent by the server; If the hash value of the second random matrix is the same as the second hash value, then the first random matrix and the second random matrix are added together to obtain the initial common matrix; The initial common matrix is concatenated with the identity matrix to obtain the common matrix.
[0010] According to a quantum encryption method provided by the present invention, generating the first public key component of the client based on the public matrix, client private key fragments, and first noise includes: Based on the central binomial distribution, the client private key fragment and the first noise are generated; Multiply the public matrix by the client's private key in segments to obtain the product; The product is added to the first noise to obtain the first public key component.
[0011] This invention provides a quantum decryption method, comprising the following steps: The server receives ciphertext and a partial decryption result from the server; the partial decryption result is obtained by the server decrypting the ciphertext based on the server's private key fragments. The plaintext message is obtained by decrypting the client's private key fragments, the ciphertext, and the partial decryption result.
[0012] According to a quantum decryption method provided by the present invention, the method of decrypting based on client private key fragmentation, the ciphertext, and the partial decryption result to obtain a plaintext message includes: The ciphertext is decoded and decompressed to obtain the decoded second part of the ciphertext; Calculate the first inner product of the decoded second part of the ciphertext and the fragment of the client's private key; The difference between the partial decryption result and the first inner product is taken as the plaintext message.
[0013] According to a quantum decryption method provided by the present invention, the partial decryption result is the difference between the decoded first part of the ciphertext and the second inner product, wherein the second inner product is the inner product of the server private key fragment and the decoded second part of the ciphertext.
[0014] The present invention also provides a quantum encryption device, comprising the following modules: An interaction module is used to interact with the server, generate a public matrix, and send the public matrix to the server. The first public key component generation module is used to generate the first public key component of the client based on the public matrix, client private key fragmentation, and first noise; The first receiving module is used to receive the second public key component sent by the server; the second public key component is generated based on the public matrix, server private key fragmentation, and second noise. A complete public key generation module is used to generate a complete public key based on the first public key component and the second public key component; An encryption module is used to encrypt plaintext messages based on the public matrix and the complete public key to generate ciphertext.
[0015] The present invention also provides a quantum decryption device, comprising the following modules: The second receiving module is used to receive ciphertext and partial decryption results sent by the server; the partial decryption results are obtained by the server decrypting the ciphertext based on the server's private key fragments. The decryption module is used to decrypt the ciphertext based on the client's private key fragments, the ciphertext, and the partial decryption results to obtain the plaintext message.
[0016] The present invention also provides an electronic device, 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 quantum encryption method as described above.
[0017] The quantum encryption method, quantum decryption method, and apparatus provided by this invention generate a public matrix through interaction between the client and server. Each party generates its own private key fragment and public key component, which are then synthesized into a complete public key, achieving distributed storage of the private key. Based on this, the client uses the synthesized public key to encrypt plaintext, ensuring the security of the encryption process. This scheme does not rely on additional hardware security devices; it only requires software collaboration to distribute the private key across both ends, effectively avoiding the risk of the private key being easily stolen when stored in a single terminal's memory. Even if the client device is lost or the server is attacked, attackers cannot obtain the complete private key, improving the security of private key storage while also ensuring user convenience. Furthermore, the decryption operation is completed collaboratively by the client and server. The server uses its private key fragment to partially decrypt the ciphertext, obtaining a partial decryption result which is sent to the client. The client then uses its private key fragment to complete the final decryption, recovering the plaintext message. This solution requires no additional hardware and enhances the security of encrypted storage and transmission while ensuring user convenience. Even if a single point of attack occurs on the client device or server, attackers will not be able to obtain plaintext information, effectively preventing data security risks caused by single point leakage of private keys. Attached Figure Description
[0018] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0019] Figure 1 This is a flowchart illustrating the quantum encryption method provided by the present invention.
[0020] Figure 2 This is a flowchart illustrating the quantum decryption method provided by the present invention.
[0021] Figure 3 This is a schematic diagram of the quantum encryption device provided by the present invention.
[0022] Figure 4 This is a schematic diagram of the quantum decryption device provided by the present invention.
[0023] Figure 5 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation
[0024] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0025] To improve key security without compromising user experience and cost savings, this invention proposes a quantum encryption / decryption method based on Aigis-enc two-party collaborative encryption. This method splits the user's decryption key into two private key fragments, stored locally on the terminal and in a cryptographic machine, respectively. Each party independently generates its own private key fragment and collaboratively generates a complete public key pair. During decryption, the terminal and cryptographic machine each use their respective private key fragments for partial decryption, and then collaborate to complete the full decryption operation, ultimately recovering the plaintext message.
[0026] The purpose of this invention is to provide a two-party collaborative post-quantum decryption method. The core idea of this method is to utilize the Asymmetric Module Learning With Errors (AMLWE) problem to effectively protect the security of the private key for decryption in the post-quantum decryption algorithm Aigis-enc.
[0027] Compared with existing technologies, the technical solution proposed in this invention has higher security and can effectively solve the security problem of decrypting private keys. In particular, it improves the security of products in software implementation without increasing user costs, and also has anti-quantum attack security.
[0028] To better understand the collaborative decryption method and data encryption method proposed in this invention, the mathematical symbols involved in this invention are first defined as follows: It is a ring of modulo integer polynomials, that is, an algebraic structure consisting of polynomials with integer coefficients that have undergone modulo reduction; Modulus; Each is a matrix The number of rows and columns; This refers to the range of the private key.
[0029] The following is combined Figures 1-5 The present invention describes a quantum encryption method, a quantum decryption method, and an apparatus.
[0030] Figure 1 This is a flowchart illustrating the quantum encryption method provided by the present invention, as shown below. Figure 1 As shown, the method includes the following: Step 101: Interact with the server to generate a common matrix, and send the common matrix to the server.
[0031] It should be understood that the public matrix is generated collaboratively by the client and the server, and is used to construct the basic parameter matrix of the Aigis-enc public key.
[0032] The client and server work together to generate a common matrix through multiple rounds of interaction, and then send the common matrix to the server.
[0033] Step 102: Based on the public matrix, client private key fragments, and the first noise, generate the first public key component of the client.
[0034] It should be understood that the client-side private key shard is a vector independently generated by the client. This shard is randomly generated by the client according to a central binomial distribution and stored locally on the client's machine. No third party (including the server) can obtain it. The client-side private key shard is added to the server-side private key shard held by the server to form the complete private key. The complete private key cannot be recovered by either party holding only a shard of the private key.
[0035] The first noise is a random interference vector introduced by the client when generating the public key component, also generated according to the central binomial distribution. The introduction of the first noise makes the calculation process of the public key component satisfy the difficulty assumption of the asymmetric modulus error learning problem, that is, it is difficult to deduce the private key fragment information from the public key component, thus ensuring the security of the private key.
[0036] The first public key component is a portion of the public key data calculated by the client based on the public matrix, client private key fragments, and the first noise.
[0037] The client uses the public matrix, its own private key fragments, and generated random noise to calculate a portion of the public key data used to synthesize the complete public key through matrix-vector multiplication and vector addition. Throughout this process, the client's private key fragments never leave its local machine, and due to the introduction of random noise, even if the first public key component is intercepted during transmission, an attacker cannot deduce the client's private key fragments from it, thus ensuring the security of the private key.
[0038] Step 103: Receive the second public key component sent by the server.
[0039] The second public key component is generated based on the public matrix, server private key fragmentation, and second noise.
[0040] The server-side private key shard is a vector independently generated by the server. This shard is randomly generated by the server according to a central binomial distribution and stored locally on the server, inaccessible to any third party (including the client). The server-side private key shard is added to the client-side private key shard held by the client to form the complete private key. No single party holding a private key shard can recover the complete private key, thus achieving distributed storage of the private key.
[0041] The second noise is a random interference vector introduced by the server when generating the public key component, also generated according to the central binomial distribution. The introduction of the second noise makes the calculation process of the server's public key component satisfy the difficulty assumption of the asymmetric modulo error learning problem, meaning it is difficult to deduce the information of the server's private key fragments from the server's public key component. Similar to the server's private key fragments, the second noise is also generated independently by the server and used only locally, and is not transmitted to the client.
[0042] The specific calculation method for generating the second public key component using the public matrix, server-side private key fragments, and second noise is as follows: multiply the public matrix by the server-side private key fragments, and add the product to the second noise to obtain the second public key component. Throughout this process, the server-side private key fragments never leave the server's local storage. Even if the server-side public key component is intercepted during transmission, attackers cannot deduce the server-side private key fragments from it, effectively preventing the risk of private key leakage.
[0043] The second public key component is sent to the client via a hash commitment mechanism, and is added to the first public key component generated by the client to form the complete public key.
[0044] Step 104: Generate a complete public key based on the first public key component and the second public key component.
[0045] The client performs a vector addition operation between its own generated first public key component and the second public key component sent by the server to synthesize the complete public key data. For example, the complete public key = first public key component + second public key component. The complete public key generated in this way, together with the public matrix, forms a complete public key pair, which is used for subsequent encryption of plaintext messages. Since the complete public key is obtained by adding the public key components of both parties, neither party can generate the complete public key alone, thus ensuring the fairness of public key generation.
[0046] Step 105: Based on the public matrix and the complete public key, encrypt the plaintext message to generate ciphertext.
[0047] The client uses a public key pair consisting of a public matrix and the complete public key, combined with randomly generated encryption noise, to encrypt the plaintext message through vector operations, obtaining compressed ciphertext data.
[0048] The quantum encryption method provided in this invention generates a public matrix through interaction with a server and sends the public matrix to the server. Based on the public matrix, client private key fragments, and first noise, a first public key component is generated for the client. A second public key component sent by the server is received. The second public key component is generated based on the public matrix, server private key fragments, and second noise. A complete public key is generated based on the first and second public key components. The plaintext message is encrypted using the public matrix and the complete public key to generate ciphertext. This invention generates a public matrix through interaction between the client and server, and each party generates its own private key fragments and public key components, ultimately synthesizing a complete public key, thus achieving distributed storage of the private key. Based on this, the client uses the synthesized public key to encrypt plaintext, ensuring the security of the encryption process. This scheme does not rely on additional hardware security devices; it can distribute and store the private key at both ends through software collaboration, effectively avoiding the risk of the private key being easily stolen when stored in the memory of a single terminal. Even if the client device is lost or the server is attacked, attackers cannot obtain the complete private key, improving the security of private key storage while also ensuring user convenience.
[0049] Based on the above embodiments, the step of interacting with the server to generate a public matrix includes: Generate a first random matrix and calculate the first hash value of the first random matrix; Send the first hash value to the server; Receive the second hash value sent by the server; Send the first random matrix to the server; Receive the second random matrix sent by the server; If the hash value of the second random matrix is the same as the second hash value, then the first random matrix and the second random matrix are added together to obtain the initial common matrix; The initial common matrix is concatenated with the identity matrix to obtain the common matrix.
[0050] It should be understood that the first and second random matrices are generated independently by the client and server respectively, and are used as the basis for collaboratively constructing the common matrix.
[0051] The first random matrix is a matrix generated by the client according to a preset random number generation method, and its dimension is... Each element in the matrix is a ring. The random multinomial is used. This random matrix is generated independently by the client and sent to the server via a hash commitment mechanism for both parties to calculate the common matrix. The specific values of the first random matrix are known only to the client; the server uses it only to calculate the common matrix and has no knowledge of its specific generation process.
[0052] The second random matrix is generated by the server according to a preset random number generation method, and its dimensions are also [dimensions missing]. Each element in the matrix is a ring. The first random matrix is a random polynomial. This random matrix is generated independently by the server and sent to the client via a hash commitment mechanism for both parties to calculate the common matrix. The specific values of the second random matrix are known only to the server; the client uses it only for calculating the common matrix after receiving it.
[0053] During the generation of the common matrix, the client sends its first random matrix to the server, and the server sends its second random matrix to the client. After receiving each other's random matrices, both parties add the first and second random matrices to obtain the initial common matrix. Since the initial common matrix is formed by adding the random matrices from both parties, neither party can unilaterally control its value, thus ensuring the fairness and randomness of the common matrix.
[0054] To further meet the format requirements of the Aigis-enc algorithm, the initial common matrix and the identity matrix are horizontally concatenated to obtain the final common matrix. The dimension of this common matrix is... The left side The part is the sum of the random matrices of both parties, and the right side is... Part of it is an identity matrix.
[0055] Through the above design, the first and second random matrices serve as the source of randomness for the common matrix, ensuring the unpredictability and security of the common matrix.
[0056] In one embodiment, the common matrix is generated based on the following steps: (1) The client randomly generates the first random matrix. And calculate the first hash value. ,Will Send to the server; among which, Indicates random uniform sampling. Indicates all dimensions as The set of matrices on the ring, from the set A matrix is uniformly and randomly selected as... .
[0057] (2) The server randomly generates a second random matrix. And calculate the second hash value. ,Will Send to the client.
[0058] (3) The client receives ,Will Send to the server; the server receives ,Will Send to the client; (4) Client verification If they are not equal, the process terminates; otherwise, the initial common matrix is calculated. ,based on Generate common matrix ,in, This represents the identity matrix, with dimensions of . Therefore, after splicing The dimension is .
[0059] This invention enables the client and server to independently generate random matrices and uses a hash commitment mechanism (exchanging hash values first, then exchanging the actual matrices) for interactive verification. This effectively prevents either party from maliciously tampering with its own matrix after learning the other party's matrix, ensuring the fairness and randomness of the public matrix generation. Both parties add their respective generated random matrices to obtain an initial public matrix, which is then concatenated with the identity matrix to form the final public matrix. This ensures that neither party can unilaterally control the value of the public matrix. This scheme does not rely on a trusted third party and can collaboratively generate a secure and reliable public matrix in an untrusted environment through two rounds of interaction, providing a secure foundation for subsequent key generation and encryption operations.
[0060] Based on the above embodiments, generating the first public key component of the client based on the public matrix, client private key fragments, and first noise includes: Based on the central binomial distribution, the client private key fragment and the first noise are generated; Multiply the public matrix by the client's private key in segments to obtain the product; The product is added to the first noise to obtain the first public key component.
[0061] It should be understood that the central binomial distribution is a symmetrical discrete probability distribution. Its sampling process is as follows: sample two independent and identically distributed random variables from the binomial distribution, and then take their difference.
[0062] The client uses the central binomial distribution as a noise source to randomly generate a secret vector that conforms to a specific probability distribution, which serves as the client's private key fragment and the first noise. For example, based on a preset random seed, a pseudo-random function is called to generate a random byte string. The random byte string is then used to generate the coefficients of each term of a polynomial successively according to the sampling rules of the central binomial distribution. The above process is repeated to generate the client's private key fragment and the first noise.
[0063] The client performs matrix multiplication on the public matrix and a fragment of the client's private key to obtain the product. It should be understood that this multiplication is a standard matrix-vector multiplication, and the result is a vector. Each additive term in the multiplication involves polynomial multiplication and addition over a ring. Because both the public matrix and the client's private key fragment are randomly generated, the product result is unpredictable.
[0064] The client adds the product to the first noise at corresponding positions to generate the first public key component. It should be understood that introducing the first noise makes it difficult to deduce the product from the first public key component, and consequently, difficult to deduce the client's private key fragments, satisfying the difficulty assumption of the asymmetric module error learning problem. Through this addition operation, the client fuses the contribution of the private key fragments with random noise to generate a publicly transmittable first public key component, ensuring that the private key information is not leaked.
[0065] In one embodiment, the collaborative Aigis-enc key portion can be generated through the following steps: (1) The client randomly generates a sub-private key (i.e., client private key fragmentation). and the first noise And calculate the first public key component. Calculate hash value ,Will Send to the server.
[0066] Indicates from private key space A vector is uniformly and randomly sampled from the data and used as the client's sub-private key. Represents the distribution space of the private key (usually a central binomial distribution); This represents the range of the private key, specifically the degree of the polynomial. Represents the vector dimension.
[0067] Indicates from the noise space A vector is uniformly and randomly sampled as noise for the client. Represents the vector dimension.
[0068] (2) The server randomly generates a sub-private key (i.e., server private key fragmentation). Second noise And calculate the second public key component. Calculate hash value ,Will Send to the client.
[0069] (3) Client verification If the condition is not met, terminate the procedure; otherwise, compute the full public key. .
[0070] (4) Output the public key Client private key sharding Server-side private key sharding In this configuration, the client-side private key fragment and the server-side private key fragment are stored separately. The client-side private key fragment is stored on the client side, and the server-side private key fragment is stored on the server side.
[0071] The embodiments of the present invention generate private key fragments and noise through a central binomial distribution, so that the coefficients are all small integers, resulting in high computational efficiency and ease of implementation; at the same time, noise is introduced into the public key component to ensure that the private key fragments cannot be reversed, thus balancing efficiency and security.
[0072] Based on the above embodiments, the step of encrypting the plaintext message and generating ciphertext based on the public matrix and the complete public key includes: Based on a preset random number generation method, first encryption noise and second encryption noise are generated; Based on the first encryption noise, the complete public key, and the plaintext message, a first part of the ciphertext is generated; A second part of the ciphertext is generated based on the first encryption noise, the common matrix, and the second encryption noise. The first part of the ciphertext and the second part of the ciphertext are compressed and encoded respectively to obtain the ciphertext.
[0073] It should be understood that the first encryption noise refers to the random noise vector generated by the client during the encryption process, which is used to generate the first part of the ciphertext by operating with the complete public key; the second encryption noise refers to the random noise vector generated by the client during the encryption process, which is used to generate the second part of the ciphertext by operating with the public matrix.
[0074] The client uses a pseudo-random function to expand a random byte string from a random seed, and then samples it using a central binomial distribution to generate two random noise vectors for encryption. For example, the client obtains a random seed, which can be generated by the system's secure random number generator to ensure sufficient entropy; it calls a pseudo-random function (PRF) using the random seed and different preset labels as input to generate the random byte strings needed for the first and second encryption noises, respectively. Using different labels ensures that the two noises are independent and avoids correlation; the generated random byte strings are then input into a central binomial distribution (CBD) sampler to generate the first and second encryption noises. The coefficients of the first and second encryption noises generated in this way are both small integers, ensuring both semantic security of the encryption process and efficient computation.
[0075] The client multiplies the first encryption noise by the complete public key, and then adds the product to the plaintext message to obtain the first part of the ciphertext. Through this calculation, the plaintext message is hidden within the product, and only the recipient holding the complete private key can extract the plaintext. Since the first encryption noise is randomly generated, even if the same plaintext message is encrypted multiple times, the generated first part of the ciphertext will be different each time, thus ensuring the semantic security of the encryption.
[0076] The client multiplies the first encryption noise by a common matrix, then adds the product to the second encryption noise to obtain the second part of the ciphertext. This second part of the ciphertext, generated through the above calculation, together with the first part, constitutes the complete ciphertext. In the subsequent decryption process, the receiver needs to use the second part of the ciphertext and the private key to eliminate the influence of the first encryption noise, thereby recovering the plaintext message. The introduction of the second encryption noise further enhances the randomness and security of the ciphertext.
[0077] The client compresses and encodes the first and second parts of the calculated ciphertext, converting the polynomial coefficients from high-precision representation to low-bit-width representation and serializing them into byte strings, which are then concatenated to form the ciphertext. Through this compression and encoding process, the original high-precision ciphertext data is converted into a compact byte string format, ensuring both communication efficiency and meeting the precision requirements for decryption.
[0078] In one embodiment, the ciphertext can be obtained through the following steps: Step 1: Randomly generate polynomials ,in, Indicates the first encryption noise; This represents a central binomial distribution and is used to generate noise with small coefficients. This represents a pseudo-random function, starting from a seed. and counter Generate random numbers.
[0079] Step 2: Randomly generate polynomials ,in, This represents the second type of encryption noise.
[0080] Step 3: Calculate the first part of the ciphertext separately. Second part of the ciphertext ;in, This indicates the message to be encrypted, i.e., the plaintext message.
[0081] Step 4: For each and Perform compression encoding, that is: , ;in, , Indicates the number of bits compressed; This represents an encoding function that encodes a polynomial into a byte string. This indicates a compression function that reduces communication volume.
[0082] Step 5: Output ciphertext .
[0083] The embodiments of the present invention introduce random noise to generate ciphertext, so that the encryption result of the same plaintext is different each time, thus ensuring semantic security; at the same time, the size of the ciphertext is greatly reduced by compression coding, reducing transmission and storage overhead, thus balancing security and communication efficiency.
[0084] Figure 2 This is a flowchart illustrating the quantum encryption method provided by the present invention, as shown below. Figure 2 As shown, the method includes the following: Step 201: Receive the ciphertext and partial decryption result sent by the server.
[0085] Partial decryption results are obtained by the server decrypting the ciphertext based on the server's private key fragments. Specifically, the partial decryption result is the difference between the first part of the decoded ciphertext and the second inner product, which is the inner product of the server's private key fragments and the second part of the decoded ciphertext.
[0086] The client receives two parts of data from the server: the original ciphertext and an intermediate result obtained by the server after partially decrypting the ciphertext using its own private key. The server uses its private key to perform partial decryption on the ciphertext, generating an intermediate result value. This result alone cannot recover the plaintext; it must be combined with the client's decryption result to complete the decryption.
[0087] The server decodes and decompresses the received ciphertext to recover the first and second parts of the ciphertext. For example, the server decodes and decompresses the received ciphertext to recover the first and second parts of the ciphertext. , Decode: ; ; in, This represents the first part of the decoded ciphertext; This represents the second part of the ciphertext after decoding; Indicates the byte string Decoded into compressed polynomial coefficients, each coefficient occupies Bit; This indicates that the compression factor will be decompressed back into the model. Approximate value; Indicates the byte string Decoded into compressed polynomial coefficients. express Number of bytes occupied, used for positioning The starting position; Indicates the degree of the polynomial; Indicates the number of bits per byte.
[0088] The server uses the server's private key for fragmentation. Decrypt the ciphertext to obtain partial decryption results. ,in, express The device, This represents the second inner product.
[0089] The server will encrypt the text , And some decryption results Send to the client.
[0090] Step 202: Decrypt the ciphertext based on the client's private key fragment, the ciphertext, and the partial decryption result to obtain the plaintext message.
[0091] Before decryption, the client needs to perform hash verification on the ciphertext to confirm that it has not been tampered with. Specifically, the client calculates the hash value of the received ciphertext and compares it with the expected hash value to verify whether the ciphertext has remained intact and has not been maliciously modified during transmission. For example, the client may have pre-obtained or negotiated the expected hash value of the ciphertext during the key generation or encryption phase. This expected hash value can be calculated and published by the sender during encryption, or it can be calculated and sent to the client by the server after receiving the ciphertext. The client receives the ciphertext sent by the server. Then, a hash operation is performed on the ciphertext byte string to calculate the actual hash value: ; in, This indicates the preset cryptographic hash function (such as SM3, SHA-256, etc.). The client will calculate the actual hash value. Compared with the expected hash value Comparison: like If the result is positive, it means that the ciphertext has not been tampered with during transmission, the integrity verification is successful, and the client can continue to perform subsequent decryption operations. like If the message indicates that the ciphertext may have been tampered with, the client will terminate the decryption process and optionally output an error message.
[0092] Through the hash verification described above, the client can effectively detect whether the ciphertext has been maliciously modified by a man-in-the-middle attacker during transmission. This mechanism ensures that the ciphertext processed in subsequent decryption operations is consistent with the original ciphertext generated by the sender, avoiding incorrect decryption results or other security risks caused by ciphertext tampering.
[0093] The client uses its own private key fragments, combined with the ciphertext sent by the server and partial decryption results, to recover the original plaintext message through vector inner product and subtraction operations. Through this process, the client uses its own private key fragments to eliminate residual server noise in the partial decryption results, thus fully recovering the original plaintext. Since the client only possesses a portion of the private key and cannot complete decryption independently, it needs to collaborate with the server to obtain the plaintext message, thereby achieving a secure mechanism of distributed private key storage and collaborative decryption.
[0094] The quantum decryption method provided in this invention involves receiving ciphertext and a partial decryption result from a server. The partial decryption result is obtained by the server decrypting the ciphertext using fragments of its private key. The plaintext message is then decrypted using fragments of the client's private key, the ciphertext, and the partial decryption result. This invention achieves decryption through collaboration between the client and server. The server uses fragments of its private key to partially decrypt the ciphertext, obtains a partial decryption result, and sends it to the client. The client then uses fragments of its private key to complete the final decryption, recovering the plaintext message. This solution requires no additional hardware, ensuring user convenience while enhancing the security of ciphertext storage and transmission. Even if a single point of attack occurs on the client device or the server, attackers cannot obtain the plaintext information, effectively preventing data security risks caused by single-point leakage of the private key.
[0095] Based on the above embodiments, the process of decrypting based on client private key fragmentation, the ciphertext, and the partial decryption result to obtain a plaintext message includes: The ciphertext is decoded and decompressed to obtain the decoded second part of the ciphertext; Calculate the first inner product of the decoded second part of the ciphertext and the fragment of the client's private key; The difference between the partial decryption result and the first inner product is taken as the plaintext message.
[0096] The client extracts the second ciphertext component from the received ciphertext, restoring it from compressed byte string form to polynomial vector form for subsequent decryption operations. Through the above decoding and decompression process, the compressed second ciphertext component in the original ciphertext is restored to a vector form that can directly participate in polynomial operations, providing the basic data for subsequent inner product calculations and plaintext recovery.
[0097] The client performs an inner product operation between the decoded second part of the ciphertext vector and its own private key fragment vector, obtaining a scalar result. Through this inner product operation, the client uses its own private key fragments to eliminate some of the remaining server-side noise components in the decrypted result, ultimately recovering the original plaintext. The client subtracts the calculated inner product from the partial decryption result sent by the server, and the result is the original plaintext message. Through the above subtraction operation, the client successfully eliminates the remaining part of the ciphertext contributed by the server's private key fragments, and combines it with its own private key fragments to complete the final decryption and recover the original plaintext message.
[0098] In one embodiment, the client uses its private key to fragment. Perform collaborative decryption to recover plaintext messages. ,in, This represents the first inner product.
[0099] This invention decomposes decryption into two independent stages: partial decryption on the server side and final decryption on the client side. This ensures that neither party can complete the decryption alone, and plaintext can only be recovered through collaboration between the two parties. This achieves physical distribution of private keys and mutual checks and balances on permissions, effectively preventing the risk of key leakage caused by single point of attack.
[0100] The quantum encryption device provided by the present invention is described below. The quantum encryption device described below and the quantum encryption method described above can be referred to in correspondence.
[0101] refer to Figure 3 The quantum encryption device provided by the present invention includes: Interaction module 301 is used to interact with the server, generate a public matrix, and send the public matrix to the server; The first public key component generation module 302 is used to generate the first public key component of the client based on the public matrix, client private key fragmentation, and first noise; The first receiving module 303 is used to receive the second public key component sent by the server; the second public key component is generated based on the public matrix, server private key fragmentation, and second noise. The complete public key generation module 304 is used to generate a complete public key based on the first public key component and the second public key component; The encryption module 305 is used to encrypt plaintext messages based on the public matrix and the complete public key to generate ciphertext.
[0102] The quantum encryption device provided in this invention generates a public matrix through interaction between the client and server. Each party then generates its own private key fragment and public key component, ultimately synthesizing a complete public key, thus achieving distributed storage of the private key. Based on this, the client uses the synthesized public key to encrypt plaintext, ensuring the security of the encryption process. This scheme does not rely on additional hardware security devices; it can distribute and store the private key across both ends solely through software collaboration. This effectively avoids the risk of the private key being easily stolen when stored in the memory of a single terminal. Even if the client device is lost or the server is attacked, attackers cannot obtain the complete private key, improving the security of private key storage while also ensuring user convenience.
[0103] In one embodiment, the encryption module 305 is further configured to: Based on a preset random number generation method, first encryption noise and second encryption noise are generated; Based on the first encryption noise, the complete public key, and the plaintext message, a first part of the ciphertext is generated; A second part of the ciphertext is generated based on the first encryption noise, the common matrix, and the second encryption noise. The first part of the ciphertext and the second part of the ciphertext are compressed and encoded respectively to obtain the ciphertext.
[0104] In one embodiment, the interaction module 301 is further configured to: Generate a first random matrix and calculate the first hash value of the first random matrix; Send the first hash value to the server; Receive the second hash value sent by the server; Send the first random matrix to the server; Receive the second random matrix sent by the server; If the hash value of the second random matrix is the same as the second hash value, then the first random matrix and the second random matrix are added together to obtain the initial common matrix; The initial common matrix is concatenated with the identity matrix to obtain the common matrix.
[0105] In one embodiment, the first public key component generation module 302 is further configured to: Based on the central binomial distribution, the client private key fragment and the first noise are generated; Multiply the public matrix by the client's private key in segments to obtain the product; The product is added to the first noise to obtain the first public key component.
[0106] The quantum decryption device provided by the present invention is described below. The quantum decryption device described below and the quantum decryption method described above can be referred to in correspondence.
[0107] refer to Figure 4 The quantum decryption device provided by the present invention includes: The second receiving module 401 is used to receive ciphertext and partial decryption results sent by the server; the partial decryption results are obtained by the server decrypting the ciphertext based on the server's private key fragments. The decryption module 402 is used to decrypt the ciphertext based on the client's private key fragments, the ciphertext, and the partial decryption results to obtain the plaintext message.
[0108] The quantum decryption device provided in this invention completes the decryption operation through collaboration between the client and the server. The server uses its private key to partially decrypt the ciphertext, obtains a partial decryption result, and sends it to the client. The client then uses its private key to complete the final decryption, recovering the plaintext message. This solution requires no additional hardware, ensuring user convenience while improving the security of ciphertext storage and transmission. Even if a single point of attack occurs on the client device or the server, attackers cannot obtain the plaintext information, effectively preventing data security risks caused by single-point leakage of the private key.
[0109] In one embodiment, the decryption module 402 is further configured to: The ciphertext is decoded and decompressed to obtain the decoded second part of the ciphertext; Calculate the first inner product of the decoded second part of the ciphertext and the fragment of the client's private key; The difference between the partial decryption result and the first inner product is taken as the plaintext message.
[0110] In one embodiment, the partial decryption result is the difference between the decoded first part of the ciphertext and the second inner product, where the second inner product is the inner product of the server private key fragment and the decoded second part of the ciphertext.
[0111] Figure 5 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 5As shown, the electronic device may include a processor 510, a communications interface 520, a memory 530, and a communication bus 540, wherein the processor 510, communications interface 520, and memory 530 communicate with each other via the communication bus 540. The processor 510 can invoke logical instructions in the memory 530 to execute a quantum encryption method, which includes: interacting with a server to generate a public matrix and sending the public matrix to the server; generating a first public key component for the client based on the public matrix, client private key fragments, and first noise; receiving a second public key component sent by the server; the second public key component is generated based on the public matrix, server private key fragments, and second noise; generating a complete public key based on the first and second public key components; and encrypting a plaintext message based on the public matrix and the complete public key to generate ciphertext.
[0112] Alternatively, processor 510 may invoke logical instructions in memory 530 to execute a quantum encryption method, which includes: receiving ciphertext and partial decryption results sent by the server; the partial decryption results being obtained by the server decrypting the ciphertext based on the server's private key fragments; and decrypting the ciphertext based on the client's private key fragments, the ciphertext, and the partial decryption results to obtain a plaintext message.
[0113] Furthermore, the logical instructions in the aforementioned memory 530 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0114] On the other hand, the present invention also provides a computer program product, which includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the quantum encryption method provided by the above methods. The method includes: interacting with a server to generate a public matrix and sending the public matrix to the server; generating a first public key component for the client based on the public matrix, client private key fragmentation, and first noise; receiving a second public key component sent by the server; the second public key component is generated based on the public matrix, server private key fragmentation, and second noise; generating a complete public key based on the first and second public key components; and encrypting a plaintext message based on the public matrix and the complete public key to generate ciphertext.
[0115] Alternatively, when the computer program is executed by the processor, the computer can execute the quantum encryption method provided by the above methods, which includes: receiving ciphertext and partial decryption result sent by the server; the partial decryption result is obtained by the server decrypting the ciphertext based on the server's private key fragments; and decrypting based on the client's private key fragments, the ciphertext, and the partial decryption result to obtain the plaintext message.
[0116] In another aspect, the present invention also provides a non-transitory computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the quantum encryption method provided by the methods described above. The method includes: interacting with a server to generate a public matrix and sending the public matrix to the server; generating a first public key component for the client based on the public matrix, client private key fragments, and first noise; receiving a second public key component sent by the server; the second public key component being generated based on the public matrix, server private key fragments, and second noise; generating a complete public key based on the first and second public key components; and encrypting a plaintext message based on the public matrix and the complete public key to generate ciphertext.
[0117] Alternatively, when the computer program is executed by a processor, it is implemented to perform the quantum encryption methods provided by the methods described above, the method comprising: receiving ciphertext and a partial decryption result sent by the server; the partial decryption result being obtained by the server decrypting the ciphertext based on the server's private key fragments; and decrypting the ciphertext based on the client's private key fragments, the ciphertext, and the partial decryption result to obtain a plaintext message.
[0118] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0119] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, 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 computer-readable 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, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0120] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A quantum encryption method, characterized in that, Applied to the client side, including: Interact with the server to generate a common matrix, and send the common matrix to the server; Based on the public matrix, client private key fragmentation, and first noise, the first public key component of the client is generated; Receive the second public key component sent by the server; the second public key component is generated based on the public matrix, server private key fragmentation, and second noise. Generate a complete public key based on the first public key component and the second public key component; Based on the public matrix and the complete public key, the plaintext message is encrypted to generate ciphertext.
2. The quantum encryption method according to claim 1, characterized in that, The process of encrypting the plaintext message based on the public matrix and the complete public key to generate ciphertext includes: Based on a preset random number generation method, first encryption noise and second encryption noise are generated; Based on the first encryption noise, the complete public key, and the plaintext message, a first part of the ciphertext is generated; A second part of the ciphertext is generated based on the first encryption noise, the common matrix, and the second encryption noise. The first part of the ciphertext and the second part of the ciphertext are compressed and encoded respectively to obtain the ciphertext.
3. The quantum encryption method according to claim 1, characterized in that, The interaction with the server to generate a public matrix includes: Generate a first random matrix and calculate the first hash value of the first random matrix; Send the first hash value to the server; Receive the second hash value sent by the server; Send the first random matrix to the server; Receive the second random matrix sent by the server; If the hash value of the second random matrix is the same as the second hash value, then the first random matrix and the second random matrix are added together to obtain the initial common matrix; The initial common matrix is concatenated with the identity matrix to obtain the common matrix.
4. The quantum encryption method according to claim 1, characterized in that, The step of generating the first public key component of the client based on the public matrix, client private key fragments, and first noise includes: Based on the central binomial distribution, the client private key fragment and the first noise are generated; Multiply the public matrix by the client's private key in segments to obtain the product; The product is added to the first noise to obtain the first public key component.
5. A quantum decryption method, characterized in that, Applied to the client side, including: The server receives ciphertext and a partial decryption result from the server; the partial decryption result is obtained by the server decrypting the ciphertext based on the server's private key fragments. The plaintext message is obtained by decrypting the client's private key fragments, the ciphertext, and the partial decryption result.
6. The quantum decryption method according to claim 5, characterized in that, The plaintext message is obtained by decrypting based on the client's private key fragment, the ciphertext, and the partial decryption result, including: The ciphertext is decoded and decompressed to obtain the decoded second part of the ciphertext; Calculate the first inner product of the decoded second part of the ciphertext and the fragment of the client's private key; The difference between the partial decryption result and the first inner product is taken as the plaintext message.
7. The quantum decryption method according to claim 6, characterized in that, The partial decryption result is the difference between the first part of the decoded ciphertext and the second inner product, where the second inner product is the inner product of the server-side private key fragment and the second part of the decoded ciphertext.
8. A quantum encryption device, characterized in that, Applied to the client side, including: An interaction module is used to interact with the server, generate a public matrix, and send the public matrix to the server. The first public key component generation module is used to generate the first public key component of the client based on the public matrix, client private key fragmentation, and first noise; The first receiving module is used to receive the second public key component sent by the server; the second public key component is generated based on the public matrix, server private key fragmentation, and second noise. A complete public key generation module is used to generate a complete public key based on the first public key component and the second public key component; An encryption module is used to encrypt plaintext messages based on the public matrix and the complete public key to generate ciphertext.
9. A quantum decryption device, characterized in that, Applied to the client side, including: The second receiving module is used to receive ciphertext and partial decryption results sent by the server; the partial decryption results are obtained by the server decrypting the ciphertext based on the server's private key fragments. The decryption module is used to decrypt the ciphertext based on the client's private key fragments, the ciphertext, and the partial decryption results to obtain the plaintext message.
10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that, When the processor executes the computer program, it implements the quantum encryption method as described in any one of claims 1 to 4, or when the processor executes the computer program, it implements the quantum decryption method as described in any one of claims 5 to 7.
