A method and device for optimizing encryption parameters of post-quantum keys
By optimizing the configuration of encryption parameters in the NTRU algorithm and its variants, generating and passing public and private key data, the decryption failure caused by the configuration error of encryption parameters is solved, and a high security and efficient encryption and decryption process is achieved.
Patent Information
- Application Number
- CN202411879289.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-19
- Publication Date
- 2025-04-18
- Estimated Expiration
- 2044-12-19
AI Technical Summary
In the NTRU algorithm and its variants, if the encryption parameters are configured incorrectly, it may lead to decryption failure, especially in the matrix NTRU algorithm, the out-of-bounds problem will lead to decryption errors.
By obtaining the encryption parameters under preset conditions, the public and private key data are generated, and these parameters are passed between the receiving device and the sending device to ensure the correctness of the encryption and decryption process.
This method effectively avoids the risk of decryption failure, improves encryption and decryption efficiency, ensures high security of data transmission, and is suitable for scenarios where there are strict requirements for decryption accuracy.
Smart Images

Figure CN119324783B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of computer information processing, and in particular to a method and device for optimizing encryption parameters of a post-quantum key. Background Art
[0002] The key system of the NTRU (number theory research unit) algorithm has the characteristics of simple structure and resistance to quantum computing attacks. It is a typical post-quantum cryptographic algorithm. During the execution of the NTRU algorithm, if the encryption parameters are configured incorrectly, such as improper modulus selection and inappropriate key generation parameters, decryption failure may occur. With the continuous deepening of the research on the NTRU algorithm, many variants of the NTRU public key cryptographic algorithm have emerged. Like the NTRU algorithm, most of these variant algorithms have decryption failures, such as the matrix NTRU algorithm. The matrix NTRU cryptographic system replaces the polynomial structure of the original NTRU cryptographic system with a matrix structure. After obtaining the ciphertext, the decryptor checks each element of the intermediate matrix. If there is an element greater than a specific value, then an out-of-bounds occurs and the decryption error occurs. How to improve and optimize the matrix NTRU algorithm to avoid decryption failures has become a research direction for post-quantum cryptography. Summary of the invention
[0003] The present invention provides a method and device for optimizing encryption parameters of a post-quantum key, which solves the problem of decryption failure caused by incorrect configuration of data encryption parameters during data encryption.
[0004] In order to solve the above technical problems, the technical solution of the present invention is as follows:
[0005] An embodiment of the present invention provides a method for optimizing encryption parameters of a post-quantum key, which is applied to a receiving device and includes:
[0006] Obtaining a first encryption parameter, where the first encryption parameter is obtained according to a first preset condition;
[0007] Generate public key data and private key data according to the first encryption parameter;
[0008] Sending the public key data to a sending end device;
[0009] Acquire ciphertext data sent by a sending end device, where the ciphertext data is obtained by the sending end device processing plaintext data according to the public key data;
[0010] The ciphertext data is processed according to the private key data to obtain plaintext data.
[0011] Optionally, obtaining a first encryption parameter, where the first encryption parameter is obtained according to a first preset condition, includes:
[0012] Generate a random positive integer;
[0013] According to the positive integer, a plurality of numerical intervals are obtained;
[0014] A first encryption parameter is obtained according to the multiple value intervals.
[0015] Optionally, multiple numerical ranges are obtained according to the positive integer, including:
[0016] according to: ,
[0017] Obtaining a first numerical interval;
[0018] in, Q 1 is the first numerical interval, a 1 for Q The elements in 1, n is a natural number, and n ≥2, Z is the ring of integers, q is a random positive integer;
[0019] according to: ,
[0020] Obtaining a second numerical interval;
[0021] in, Q 2 is the second numerical interval, a 2 for Q Elements in 2;
[0022] according to: ,
[0023] Obtaining a third numerical interval;
[0024] in, Q 3 is the third numerical interval, a 3 for Q 3.
[0025] Optionally, obtaining a first encryption parameter according to the multiple value intervals includes:
[0026] according to:
[0027] ,
[0028] Obtaining a first encryption parameter;
[0029] in, p For q are mutually prime integers, and p Less than q , F andG are all square matrices, and det( F )≠0.
[0030] Optionally, generating public key data and private key data according to the first encryption parameter includes:
[0031] according to: ,
[0032] Generate public key data and private key data;
[0033] in, pk is the public key data, sk is the private key data, H is a real matrix, ≡ is the congruence symbol, , For the matrix F The inverse element, E is the identity matrix.
[0034] Optionally, the ciphertext data is processed according to the private key data to obtain plaintext data, including:
[0035] according to: ,
[0036] Processing the ciphertext data to obtain an intermediate result;
[0037] in, A is the intermediate result, C is the ciphertext data;
[0038] according to:
[0039] ,
[0040] Processing the intermediate result to obtain plaintext data;
[0041] in, B The data is in plain text.
[0042] The embodiment of the present invention further provides a method for optimizing encryption parameters of a post-quantum key, which is applied to a sending end device, comprising:
[0043] Obtain the public key data sent by the receiving device;
[0044] Processing the plaintext data according to the public key data to obtain ciphertext data;
[0045] The ciphertext data is sent to the receiving device.
[0046] Optionally, the plaintext data is processed according to the public key data to obtain the ciphertext data, including:
[0047] Obtaining a second encryption parameter, where the second encryption parameter is obtained according to a second preset condition;
[0048] According to the public key data and the second encryption parameter, by: ,
[0049] Mapping the plaintext data to obtain the ciphertext data;
[0050] in, C is the ciphertext data, ≡ is the congruence symbol, H is a real matrix, H =pk, pk is the public key data, q is a random positive integer, p For q are mutually prime integers, and p Less than q , the second encryption parameter includes a randomly selected matrix R and the plaintext matrix M ,in, , , Elements in , , is the plaintext space, the second encryption parameter R.M. satisfy: ,
[0051] in, ,a for Q The elements in 3, Z is the ring of integers.
[0052] The embodiment of the present invention further provides a receiving end device, including:
[0053] A first acquisition module, used to acquire a first encryption parameter, where the first encryption parameter is obtained according to a first preset condition;
[0054] A first generating module, used to generate public key data and private key data according to the first encryption parameter;
[0055] A first transceiver module, used to send the public key data to a sending end device;
[0056] The first transceiver module is further used to obtain ciphertext data sent by the sending end device, where the ciphertext data is obtained by the sending end device processing the plaintext data according to the public key data;
[0057] The first processing module is used to process the ciphertext data according to the private key data to obtain plaintext data.
[0058] The embodiment of the present invention further provides a sending end device, including:
[0059] The second transceiver module is used to obtain the public key data sent by the receiving device;
[0060] A second processing module, used to process the plaintext data according to the public key data to obtain ciphertext data;
[0061] The second transceiver module further sends the ciphertext data to the receiving device.
[0062] The technical solution of the present invention includes at least the following effects:
[0063] The above scheme of the present invention obtains a first encryption parameter, which is obtained by a first preset condition; generates public key data and private key data according to the first encryption parameter; sends the public key data to a sending end device; obtains ciphertext data sent by the sending end device, which is obtained by the sending end device processing plaintext data according to the public key data; and processes the ciphertext data according to the private key data to obtain plaintext data. This scheme realizes rapid encryption and decryption of data and improves encryption and decryption efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0064] Figure 1 is a flow chart of a method for optimizing encryption parameters of a post-quantum key applied to a receiving device provided in an embodiment of the present invention;
[0065] Figure 2 is a flow chart of a method for optimizing encryption parameters of a post-quantum key applied to a transmitting end device provided in an embodiment of the present invention;
[0066] Figure 3 It is a function diagram of the encryption parameter optimization method of the post-quantum key provided by an embodiment of the present invention;
[0067] Figure 4 is a structural diagram of a receiving end device provided by an embodiment of the present invention;
[0068] Figure 5 It is a structural diagram of a sending end device provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0069] The exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present invention and to enable the scope of the present invention to be fully communicated to those skilled in the art.
[0070] like Figure 1As shown, an embodiment of the present invention proposes a method for optimizing encryption parameters of a post-quantum key, which is applied to a receiving device, comprising:
[0071] Step 11, obtaining a first encryption parameter, wherein the first encryption parameter is obtained according to a first preset condition;
[0072] Step 12, generating public key data and private key data according to the first encryption parameter;
[0073] Step 13, sending the public key data to the sending end device;
[0074] Step 14, obtaining ciphertext data sent by the sending end device, wherein the ciphertext data is obtained by the sending end device processing the plaintext data according to the public key data;
[0075] Step 15: Process the ciphertext data according to the private key data to obtain plaintext data.
[0076] In this embodiment, the receiving end first determines a parameter for the encryption process, which is obtained through preset conditions. Taking the NTRU (number theory research unit) algorithm as an example, during the execution of the NTRU algorithm, if the encryption parameter configuration is incorrect, such as improper modulus selection, inappropriate key generation parameters, etc., decryption failure may occur. In the matrix NTRU algorithm, the polynomial structure of the original NTRU cryptographic system is replaced with a matrix structure. After obtaining the ciphertext C, the decryption party calculates A≡F∙C(mod q ), check each element of matrix A , if it exists , then an out-of-bounds situation occurs, causing a decryption error; therefore, selecting encryption parameters according to preset conditions can avoid the above problems and ensure that decryption can be carried out successfully; at the same time, the value of the encryption parameter will directly affect the strength of the generated public and private keys;
[0077] After obtaining the encryption parameters, an encryption algorithm is used to generate a pair of keys: a public key and a private key. As a preferred method, the NTRU variant algorithm is selected in this embodiment to generate the public key and the private key; wherein the public key is public and can be used by any sending device that needs to communicate with the encryption party to encrypt messages; and the private key is confidential and is only stored in the encryption party device and is used to decrypt messages encrypted by the public key;
[0078] After generating the public key and private key, the receiver sends the public key to any sender device that wishes to communicate with it; the publicity of the public key enables any sender device that has the public key to use it to encrypt messages without worrying about the security of the message during transmission, because only the receiver holding the corresponding private key can decrypt it;
[0079] Once the public key is sent and successfully received, the sending device can use the public key to encrypt the plaintext data it wants to send to the receiving device to generate ciphertext data; the encryption process involves combining the plaintext data with the public key through an encryption algorithm to generate seemingly random and incomprehensible ciphertext data, which the sending device then sends to the receiving device;
[0080] Finally, the receiver uses its private key to decrypt the received ciphertext data; decryption is the reverse process of encryption, using the private key and encryption algorithm to restore the original plaintext data; since only the receiver holds the correct private key, only the receiver can successfully decrypt the message encrypted by the corresponding public key, thus ensuring the security and privacy of the communication.
[0081] The parameter optimization selection method can be applied to the matrix NTRU algorithm, including the key generation, encryption algorithm and decryption algorithm. The method is applied to parameter generation; the technical solution includes at least the following effects:
[0082] (1) High-security data transmission: By optimizing parameters, the risk of decryption failure is reduced or even eliminated, making it suitable for scenarios with strict requirements on decryption correctness, such as financial transactions, military communications and other highly confidential data transmission occasions;
[0083] (2) Data encryption in cloud computing and IoT environments: A large amount of sensitive data in cloud computing and IoT environments needs to be encrypted for transmission and storage. The matrix NTRU algorithm with optimized parameters can improve the decryption success rate and ensure the integrity and reliability of data;
[0084] (3) Medical data security: In medical information systems, the privacy protection of patient data is crucial. The use of the optimized matrix NTRU algorithm can ensure the accuracy of decryption and prevent data leakage caused by data loss or erroneous decryption.
[0085] In an optional embodiment of the present invention, step 11 may include:
[0086] Step 111, generate a random positive integer;
[0087] Step 112, obtaining a plurality of numerical intervals according to the positive integer;
[0088] Among them, according to:
[0089] (1)
[0090] Obtaining a first numerical interval;
[0091] in, Q 1 is the first numerical interval, a 1 forQ The elements in 1, n is a natural number, and n ≥2, Z is the ring of integers, q is a random positive integer;
[0092] according to:
[0093] (2)
[0094] Obtaining a second numerical interval;
[0095] in, Q 2 is the second numerical interval, a 2 for Q Elements in 2;
[0096] according to:
[0097] (3)
[0098] Obtaining a third numerical interval;
[0099] in, Q 3 is the third numerical interval, a 3 for Q 3.
[0100] Step 113, obtaining a first encryption parameter according to the multiple value intervals;
[0101] Among them, according to: (4)
[0102] Obtaining a first encryption parameter;
[0103] in, p For q are mutually prime integers, and p Less than q , F and G are all square matrices, and .
[0104] In this embodiment, a random positive integer is first determined q ;get q Then, according to equations (1) to (3), we can get to These three numerical ranges; from to In these three numerical intervals, p, F.G These three encryption parameters, among which, p Also need to meet: p For q are mutually prime integers, andp Much smaller than q ; F is a square matrix of order not less than 2, F Any element in In, and F Need to meet : G is a square matrix of order not less than 2, G Any element in After the above preconditions, we can get p, F , G These three encryption parameters.
[0105] In an optional embodiment of the present invention, step 12 may include:
[0106] Step 121, according to: (5)
[0107] Generate public key data and private key data;
[0108] in, pk is the public key data, sk is the private key data, H is a real matrix, ≡ is the congruence symbol, , For the matrix F The inverse element, E is the identity matrix.
[0109] In this embodiment, after obtaining p, F , G After these three encryption parameters are obtained, the public key data can be obtained according to formula (5): pk and private key data sk The public key is public and can be used by any sending device that needs to communicate with the encryption party to encrypt messages; the private key is confidential and is only stored in the encryption party device to decrypt messages encrypted by the public key.
[0110] In an optional embodiment of the present invention, step 15 may include:
[0111] Step 151, according to: (6)
[0112] Processing the ciphertext data to obtain an intermediate result;
[0113] in, A is the intermediate result, C is the ciphertext data;
[0114] Step 152, according to: (7)
[0115] Processing the intermediate result to obtain plaintext data;
[0116] in, B The data is in plain text.
[0117] In this embodiment, the receiving end obtains the ciphertext data C After that, the ciphertext data C According to formula (6), the intermediate result is obtained A ; Then the intermediate result A According to formula (7), we can get the plaintext data B .
[0118] like Figure 2 As shown, an embodiment of the present invention proposes a method for optimizing encryption parameters of a post-quantum key, which is applied to a sending end device, comprising:
[0119] Step 21, obtaining the public key data sent by the receiving device;
[0120] Step 22, processing the plaintext data according to the public key data to obtain ciphertext data;
[0121] Step 23: Send the encrypted data to the receiving device.
[0122] In this embodiment, a secure communication channel is first established between the sender and the receiver to ensure the security of the public key data during the transmission process; after the secure connection is established, the receiving device will send its public key data to the sender; after receiving the public key, the sender selects an encryption algorithm to encrypt the plaintext data to ensure that even if the ciphertext is intercepted by a third party, it cannot be easily restored to plaintext; after the encryption is completed, the ciphertext data is obtained; the ciphertext data is the result of the plaintext data being processed by the encryption algorithm, and can only be decrypted if the corresponding private key is possessed; using the previously established secure connection, the sender sends the ciphertext data to the receiver; since the ciphertext data has been encrypted, even if it is intercepted by a third party during network transmission, the original information cannot be directly obtained; after confirming that the ciphertext data has been successfully sent and receiving the confirmation from the receiver, the sender can safely close the secure connection with the receiver.
[0123] In an optional embodiment of the present invention, step 22 may include:
[0124] Step 221, obtaining a second encryption parameter, where the second encryption parameter is obtained according to a second preset condition;
[0125] Step 222, according to the public key data and the second encryption parameter, by:
[0126] (8)
[0127] Mapping the plaintext data to obtain the ciphertext data;
[0128] in, C is the ciphertext data, ≡ is the congruence symbol, H is a real matrix, H = pk , pk is the public key data, q is a random positive integer, p For q are mutually prime integers, and p Less than q , the second encryption parameter
[0129] Including random selection matrix R and the plaintext matrix M ,in, , , Elements in , , is the plaintext space, the second encryption parameter R.M. satisfy:
[0130] (9)
[0131] in, , a for Q The elements in 3, Z is the ring of integers.
[0132] In this embodiment, when the sending end encrypts the plaintext data according to the public key data, it first obtains the second encryption parameter through the second preset condition, wherein the second encryption parameter includes the random selection matrix R and the plaintext matrix M , R and M The second prerequisite that needs to be met includes: , , is the plaintext space, , Elements in ,and , ,in, , a for Q The elements in 3, Z is the ring of integers;
[0133] After obtaining the second encryption parameter, the plaintext matrix M Perform mapping processing to obtain ciphertext dataC .
[0134] like Figure 3 As shown, a specific embodiment of the encryption parameter optimization method of the post-quantum key provided by the embodiment of the present invention is:
[0135] Step 1: Obtain a first encryption parameter, where the first encryption parameter is obtained through a first preset condition.
[0136] First generate a random positive integer q ; Then according to the positive integer q ,get Q 1~ Q 3These three numerical intervals, among which,
[0137] ,
[0138] ,
[0139] ,
[0140] In the formula, n is a natural number, and n ≥2, Z is the ring of integers, a 1 for Q The elements in 1, a 2 for Q The elements in 2, a 3 for Q Elements in 3;
[0141] Finally Q 1~ Q 3 Randomly select a value from these three value intervals to obtain the first encryption parameter p , F , G ,in, , , , p For q are mutually prime integers, and p Much smaller than q , F The order is equal to n The square array, F Any element in Q 2, and F Need to meet : G The order is equal to n The square array, G Any element in Q 3 in;
[0142] Step 2: Generate public key data and private key data according to the first encryption parameter.
[0143] Get the first encryption parameter p , F , G Afterwards, according to:
[0144] ,
[0145] Generate public key data and private key data;
[0146] in, pk is the public key data, sk is the private key data, H is a real matrix, ≡ is the congruence symbol, , For the matrix F The inverse element, E is the identity matrix.
[0147] Step 3, sending the public key data to the sending end device; the sending end device processes the plaintext data according to the public key data to obtain ciphertext data; and sends the ciphertext data to the receiving end device.
[0148] After receiving the public key data, the sending end device first obtains the second encryption parameter when encrypting the plaintext data. The second encryption parameter includes a random selection matrix R and the plaintext matrix M The second encryption parameter is obtained by a second preset condition. The specific process includes: first determining a random positive integer q , and then according to the positive integer q ,get Q 1 and Q 3, namely
[0149] ,
[0150] ,
[0151] In the formula, a 1 for Q The elements in 1, a for Q The elements in 3, Z is the ring of integers;
[0152] according to: ,
[0153] get p , p For q are mutually prime integers, and p Much smaller than q ;
[0154] according to:
[0155] Get the random selection matrix R and the plaintext matrix M ,in, , , Elements in , , is the plaintext space; the corresponding table of the optimized parameter selection space is shown in Table 1.
[0156] Table 1 Parameter space correspondence table
[0157]
[0158] According to the public key data and the second encryption parameter, by:
[0159] ,
[0160] Mapping the plaintext data to obtain the ciphertext data;
[0161] in, C is the ciphertext data, ≡ is the congruence symbol, H is a real matrix, H = pk , pk It is the public key data.
[0162] The sending device gets the ciphertext data C Then, the ciphertext data is sent to the receiving device.
[0163] Step 4: Obtain the ciphertext data sent by the sending device.
[0164] Step 5: Process the ciphertext data according to the private key data to obtain plaintext data.
[0165] The receiving end obtains the ciphertext data C After that, the ciphertext data C according to:
[0166] ,
[0167] Process and obtain intermediate results A ;
[0168] Then the intermediate result A according to:
[0169] ,
[0170] Process and get the plaintext data B .
[0171] From the decryption algorithm, we can know that
[0172] A ≡ F∙C (mod q)≡p∙ F∙ ∙ G∙R+F∙M (mod q)≡p ∙G∙R+F∙M (mod q),
[0173] The element in row i and column j for:
[0174] ,
[0175] Therefore, for , whose maximum value is
[0176] ,
[0177] Cause Matrix A The absolute value of any element is less than , so the model The calculation will not affect the data and can prevent subsequent model Decryption of the operation failed.
[0178] The technical solution includes at least the following effects:
[0179] (1) High-security data transmission: By optimizing parameters, the risk of decryption failure is reduced or even eliminated, making it suitable for scenarios with strict requirements on decryption correctness, such as financial transactions, military communications and other highly confidential data transmission occasions;
[0180] (2) Data encryption in cloud computing and IoT environments: A large amount of sensitive data in cloud computing and IoT environments needs to be encrypted for transmission and storage. The matrix NTRU with optimized parameters can improve the decryption success rate and ensure the integrity and reliability of the data;
[0181] (3) Medical data security: In medical information systems, the privacy protection of patient data is crucial. The use of the optimized matrix NTRU algorithm can ensure the accuracy of decryption and prevent data leakage caused by data loss or erroneous decryption.
[0182] like Figure 4 As shown, the embodiment of the present invention further provides a receiving end device 40, including:
[0183] A first acquisition module 41, used to acquire a first encryption parameter, where the first encryption parameter is obtained according to a first preset condition;
[0184] A first generating module 42, used to generate public key data and private key data according to the first encryption parameter;
[0185] A first transceiver module 43, used to send the public key data to a sending end device;
[0186] The first transceiver module 43 is further used to obtain ciphertext data sent by the sending end device, where the ciphertext data is obtained by the sending end device processing the plaintext data according to the public key data;
[0187] The first processing module 44 is used to process the ciphertext data according to the private key data to obtain plaintext data.
[0188] Optionally, the first acquisition module 41 is specifically used for:
[0189] Generate a random positive integer;
[0190] According to the positive integer, a plurality of numerical intervals are obtained;
[0191] A first encryption parameter is obtained according to the multiple value intervals.
[0192] Optionally, multiple numerical ranges are obtained according to the positive integer, including:
[0193] according to: ,
[0194] Obtaining a first numerical interval;
[0195] in, Q 1 is the first numerical interval, a 1 for Q The elements in 1, n is a natural number, and n ≥2, Z is the ring of integers, q is a random positive integer;
[0196] according to: ,
[0197] Obtaining a second numerical interval;
[0198] in, Q 2 is the second numerical interval, a 2 for Q Elements in 2;
[0199] according to: ,
[0200] Obtaining a third numerical interval;
[0201] in, Q 3 is the third numerical interval, a 3 forQ 3.
[0202] Optionally, obtaining a first encryption parameter according to the multiple value intervals includes:
[0203] according to:
[0204] ,
[0205] Obtaining a first encryption parameter;
[0206] in, p For q are mutually prime integers, and p Less than q , F and G are all square matrices, and det( F )≠0.
[0207] Optionally, the first generating module 42 is specifically used for:
[0208] according to:
[0209] ,
[0210] Generate public key data and private key data;
[0211] in, pk is the public key data, sk is the private key data, H is a real matrix, ≡ is the congruence symbol, , For the matrix F The inverse element, E is the identity matrix.
[0212] Optionally, the first processing module 44 is specifically used for:
[0213] according to: ,
[0214] Processing the ciphertext data to obtain an intermediate result;
[0215] in, A is the intermediate result, C is the ciphertext data;
[0216] according to: ,
[0217] Processing the intermediate result to obtain plaintext data;
[0218] in, B The data is in plain text.
[0219] It should be noted that this device is a device corresponding to the above-mentioned encryption parameter optimization method of the post-quantum key applied to the receiving device. All implementation methods in the above-mentioned method embodiment are applicable to this embodiment and can achieve the same technical effect.
[0220] like Figure 5 As shown, the embodiment of the present invention further provides a sending end device 50, including:
[0221] The second transceiver module 51 is used to obtain the public key data sent by the receiving device;
[0222] A second processing module 52, used to process the plaintext data according to the public key data to obtain ciphertext data;
[0223] The second transceiver module 51 further sends the ciphertext data to the receiving device.
[0224] Optionally, the second processing module 52 is specifically used for:
[0225] Obtaining a second encryption parameter, where the second encryption parameter is obtained according to a second preset condition;
[0226] According to the public key data and the second encryption parameter, by:
[0227] ,
[0228] Mapping the plaintext data to obtain the ciphertext data;
[0229] in, C is the ciphertext data, ≡ is the congruence symbol, H is a real matrix, H=pk , pk is the public key data, q is a random positive integer, p For q are mutually prime integers, and p Less than q , the second encryption parameter includes a randomly selected matrix R and the plaintext matrix M ,in, , , The elements in , ,
[0230] is the plaintext space, the second encryption parameter R.M. satisfy:
[0231] ,
[0232] in, , a for Q The elements in 3, Z is the ring of integers.
[0233] It should be noted that this device is a device corresponding to the above-mentioned encryption parameter optimization method of the post-quantum key applied to the sending end device. All implementation methods in the above-mentioned method embodiment are applicable to this embodiment and can achieve the same technical effect.
[0234] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0235] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0236] In the embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0237] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0238] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0239] If the functions are implemented in the form of software functional units and sold or used as independent products, they 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 the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods of various embodiments of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard disks, ROM, RAM, magnetic disks, or optical disks.
[0240] In addition, it should be pointed out that in the apparatus and method of the present invention, it is obvious that each component or each step can be decomposed and / or recombined. These decompositions and / or recombinations should be regarded as equivalent schemes of the present invention. Moreover, the steps of performing the above series of processing can naturally be performed in chronological order according to the order of description, but it is not necessary to perform them in chronological order, and some steps can be performed in parallel or independently of each other. For those of ordinary skill in the art, it is understandable that all or any steps or components of the method and apparatus of the present invention can be implemented in hardware, firmware, software or a combination thereof in any computing device (including processors, storage media, etc.) or a network of computing devices, which can be achieved by those of ordinary skill in the art using their basic programming skills after reading the description of the present invention.
[0241] Therefore, the purpose of the present invention can also be achieved by running a program or a group of programs on any computing device. The computing device can be a well-known general-purpose device. Therefore, the purpose of the present invention can also be achieved by simply providing a program product containing a program code for implementing a method or device. That is to say, such a program product also constitutes the present invention, and a storage medium storing such a program product also constitutes the present invention. Obviously, the storage medium can be any well-known storage medium or any storage medium developed in the future. It should also be pointed out that in the device and method of the present invention, it is obvious that each component or each step can be decomposed and / or recombined. These decompositions and / or recombinations should be regarded as equivalent schemes of the present invention. In addition, the steps of performing the above-mentioned series of processing can naturally be performed in chronological order according to the order of description, but it is not necessary to perform them in chronological order. Some steps can be performed in parallel or independently of each other.
[0242] The above are preferred embodiments of the present invention. It should be pointed out that, for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as within the scope of protection of the present invention.
Claims
1. A method for optimizing encryption parameters of a post-quantum key, characterized in that: Applied to receiving devices, including: Obtaining a first encryption parameter, where the first encryption parameter is obtained according to a first preset condition; Generate public key data and private key data according to the first encryption parameter; Sending the public key data to a sending end device; Acquire ciphertext data sent by a sending end device, where the ciphertext data is obtained by the sending end device processing plaintext data according to the public key data; Processing the ciphertext data according to the private key data to obtain plaintext data; The step of obtaining a first encryption parameter, wherein the first encryption parameter is obtained according to a first preset condition, includes: Generate a random positive integer; According to the positive integer, a plurality of numerical intervals are obtained; Obtaining a first encryption parameter according to the multiple value intervals; Wherein, according to the positive integer, multiple numerical intervals are obtained, including: according to: Obtaining a first numerical interval; Wherein, Q1 is the first numerical interval, a1 is an element in Q1, n is a natural number, and n≥2, Z is an integer ring, and q is a random positive integer; according to: Obtaining a second numerical interval; Wherein, Q2 is the second numerical interval, and a2 is an element in Q2; according to: Obtaining a third numerical interval; Wherein, Q3 is the third numerical interval, and a3 is an element in Q3; Wherein, obtaining the first encryption parameter according to the multiple value intervals includes: according to: Obtaining a first encryption parameter; Where p is an integer coprime with q, and p is less than q, F and G are both square matrices, and det(F)≠0; According to the first encryption parameter, generating public key data and private key data includes: according to: Generate public key data and private key data; Among them, pk is the public key data, sk is the private key data, H is the real number matrix, ≡ is the congruence symbol, F p -1 、F q -1 is the inverse element of the matrix F, and E is the identity matrix.
2. The post-quantum key encryption parameter optimization method according to claim 1, characterized in that: The ciphertext data is processed according to the private key data to obtain plaintext data, including: according to: A≡F·C(mod q), Processing the ciphertext data to obtain an intermediate result; Among them, A is the intermediate result, and C is the ciphertext data; according to: Processing the intermediate result to obtain plaintext data; Among them, B is the plaintext data.
3. A method for optimizing encryption parameters of a post-quantum key, characterized in that: Applied to the sending device, including: Obtain the public key data sent by the receiving device; Processing the plaintext data according to the public key data to obtain ciphertext data; Sending the ciphertext data to the receiving device; The plaintext data is processed according to the public key data to obtain the ciphertext data, including: Obtaining a second encryption parameter, where the second encryption parameter is obtained according to a second preset condition; According to the public key data and the second encryption parameter, by: C≡p·H·R+M(mod q), Mapping the plaintext data to obtain the ciphertext data; Wherein, C is ciphertext data, ≡ is a congruence symbol, H is a real number matrix, H=pk, pk is public key data, q is a random positive integer, p is an integer coprime with q, and p is less than q, and the second encryption parameter includes a randomly selected matrix R and a plaintext matrix M, wherein, n≥2, Elements in is a plaintext space, and the second encryption parameters R and M satisfy: in, is an element in Q3, and Z is an integer ring.
4. A receiving device, characterized in that: include: A first acquisition module, used to acquire a first encryption parameter, where the first encryption parameter is obtained according to a first preset condition; A first generating module, used to generate public key data and private key data according to the first encryption parameter; A first transceiver module, used to send the public key data to a sending end device; The first transceiver module is further used to obtain ciphertext data sent by the sending end device, where the ciphertext data is obtained by the sending end device processing the plaintext data according to the public key data; A first processing module, used to process the ciphertext data according to the private key data to obtain plaintext data; The step of obtaining a first encryption parameter, wherein the first encryption parameter is obtained according to a first preset condition, includes: Generate a random positive integer; According to the positive integer, a plurality of numerical intervals are obtained; Obtaining a first encryption parameter according to the multiple value intervals; Wherein, according to the positive integer, multiple numerical intervals are obtained, including: according to: Obtaining a first numerical interval; Wherein, Q1 is the first numerical interval, a1 is an element in Q1, n is a natural number, and n≥2, Z is an integer ring, and q is a random positive integer; according to: Obtaining a second numerical interval; Wherein, Q2 is the second numerical interval, and a2 is an element in Q2; according to: Obtaining a third numerical interval; Wherein, Q3 is the third numerical interval, and a3 is an element in Q3; Wherein, obtaining the first encryption parameter according to the multiple value intervals includes: according to: Obtaining a first encryption parameter; Where p is an integer coprime with q, and p is less than q, F and G are both square matrices, and det(F)≠0; According to the first encryption parameter, generating public key data and private key data includes: according to: Generate public key data and private key data; Among them, pk is the public key data, sk is the private key data, H is the real number matrix, ≡ is the congruence symbol, F p -1 、F q -1 is the inverse element of the matrix F, and E is the identity matrix.
5. A transmitting device, characterized in that: include: The second transceiver module is used to obtain the public key data sent by the receiving device; A second processing module, used to process the plaintext data according to the public key data to obtain ciphertext data; The second transceiver module further sends the ciphertext data to the receiving end device; The plaintext data is processed according to the public key data to obtain the ciphertext data, including: Obtaining a second encryption parameter, where the second encryption parameter is obtained according to a second preset condition; According to the public key data and the second encryption parameter, by: C≡p·H·R+M(mod q), Mapping the plaintext data to obtain the ciphertext data; Wherein, C is ciphertext data, ≡ is a congruence symbol, H is a real number matrix, H=pk, pk is public key data, q is a random positive integer, p is an integer coprime with q, and p is less than q, and the second encryption parameter includes a randomly selected matrix R and a plaintext matrix M, wherein, n≥2, Elements in is a plaintext space, and the second encryption parameters R and M satisfy: in, is an element in Q3, and Z is an integer ring.
Citation Information
Patent Citations
Data processing method, device and system and computer readable storage medium
CN114095170A
Grid-based access control encryption and decryption method and system
CN116055152A