A key generation method, device and electronic equipment
By utilizing inconsistent basis vector encoding values in quantum communication and employing encryption algorithms and permutations to generate keys, the problem of low target key generation rate is solved, achieving higher information utilization and security.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA TELECOM CORP LTD TECHNOLOGY INNOVATION CENTER
- Filing Date
- 2023-07-21
- Publication Date
- 2026-05-19
AI Technical Summary
In quantum communication, the randomness of the basis vectors chosen by each communicating party leads to 50% basis vector inconsistency, resulting in a low target key generation rate and a high information loss rate.
By identifying the inconsistent basis vectors between the first target basis vector set and the second basis vector set, and using a preset encryption algorithm and permutation method, a target encoding set is generated and a target key is formed, making full use of the inconsistent basis vector encoding values.
This increases the key generation rate, increases the number of key encoded values, forms a more complex encryption system, and enhances security.
Smart Images

Figure CN116865961B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of quantum communication technology, and in particular to a key generation method, apparatus and electronic device. Background Technology
[0002] Quantum communication technology generates keys based on the Heisenberg uncertainty principle and the quantum no-cloning theorem, fundamental principles of quantum mechanics, thus ensuring the security of the key during generation and transmission. Specifically, quantum key distribution (QKD) can be used to generate keys, ensuring that both communicating parties generate identical keys, meaning that the encoded values corresponding to each position tag in their respective keys are the same. A higher key generation rate allows the key to contain more information, enabling the formation of more complex encryption systems and further enhancing key security. The key generation rate is the number of key bits generated per unit of time, i.e., the number of encoded values in the key generated per unit of time.
[0003] In QKD (Quantum Key Dependency), the communicating parties use quantum states to carry information, thereby generating a key. Due to the inherent properties of quantum states, if a third party intercepts the quantum state during transmission, the basis vectors chosen by the third party when measuring the quantum state will differ from those chosen by the sender, causing the quantum state to change. In this case, the quantum state received by the receiver will not be exactly the same as the quantum state sent by the sender. The communicating parties can then determine whether a third party has intercepted the quantum state by detecting the quantum state's bit error rate, thus ensuring the security of the key.
[0004] Specifically, firstly, the sender in the communication process randomly generates an initial bit string of length N, where N is a positive integer. For example, if N is 10, the initial bit string could be 01001001.
[0005] Then, the sending method randomly selects one basis vector from two pre-agreed basis vectors to prepare the quantum state corresponding to the encoded value of each position tag in the initial bit string, obtaining a set of quantum states, and sends this set of quantum states to the receiver in the communication. Each position tag in the initial bit string corresponds to one quantum state.
[0006] After receiving the set of quantum states, the receiver, for each quantum state in the set, randomly selects one of two pre-agreed basis vectors to measure the quantum state and determine its specific state. For example, the measurement might determine that the quantum state is a horizontal quantum state. After determining the specific state, the receiver then determines the corresponding encoded value for that quantum state based on a pre-agreed correspondence between quantum states and encoded values.
[0007] After the receiver completes the measurement for each quantum state in the set of quantum states, it obtains the coded value corresponding to each quantum state in the set of quantum states based on the pre-agreed correspondence between quantum states and coded values; and then obtains the initial key based on each coded value.
[0008] Next, the two communicating parties learn about each other's chosen basis vectors through a public channel and perform basis vector comparison. During the basis vector comparison, the two parties discard the inconsistent basis vectors and retain the consistent basis vectors. Based on the consistent basis vectors and the initial key, the target key is generated, and the target keys generated by the two communicating parties are consistent.
[0009] After the target key is generated, the two communicating parties can check whether the error rate of the encoded value in the target key is not greater than the preset error rate threshold, so as to verify whether a third party has intercepted the information during the key generation process.
[0010] However, since the basis vectors chosen by each communicating party are randomly selected, according to the coin toss probability principle, there is a 50% probability that their chosen basis vectors will be inconsistent. Therefore, when the communicating parties compare basis vectors, each basis vector has a 50% chance of being inconsistent. To ensure that the target keys generated by both parties are consistent, inconsistent basis vectors are discarded, resulting in 50% of the information in the initial bit string being discarded, leading to a low key generation rate for the target key. For example, if the sender sends 100 quantum states, but only 50% of the quantum states correspond to encoded values that can be used to generate the target key, then the key generation rate is approximately 50%. Therefore, relative to these 100 quantum states, the key generation rate for the target key is low. Summary of the Invention
[0011] This application provides a key generation method, apparatus, and electronic device to improve the key generation rate of a target key. The specific implementation scheme is as follows:
[0012] Firstly, this application provides a key generation method, which is applied to a sender and includes:
[0013] Determine a first target basis vector set; wherein the first target basis vectors included in the first target basis vector set are basis vectors in the first basis vector set, and the first target basis vectors are inconsistent with the basis vectors in the second basis vector set;
[0014] Based on the encoded values corresponding to the first target basis vector, a first target encoding set is determined; wherein the encoded values in the first target encoding set are consistent with the encoded values in the second target encoding set in the receiver;
[0015] Based on a preset encryption algorithm, the first target encoding set is encrypted using a third target encoding set to generate a fourth target encoding set; wherein, the encoded value in the third target encoding set is the encoded value corresponding to the second target basis vector; the second target basis vector is a basis vector that is consistent between the first basis vector set and the second basis vector set;
[0016] Based on a preset arrangement, the encoded values in the third target encoding set and the encoded values in the fourth target encoding set are arranged to obtain the first target key.
[0017] By utilizing the inconsistent basis vectors between the first and second basis vector sets as described above, a first target encoding set is obtained. Then, based on a preset encryption algorithm, this first target encoding set is encrypted to generate a fourth target encoding set. Finally, based on a preset permutation method, the encoded values in the original third target encoding set and the generated fourth target encoding set are arranged to obtain the first target key. By adding the fourth target encoding set, which is based on inconsistent basis vectors from the receiver and a preset encryption algorithm, the resulting first target key has a higher utilization rate of the basis vectors in the first basis vector set compared to the original third target encoding set, thus improving the key generation rate. Furthermore, compared to directly using the third target encoding set as the target key, the first target key contains more encoded values, thus containing more information, resulting in a more complex encryption system and higher security.
[0018] In one possible implementation, determining the first target basis vector set includes:
[0019] Determine the first set of basis vectors and receive the second set of basis vectors; wherein the basis vectors in the first set of basis vectors are used to prepare the quantum state of the initial bit string;
[0020] Compare the first basis set with the second basis set, and determine the inconsistent basis sets as the first target basis set.
[0021] In one possible implementation, after determining the first basis set and receiving the second basis set, the method further includes:
[0022] The first basis vector set is compared with the second basis vector set, and the consistent basis vectors are determined as the second target basis vector set; wherein, the second target basis vector set contains the position labels corresponding to the consistent basis vectors;
[0023] Based on the location label and the initial bit string, determine the fifth target encoding set;
[0024] M coded values are randomly removed from the fifth target coded set to obtain the third target coded set; where M is a positive integer less than the total number of coded values in the fifth target coded set.
[0025] In one possible implementation, determining the first target encoding set based on the encoding value corresponding to the first target basis vector includes:
[0026] Randomly generate the correspondence between basis vectors and encoded values;
[0027] Based on the correspondence, the encoding value corresponding to the first target basis vector and the sixth target encoding set are determined; wherein, the sixth target encoding set is composed of the encoding value corresponding to the first target basis vector;
[0028] Based on the specified flip value, determine whether the flipping party performing the flip operation is the sender;
[0029] If not, the sixth target encoding set shall be used as the first target encoding set.
[0030] In one possible implementation, after determining whether the flipping party performing the flipping operation is the sender, the method further includes:
[0031] If the flipper is the sender, flip the encoded values in the sixth target encoding set to obtain the first target encoding set.
[0032] In one possible implementation, prior to determining the first target basis vector set, the method further includes:
[0033] An encrypted specified array and an arranged specified array are generated, and the encrypted specified array and the arranged specified array are sent to the receiver so that the receiver can determine the preset encryption algorithm and the preset arrangement method; wherein, the encrypted specified value in the encrypted specified array indicates the preset encryption algorithm, and the arranged specified value in the arranged specified array indicates the preset arrangement method.
[0034] In one possible implementation, the step of arranging the encoded values in the third target encoding set and the encoded values in the fourth target encoding set according to a preset arrangement to obtain the first target key includes:
[0035] According to the first preset swapping order, the encoding values in the third target encoding set are swapped to obtain the first target encoding subset; and according to the second preset swapping order, the encoding values in the fourth target encoding set are swapped to obtain the second target encoding subset;
[0036] The first target key is obtained by arranging the encoded values in the first target encoded subset and the encoded values in the second target encoded subset according to a preset sub-arrangement method; wherein, the preset sub-arrangement method indicates that the encoded values in the first target encoded subset are inserted into the encoded values in the second target encoded subset.
[0037] Secondly, this application provides a key generation method, which is applied to a receiver and includes:
[0038] Determine a first set of target basis vectors; wherein the third target basis vectors included in the first set of target basis vectors are basis vectors in the second set of basis vectors, and the third target basis vectors are inconsistent with the basis vectors in the first set of basis vectors;
[0039] Based on the encoded values corresponding to the third target basis vector, a second target encoding set is determined; wherein the encoded values in the second target encoding set are consistent with the encoded values in the first target encoding set of the sender;
[0040] Based on a preset encryption algorithm, the second target encoding set is encrypted using the seventh target encoding set to generate an eighth target encoding set; wherein, the encoded value in the seventh target encoding set is the encoded value corresponding to the second target basis vector; the second target basis vector is a basis vector that is consistent between the first basis vector set and the second basis vector set;
[0041] Based on a preset arrangement, the encoded values in the seventh target encoding set and the encoded values in the eighth target encoding set are arranged to obtain the second target key.
[0042] By employing the above method, a second target encoding set is obtained based on the encoded values corresponding to the inconsistent basis vectors between the first and second basis vector sets. Then, the second target encoding set is encrypted using a preset encryption algorithm to obtain an eighth target encoding set. Finally, the encoded values in the seventh and eighth target encoding sets are arranged according to a preset permutation method to obtain the second target key. This method, based on the encoded values corresponding to the consistent basis vectors in the initial bit string (i.e., the encoded values in the eighth target encoding set) and the encoded values corresponding to the inconsistent basis vectors (i.e., the encoded values in the seventh target encoding set), yields the second target key. This ensures full utilization of the encoded values corresponding to the inconsistent basis vectors, improving the key generation rate.
[0043] Thirdly, this application also provides a key generation apparatus, which is applied to the sender and includes:
[0044] The first basis vector determination module is used to determine a first target basis vector set; wherein the first target basis vector included in the first target basis vector set is the basis vector in the first basis vector set, and the first target basis vector is inconsistent with the basis vector in the second basis vector set;
[0045] The first encoding determination module is used to determine a first target encoding set based on the encoding value corresponding to the first target basis vector; wherein the encoding value in the first target encoding set is consistent with the encoding value in the second target encoding set in the receiver;
[0046] The first encryption module is used to encrypt the first target encoding set using a third target encoding set based on a preset encryption algorithm to generate a fourth target encoding set; wherein the encoded value in the third target encoding set is the encoded value corresponding to the second target basis vector; the second target basis vector is a basis vector that is consistent between the first basis vector set and the second basis vector set;
[0047] The first processing module is used to arrange the encoded values in the third target encoding set and the encoded values in the fourth target encoding set according to a preset arrangement to obtain the first target key.
[0048] In one possible implementation, the first basis vector determination module is specifically used to determine the first basis vector set and receive the second basis vector set; wherein, the basis vectors in the first basis vector set are used to prepare the quantum state of the initial bit string; the first basis vector set and the second basis vector set are compared, and the inconsistent basis vectors are determined as the first target basis vector set.
[0049] In one possible implementation, the first basis vector determination module is specifically used to compare the first basis vector set with the second basis vector set, and determine the consistent basis vectors as the second target basis vector set; wherein, the second target basis vector set includes the position labels corresponding to the consistent basis vectors; based on the position labels and the initial bit string, a fifth target encoding set is determined; M encoding values are randomly removed from the fifth target encoding set to obtain the third target encoding set; wherein, M is a positive integer less than the total number of encoding values in the fifth target encoding set.
[0050] In one possible implementation, the first encoding determination module is specifically used to randomly generate a correspondence between basis vectors and encoding values; based on the correspondence, determine the encoding value corresponding to the first target basis vector and a sixth target encoding set; wherein, the sixth target encoding set is composed of the encoding value corresponding to the first target basis vector; according to the flip specified value, determine whether the flipping party performing the flipping operation is the sender; if not, use the sixth target encoding set as the first target encoding set.
[0051] In one possible implementation, the first encoding determination module is specifically used to flip the encoded values in the sixth target encoding set to obtain the first target encoding set if the flipping party is the sender.
[0052] In one possible implementation, the first basis vector determination module is specifically used to generate an encrypted specified array and an arranged specified array, and send the encrypted specified array and the arranged specified array to the receiver, so that the receiver can determine the preset encryption algorithm and the preset arrangement method; wherein, the encrypted specified value in the encrypted specified array indicates the preset encryption algorithm, and the arranged specified value in the arranged specified array indicates the preset arrangement method.
[0053] In one possible implementation, the first processing module is specifically configured to: swap the encoded values in the third target encoding set according to a first preset swapping order to obtain a first target encoding subset; swap the encoded values in the fourth target encoding set according to a second preset swapping order to obtain a second target encoding subset; and arrange the encoded values in the first target encoding subset and the encoded values in the second target encoding subset according to a preset sub-arrangement method to obtain the first target key; wherein the preset sub-arrangement method indicates that the encoded values in the first target encoding subset are inserted into the encoded values in the second target encoding subset.
[0054] Fourthly, this application also provides a key generation apparatus, which is applied to a receiver and includes:
[0055] The second basis vector determination module is used to determine the first target basis vector set; wherein the third target basis vector contained in the first target basis vector set is a basis vector in the second basis vector set, and the third target basis vector is inconsistent with the basis vector in the first basis vector set;
[0056] The second encoding determination module is used to determine a second target encoding set based on the encoding value corresponding to the third target basis vector; wherein the encoding value in the second target encoding set is consistent with the encoding value in the first target encoding set in the sender;
[0057] The second encryption module is used to encrypt the second target encoding set using a seventh target encoding set based on a preset encryption algorithm to generate an eighth target encoding set; wherein, the encoded value in the seventh target encoding set is the encoded value corresponding to the second target basis vector; the second target basis vector is a basis vector that is consistent between the first basis vector set and the second basis vector set;
[0058] The second processing module is used to arrange the encoded values in the seventh target encoding set and the encoded values in the eighth target encoding set according to a preset arrangement to obtain the second target key.
[0059] Fifthly, this application provides an electronic device, comprising:
[0060] Memory, used to store computer programs;
[0061] When a processor executes a computer program stored in the memory, it implements the steps of the above-described key generation method.
[0062] Sixthly, this application provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the above-described key generation method. Attached Figure Description
[0063] Figure 1 A flowchart illustrating a key generation method provided in this application embodiment. Figure 1 ;
[0064] Figure 2 A flowchart illustrating the process of determining the first target basis vector set provided in an embodiment of this application;
[0065] Figure 3 A flowchart illustrating the process of determining the first target encoding set provided in an embodiment of this application;
[0066] Figure 4 A flowchart illustrating the process of determining a third target encoding set provided in an embodiment of this application;
[0067] Figure 5 A flowchart illustrating a key generation method provided in this application embodiment. Figure 2 ;
[0068] Figure 6 A schematic diagram illustrating the processing steps of a key generation method provided in this application embodiment;
[0069] Figure 7 A schematic diagram of a key generation apparatus provided in an embodiment of this application. Figure 1 ;
[0070] Figure 8 A schematic diagram of a key generation apparatus provided in an embodiment of this application. Figure 2 ;
[0071] Figure 9 This is a schematic diagram of an electronic device provided in an embodiment of this application. Detailed Implementation
[0072] To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings. The specific operational methods in the method embodiments can also be applied to the device embodiments or system embodiments. It should be noted that in the description of this application, "multiple" is understood as "at least two". "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. A connected to B can represent: A and B directly connected, and A and B connected through C. Furthermore, in the description of this application, terms such as "first" and "second" are used only for distinguishing the purpose of description and should not be construed as indicating or implying relative importance or order.
[0073] The embodiments of this application will now be described in detail with reference to the accompanying drawings.
[0074] In the current QKD process of generating the target key, about 50% of the results obtained when measuring the quantum state of the basis vectors are discarded, which reduces the key generation rate of the target key.
[0075] Therefore, this application proposes a key generation method. The sender obtains a first target encoding set based on the encoded values corresponding to the first target basis vectors that are inconsistent between the first and second basis vector sets. Then, based on a pre-agreed encryption algorithm, the first target encoding set is encrypted to generate a fourth target encoding set. Finally, based on a pre-agreed arrangement, the encoded values in the third and fourth target encoding sets are arranged to obtain the first target key. This method utilizes the inconsistent basis vectors between the sender and receiver (i.e., the first target basis vectors inconsistent between the first and second basis vector sets) to obtain the fourth target encoding set. By adding this fourth target encoding set to the third target encoding set, the inconsistent basis vectors between the sender and receiver are effectively utilized, thereby improving the key generation rate of the first target key.
[0076] Reference Figure 1 The diagram shows a key generation method flow provided in an embodiment of this application. Figure 1 This method is specifically applied to the sender in a communication between two parties, including:
[0077] S11, determine the first target basis set.
[0078] The first target basis set includes the first target basis, the position label of the first target basis, and the third target basis and the position label of the third target basis.
[0079] The first target basis vector is a basis vector in the first basis vector set, and the first target basis vector is inconsistent with the basis vectors in the second basis vector set; the third target basis vector is a basis vector in the second basis vector set, and the third target basis vector is inconsistent with the basis vectors in the first basis vector set.
[0080] In the first set of basis vectors mentioned above, the basis vectors are those selected by the sender when preparing the quantum state, and in the second set of basis vectors mentioned above, the basis vectors are those selected by the receiver when measuring the quantum state sent by the sender.
[0081] Therefore, the basis vectors in the first basis vector set and the first target basis vector are basis vectors in the sender's data, and the basis vectors in the second basis vector set and the third target basis vector are basis vectors in the receiver's data. The first target basis vector set contains basis vectors in both the sender's data and the receiver's data.
[0082] In one possible implementation, when determining the first target basis vector set, reference can be made to, as follows: Figure 2 The flowchart shown determines the first target basis set, including:
[0083] S1101, determine the first basis set and receive the second basis set.
[0084] Specifically, before determining the first set of basis vectors, it is necessary to generate agreement information and send it to the receiver, while simultaneously generating an initial bit string randomly. Then, based on this initial bit string, the first set of basis vectors is determined, and the second set of basis vectors is received.
[0085] The agreed-upon information includes at least basis vectors, quantum states, and encoded values, as well as the correspondence between them, so that the sender and receiver can agree on the correspondence between basis vectors, quantum states, and encoded values. The correspondence between basis vectors, quantum states, and encoded values is marked as the first correspondence.
[0086] Each encoded value in the initial bit string is selected from the encoded values in the agreed information. In this embodiment, the length of the initial bit string is not limited. For example, if the encoded values in the agreed information are 0 and 1, the randomly generated initial bit string can be 0111010001 or 01101.
[0087] In this embodiment of the application, the basis vectors included in the aforementioned agreed information may include a first basis vector and a second basis vector. The first and second basis vectors are basis vectors corresponding to different diffraction angles.
[0088] The agreed-upon information may contain two sets of quantum states, which are the polarization states of a quantum. Each basis vector corresponds to a set of quantum states, and the two quantum states in each set are orthogonal to each other.
[0089] The coded values in the agreed-upon information correspond to the quantum states in each group of quantum states. For example, the first quantum state in each group of quantum states corresponds to the first coded value in the agreed-upon information, and the second quantum state in each group of quantum states corresponds to the second coded value in the agreed-upon information. The first coded value and the second coded value are not the same.
[0090] For example, the agreed-upon information is shown in Table 1 below:
[0091] Table 1. Schematic Diagram of Agreed Information
[0092]
[0093] In this system, the first basis vector is denoted by "+", and the second basis vector by "×". In the first basis vector, the horizontal quantum state is denoted by "→", and the vertical quantum state by "↑". In the second basis vector, the 45° quantum state is denoted by "↗", and the 135° quantum state by "↖". The set of quantum states corresponding to the first basis vector represents the horizontal and vertical quantum states; the set of quantum states corresponding to the second basis vector represents the 45° and 135° quantum states.
[0094] In Table 1, the first designated code value corresponding to the horizontal quantum state and the 45° quantum state is 0, and the second designated code value corresponding to the vertical quantum state and the 135° quantum state is 1. That is to say, when the quantum state sent by the transmitter to the receiver is a horizontal quantum state or a 45° quantum state, it indicates that the transmitter is sending information with a code value of 0 to the receiver.
[0095] It should be noted that, in the embodiments of this application, the first correspondence between quantum states and encoded values can be adjusted according to specific application scenarios. For example, the first correspondence between quantum states and encoded values in the information specified in Table 1 above can also be that the encoded value corresponding to the horizontal quantum state and the 135° quantum state is 0, and the encoded value corresponding to the vertical quantum state and the 45° quantum state is 1.
[0096] In one possible implementation, when determining a first set of basis vectors based on the initial bit string and receiving a second set of basis vectors, the first set of basis vectors is first determined, in which the basis vectors are used to prepare the quantum states of the initial bit string; then, after sending the first set of quantum states to the receiver, the second set of basis vectors is received. The first set of quantum states is obtained based on the first set of basis vectors and the initial bit string. The following is a detailed explanation:
[0097] Specifically, based on the first correspondence between the basis vectors, quantum states, and encoded values in the agreed-upon information, for each encoded value in the initial bit string, a quantum state corresponding to the encoded value is prepared by randomly selecting either the first or second basis vector from the agreed-upon information, thus obtaining the first set of quantum states corresponding to the initial bit string. This first set of quantum states is then transmitted to the receiver through a first channel. This first channel can be a quantum channel.
[0098] At this point, the basis vectors (first basis vector or second basis vector) used to prepare the quantum state of the initial bit string are the basis vectors in the first basis vector set, thus determining the first basis vector set. Furthermore, this first basis vector set also contains the position labels corresponding to the basis vectors.
[0099] For example, the initial bit string is 0111010001. Assume that the basis vectors chosen for each encoded value in this initial bit string are: first basis vector, second basis vector, first basis vector, first basis vector, second basis vector, first basis vector, second basis vector, second basis vector, first basis vector, second basis vector. Then, according to the first correspondence between basis vectors, quantum states, and encoded values in the agreed information shown in Table 1 above, the first set of quantum states and the first set of basis vectors can be generated as shown in Table 2 below:
[0100] Table 2. Schematic diagram of the first quantum state set and the first basis set.
[0101]
[0102]
[0103] In Table 2, for the encoded value 0 corresponding to the first position tag, the sender selects the first basis vector, which is the basis vector corresponding to the first position tag in the first basis vector set. Then, according to the correspondence between basis vectors, quantum states, and encoded values in the convention information of Table 1, when the encoded value is 0, the quantum state corresponding to the first basis vector is a horizontal quantum state. Therefore, the quantum state corresponding to the encoded value 0 of the first position tag in Table 2 is a horizontal quantum state, i.e., "→". Similarly, the first basis vector set can be determined, and based on this first basis vector set, the quantum states corresponding to the remaining encoded values in the initial bit string can be obtained, thus obtaining the first quantum state set.
[0104] Then, after sending the first set of quantum states to the receiver, the second set of basis vectors is received.
[0105] S1102, compare the first basis set with the second basis set, and determine the inconsistent basis set as the first target basis set.
[0106] After determining the first basis set and receiving the second basis set in step S1101, it is determined whether the basis vectors in the first basis set and the basis vectors in the second basis set are consistent at the same position label.
[0107] If the basis vectors corresponding to the same position label are the same in the first basis vector set and the second basis vector set, then the basis vectors that are the same are taken as the basis vectors in the second target basis vector set.
[0108] If the basis vectors corresponding to the same position label in the first basis vector set and the second basis vector set are inconsistent, then the inconsistent basis vector is taken as the basis vector in the first target basis vector set. Specifically, the inconsistent basis vector is the aforementioned first target basis vector and the aforementioned third target basis vector.
[0109] For example, the determined first set of basis vectors and the received second set of basis vectors are shown in Table 3 below:
[0110] Table 3. Schematic diagram of the first and second basis sets.
[0111]
[0112]
[0113] It should be noted that in Table 3 and subsequent Tables 4-10, " / " indicates an empty space.
[0114] In Table 3, for the first position label, if both the first and second basis vector sets contain the first basis vector "+", then the consistent basis vector "+" is taken as the basis vector in the second target basis vector set. For the second position label, if both the first and second basis vector sets contain the second basis vector "×", then the inconsistent basis vectors "×" and "+" are taken as the basis vectors in the first target basis vector set. Where "×" is a basis vector in the first basis vector set, then "×" is the first target basis vector; and "+" is a basis vector in the second basis vector set, then "+" is the third target basis vector. Similarly, the first and second target basis vector sets in Table 3 can be obtained.
[0115] In addition, after confirming the first target basis set and the second target basis set, the first target basis set and the second target basis set must be sent to the receiver so that the receiver can confirm the basis sets that are consistent with the sender and the basis sets that are inconsistent.
[0116] In another possible implementation, when comparing the first basis set and the second basis set in step S1102 and determining the inconsistent basis sets as the first target basis set, the first basis set can also be sent to the receiver. The receiver performs the operation of comparing the first basis set and the second basis set and determining the first target basis set and the second target basis set. Then, the receiver receives the first target basis set and the second target basis set sent by the receiver, thereby determining the first target basis set, and can also determine the second target basis set.
[0117] It is worth noting that in the above implementation, the first set of basis vectors must be sent to the receiver before the first set of quantum states is sent to the receiver. If the first set of basis vectors is sent to the receiver simultaneously with the first set of quantum states, the communicating parties will not be able to determine whether any quantum states have been intercepted during the quantum state transmission process.
[0118] For example, when a sender transmits a first set of quantum states to a receiver, it simultaneously transmits a first set of basis vectors to the receiver. Suppose a third party intercepts both the first quantum states and the first set of basis vectors. After intercepting these sets, the third party can use the basis vectors in the first set to measure the corresponding quantum states in the first set of quantum states. The measured quantum state will then be identical to the one transmitted by the sender. According to the no-cloning theorem, quantum states cannot be copied. Therefore, the third party must transmit the measured quantum state to the receiver. Otherwise, if the receiver cannot receive the first set of quantum states after the third party's interception, it can be directly confirmed that a problem occurred during quantum state transmission. When the third party transmits the measured quantum state to the receiver, because the quantum state obtained by the third party is identical to the one transmitted by the sender, the communicating parties cannot distinguish whether the quantum state received by the receiver was transmitted by the sender or the third party. Consequently, the communicating parties cannot determine whether a quantum state was intercepted during transmission.
[0119] If the first set of quantum states is sent to the receiver only after the first set of quantum states has been sent, the error rate calculated in step S13 can be used to confirm whether a third party has intercepted the quantum state during the quantum state transmission process.
[0120] Therefore, when sending the first set of basis vectors to the receiver, the first set of quantum states must be sent to the receiver first before the first set of basis vectors can be sent to the receiver.
[0121] In another possible implementation, when determining the first target basis set, the first basis set can be sent to the receiver after the first quantum state set has been sent to the receiver, while simultaneously receiving the second basis set. Then, a comparison operation between the first and second basis sets is performed between the receiver and the first basis set, thereby each determining its own first and second target basis sets. In this case, it is unnecessary to send the first and second target basis sets to the receiver again, nor is it necessary to receive the first and second target basis sets sent by the receiver.
[0122] S12, determine the first target encoding set based on the encoding values corresponding to the first target basis vectors contained in the first target basis vector set.
[0123] The encoded values in the first target encoding set are consistent with the encoded values in the second target encoding set in the receiver. The encoded values in the second target encoding set are obtained by the receiver based on the encoded values corresponding to the third target basis vector.
[0124] In one possible implementation, when determining the first target encoding set based on the encoding values corresponding to the first target basis vectors contained in the first target basis vector set, reference can be made as follows: Figure 3 The flowchart shown determines the first target encoding set, including:
[0125] S1201, randomly generates the correspondence between basis vectors and encoded values.
[0126] The correspondence between randomly generated basis vectors and encoded values is marked as the second correspondence.
[0127] Wherein, the first basis vector corresponds to the first preset encoding value, and the second basis vector corresponds to the second preset encoding value. The first and second basis vectors are selected from the basis vectors in the aforementioned agreed-upon information. The first and second preset encoding values can be selected from the encoding values in the aforementioned agreed-upon information, or they can be represented by other numerical values, letters, or symbols. For example, the first and second preset encoding values can be 0 and 1 respectively, or they can be a and b respectively.
[0128] When the first preset code value and the second preset code value are selected from the code values in the aforementioned agreed information, the first preset code value can be the first code value in the aforementioned agreed information, and the second preset code value can be the second code value in the aforementioned agreed information. Alternatively, the first preset code value can be the second code value in the aforementioned agreed information, and the second preset code value can be the first code value in the aforementioned agreed information.
[0129] In this embodiment of the application, the first preset encoding value and the second preset encoding value can be randomly generated. Then, based on the first preset encoding value and the second preset encoding value, a second correspondence between the basis vector and the encoding value is established.
[0130] For example, the second correspondence between randomly generated basis vectors and encoded values is shown in Table 4 below:
[0131] Table 4. Schematic diagram of the second correspondence between basis vectors and encoded values.
[0132] First preset code value (0) First basis vector (+) Second preset encoding value (1) Second basis vector (×)
[0133] In Table 4, the first preset code value corresponding to the first basis vector "+" is 0, and the second preset code value corresponding to the second basis vector "×" is 1.
[0134] Furthermore, after randomly generating the second correspondence between the basis vectors and the encoded values, this second correspondence needs to be sent to the receiver via a second channel so that the receiver can determine the second correspondence between the basis vectors and the encoded values. This second channel can be a common channel.
[0135] In this embodiment of the application, when randomly generating the second correspondence between the basis vector and the encoded value, the second correspondence can also be randomly generated in step S11. The generation of the second correspondence only needs to be done before step S1201.
[0136] Furthermore, in this embodiment, when sending the second correspondence to the recipient, the second correspondence can also be added to the agreement information in step S1, and the second correspondence can be sent to the recipient when sending the agreement information. In this embodiment, the sending time of the second correspondence can be adjusted according to the specific application scenario.
[0137] S1202, Based on the correspondence, determine the encoding value corresponding to the first target basis vector and the encoding set of the sixth target.
[0138] The sixth target encoding set is composed of the encoding values corresponding to the first target basis vector. Specifically, it is first determined whether the first target basis vector is a first basis vector or a second basis vector. If the first target basis vector is a first basis vector, then the encoding value corresponding to the first target basis vector is a first preset encoding value. If the first target basis vector is a second basis vector, then the encoding value corresponding to the second target basis vector is a second preset encoding value. Thus, after determining the encoding value corresponding to the first target basis vector, the sixth target encoding set composed of that encoding value can be determined.
[0139] For example, the first target basis vector set contains the first target basis vectors as shown in Table 3, and the second correspondence between the basis vectors and the encoded values is shown in Table 4. Then, the sixth target encoding set corresponding to the first target basis vector, composed of the encoded values corresponding to the first target basis vector, is shown in Table 5 below:
[0140] Table 5. Schematic diagram of the sixth target encoding set.
[0141]
[0142] That is, the encoding value in the sixth target encoding set can be 10101, and the sixth target encoding set also contains the position label corresponding to each encoding value.
[0143] S1203, based on the specified flip value, determine whether the flipping party performing the flip operation is the sender.
[0144] The flip instruction modifies either the first preset code value to the second preset code value, or the second preset code value to the first preset code value. For example, if the correspondence between the basis vector and the code value contains a first preset code value of 0 and a second preset code value of 1, then the flip instruction will modify 1 to 0, or 0 to 1.
[0145] The specified flip values mentioned above can be shown in Table 6 below:
[0146] Table 6. Indication of Flipping Specified Values
[0147] Flip the specified value describe 0x00 Sender flip 0x01 Receiver flip
[0148] In Table 6, if the flip specification value is 0x00, it indicates that the flip operation should be performed by the sender. If the flip specification value is 0x01, it indicates that the flip operation should be performed by the receiver.
[0149] In one possible implementation, before determining whether the flipper performing the flip operation is the sender based on the flip specified value, the sender sends the flip specified value to the receiver via a second channel so as to agree on the flipper with the receiver.
[0150] By using the above method, when the flipping specified value is agreed upon with the receiver, the number of bytes occupied by the flipping specified value is less than the number of bytes occupied by the text description, thus reducing resource consumption.
[0151] When sending the flipped specified value to the receiver via the second channel, the flipped specified value can also be sent to the receiver when the first target basis set and the second target basis set are sent to the receiver in step S11. Alternatively, the flipped specified value can be added to the agreement information, and sent to the receiver when the agreement information is sent to the receiver in step S1. In this embodiment, the sending time of the flipped specified value can be adjusted according to the specific application scenario.
[0152] Then, based on the specified flip value, determine whether the flipping party performing the flip operation is the sender.
[0153] If the flipper is not the sender, then proceed to step S1204.
[0154] If the flipper is the sender, then proceed to step S1205.
[0155] S1204, the sixth target coding set is used as the first target coding set.
[0156] S1205, flip the encoded values in the sixth target encoding set to obtain the first target encoding set.
[0157] Specifically, each code value in the sixth target code set is flipped, and the flipped code values form the first target code set, thus obtaining the first target code set.
[0158] For example, assuming the flipper is the sender, and the sixth target code set is shown in Table 5, then flipping each code value in the sixth target code set yields the first target code set shown in Table 7 below:
[0159] Table 7. Schematic diagram of the first target encoding set.
[0160]
[0161] That is, the first target encoding set obtained has an encoding value of 01010.
[0162] S13, based on the preset encryption algorithm, the first target encoding set is encrypted using the third target encoding set to generate the fourth target encoding set.
[0163] In this context, the encoded values in the third target encoding set are the encoded values corresponding to the second target basis vector. This second target basis vector is a basis vector consistent between the first and second basis vector sets.
[0164] Specifically, when encrypting the first target code set using the third target code set based on the preset encryption algorithm to generate the fourth target code set, the third target code set is first determined.
[0165] In one possible implementation, when determining the third target encoding set, reference can be made to, as follows: Figure 4 The flowchart for determining the third target encoding set shown includes:
[0166] S1301, compare the first basis set with the second basis set, and determine the consistent basis set as the second target basis set.
[0167] The second target basis set contains the position labels corresponding to the basis vectors.
[0168] In step S1102 of step S1, while determining the first target basis set, the second target basis set can also be determined. Therefore, the determination of the second target basis set will not be described in detail here.
[0169] S1302, based on the initial bit string and the position labels corresponding to the basis vectors in the second target basis vector set, determine the fifth target encoding set.
[0170] Specifically, firstly, in the initial bit string, a first target position label is identified that is identical to the position label corresponding to the basis vector in the second target basis vector set. Then, the encoded value corresponding to the first target position label in the initial bit string is extracted, and a fifth target encoding set composed of these encoded values is determined.
[0171] For example, the initial bit string is shown in Table 2, and the second target encoding set is shown in Table 4. In Table 4, the position labels corresponding to the basis vectors in the second target basis vector set can be the 1st, 4th, 7th, 9th, and 10th bits. Next, the first target position labels in the initial bit string that are identical to the position labels corresponding to the basis vectors in the second target basis vector set can be the 1st, 4th, 7th, 9th, and 10th bits. Then, the encoded values corresponding to the first target position labels in the initial bit string are extracted; the extracted encoded values can be 0, 1, 0, 0, and 1. The fifth target encoding set composed of these encoded values is shown in Table 8 below.
[0172] Table 8. Schematic diagram of the fifth target coding set
[0173]
[0174] That is, the encoded value in the fifth target encoding set can be 01001, and the fifth target encoding set also contains the position label corresponding to each encoded value.
[0175] S1303, randomly remove M code values from the fifth target code set to obtain the third target code set.
[0176] Here, M is a positive integer less than the total number of coded values in the fifth target coding set. These M coded values are used to calculate the error rate of the coded values.
[0177] Specifically, firstly, in the fifth target encoding set, M encoding values are randomly removed, and these M encoding values are sent to the receiver so that the receiver can calculate the error rate based on these M encoding values. These M encoding values are then marked as the M first encoding values.
[0178] In this embodiment, error rate information can be added to the agreed-upon information. This error rate information includes the number M of encoded values used to calculate the error rate and their corresponding position labels. For example, the error rate information could be the first 100 encoded values in the fifth target encoding set and the first 100 encoded values in the ninth target encoding set. The ninth target encoding set is obtained by the receiver based on the position labels corresponding to the basis vectors in the second target basis vector set, the second quantum state set, and the first correspondence between quantum states and encoded values in the agreed-upon information. Therefore, based on the error rate information in this agreed-upon information, the encoded values used to calculate the error rate can be agreed upon with the receiver.
[0179] Then, M second-coded values sent by the receiver are received. These M second-coded values are the coded values in the ninth target coding set in the receiver.
[0180] Then, based on the M first encoded values and the M second encoded values, the error rate is calculated. The formula for calculating the error rate is as follows:
[0181]
[0182] Where Q is the number of coded values that are inconsistent between the M first coded values and the M second coded values.
[0183] For example, assuming M is 6, the M first encoded values removed from the fifth target encoded set could be 110110, and the M received second encoded values could be 100110. Only one location tag has a different encoded value. Therefore, the error rate is 1 / 6 * 100% = 16.67%.
[0184] After calculating the error rate, it is also necessary to determine whether the error rate is greater than the preset error rate threshold.
[0185] If the error rate is not greater than the preset error rate threshold, it is confirmed that no third party intercepted information during the communication process. The third target code set can then be formed by removing M code values from the fifth target code set. The preferred value for the preset error rate threshold is 0.
[0186] If the error rate exceeds a preset threshold, it indicates that there are a certain number of inconsistent encoded values between the fifth target encoding set and the ninth target encoding set, suggesting that information has been intercepted by a third party during communication. The reasons are as follows:
[0187] The fifth target encoding set is obtained by taking the position labels corresponding to the basis vectors in the second target basis vector set, and the basis vectors in the second target basis vector set are the same as those in the first and second basis vector sets. The ninth target encoding set is also obtained by the receiver based on the position labels corresponding to the basis vectors in the second target basis vector set.
[0188] Under normal circumstances, basis vectors that are consistent between the first and second basis vector sets correspond to consistent quantum states. For example, according to the convention shown in Table 1, when the basis vector in the first basis vector set is the first basis vector, then the quantum state with the encoded value of 0 prepared based on the first basis vector is a horizontal quantum state. When the quantum state measured by the receiver is 100% the quantum state sent by the sender, and the receiver also uses the first basis vector to measure the quantum state, then the obtained quantum state should also be a horizontal quantum state. Similarly, this ensures that the encoded values in the fifth target encoding set are consistent with the encoded values in the ninth target encoding set.
[0189] Therefore, when there is a certain number of inconsistent encoded values between the fifth target encoding set and the ninth target encoding set, it indicates that a third party has intercepted information during the communication process. At this point, the communication process ends.
[0190] In one possible implementation, when randomly removing M coded values from the fifth target coded set to obtain the third target coded set, it is also possible to first randomly remove M1 third coded values from the fifth target coded set. M1 is an integer less than the total number of coded values in the fifth target coded set. These M1 third coded values are then sent to the receiver so that the receiver can calculate the aforementioned error rate.
[0191] Simultaneously, the receiver receives M2 fourth-coded values randomly removed from the ninth target coding set. M2 is an integer less than the total number of coded values in the ninth target coding set.
[0192] However, it should be noted that when M1 is 0, M2 is not 0; when M2 is 0, M1 is not 0. M1 and M2 do not have to be equal.
[0193] Next, remove the M2 fifth-coded values corresponding to the M2 fourth-coded values from the fifth target coding set. Then, calculate the aforementioned error rate based on these M2 fifth-coded values and the M2 fourth-coded values.
[0194] In the embodiments of this application, the M1 third encoding values and the M2 fifth encoding values may include encoding values corresponding to the same position labels, or they may not include encoding values corresponding to the same position labels.
[0195] Furthermore, in this embodiment of the application, the execution of the above steps S1301, S1302, and S1303 to determine the third target encoding set can also be performed when determining the first target basis vector set in step S11, thereby determining the third target encoding set.
[0196] Furthermore, after determining the third target encoding set, the first target encoding set determined in step S12 is encrypted using a preset encryption algorithm to generate a fourth target encoding set. This improves the security of the fourth target encoding set.
[0197] The aforementioned preset encryption algorithm is determined based on the generated encryption specification array. This encryption specification array contains at least a first encryption specification value and a second encryption specification value.
[0198] The first encryption specification value indicates a preset encryption algorithm, and the second encryption specification value indicates the operating mode corresponding to the preset encryption algorithm. Therefore, the preset encryption algorithm and operating mode can be determined based on the encryption specification array.
[0199] The preset encryption algorithm indicated by the first encryption specification value mentioned above can be a block cipher algorithm, such as the SM4 block cipher algorithm, the Advanced Encryption Standard (AES-128) algorithm with a 128-bit key, or the AES-256 algorithm. It can also be a stream cipher algorithm, such as the Zu Chongzhi algorithm (ZUC) or the Rivest Cipher 4 (RC4) algorithm.
[0200] For block cipher algorithms, each algorithm includes different operating modes. For example, the SM4 block cipher algorithm has the following operating modes: Cipher Block Chaining (CBC), Output Feedback Mode (OFB), and Galois Counter Mode (GCM).
[0201] For example, the information corresponding to the encryption algorithm is shown in Table 9 below:
[0202] Table 9. Encryption Algorithm Information Diagram
[0203] Encrypt specified array describe 0x00, 0x01 SM4, CBC working mode 0x00, 0x02 SM4, OFB working mode 0x00, 0x03 SM4, GCM working mode 0x01, 0x01 AES-128, CBC working mode 0x01, 0x02 AES-128, OFB working mode 0x01, 0x03 AES-128, GCM operating mode 0x02, 0x00 Zu Chongzhi's Stream Cipher Algorithm ZUC 0x03, 0x00 RC4 with a 128-bit key length
[0204] In Table 9 above, the "Encryption Specification Array" includes a first encryption specification value and a second encryption specification value. For example, if the sender sets the first encryption specification value to 0x00 and the second encryption specification value to 0x01, it indicates that the preset encryption algorithm is the SM4 block cipher algorithm in CBC mode. If the second encryption specification value is 0x00, it indicates that the preset encryption algorithm is not a block cipher algorithm.
[0205] Furthermore, the aforementioned encryption specification array may also contain a third encryption specification value, which indicates the padding value in the block cipher. For example, in Table 7, if the first and second encryption specification values in the encryption specification array are 0x01, 0x01, and 0x00 respectively, it indicates that the preset encryption algorithm used is the AES-128 block cipher in CBC mode, and the encryption specification array also contains the third encryption specification value 0x00. In this block cipher algorithm, padding is from 0 to an integer multiple of the block length.
[0206] In this embodiment, after generating the encrypted specified array, it is also necessary to send the encrypted specified array to the receiver through a second channel so that the receiver can determine the preset encryption algorithm. Thus, based on the encrypted specified array, the preset encryption algorithm is agreed upon with the receiver, ensuring that the encoded values of the generated fourth target encoding set and the eighth target encoding set generated by the receiver are consistent.
[0207] When sending the aforementioned encrypted specified array to the receiver, the encrypted specified array can also be sent to the receiver when the first target basis set and the second target basis set are sent to the receiver in step S11. Alternatively, the encrypted specified array can be added to the agreed-upon information, and then sent to the receiver when the agreed-upon information is sent to the receiver in step S1. In this embodiment, the sending time of the encrypted specified array can be adjusted according to the specific application scenario.
[0208] By using the above method, when the encrypted specified value in the encrypted specified array is agreed upon with the receiver using a preset encryption algorithm, the number of bytes occupied by the encrypted specified value in the encrypted specified array is less than the number of bytes occupied by the text description, thus reducing resource consumption.
[0209] S14, based on a preset arrangement, arrange the encoded values in the third target encoding set and the encoded values in the fourth target encoding set to obtain the first target key.
[0210] Specifically, firstly, the encoded values in the third target encoding set are swapped according to a first preset swapping order to obtain a first target encoding subset; then, the encoded values in the fourth target encoding set are swapped according to a second preset swapping order to obtain a second target encoding subset. Next, the encoded values in the first target encoding subset and the second target encoding subset are arranged according to a preset sub-arrangement method to obtain the first target key. This preset sub-arrangement method indicates that the encoded values in the first target encoding subset are inserted into the encoded values in the second target encoding subset.
[0211] The aforementioned first and second preset swap orders can also include the original order, meaning that the order of the encoded values in the first target encoding subset is consistent with the order of the encoded values in the third target encoding set, and the order of the encoded values in the second target encoding subset is consistent with the order of the encoded values in the fourth target encoding set. In other words, when the first and second preset swap orders are set to the original order, the first target encoding subset is the third target encoding set, and the second target encoding subset is the fourth target encoding set.
[0212] The first and second preset swapping orders mentioned above can also include reverse order. For example, assuming the code value in the third target code set is 01001 and the code value in the fourth target code set is 10100, then the code value in the first target code subset is 10010 and the code value in the second target code subset is 00101.
[0213] In this application embodiment, a first preset swapping order and a second preset swapping order can be set according to specific application scenarios.
[0214] The above-mentioned preset sub-arrangement can be one of the following four sub-arrangement methods:
[0215] Sub-permutation method one (bit-by-bit interleaving):
[0216] The encoded values in the first target encoded subset are inserted into the encoded values in the second target encoded subset in a manner that K encoded values in the second target encoded subset are inserted into L encoded values in the first target encoded subset at intervals of 1 to 2. Here, K is a positive integer less than the total number of encoded values in the second target encoded subset, and L is a positive integer less than the total number of encoded values in the first target encoded subset.
[0217] For example, if both K and L are 1, then according to sub-permutation method one, after inserting the encoded values from the first target encoded subset into the encoded values from the second target encoded subset, the resulting first target key is shown in Table 10 below:
[0218] Table 10 shows the first target key obtained based on sub-permutation method one.
[0219]
[0220]
[0221] In Table 10 above, A and a both represent a code value of 0, where A indicates a code value of 0 in the first target code subset and a indicates a code value of 0 in the second target code subset; B and b both represent a code value of 1, where B indicates a code value of 1 in the first target code subset and b indicates a code value of 1 in the second target code subset. Therefore, when the first preset swapping order and the second preset order are set to their original order, and K and L are set to 1, the first target key obtained according to sub-concatenation method one can be 1011000111.
[0222] Sub-permutation method two (second target encoding subset || first target encoding subset, "||" indicates concatenation):
[0223] The encoded value in the second target encoded subset is inserted before the first encoded value in the first target encoded subset.
[0224] For example, assuming the first preset swapping order and the second preset order are set to the original order, the first target encoding subset and the second target encoding subset are shown in Table 10. Then, the first target key obtained by using sub-concatenation method two can be bbaabABABB, i.e., 1100101011.
[0225] Sub-concatenation method three (first target encoding subset || first target encoding subset):
[0226] The encoded value in the first target encoded subset is inserted before the first encoded value in the second target encoded subset.
[0227] For example, assuming the first preset swapping order and the second preset order are set to the original order, the first target encoding subset and the second target encoding subset are shown in Table 10. Then, the first target key obtained by using sub-concatenation method three can be ABABBbbaab, i.e., 0101111001.
[0228] Sub-splicing method four (original position interleaving):
[0229] Arrange the encoded values in the first target encoded subset and the second target encoded subset according to their original positional order. The original positional order is the positional order in the initial bit string.
[0230] For example, assuming the first preset swapping order and the second preset order are set to the original order, the first target encoding subset and the second target encoding subset are shown in Table 10. The position labels in the first target encoding subset and the position labels in the second target encoding subset are the original position labels corresponding to each encoded value in the initial bit string. Therefore, the first target key obtained using sub-permutation method four can be AbbBaaAbBB, i.e., 0111000111.
[0231] By using the above method, based on the first preset swapping order, the second preset swapping order, and the preset sub-permutation method, the encoded values in the third target encoding set and the encoded values in the fourth target encoding set are arranged, making the obtained first target key more complex and improving the security of the first target key.
[0232] In one possible implementation, when arranging the encoded values in the third target encoding set and the encoded values in the fourth target encoding set based on a preset arrangement, the preset arrangement is determined according to a generated arrangement specification array. This arrangement specification array contains at least a first arrangement specification value, a second arrangement specification value, and a third arrangement specification value.
[0233] The first specified value indicates a first preset swap order, the second specified value indicates a second preset swap order, and the third specified value indicates a preset sub-sorting method. Thus, the preset sorting method is determined based on the specified values in this specified array.
[0234] For example, the array specified in the above permutation is shown in Table 11 below:
[0235] Table 11: Illustration of Arranging Specified Arrays
[0236] Arrange the specified array describe 0x00, 0x00, 0x01 Original order, original order, sub-splicing method one 0x00, 0x00, 0x02 Original order, original order, sub-splicing method two 0x00, 0x00, 0x03 Original order, original order, sub-splicing method three 0x00, 0x00, 0x03 Original order, original order, sub-splicing method four
[0237] In Table 11, for example, when the specified array contains a first specified value of 0x00, a second specified value of 0x00, and a third specified value of 0x01, it indicates that the preset arrangement method used is the original order of the first preset swap order and the second preset swap order, and the preset sub-arrangement method is sub-splicing method one.
[0238] In this embodiment, after generating the specified permutation array, it is also necessary to send the specified permutation array to the receiver via a second channel so that the receiver can determine the preset permutation method. Thus, based on the specified permutation array, the preset permutation method is agreed upon with the receiver, ensuring that the generated first target key is consistent with the second target key generated by the receiver. Simultaneously, the bytes occupied by the specified permutation values in the specified permutation array are fewer than those occupied by the text description, reducing resource consumption.
[0239] When sending the specified array to the receiver, the specified array can also be sent to the receiver when the first target basis set and the second target basis set are sent to the receiver in step S11. Alternatively, the specified array can be added to the agreement information, and sent to the receiver when the agreement information is sent to the receiver in step S1. In this embodiment, the sending time of the specified array can be adjusted according to the specific application scenario.
[0240] It should also be noted that, in the embodiments of this application, when sending the target encoding set, basis vector set, and quantum state set to the receiver, that is, when sending information to the receiver, the receiver can be authenticated first. Only when it is determined that the receiver is the recipient of the information sent this time can the information be sent to the receiver, which can improve the security of the information transmission process.
[0241] In summary, the key generation method proposed in this application, when applied to the sender, involves the sender obtaining a first target encoding set by targeting the encoded values corresponding to the first target basis vectors in the first target basis vector set that are inconsistent between the first and second basis vector sets. Then, based on a pre-determined encryption algorithm, the first target encoding set is encrypted to generate a fourth target encoding set. Finally, based on a pre-determined arrangement, the encoded values in the third target encoding set (obtained from basis vectors consistent between the first and second basis vector sets) are arranged with the encoded values in the fourth target encoding set to obtain the first target key. This ensures that the number of encoded values in the first target key is close to the number of encoded values in the initial bit string (i.e., the number of basis vectors selected by the sender), improving the key generation rate of the first target key. Especially in the absence of third-party interception, the key generation rate of the key generation method provided in this application can reach 100%.
[0242] Furthermore, when the flipper is the sender, the encoded values corresponding to the first target basis vectors in the first target basis vector set are flipped to obtain the first target encoding set; when the flipper is not the sender, the encoded values corresponding to the first target basis vectors in the first target basis vector set are directly combined to form the first target encoding set, and the receiver performs the flipping operation, so that the encoded values in the first target encoding set are consistent with the encoded values in the second target encoding set in the receiver, thus avoiding the inconsistency between the generated first target key and the generated second target key in the receiver.
[0243] Meanwhile, based on the pre-agreed encryption algorithm and pre-arranged arrangement agreed upon with the recipient, the consistency between the generated first target key and the second target key generated by the recipient is further guaranteed.
[0244] Furthermore, the randomness of the first target key generation process is guaranteed by the basis vectors randomly selected from the first and second basis vector sets, and the security of the first target key generation process is guaranteed by the determination of the third target encoding set.
[0245] Based on the same inventive concept, this application provides a key generation method, which is applied to the receiver in a communication between two parties. Please refer to... Figure 5 The implementation steps of this method include:
[0246] S21, determine the first target basis set.
[0247] The first target basis set is the first target basis set determined by the sender in step S11. Therefore, the information contained in the first target basis set will not be described again here.
[0248] In one possible implementation, when determining the first target basis set, the first target basis set and the second target basis set sent by the sender are directly received, thereby the first target basis set can be determined directly.
[0249] Before receiving the first set of target basis vectors and the second set of target basis vectors sent by the sender, the agreed information and the first set of quantum states sent by the sender are received first.
[0250] Because the receiver needs to measure the quantum state using the basis vectors in the agreed-upon information before it can determine the specific state of the quantum state. For example, it needs to determine whether the quantum state is a horizontal quantum state, a vertical quantum state, a 45° quantum state, or a 135° quantum state.
[0251] Therefore, after receiving the first set of quantum states from the sender, the receiver randomly selects either the first or second basis vector from the agreed-upon information for each quantum state in the first set of quantum states, and measures that quantum state to obtain the second set of quantum states. The receiver then determines the second set of basis vectors. The basis vectors in this second set are the basis vectors selected when measuring the first quantum state.
[0252] It should be noted that when the receiver measures the quantum state using basis vectors, if the selected basis vector is the first basis vector, according to the first correspondence between the basis vector and the quantum state in the conventional information shown in Table 1 above, the measurement result will be either a horizontal quantum state or a vertical quantum state.
[0253] Specifically, when the measured quantum state is a horizontal quantum state, there is a 100% probability of obtaining a horizontal quantum state; similarly, when the measured quantum state is a vertical quantum state, there is also a 100% probability of obtaining a vertical quantum state. However, when the measured quantum state is a 45° quantum state or a 135° quantum state, there is a 50% probability of obtaining a horizontal quantum state or a 50% probability of obtaining a vertical quantum state. Therefore, when using the first basis vector to measure a 45° quantum state or a 135° quantum state, the measurement result is 100% incorrect.
[0254] Similarly, if the chosen basis vector is the second basis vector, according to the first correspondence between basis vectors and quantum states in the conventional information shown in Table 1 above, when the measured quantum state is a 45° quantum state, a 45° quantum state will be obtained with 100% probability; when the measured quantum state is a 135° quantum state, a 135° quantum state will also be obtained with 100% probability. When the measured quantum state is a horizontal or vertical quantum state, the measurement result will be 100% incorrect.
[0255] For example, when the receiver measures the received first set of quantum states, it assumes that the basis vectors chosen for each quantum state in the first set of quantum states are first basis vector, first basis vector, second basis vector, first basis vector, first basis vector, second basis vector, second basis vector, first basis vector, first basis vector, second basis vector. Based on the first correspondence between basis vectors and quantum states in the agreed information shown in Table 1, the receiver determines the measurement results of the first set of quantum states as shown in Table 12 below:
[0256] Table 12 Schematic diagram of measurement results for the first set of quantum states
[0257]
[0258] In Table 12, the second set of basis vectors contains the basis vectors selected by the receiver for each quantum state in the first set of quantum states. The second set of quantum states is the measurement result of the first set of quantum states.
[0259] Since the quantum states obtained by measuring the 135° and 45° quantum states using the first basis vector may be either horizontal or vertical, and the quantum states obtained by measuring the horizontal and vertical quantum states using the second basis vector may also be either 135° or 45°, the quantum states corresponding to the second set of quantum states in the measurement results in Table 12 above are only one set of possible results. Other possible measurement results will not be elaborated here.
[0260] Then the second basis set is sent to the sender, who compares the first basis set with the second basis set to determine the first target basis set and the second target basis set.
[0261] Next, the first target basis set and the second target basis set are received, so that the first target basis set can be directly determined.
[0262] In another possible implementation, the first target basis set can be determined by receiving the first basis set sent by the sender. Then, the first basis set is compared with the second basis set to determine the first target basis set and the second target basis set. These two sets are then sent to the sender, allowing the sender to directly determine the basis sets consistent with the receiver's and the inconsistent basis sets.
[0263] When comparing the first basis set with the second basis set to determine the first target basis set and the second target basis set, the determination steps are the same as those of step S1102 in step S11 of the sender, and will not be repeated here.
[0264] In another possible implementation, when determining the first target basis set, the second basis set can be sent to the sender while simultaneously receiving the first basis set sent by the sender. Then, a comparison operation between the first and second basis sets is performed between the sender and the first basis set, thereby determining the first and second target basis sets respectively. In this case, it is unnecessary to send the first and second target basis sets to the sender again, nor is it necessary to receive the first and second target basis sets sent by the sender.
[0265] S22, determine the second target encoding set based on the encoding values corresponding to the third target basis vectors contained in the first target basis vector set.
[0266] The third target basis vector is a basis vector in the second basis vector set, and this third target basis vector is inconsistent with the basis vectors in the first basis vector set. The encoded values in the second target encoding set are consistent with the encoded values in the first target encoding set of the sender.
[0267] Based on the encoding values corresponding to the third target basis vectors contained in the first target basis vector set, the second target encoding set is determined. This is consistent with the principle in step S12 of the sender, which determines the first target encoding set based on the encoding values corresponding to the first target basis vectors contained in the first target basis vector set. This will not be elaborated further here.
[0268] S23, based on the preset encryption algorithm, the second target encoding set is encrypted using the seventh target encoding set to generate the eighth target encoding set.
[0269] Specifically, the encoded values in the seventh target encoding set are the encoded values corresponding to the second target basis vector. This second target basis vector is a basis vector consistent between the first and second basis vector sets.
[0270] Specifically, when using a preset encryption algorithm to encrypt the second target encoding set with the seventh target encoding set to generate the eighth target encoding set, the seventh target encoding set is determined first.
[0271] When determining the seventh target encoding set, the ninth target encoding set is first determined based on the second quantum state set, the received second target basis vector set, and the first correspondence between quantum states and encoding values in the received agreed information.
[0272] The second target basis vector set contains basis vectors that are consistent between the first and second basis vector sets, and also includes position labels corresponding to the consistent basis vectors. Since the second target basis vectors are consistent between the first and second basis vector sets, the consistent basis vectors in the second target basis vector set are the second target basis vectors themselves.
[0273] Specifically, firstly, in the second set of quantum states, a second target position label that is identical to the position label in the second target basis vector set is determined. Then, based on the first correspondence between the encoded value and the quantum state in the agreed information, the encoded value corresponding to the quantum state corresponding to the second target position label in the second set of quantum states is determined. This encoded value then constitutes the ninth target encoded set.
[0274] Then, based on the ninth target coding set, the seventh target coding set is determined.
[0275] When determining the seventh target coding set based on the ninth target coding set, it is similar to step S1303 in the sender's process of determining the third target coding set based on the fifth target coding set, and will not be repeated here.
[0276] Furthermore, after determining the seventh target encoding set, the second target encoding set is encrypted using the seventh target encoding set based on a preset encryption algorithm to generate the eighth target encoding set.
[0277] The implementation method of encrypting the second target code set with the seventh target code set based on the preset encryption algorithm to generate the eighth target code set is consistent with step S13 in the sender, which encrypts the first target code set with the third target code set based on the preset encryption algorithm to generate the fourth target code set. It will not be described again here.
[0278] It should be noted that, in this embodiment of the application, the seventh target encoding set is consistent with the third target encoding set of the sender in step S13, and the eighth target encoding set generated is consistent with the fourth target encoding set generated by the sender in step S13.
[0279] S24, based on a preset arrangement, arrange the encoded values in the seventh target encoding set and the encoded values in the eighth target encoding set to obtain the second target key.
[0280] The implementation method of arranging the encoded values in the seventh target encoding set and the encoded values in the eighth target encoding set according to a preset arrangement to obtain the second target key is consistent with the implementation method of step S14 in the sender, which arranges the encoded values in the third target encoding set and the encoded values in the fourth target encoding set according to a preset arrangement to obtain the first target key. It will not be described again here.
[0281] It is worth noting that in this embodiment of the application, the second target key obtained above is the same as the first target key obtained by the sender in step S14, and is the same key.
[0282] It should also be noted that, in the embodiments of this application, when sending the target encoding set, basis vector set, and quantum state set to the sender, that is, when sending information to the sender, the sender can be authenticated first. Only when it is determined that the sender is the recipient of the information sent this time can the information be sent to the sender, which can improve the security of the information transmission process.
[0283] In summary, the key generation method proposed in this application, when applied to the receiver, utilizes the inconsistent basis vectors in the first and second basis vector sets to obtain a second target encoding set; then, based on a pre-agreed encryption algorithm, the second target encoding set is encrypted to generate an eighth target encoding set; finally, based on a pre-agreed arrangement, the encoded values in the seventh target encoding set (obtained from basis vectors consistent in the first and second basis vector sets) are arranged with the encoded values in the eighth target encoding set to obtain the second target key. This second target key is based on the seventh target encoding set, with the addition of the eighth target encoding set obtained from basis vectors inconsistent with those in the sender's set and the pre-agreed encryption algorithm. This increases the number of encoded values in the second target key, and the number of encoded values in the second target key is approximately equal to the number of encoded values in the initial bit string (i.e., the number of basis vectors selected by the receiver). This fully utilizes the inconsistent basis vectors in the sender's set, improving the key generation rate of the second target key.
[0284] At the same time, based on the received flipped specified value, encrypted specified array, and arranged specified array, it is ensured that the second target key is exactly the same as the first key.
[0285] Furthermore, the randomness in the second target key generation process can be guaranteed by the basis vectors randomly selected from the first and second basis vector sets, and the security in the second target key generation process can be guaranteed by the error rate calculated in the process of determining the eighth target encoding set.
[0286] In summary, the communicating parties pre-agree on the flipping method, encryption algorithm, and arrangement during the generation of the target key. After determining the encoded values corresponding to the first set of discarded target basis vectors, they flip the encoded values of the first set of target basis vectors according to the pre-agreement flipping method to obtain the discarded target encoded sets (i.e., the first target encoded set and the second target encoded set). Then, using the pre-determined encryption algorithm, they encrypt the discarded target encoded sets to obtain the fourth target encoded set and the eighth target encoded set. After determining the original target encoded sets (i.e., the third target encoded set and the seventh target encoded set), they concatenate the encoded values in the fourth target encoded set with the encoded values in the third target encoded set, and concatenate the encoded values in the eighth target encoded set with the encoded values in the seventh target encoded set according to the pre-agreement arrangement to obtain the first target key and the second target key.
[0287] By utilizing the basis vector information discarded during target key generation in existing technologies, the number of encoded values in the resulting target key is similar to the number of encoded values in the initial bit string (i.e., the number of basis vectors selected by the sender or receiver), thus improving the utilization rate of basis vectors. Compared to the code generation rate of target keys in existing technologies, the code generation rate of this first and second target keys is improved by approximately 100%.
[0288] The technical solution of this application will be further explained below with reference to a specific application process.
[0289] like Figure 6 The diagram shows the processing steps of the key generation method, with the two communicating parties being the sender and the receiver.
[0290] In the sending unit, firstly, agreed-upon information is generated. This agreed-upon information includes flipping a specified value, encrypting a specified array, arranging a specified array, basis vectors, quantum states, encoded values, a first correspondence between the basis vectors, quantum states, and encoded values, and a second correspondence between randomly generated basis vectors and encoded values.
[0291] The basis vectors include a first basis vector "+" and a second basis vector "×". The encoded value includes 0 and 1. The quantum state includes a horizontal quantum state "→", a vertical quantum state "↑", a 45° quantum state "↗", and a 135° quantum state "↖". The flip specified value indicates the flipping side to perform the flipping operation. The encryption specified value in the encryption specified array indicates the preset encryption algorithm. The permutation specified value in the permutation specified array indicates the preset permutation method.
[0292] Then, in the sending unit's preparation unit, an initial bit string of length N is randomly generated, where N is a positive integer. Each value in this initial bit string belongs to the encoded value in the agreed-upon information. After generating the initial bit string, in the sending unit's preparation unit, a first set of basis vectors is determined; and based on this first set of basis vectors, the quantum states corresponding to the encoded values in the initial bit string are prepared, resulting in a first set of quantum states. The basis vectors in this first set of basis vectors are either the first or second basis vector from the agreed-upon information, randomly selected during the preparation of the quantum states. The first set of quantum states is then sent to the measurement unit in the receiver, the first set of basis vectors is transmitted to the basis vector comparison unit in the sender, the initial bit string is transmitted to the first encoding determination unit in the sender, the basis vectors in the agreed information are sent to the measurement unit in the receiver, the first correspondence in the agreed information is sent to the second encoding determination unit in the receiver, the second correspondence between the flipped specified value, the basis vectors and the encoded value in the agreed information is sent to the second flipping unit in the receiver and the first flipping unit in the sender, the encrypted specified array in the agreed information is sent to the second encryption unit in the receiver and the first encryption unit in the sender, and the arranged specified array in the agreed information is sent to the second arrangement unit in the receiver and the first arrangement unit in the sender.
[0293] In the receiving unit's measurement unit, the basis vectors and the first set of quantum states in the agreed-upon information are received. Next, in the receiving unit's measurement unit, a second set of basis vectors is determined, and based on this second set, the quantum states in the first set of quantum states are measured to obtain a second set of quantum states. The basis vectors in this second set are either the first or second basis vectors in the agreed-upon information randomly selected during quantum state measurement. This second set of basis vectors is then sent to the sending unit's basis vector comparison unit, so that the sending unit can compare it with the first set of basis vectors obtained by its preparation unit. Simultaneously, the second set of quantum states is sent to the receiving unit's second encoding determination unit, so that it can determine the seventh target encoding set based on the second set of quantum states.
[0294] In the basis vector comparison unit of the sender, a second set of basis vectors transmitted by the measurement unit in the receiver, and a first set of basis vectors transmitted by the preparation unit in the sender, are received. Then, the second set of basis vectors is compared with the first set of basis vectors. Inconsistent basis vectors are identified as the first target set of basis vectors, and consistent basis vectors are identified as the second target set of basis vectors. The first target set of basis vectors includes a first target basis vector and a third target basis vector. The first target basis vector is a basis vector within the first set of basis vectors, and it is inconsistent with the basis vectors in the second set of basis vectors. The third target basis vector is a basis vector within the second set of basis vectors, and it is inconsistent with the basis vectors in the first set of basis vectors. The first target set of basis vectors is then transmitted to a first flipping unit in the sender and a second flipping unit in the receiver, so that the sender and receiver can each perform a flipping operation based on the first target set of basis vectors. Simultaneously, the second target basis vector set is transmitted to the first encoding determination unit in the sender and the second encoding determination unit in the receiver, so that the sender can determine the third target encoding set based on the second target basis vector set, and the receiver can determine the seventh target encoding set based on the second target basis vector set.
[0295] In the first flipping unit of the sender, a flipped specified value, a second correspondence between basis vectors and encoded values, and a first target basis vector set transmitted by the preparation unit of the sender are received. Then, based on the second correspondence between basis vectors and encoded values, the encoded values corresponding to the first target basis vectors included in the first target basis vector set are determined, and a sixth target encoding set composed of the encoded values corresponding to the first target basis vectors is determined. Next, based on the flipped specified value, it is determined that the flipping party is the sender, and the encoded values in the sixth target encoding set are flipped to obtain the first target encoding set. This first target encoding set is then transmitted to the first encryption unit of the sender for encryption.
[0296] In the first encoding determination unit of the sender, a second target basis vector set transmitted by the basis vector comparison unit of the sender and an initial bit string transmitted by the preparation unit of the sender are received. Then, based on the initial bit string and the position tags corresponding to the basis vectors in the second target basis vector set, a fifth target encoding set is determined. Then, M encoding values are randomly removed from the fifth target encoding set to obtain a third target encoding set. This third target encoding set is then transmitted to the first encryption unit and the first permutation unit of the sender, so that the first encryption unit can encrypt the first target encoding set based on the third target encoding set, and the first permutation unit can obtain the first target key based on the third target encoding set. Simultaneously, the M encoding values and their corresponding position tags are sent to the second encoding determination unit of the receiver, so that it can determine the encoding values removed from the ninth target encoding set. The position tags actually indicate the relative positional relationship between the M encoding values and other encoding values in the initial bit string.
[0297] In the first encryption unit of the sender, a third target encoding set transmitted by the first encoding determination unit of the sender, a first target encoding set transmitted by the first flipping unit of the sender, and an encryption specification array transmitted by the preparation unit of the sender are received. Then, a preset encryption algorithm is determined based on the encryption specification array. Next, based on the preset encryption algorithm and the working mode, the first target encoding set is encrypted using the third target encoding set to generate a fourth target encoding set. This fourth target encoding set is then transmitted to the first permutation unit of the sender so that it can obtain the first target key based on the fourth target encoding set.
[0298] In the first arrangement unit of the sender, the fourth target encoding set transmitted by the first encryption unit of the sender, the third target encoding set transmitted by the first encoding determination unit of the sender, and the arrangement specification array in the agreed information transmitted by the preparation unit of the sender are received. Then, a preset arrangement method is determined based on the arrangement specification array. Then, based on the preset arrangement method, the encoded values in the third target encoding set and the encoded values in the fourth target encoding set are arranged to obtain the first target key.
[0299] Similarly, in the second flipping unit of the receiver, it receives the first target basis vector set sent by the basis vector comparison unit in the sender, and the flipped specified value, the second correspondence between basis vectors and encoded values sent by the preparation unit in the sender. Then, based on the second correspondence between basis vectors and encoded values, it determines the encoded values corresponding to the third target basis vectors included in the first target basis vector set, and determines the tenth target encoding set composed of the encoded values corresponding to the third target basis vectors. Based on the flipped specified value in the agreed information, it is determined that the flipping party is the sender, and the tenth target encoding set is used as the second target encoding set. The second target encoding set is then transmitted to the second encryption unit in the receiver so that it can encrypt the second target encoding set.
[0300] In the second encoding determination unit of the receiver, M encoded values and corresponding position tags sent by the first encoding determination unit of the sender, a second target basis vector set sent by the basis vector comparison unit of the sender, a first correspondence relationship in the agreed information sent by the preparation unit of the sender, and a second quantum state set transmitted by the measurement unit of the receiver are received. Then, based on the position tags corresponding to the basis vectors in the second target basis vector set, the quantum state corresponding to the position tag is marked in the second quantum state set. Then, based on the first correspondence relationship between the quantum state and the encoded value, a ninth target encoding set composed of the encoded values corresponding to the marked quantum states in the second quantum state set is determined. Next, the encoded values corresponding to the position tags of the M encoded values are removed from the ninth target encoding set to obtain a seventh target encoding set. The seventh target encoding set is then transmitted to the second encryption unit and the second permutation unit of the receiver so that the second encryption unit of the receiver can encrypt the second target encoding set based on the seventh target encoding set, and the second permutation unit of the receiver can obtain the second target key based on the seventh target encoding set.
[0301] In the second encryption unit of the receiver, the seventh target encoding set transmitted by the second encoding determination unit of the receiver, the second target encoding set transmitted by the second flipping unit of the receiver, and the encryption specified array sent by the preparation unit of the sender are received. Then, a preset encryption algorithm is determined based on the encryption specified array. Then, based on the preset encryption algorithm and the working mode, the second target encoding set is encrypted using the seventh target encoding set to generate an eighth target encoding set. The eighth target encoding set is transmitted to the second permutation unit of the receiver so that it can obtain the second target key based on the eighth target encoding set.
[0302] In the second permutation unit of the receiver, the eighth target encoding set transmitted by the second encryption unit of the receiver, the seventh target encoding set transmitted by the second encoding determination unit of the receiver, and the permutation specification array sent by the preparation unit of the sender are received. Then, a preset permutation method is determined based on the permutation specification array. Then, based on the preset permutation method, the encoded values in the seventh target encoding set and the encoded values in the eighth target encoding set are arranged to obtain the second target key.
[0303] Through the above method, both communicating parties utilize the first and second flip units respectively to ensure that the encoded values in the first target encoding set are consistent with the encoded values in the second target encoding set. Then, based on a preset encryption algorithm, each party uses the first encryption unit to encrypt the encoded values in the first target encoding set and the second encryption unit to encrypt the encoded values in the second target encoding set, generating a fourth and an eighth target encoding set respectively, ensuring that the encoded values in the generated fourth target encoding set are consistent with the encoded values in the eighth target encoding set. Finally, based on a preset permutation method, the first and second permutation units are used to ensure that the generated first target key is consistent with the second target key. By utilizing the encoded values corresponding to the inconsistent basis vectors in the first and second basis vector sets, the utilization rate of the first or second target key on the basis vectors in the first and second basis vector sets is higher than that of the original third or seventh target encoding sets, thereby increasing the code generation rate of the target key.
[0304] Furthermore, compared to the existing technology that encrypts the encoded value corresponding to the consistent basis vector of the two communicating parties (i.e., the third target encoding set) as the target key, the target key obtained in this application contains more key information and has a higher coding rate, thus forming a more complex encryption system and making the target key more secure.
[0305] Based on the same inventive concept, this application also provides a key generation device, such as... Figure 7 The diagram shown is a schematic representation of the key generation device provided in this application. Figure 1 This device is used on the sender in a communication between two parties, and this device is similar to the aforementioned Figure 1 This corresponds to a key generation method. The apparatus includes:
[0306] The first basis vector determination module 701 is used to determine the first target basis vector set; wherein the first target basis vector contained in the first target basis vector set is the basis vector in the first basis vector set, and the first target basis vector is inconsistent with the basis vector in the second basis vector set;
[0307] The first encoding determination module 702 is used to determine a first target encoding set based on the encoding value corresponding to the first target basis vector; wherein the encoding value in the first target encoding set is consistent with the encoding value in the second target encoding set in the receiver;
[0308] The first encryption module 703 is used to encrypt the first target encoding set using a third target encoding set based on a preset encryption algorithm to generate a fourth target encoding set; wherein, the encoded value in the third target encoding set is the encoded value corresponding to the second target basis vector; the second target basis vector is a basis vector that is consistent between the first basis vector set and the second basis vector set;
[0309] The first processing module 704 is used to arrange the encoded values in the third target encoding set and the encoded values in the fourth target encoding set according to a preset arrangement to obtain the first target key.
[0310] In one possible implementation, the first basis vector determination module 701 is specifically used to determine a first basis vector set and receive a second basis vector set; wherein the basis vectors in the first basis vector set are used to prepare the quantum state of the initial bit string; the first basis vector set and the second basis vector set are compared, and the inconsistent basis vectors are determined as the first target basis vector set.
[0311] In one possible implementation, the first basis vector determination module 701 is further configured to compare the first basis vector set with the second basis vector set, and determine the consistent basis vectors as the second target basis vector set; wherein the second target basis vector set contains the position labels corresponding to the consistent basis vectors; based on the position labels and the initial bit string, a fifth target encoding set is determined; M encoding values are randomly removed from the fifth target encoding set to obtain a third target encoding set; wherein M is a positive integer less than the total number of encoding values in the fifth target encoding set.
[0312] In one possible implementation, the first encoding determination module 702 is specifically used to randomly generate a correspondence between basis vectors and encoding values; based on the correspondence, determine the encoding value corresponding to the first target basis vector and the sixth target encoding set; wherein the sixth target encoding set is composed of the encoding value corresponding to the first target basis vector; according to the flip specified value, determine whether the flipping party performing the flipping operation is the sender; if not, use the sixth target encoding set as the first target encoding set.
[0313] In one possible implementation, the first encoding determination module 702 is further configured to, if the flipping party is the sender, flip the encoded values in the sixth target encoding set to obtain the first target encoding set.
[0314] In one possible implementation, the first basis vector determination module 701 is further configured to generate an encrypted specified array and an arranged specified array, and send the encrypted specified array and the arranged specified array to the receiver so that the receiver can determine the preset encryption algorithm and the preset arrangement method; wherein, the encrypted specified value in the encrypted specified array indicates the preset encryption algorithm, and the arranged specified value in the arranged specified array indicates the preset arrangement method.
[0315] In one possible implementation, the first processing module 704 is specifically configured to: swap the encoded values in the third target encoding set according to a first preset swapping order to obtain a first target encoding subset; swap the encoded values in the fourth target encoding set according to a second preset swapping order to obtain a second target encoding subset; and arrange the encoded values in the first target encoding subset and the encoded values in the second target encoding subset according to a preset sub-arrangement method to obtain a first target key; wherein the preset sub-arrangement method indicates that the encoded values in the first target encoding subset are inserted into the encoded values in the second target encoding subset.
[0316] like Figure 8 The diagram shown is a schematic representation of the key generation device provided in this application. Figure 2 This device is used on the receiving side of a communication between two parties, and this device is similar to the aforementioned Figure 5 This corresponds to a key generation method. The apparatus includes:
[0317] The second basis vector determination module 801 is used to determine the first target basis vector set; wherein the third target basis vector contained in the first target basis vector set is a basis vector in the second basis vector set, and the third target basis vector is inconsistent with the basis vector in the first basis vector set;
[0318] The second encoding determination module 802 is used to determine a second target encoding set based on the encoding value corresponding to the third target basis vector; wherein the encoding value in the second target encoding set is consistent with the encoding value in the first target encoding set in the sender;
[0319] The second encryption module 803 is used to encrypt the second target encoding set using the seventh target encoding set based on a preset encryption algorithm to generate an eighth target encoding set; wherein, the encoded value in the seventh target encoding set is the encoded value corresponding to the second target basis vector; the second target basis vector is a basis vector that is consistent between the first basis vector set and the second basis vector set;
[0320] The second processing module 804 is used to arrange the encoded values in the seventh target encoding set and the encoded values in the eighth target encoding set according to a preset arrangement to obtain the second target key.
[0321] Based on the same inventive concept, this application also provides an electronic device that can realize the function of the aforementioned key generation device. (Refer to...) Figure 9 The aforementioned electronic devices include:
[0322] At least one processor 901 and a memory 902 connected to at least one processor 901. In this embodiment, the specific connection medium between the processor 901 and the memory 902 is not limited. Figure 9 The example shown is the connection between processor 901 and memory 902 via bus 900. Bus 900 is... Figure 9 The connections between other components are indicated by thick lines and are for illustrative purposes only, not as limiting information. The Bus 900 can be divided into address bus, data bus, control bus, etc., for ease of representation. Figure 9 The term is represented by a single thick line, but this does not imply that there is only one bus or one type of bus. Alternatively, the processor 901 can also be called a controller; there is no restriction on the name.
[0323] In this embodiment, memory 902 stores instructions executable by at least one processor 901. By executing the instructions stored in memory 902, at least one processor 901 can execute the key generation method described above. Processor 901 can implement... Figure 7 and Figure 8 The functions of each module in the device shown.
[0324] The processor 901 is the control center of the device. It can connect to various parts of the control device through various interfaces and lines. By running or executing instructions stored in memory 902 and calling data stored in memory 902, the processor can perform various functions and process data, thereby monitoring the device as a whole.
[0325] In one possible design, processor 901 may include one or more processing units. Processor 901 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understood that the modem processor may also not be integrated into processor 901. In some embodiments, processor 901 and memory 902 may be implemented on the same chip; in some embodiments, they may also be implemented on separate chips.
[0326] The processor 901 can be a general-purpose processor, such as a central processing unit (CPU), digital signal processor, application-specific integrated circuit, field-programmable gate array or other programmable logic device, discrete gate or transistor logic device, or discrete hardware component, capable of implementing or executing the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the key generation method disclosed in the embodiments of this application can be directly manifested as being executed by a hardware processor, or executed by a combination of hardware and software modules within the processor.
[0327] Memory 902, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules. Memory 902 may include at least one type of storage medium, such as flash memory, hard disk, multimedia card, card-type memory, random access memory (RAM), static random access memory (SRAM), programmable read-only memory (PROM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), magnetic storage, magnetic disk, optical disk, etc. Memory 902 can be any other medium capable of carrying or storing desired program code in the form of instructions or data structures that can be accessed by a computer, but is not limited thereto. In the embodiments of this application, memory 902 can also be a circuit or any other device capable of implementing storage functions for storing program instructions and / or data.
[0328] By designing and programming the processor 901, the code corresponding to the key generation method described in the foregoing embodiments can be embedded into the chip, enabling the chip to execute it during operation. Figure 1 and Figure 5 The steps of the key generation method in the illustrated embodiment are described. How to design and program the processor 901 is a technique well-known to those skilled in the art and will not be elaborated upon here.
[0329] Based on the same inventive concept, embodiments of this application also provide a storage medium storing computer instructions that, when executed on a computer, cause the computer to perform the key generation method described above.
[0330] In some possible implementations, various aspects of the key generation method provided in this application can also be implemented as a program product comprising program code that, when the program product is run on a device, causes the control device to perform the steps in the key generation method according to the various exemplary embodiments of this application described above.
[0331] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0332] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0333] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0334] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0335] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.
Claims
1. A method for generating a key, characterized in that, The method is applied to the sender and includes: Determine a first target basis vector set; wherein the first target basis vectors included in the first target basis vector set are basis vectors in the first basis vector set, and the first target basis vectors are inconsistent with the basis vectors in the second basis vector set; A random correspondence is generated between basis vectors and encoded values; based on the correspondence, the encoded value corresponding to the first target basis vector and a sixth target encoding set are determined; wherein, the sixth target encoding set is composed of the encoded values corresponding to the first target basis vector; according to the flipped specified value, it is determined whether the flipping party performing the flipping operation is the sender; if not, the sixth target encoding set is taken as the first target encoding set; if yes, the encoded values in the sixth target encoding set are flipped to obtain the first target encoding set; wherein, the encoded values in the first target encoding set are consistent with the encoded values in the second target encoding set of the receiver; Based on a preset encryption algorithm, the first target encoding set is encrypted using a third target encoding set to generate a fourth target encoding set; wherein, the encoded value in the third target encoding set is the encoded value corresponding to the second target basis vector; the second target basis vector is a basis vector that is consistent between the first basis vector set and the second basis vector set; According to a first preset swapping order, the encoded values in the third target encoding set are swapped to obtain a first target encoding subset; and according to a second preset swapping order, the encoded values in the fourth target encoding set are swapped to obtain a second target encoding subset; and according to a preset sub-arrangement method, the encoded values in the first target encoding subset and the encoded values in the second target encoding subset are arranged to obtain a first target key; wherein, the preset sub-arrangement method indicates that the encoded values in the first target encoding subset are inserted into the encoded values in the second target encoding subset.
2. The method as described in claim 1, characterized in that, Determining the first target basis vector set includes: Determine the first set of basis vectors and receive the second set of basis vectors; wherein the basis vectors in the first set of basis vectors are used to prepare the quantum state of the initial bit string; Compare the first basis set with the second basis set, and determine the inconsistent basis sets as the first target basis set.
3. The method as described in claim 2, characterized in that, After determining the first set of basis vectors and receiving the second set of basis vectors, the method further includes: The first basis vector set is compared with the second basis vector set, and the consistent basis vectors are determined as the second target basis vector set; wherein, the second target basis vector set contains the position labels corresponding to the consistent basis vectors; Based on the location label and the initial bit string, determine the fifth target encoding set; M coded values are randomly removed from the fifth target coded set to obtain the third target coded set; where M is a positive integer less than the total number of coded values in the fifth target coded set.
4. The method as described in claim 1, characterized in that, Before determining the first set of target basis vectors, the method further includes: Generate an encrypted specified array and an arranged specified array, and send the encrypted specified array and the arranged specified array to the receiver so that the receiver can determine the preset encryption algorithm and the preset arrangement method; wherein, the encrypted specified value in the encrypted specified array indicates the preset encryption algorithm, and the arranged specified value in the arranged specified array indicates the preset arrangement method.
5. A method for generating a key, characterized in that, The method is applied to the receiver and includes: Determine a first set of target basis vectors; wherein the third target basis vectors included in the first set of target basis vectors are basis vectors in the second set of basis vectors, and the third target basis vectors are inconsistent with the basis vectors in the first set of basis vectors; A correspondence between basis vectors and encoded values is randomly generated; based on the correspondence, the encoded value corresponding to the third target basis vector and the tenth target encoding set are determined; wherein, the tenth target encoding set is composed of the encoded values corresponding to the third target basis vector; according to the flipped specified value, it is determined whether the flipping party performing the flipping operation is the sender; if yes, the tenth target encoding set is used as the second target encoding set; if no, the encoded values in the tenth target encoding set are flipped to obtain the second target encoding set; wherein, the encoded values in the second target encoding set are consistent with the encoded values in the first target encoding set of the sender; Based on a preset encryption algorithm, the second target encoding set is encrypted using the seventh target encoding set to generate an eighth target encoding set; wherein, the encoded value in the seventh target encoding set is the encoded value corresponding to the second target basis vector; the second target basis vector is a basis vector that is consistent between the first basis vector set and the second basis vector set; According to a first preset swapping order, the encoded values in the seventh target encoding set are swapped to obtain a first target encoding subset; and according to a second preset swapping order, the encoded values in the eighth target encoding set are swapped to obtain a second target encoding subset; and according to a preset sub-arrangement method, the encoded values in the first target encoding subset and the encoded values in the second target encoding subset are arranged to obtain a second target key; wherein, the preset sub-arrangement method indicates that the encoded values in the first target encoding subset are inserted into the encoded values in the second target encoding subset.
6. A key generation apparatus, characterized in that, The device is used on the sender and includes: The first basis vector determination module is used to determine a first target basis vector set; wherein the first target basis vector included in the first target basis vector set is the basis vector in the first basis vector set, and the first target basis vector is inconsistent with the basis vector in the second basis vector set; A first encoding determination module is used to randomly generate a correspondence between basis vectors and encoded values; based on the correspondence, determine the encoded value corresponding to the first target basis vector and a sixth target encoding set; wherein the sixth target encoding set is composed of the encoded values corresponding to the first target basis vector; according to a flipped specified value, determine whether the flipping party performing the flipping operation is the sender; if not, use the sixth target encoding set as the first target encoding set; if yes, flip the encoded values in the sixth target encoding set to obtain the first target encoding set; wherein the encoded values in the first target encoding set are consistent with the encoded values in the second target encoding set of the receiver; The first encryption module is used to encrypt the first target encoding set using a third target encoding set based on a preset encryption algorithm to generate a fourth target encoding set; wherein the encoded value in the third target encoding set is the encoded value corresponding to the second target basis vector; the second target basis vector is a basis vector that is consistent between the first basis vector set and the second basis vector set; The first processing module is configured to: swap the encoded values in the third target encoding set according to a first preset swapping order to obtain a first target encoding subset; swap the encoded values in the fourth target encoding set according to a second preset swapping order to obtain a second target encoding subset; and arrange the encoded values in the first target encoding subset and the encoded values in the second target encoding subset according to a preset sub-arrangement method to obtain a first target key; wherein the preset sub-arrangement method indicates that the encoded values in the first target encoding subset are inserted into the encoded values in the second target encoding subset.
7. A key generation apparatus, characterized in that, The device is applied to the receiver and includes: The second basis vector determination module is used to determine the first target basis vector set; wherein the third target basis vector contained in the first target basis vector set is a basis vector in the second basis vector set, and the third target basis vector is inconsistent with the basis vector in the first basis vector set; The second encoding determination module is used to randomly generate a correspondence between basis vectors and encoded values; based on the correspondence, determine the encoded value corresponding to the third target basis vector and the tenth target encoding set; wherein the tenth target encoding set is composed of the encoded values corresponding to the third target basis vector; according to the flipped specified value, determine whether the flipping party performing the flipping operation is the sender; if yes, use the tenth target encoding set as the second target encoding set; if no, flip the encoded values in the tenth target encoding set to obtain the second target encoding set; wherein the encoded values in the second target encoding set are consistent with the encoded values in the first target encoding set of the sender; The second encryption module is used to encrypt the second target encoding set using a seventh target encoding set based on a preset encryption algorithm to generate an eighth target encoding set; wherein, the encoded value in the seventh target encoding set is the encoded value corresponding to the second target basis vector; the second target basis vector is a basis vector that is consistent between the first basis vector set and the second basis vector set; The second processing module is used to swap the encoded values in the seventh target encoding set according to a first preset swapping order to obtain a first target encoding subset; and swap the encoded values in the eighth target encoding set according to a second preset swapping order to obtain a second target encoding subset; and arrange the encoded values in the first target encoding subset and the encoded values in the second target encoding subset according to a preset sub-arrangement method to obtain a second target key; wherein the preset sub-arrangement method indicates that the encoded values in the first target encoding subset are inserted into the encoded values in the second target encoding subset.
8. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor, when executing a computer program stored in the memory, implements the method steps of any one of claims 1-5.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the method described in any one of claims 1-5.