Method and system for encrypting and decrypting network data messages using quantum distributed keys
The generation of key encryption keys through quantum distribution keys and cryptographic hash algorithms solves the problem that encryption gateways cannot negotiate keys in complex network environments, realizes secure encrypted communication of data packets, and enhances the security of data transmission.
Patent Information
- Application Number
- CN202211198246.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-29
- Publication Date
- 2024-11-05
- Estimated Expiration
- 2042-09-29
AI Technical Summary
The prior art encryption gateway cannot negotiate the key in a complex network environment, and there is difficulty in synchronizing the keys of encrypted data packets at one crypto at a time, and it is impossible to achieve secure encrypted communication.
The network data packet is encrypted and decrypted through quantum distribution keys, and the master key is charged offline using a secure storage medium. The password hash algorithm is used to generate a key encryption key, which generates a data encryption key in real time, and embeds a password in the data packet. Key encryption key and key ID to realize data encryption and decryption.
Key negotiation and key synchronization between encryption gateways are realized in complex network environments, enhancing the confidentiality protection of data transmission, avoiding the needs of complex key management systems and key negotiation protocols, and suitable for charging only offline A scenario where key is noted.
Smart Images

Figure CN115567206B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of cryptographic applications, and in particular to a method and system for implementing network data message encryption and decryption by using quantum distributed keys. Background Art
[0002] Currently, the LAN interconnection of each branch is carried out through a secure encryption channel established by an encryption gateway such as a VPN device. Before encrypted communication, the encryption gateways need to use a key exchange protocol such as IKE to negotiate the session key used for data communication. This model has the following problems:
[0003] (1) There needs to be a communication channel between encryption gateways for direct key negotiation, which is difficult to implement in complex network environments such as NAT, especially when the gateways at both ends of the communication need to be NATed before they can access the Internet.
[0004] (2) The negotiation process is relatively complex and has certain computational and communication costs. Therefore, the generated session key is generally used for a period of time. From a security perspective, it is not possible to achieve a one-time one-key.
[0005] (3) The key negotiation process is based on asymmetric key pairs and digital certificates. The public key used to encrypt and transmit session key materials is public. If the computing power of quantum computers is improved, there is a possibility that it can be deciphered, resulting in the session key to be transmitted being deciphered and stolen.
[0006] Therefore, there are problems such as the inability of encryption gateways to negotiate keys in complex network environments such as bidirectional NAT, as well as key synchronization issues for one-time encrypted data messages.
[0007] In the related art, the Chinese invention patent document with publication number CN107453869A records a method for realizing quantum-secure IPSecVPN, by adding a QKD security interface to the IPSec VPN gateway, adding a quantum key access and application mechanism to the IPSec VPN security policy, adding a one-time encryption option based on quantum keys to the IPSec encryption component, and adding a strategy of preferentially using quantum keys as pre-shared keys, session keys for data encryption algorithms, and shared keys for HMAC algorithms; realizing the integrated application of QKD and quantum encryption with the IPSec protocol, and improving the quantum security of identity authentication, message identification, and data encryption of the IPSecVPN system.
[0008] However, this solution requires key negotiation, and the network topology is complex; and the pre-shared key is directly used as the encryption key, and the key security is relatively low.
[0009] A Chinese invention patent document with publication number CN110213050A records a key generation method, device and storage medium, the method comprising: obtaining a quantum key generated by a quantum key generation terminal; dividing the quantum key into multiple first keys and multiple second keys; using the multiple first keys and the multiple second keys to perform m rounds of derivation transformation to obtain multiple derived keys.
[0010] The Chinese invention patent document with publication number CN103036675A describes a data communication method based on dynamic keys, a sending end and a receiving end, wherein the method of the sending end comprises the following steps: the sending end generates a session key Ks for encrypting communication data, Ks=H S (K1)XORH T (K2); where S is the value of the counter in the sending end, and its initial value is 1, S+T=n, and the value of the counter increases by 1 each time the sending end and the receiving end have a conversation; K1 and K2 are two parts of equal length that divide the key seed K, and the key seed K is a shared key agreed upon in advance by the receiving end and the sending end; the sending end uses the session key Ks to encrypt the communication data; the sending end sends the encrypted communication data to the receiving end. Summary of the invention
[0011] The technical problem to be solved by the present invention is how to solve the problem of secure encryption communication of data messages in a scenario where keys can only be charged offline and online key negotiation and key distribution cannot be performed.
[0012] The present invention solves the above technical problems through the following technical means:
[0013] The present invention proposes a method for encrypting and decrypting network data messages using quantum distributed keys, which is applied to an encryption gateway, wherein the encryption gateway is connected to a secure storage medium, and the method comprises:
[0014] Reading a master key from a connected secure storage medium to establish a master key pool, wherein the master key is pre-filled into the secure storage medium by a quantum key distribution network;
[0015] Receiving an outbound network data message from a network interface connected to an intranet, and encrypting the network data message using a data encryption key to obtain an encrypted data message, wherein the data encryption key is a random number generated in real time;
[0016] Randomly selecting the master key from the master key pool, and transforming the master key into a key encryption key using a cryptographic hash algorithm;
[0017] Putting the ciphertext obtained by encrypting the data encryption key using the key encryption key and the ID identifier of the master key into the security message header of the encrypted data message to obtain an outbound encrypted message;
[0018] The outbound encrypted message is sent from a network interface connected to an external network.
[0019] The present invention charges a large number of master keys offline and shares them among encryption gateways in a security domain, utilizes master key transformation to generate key encryption keys, the key encryption keys are used to encrypt data encryption keys, and the data encryption keys are generated in real time in a packet and a key and transmitted together with data messages, thereby realizing the secure and free transmission of data messages in a security domain, and does not require a complex key management system and key negotiation protocol. The present invention is suitable for scenarios where master keys can only be charged offline and online key negotiation and key distribution cannot be performed; the problem that encryption gateways cannot negotiate keys in complex network environments such as bidirectional NAT and the key synchronization problem of one-time encrypted data messages are solved, thereby enhancing the security strength of confidentiality protection of data transmission when interconnecting between local area networks.
[0020] Furthermore, the randomly selecting the master key from the master key pool and transforming the master key into a key encryption key using a cryptographic hash algorithm comprises:
[0021] Randomly select the master key mk from the master key pool;
[0022] The encrypted information is subjected to a keyed cryptographic hash operation using the master key to obtain the key encryption key kek, which is expressed as follows:
[0023] kek=PRF(mk, source IP address|destination IP address|master key ID identifier).
[0024] Furthermore, the method further comprises:
[0025] Counting the selected master keys using a master key serial number generator, and when the count value exceeds the maximum number of pre-charged master keys, clearing the count value and starting the count again from 1;
[0026] The master key usage accumulator is used to count the number of times the master key is used, and when the count value exceeds the set threshold, an early warning signal is generated and the master key is updated.
[0027] Furthermore, after receiving the outbound network data message from the network interface connected to the intranet, the method further includes:
[0028] Determine whether the data length MSS of the network data message exceeds the length of the maximum data portion allowed to be transmitted;
[0029] If yes, modify the data length MSS of the network data message to be MSS-4-n, where n is the length of the key or initialization vector;
[0030] If not, the network data message is encrypted using the data encryption key to obtain an encrypted data message.
[0031] Furthermore, before sending the outbound encrypted message from the network interface connected to the external network, the method further includes:
[0032] Determine whether the outbound encrypted message exceeds the MTU;
[0033] If yes, fragment the outbound encrypted message;
[0034] If not, the outbound encrypted message is sent from the network interface connected to the external network.
[0035] Furthermore, before reading the master key from the secure storage medium, the method further includes:
[0036] Sending a registration request to the control platform to bind to a corresponding security domain, the security domain being divided by the control platform;
[0037] Sending a key injection request to the control platform, so that the control platform forwards the key injection request to the quantum key distribution network, where the quantum key distribution network stores security domain division information and encryption gateway information in each security domain;
[0038] The master key is injected offline into the secure storage medium through a key agent or a quantum network node, and the ID identifier of the master key injected into the secure storage medium connected to each encryption gateway in the same security domain is the same.
[0039] Furthermore, when the encryption gateway serves as a receiver, the method further includes:
[0040] Receiving the outbound encrypted message from a network interface connected to an external network;
[0041] Determining whether the outbound encrypted message is a fragmented message;
[0042] If yes, then the pieces are combined;
[0043] If not, select a master key corresponding to the ID of the master key from the master key pool and convert it into the key encryption key;
[0044] decrypting the ciphertext using the key encryption key to obtain the data encryption key;
[0045] The encrypted data message is decrypted using the data encryption key.
[0046] In addition, the present invention also proposes a gateway for realizing network data message encryption and decryption using quantum distributed keys, the gateway comprising a data encryption and decryption processing module, a key conversion module and a key injection module, the key injection module is connected to a secure storage medium, the secure storage medium stores a master key pre-filled by a quantum key distribution network;
[0047] The key injection module is used to read the master key from the connected secure storage medium and establish a master key pool;
[0048] The key conversion module is used to randomly select the master key from the master key pool and convert the master key into a key encryption key using a cryptographic hash algorithm;
[0049] The data encryption and decryption processing module is used to receive an outbound network data message from a network interface connected to an intranet, and encrypt the network data message using a data encryption key to obtain an encrypted data message, wherein the data encryption key is a random number generated in real time; put the ciphertext obtained by encrypting the data encryption key using the key encryption key and the ID identifier of the master key into the security message header of the encrypted data message to obtain an outbound encrypted message; and send the outbound encrypted message from the network interface connected to an external network.
[0050] Furthermore, the gateway further includes a counter module and an early warning module, wherein the counter module includes a master key sequence number generator and a master key usage accumulator, wherein:
[0051] The master key serial number generator is used to count the selected master keys, and when the count value exceeds the maximum number of pre-charged master keys, the count value is cleared and counted again from 1;
[0052] The master key usage accumulator is used to count the number of times the master key is used, and when the count value exceeds a set threshold, the master key is updated and an early warning signal is generated to the early warning module for early warning.
[0053] In addition, the present invention also proposes a system for implementing network data message encryption and decryption using quantum distributed keys, the system comprising a first encryption gateway, a second encryption gateway, a management and control platform, and a quantum key distribution network, the first encryption gateway, the second encryption gateway, and the quantum key distribution network are all connected to the management and control platform, the first encryption gateway and the second encryption gateway are both connected to the quantum key distribution network, wherein the first encryption gateway and the second encryption gateway each comprise a data encryption and decryption processing module, a key transformation module, and a key injection module, the key injection module is connected to a secure storage medium, and the secure storage medium stores a master key pre-filled by the quantum key distribution network;
[0054] The management and control platform is used for performing security domain division, and registration and identity binding services for the first encryption gateway and the second encryption gateway;
[0055] The quantum key distribution network is used to pre-fill the secure storage medium with a master key;
[0056] The key injection module is used to read the master key from the connected secure storage medium and establish a master key pool;
[0057] The key conversion module is used to randomly select the master key from the master key pool and convert the master key into a key encryption key using a cryptographic hash algorithm;
[0058] The data encryption and decryption processing module is used to receive an outbound network data message from a network interface connected to an intranet, and encrypt the network data message using a data encryption key to obtain an encrypted data message, wherein the data encryption key is a random number generated in real time; put the ciphertext obtained by encrypting the data encryption key using the key encryption key and the ID identifier of the master key into the security message header of the encrypted data message to obtain an outbound encrypted message; and send the outbound encrypted message from the network interface connected to an external network.
[0059] The advantages of the present invention are:
[0060] (1) The present invention charges a large number of master keys offline and shares them among encryption gateways in a security domain, and generates key encryption keys by transforming master keys. The key encryption keys are used to encrypt data encryption keys. The data encryption keys are generated in real time and transmitted together with data messages. This enables secure and free transmission of data messages in a security domain, and does not require a complex key management system and key negotiation protocol. The present invention is suitable for scenarios where master keys can only be charged offline and online key negotiation and key distribution cannot be performed. The present invention solves the problem that encryption gateways cannot negotiate keys in complex network environments such as bidirectional NAT and the key synchronization problem of one-time encrypted data messages, thereby enhancing the security strength of confidentiality protection of data transmission when interconnecting between local area networks.
[0061] (2) Based on the pre-filled master key, the data ciphertext and the key ciphertext of the encrypted data are transmitted together in a digital envelope, realizing one package and one ciphertext, which has strong adaptability and fault tolerance.
[0062] Additional aspects and advantages of the present invention will be given in part in the following description and in part will be obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0063] Figure 1 It is a flow chart of a method for realizing network data message encryption and decryption using quantum distributed keys proposed in the first embodiment of the present invention;
[0064] Figure 2 It is a schematic diagram of the structure of a gateway for implementing network data message encryption and decryption using quantum distributed keys proposed in the second embodiment of the present invention;
[0065] Figure 3 It is a schematic diagram of the structure of a system for implementing network data message encryption and decryption using quantum distributed keys proposed in the third embodiment of the present invention;
[0066] Figure 4 It is a schematic diagram of the workflow of a system for encrypting and decrypting network data messages using quantum distributed keys, as proposed in the third embodiment of the present invention. DETAILED DESCRIPTION
[0067] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in combination with the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0068] Example 1
[0069] like Figure 1As shown, the first embodiment of the present invention proposes a method for encrypting and decrypting network data messages using quantum distributed keys, which is applied to an encryption gateway, the encryption gateway is connected to a secure storage medium, and when the encryption gateway acts as a sender, the method includes the following steps:
[0070] S101, reading a master key from a connected secure storage medium and establishing a master key pool, wherein the master key is pre-filled into the secure storage medium by a quantum key distribution network;
[0071] It should be noted that the format of the master key is 4-byte key ID + n-byte key and n-byte initialization vector. All devices in the same security domain share the same master key identified by the same key ID. The value of n is related to the encryption algorithm.
[0072] S102, receiving an outbound network data message from a network interface connected to an intranet, and encrypting the network data message using a data encryption key to obtain an encrypted data message, wherein the data encryption key is a random number generated in real time;
[0073] It should be noted that the encryption gateway encrypts outbound network data messages one by one. The encryption key of the data is a random number generated in real time, and the encryption mode is CBC (integer multiple of the algorithm grouping) + CFB (the remainder beyond the integer multiple of the algorithm grouping).
[0074] S103, randomly selecting the master key from the master key pool, and transforming the master key into a key encryption key using a cryptographic hash algorithm;
[0075] Specifically, in this embodiment, the master key is used as the key, and the source and destination IP and key ID are concatenated to perform a key hash operation to obtain a key encryption key. The algorithm is specifically the SM3 national secret algorithm.
[0076] S104, putting the ciphertext obtained by encrypting the data encryption key using the key encryption key and the ID identifier of the master key into the security message header of the encrypted data message to obtain an outbound encrypted message;
[0077] This embodiment attaches a security message header to each data message, encrypts the data encryption key with the key encryption key and puts it into the message header, and uses a digital envelope to securely transmit the data and the key for encrypting the data in the same package, which can avoid key asynchrony and achieve one package with one key.
[0078] Specifically, the format of the security message header is: 4-byte key ID + n-byte key ciphertext, where the value of n is related to the encryption algorithm.
[0079] S105: Send the outbound encrypted message from the network interface connected to the external network.
[0080] This embodiment charges a large number of master keys offline and shares them among encryption gateways in the security domain, and uses master key transformation to generate key encryption keys. The key encryption keys are used to encrypt data encryption keys. The data encryption keys are generated in real time and transmitted together with data messages. This realizes the secure and free transmission of data messages in the security domain, and does not require a complex key management system and key negotiation protocol. It is suitable for scenarios where master keys can only be charged offline and online key negotiation and key distribution cannot be performed. It solves the problem that encryption gateways cannot negotiate keys in complex network environments such as bidirectional NAT and the key synchronization problem of one-time encrypted data messages, and enhances the security strength of confidentiality protection of data transmission when interconnecting between local area networks.
[0081] In one embodiment, the step S103: randomly selecting the master key from the master key pool, and transforming the master key using a cryptographic hash algorithm to obtain a key encryption key, specifically:
[0082] Randomly select the master key mk from the master key pool;
[0083] The encrypted information is subjected to a keyed cryptographic hash operation using the master key to obtain the key encryption key kek, which is expressed as follows:
[0084] kek=PRF(mk, source IP address|destination IP address|master key ID identifier).
[0085] Among them, PRF (key, msg) refers to using the key key to perform a keyed cryptographic hash operation on msg, and the cryptographic hash algorithm adopts SM3.
[0086] In one embodiment, the method further comprises the following steps:
[0087] Counting the selected master keys using a master key serial number generator, and when the count value exceeds the maximum number of pre-charged master keys, clearing the count value and starting the count again from 1;
[0088] The master key usage accumulator is used to count the number of times the master key is used, and when the count value exceeds the set threshold, an early warning signal is generated and the master key is updated.
[0089] It should be noted that the present embodiment uses counters for the key serial number and key usage respectively. A data stream determined by a quintuple uses a master key and increases the master key serial number by 1. A data packet is encrypted once with the master key and increases the master key usage count by 1. When the master key usage accumulator (representing the total number of times the master key charged this time is used) exceeds the threshold, the encryption gateway issues an early warning through indicator lights, buzzers, log monitoring, emails, etc., and the administrator performs a master key update operation within the security domain to recharge the encryption gateway with a new master key.
[0090] In one embodiment, after the step S102: receiving an outbound network data message from a network interface connected to the intranet, the method further comprises the following steps:
[0091] Determine whether the data length MSS of the network data message exceeds the length of the maximum data portion allowed to be transmitted;
[0092] If yes, modify the data length MSS of the network data message to be MSS-4-n, where n is the length of the key or initialization vector;
[0093] If not, the network data message is encrypted using the data encryption key to obtain an encrypted data message.
[0094] It should be noted that the encryption gateway device node modifies the MSS data content in the outbound TCP connection establishment phase, and the new MSS = MSS-4-n, in order to avoid further fragmentation of the message after adding the security message header.
[0095] In one embodiment, before the step S105: sending the outbound encrypted message from the network interface connected to the external network, the method further includes the following steps:
[0096] Determine whether the outbound encrypted message exceeds the MTU;
[0097] If yes, fragment the outbound encrypted message;
[0098] If not, the outbound encrypted message is sent from the network interface connected to the external network.
[0099] It should be noted that if the non-TCP message plus the security message header exceeds the MTU, it will be fragmented.
[0100] In one embodiment, before step S101, the method further includes the following steps:
[0101] Sending a registration request to the control platform to bind to a corresponding security domain, the security domain being divided by the control platform;
[0102] Sending a key injection request to the control platform, so that the control platform forwards the key injection request to the quantum key distribution network, where the quantum key distribution network stores security domain division information and encryption gateway information in each security domain;
[0103] The master key is injected offline into the secure storage medium through a key agent or a quantum network node, and the ID identifier of the master key injected into the secure storage medium connected to each encryption gateway in the same security domain is the same.
[0104] This embodiment uses a quantum key distribution network to solve the problem of data encryption communication between networks, and implements a handshake-free network communication encryption solution that cannot be solved by traditional asymmetric cryptography and IKE protocols, thereby avoiding the security risks of the handshake process.
[0105] It should be noted that the quantum key distribution equipment used in this embodiment includes but is not limited to the QKD key distribution network, and the key pre-filling function involved can be implemented by any symmetric key management system and equipment.
[0106] In one embodiment, when the encryption gateway acts as a receiver, the method further includes:
[0107] Receiving the outbound encrypted message from a network interface connected to an external network;
[0108] Determining whether the outbound encrypted message is a fragmented message;
[0109] If yes, then the pieces are combined;
[0110] If not, select a master key corresponding to the ID of the master key from the master key pool and convert it into the key encryption key;
[0111] decrypting the ciphertext using the key encryption key to obtain the data encryption key;
[0112] The encrypted data message is decrypted using the data encryption key.
[0113] This embodiment uses a quantum key distribution network to solve the problem of data encryption communication between networks, and implements a handshake-free network communication encryption scheme that cannot be solved by traditional asymmetric cryptography and IKE protocols, avoiding the security risks of the handshake process. Different from the technology of key negotiation based on public key cryptography, a network data encryption scheme based on quantum key distribution network and symmetric cryptographic system for key distribution is constructed; it solves the problem of secure intercommunication when the encryption gateway does not directly exchange key information.
[0114] Example 2
[0115] like Figure 2As shown, the second embodiment of the present invention proposes a gateway for implementing network data message encryption and decryption using quantum distributed keys, characterized in that the gateway includes a data encryption and decryption processing module 11, a key transformation module 13 and a key injection module 12, the key injection module 12 is connected to a secure storage medium, and the secure storage medium stores a master key pre-filled by a quantum key distribution network 4;
[0116] The key injection module 12 is used to read the master key from the connected secure storage medium and establish a master key pool;
[0117] The key transformation module 13 is used to randomly select the master key from the master key pool and transform the master key into a key encryption key using a cryptographic hash algorithm;
[0118] The data encryption and decryption processing module 11 is used to receive outbound network data messages from the network interface connected to the intranet, and encrypt the network data messages using a data encryption key to obtain an encrypted data message, wherein the data encryption key is a random number generated in real time; put the ciphertext obtained by encrypting the data encryption key using the key encryption key and the ID identifier of the master key into the security message header of the encrypted data message to obtain an outbound encrypted message; and send the outbound encrypted message from the network interface connected to the external network.
[0119] This embodiment charges a large number of master keys offline and shares them among encryption gateways in the security domain, and uses master key transformation to generate key encryption keys. The key encryption keys are used to encrypt data encryption keys. The data encryption keys are generated in real time and transmitted together with data messages. This realizes the secure and free transmission of data messages in the security domain, and does not require a complex key management system and key negotiation protocol. It is suitable for scenarios where master keys can only be charged offline and online key negotiation and key distribution cannot be performed. It solves the problem that encryption gateways cannot negotiate keys in complex network environments such as bidirectional NAT and the key synchronization problem of one-time encrypted data messages, and enhances the security strength of confidentiality protection of data transmission when interconnecting between local area networks.
[0120] In one embodiment, the key conversion module 13 is used to use the master key to perform a keyed cryptographic hash operation on the encrypted information to obtain the key encryption key kek, which is expressed as follows:
[0121] kek=PRF(mk, source IP address|destination IP address|master key ID identifier).
[0122] Among them, PRF (key, msg) refers to using the key key to perform a keyed cryptographic hash operation on msg, and the cryptographic hash algorithm adopts SM3.
[0123] In one embodiment, the gateway further includes a counter module 14 and an early warning module 15, wherein the counter module 14 includes a master key sequence number generator and a master key usage accumulator, wherein:
[0124] The master key serial number generator is used to count the selected master keys, and when the count value exceeds the maximum number of pre-charged master keys, the count value is cleared and counted again from 1;
[0125] The master key usage accumulator is used to count the number of times the master key is used, and when the count value exceeds a set threshold, the master key is updated and an early warning signal is generated to the early warning module 15 for early warning.
[0126] In one embodiment, the gateway further includes:
[0127] A data length determination module, used to determine whether the data length MSS of the network data message exceeds the length of the maximum data portion allowed to be transmitted;
[0128] A data length modification module, used to modify the data length MSS=MSS-4-n of the network data message when the output result of the data length judgment module is yes, where n is the length of the key or the initialization vector;
[0129] The data encryption and decryption processing module 11 is used to encrypt the network data message using the data encryption key to obtain the encrypted data message when the output result of the data length judgment module is no.
[0130] In one embodiment, the gateway further includes:
[0131] A judgment module, used to judge whether the outbound encrypted message exceeds the MTU;
[0132] A fragmentation processing module, used for fragmenting the outbound encrypted message when the result output by the judgment module is yes;
[0133] The data encryption and decryption processing module 11 is further configured to send the outbound encrypted message from the network interface connected to the external network when the output result of the judgment module is no.
[0134] In one embodiment, the gateway further includes:
[0135] A registration module, used to send a registration request to the control platform 3 to bind to a corresponding security domain, the security domain being divided by the control platform 3;
[0136] A key injection request module is used to send a key injection request to the control platform 3, so that the control platform 3 forwards the key injection request to the quantum key distribution network 4. The quantum key distribution network 4 injects the master key into the secure storage medium offline through a key agent or a quantum network node, and the ID identifier of the master key injected into the secure storage medium connected to each encryption gateway in the same security domain is the same; the quantum key distribution network 4 stores security domain division information and encryption gateway information in each security domain.
[0137] In one embodiment, when the encryption gateway acts as a receiver, the encryption gateway further includes:
[0138] An encrypted message receiving module, used for receiving the outbound encrypted message from a network interface connected to an external network;
[0139] A fragmentation determination module, used to determine whether the outbound encrypted message is a fragmented message;
[0140] A slice combining processing module, used for performing slice combining processing when the slice determination module outputs a yes result;
[0141] The data encryption and decryption processing module 11 is also used to select a master key corresponding to the ID identifier of the master key from the master key pool and convert it into the key encryption key when the output result of the fragmentation judgment module is no; use the key encryption key to decrypt the ciphertext to obtain the data encryption key; and use the data encryption key to decrypt the encrypted data message.
[0142] It should be noted that other embodiments or implementation methods of the present invention for implementing a network data message encryption and decryption gateway using quantum distribution keys can refer to the above-mentioned method embodiment 1, which will not be repeated here.
[0143] Example 3
[0144] like Figure 3 As shown, the third embodiment of the present invention further proposes a system for implementing network data message encryption and decryption using quantum distributed keys, the system comprising a first encryption gateway 1, a second encryption gateway 2, a management and control platform 3 and a quantum key distribution network 4, the first encryption gateway 1, the second encryption gateway 2 and the quantum key distribution network 4 are all connected to the management and control platform 3, the first encryption gateway 1 and the second encryption gateway 2 are both connected to the quantum key distribution network 4, wherein the first encryption gateway 1 and the second encryption gateway 2 both comprise a data encryption and decryption processing module 11, a key transformation module 13 and a key injection module 12, the key injection module 12 is connected to a secure storage medium, the secure storage medium stores a master key pre-filled by the quantum key distribution network 4;
[0145] The management and control platform 3 is used for performing security domain division, and registration and identity binding services for the first encryption gateway 1 and the second encryption gateway 2;
[0146] The quantum key distribution network 4 is used to pre-fill the secure storage medium with a master key;
[0147] The key injection module 12 is used to read the master key from the connected secure storage medium and establish a master key pool;
[0148] The key transformation module 13 is used to randomly select the master key from the master key pool and transform the master key into a key encryption key using a cryptographic hash algorithm;
[0149] The data encryption and decryption processing module 11 is used to receive outbound network data messages from the network interface connected to the intranet, and encrypt the network data messages using a data encryption key to obtain an encrypted data message, wherein the data encryption key is a random number generated in real time; put the ciphertext obtained by encrypting the data encryption key using the key encryption key and the ID identifier of the master key into the security message header of the encrypted data message to obtain an outbound encrypted message; and send the outbound encrypted message from the network interface connected to the external network.
[0150] This embodiment charges a large number of master keys offline and shares them among encryption gateways in the security domain, and uses master key transformation to generate key encryption keys. The key encryption keys are used to encrypt data encryption keys. The data encryption keys are generated in real time and transmitted together with data messages. This realizes the secure and free transmission of data messages in the security domain, and does not require a complex key management system and key negotiation protocol. It is suitable for scenarios where master keys can only be charged offline and online key negotiation and key distribution cannot be performed. It solves the problem that encryption gateways cannot negotiate keys in complex network environments such as bidirectional NAT and the key synchronization problem of one-time encrypted data messages, and enhances the security strength of confidentiality protection of data transmission when interconnecting between local area networks.
[0151] Specifically in this embodiment, the encryption gateway is used to encrypt and decrypt user data transmitted through the network, and is composed of functional modules such as data encryption and decryption, key transformation, key injection, counter, and early warning;
[0152] Management and control platform 3: used to provide the corresponding relationship between encryption gateways, key agents, and quantum network nodes, divide security domains, and provide encryption gateway registration and identity binding services;
[0153] Key agent: used to provide a key injection agent function when the encryption gateway cannot directly inject keys at the nodes of the quantum key distribution network 4;
[0154] Quantum key distribution network 4: includes quantum network nodes and quantum network link control center, realizing quantum key generation, quantum key relay, quantum key provision and other services;
[0155] Quantum network node: used to store the generated quantum key, receive key applications from key agents, provide keys to key agents or directly provide key filling services;
[0156] Quantum network link control center: can establish quantum key distribution and relay links between nodes according to quantum network node ID.
[0157] In one embodiment, the key conversion module 13 is used to use the master key to perform a keyed cryptographic hash operation on the encrypted information to obtain the key encryption key kek, which is expressed as follows:
[0158] kek=PRF(mk, source IP address|destination IP address|master key ID identifier).
[0159] Among them, PRF (key, msg) refers to using the key key to perform a keyed cryptographic hash operation on msg, and the cryptographic hash algorithm adopts SM3.
[0160] In one embodiment, the gateway further includes a counter module 14 and an early warning module 15, wherein the counter module 14 includes a master key sequence number generator and a master key usage accumulator, wherein:
[0161] The master key serial number generator is used to count the selected master keys, and when the count value exceeds the maximum number of pre-charged master keys, the count value is cleared and counted again from 1;
[0162] The master key usage accumulator is used to count the number of times the master key is used, and when the count value exceeds a set threshold, the master key is updated and an early warning signal is generated to the early warning module 15 for early warning.
[0163] In one embodiment, the gateway further includes:
[0164] A data length determination module, used to determine whether the data length MSS of the network data message exceeds the length of the maximum data portion allowed to be transmitted;
[0165] A data length modification module, used to modify the data length MSS=MSS-4-n of the network data message when the output result of the data length judgment module is yes, where n is the length of the key or the initialization vector;
[0166] The data encryption and decryption processing module 11 is used to encrypt the network data message using the data encryption key to obtain the encrypted data message when the output result of the data length judgment module is no.
[0167] In one embodiment, the gateway further includes:
[0168] A judgment module, used to judge whether the outbound encrypted message exceeds the MTU;
[0169] A fragmentation processing module, used for fragmenting the outbound encrypted message when the result output by the judgment module is yes;
[0170] The data encryption and decryption processing module 11 is further configured to send the outbound encrypted message from the network interface connected to the external network when the output result of the judgment module is no.
[0171] In one embodiment, the gateway further includes:
[0172] A registration module, used to send a registration request to the control platform 3 to bind to a corresponding security domain, the security domain being divided by the control platform 3;
[0173] A key injection request module is used to send a key injection request to the control platform 3, so that the control platform 3 forwards the key injection request to the quantum key distribution network 4. The quantum key distribution network 4 injects the master key into the secure storage medium offline through a key agent or a quantum network node, and the ID identifier of the master key injected into the secure storage medium connected to each encryption gateway in the same security domain is the same; the quantum key distribution network 4 stores security domain division information and encryption gateway information in each security domain.
[0174] In one embodiment, when the encryption gateway acts as a receiver, the encryption gateway further includes:
[0175] An encrypted message receiving module, used for receiving the outbound encrypted message from a network interface connected to an external network;
[0176] A fragmentation determination module, used to determine whether the outbound encrypted message is a fragmented message;
[0177] A slice combining processing module, used for performing slice combining processing when the slice determination module outputs a yes result;
[0178] The data encryption and decryption processing module 11 is also used to select a master key corresponding to the ID identifier of the master key from the master key pool and convert it into the key encryption key when the output result of the fragmentation judgment module is no; use the key encryption key to decrypt the ciphertext to obtain the data encryption key; and use the data encryption key to decrypt the encrypted data message.
[0179] Furthermore, if Figure 4 As shown, the workflow of the network data message encryption and decryption system using quantum distributed keys proposed in this embodiment is as follows:
[0180] (1) The management and control platform defines the security domain, and through the quantum key distribution network QKD, a large number of master keys are pre-charged offline to each encryption gateway device node in the security domain using a large-capacity secure storage medium such as a secure TF card or a secure U-shield, and a master key pool is established. Each device in the same security domain shares the same master key identified by the same key ID. The format of the master key is 4-byte key ID + n-byte key and n-byte initialization vector.
[0181] (2) The encryption gateway device node modifies the MSS data content of the outbound TCP connection establishment phase, and the new MSS = MSS-4-n, to avoid message fragmentation after adding the security message header.
[0182] (3) The encryption gateway device node uses the data encryption key to encrypt the outgoing data message on a packet-by-packet basis. The data encryption key is a random number generated in real time, and a security message header is attached to each data message. The data encryption key is encrypted with the key encryption key and then placed in the message header.
[0183] The key encryption key is obtained by transforming the master key as follows (in the following formula, mk is the master key, kek is the key encryption key obtained after the transformation, PRF (key, msg) refers to the keyed cryptographic hash operation on msg using the key key, and the cryptographic hash algorithm adopts SM3):
[0184] kek=PRF(mk,source IP address|destination IP address|master key ID).
[0185] The encryption gateway device maintains two counters, which increase in sequence from 1. One of the counters is the master key serial number generator, which increases by 1 each time the master key is selected according to the ID corresponding to its value. When its value exceeds the maximum number of pre-charged master keys, it starts counting from 1 again. The other counter is the master key usage accumulator, which increases by 1 each time the master key is used. A threshold is set for the master key usage accumulator. When the master key usage accumulator (representing the total number of times the master key charged this time is used) exceeds the threshold, the encryption gateway issues an early warning through indicator lights, buzzers, log monitoring, emails, etc., and the administrator performs the master key update operation in the security domain and recharges the encryption gateway with a new master key.
[0186] (4) If the non-TCP message plus the security header exceeds the MTU, it will be fragmented.
[0187] (5) The encryption gateway device node decrypts the incoming data message (fragmented messages are first merged), takes out the key and initialization vector from the master key pool according to the key ID of the security message header, decrypts the data encryption key, and then decrypts the message data.
[0188] This embodiment uses a quantum key distribution network to solve the problem of data encryption communication between networks, and realizes the handshake-free network communication encryption scheme that cannot be solved by traditional asymmetric cryptography and IKE protocols, avoiding the security risks of the handshake process. By filling a large number of master keys offline and sharing them with each encryption gateway in the security domain, the master key is transformed to generate a key encryption key, and the data encryption key is generated in real time and transmitted with the data message, so as to realize the safe and free transmission of data messages in the security domain, and no complex key management system and key negotiation protocol are required. It solves the problem of secure encryption communication of data messages in scenarios where keys can only be filled offline and online key negotiation and key distribution cannot be performed.
[0189] It should be noted that the logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be specifically implemented in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in combination with these instruction execution systems, devices or apparatuses. For the purposes of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in combination with these instruction execution systems, devices or apparatuses. More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection portion with one or more wirings (electronic device), a portable computer disk box (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium and then editing, interpreting or processing in other suitable ways if necessary, and then stored in a computer memory.
[0190] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, a plurality of steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0191] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.
[0192] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In the description of the present invention, the meaning of "plurality" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined.
[0193] Although the embodiments of the present invention have been shown and described above, it is to be understood that the above embodiments are exemplary and are not to be construed as limitations of the present invention. A person skilled in the art may change, modify, replace and vary the above embodiments within the scope of the present invention.
Claims
1. A method for encrypting and decrypting network data messages using quantum distributed keys, characterized in that: Applied to an encryption gateway connected to a secure storage medium, the method includes: Reading a master key from a connected secure storage medium to establish a master key pool, wherein the master key is pre-filled into the secure storage medium by a quantum key distribution network; Receiving an outbound network data message from a network interface connected to an intranet, and encrypting the network data message using a data encryption key to obtain an encrypted data message, wherein the data encryption key is a random number generated in real time; Randomly selecting the master key from the master key pool and transforming the master key into a key encryption key using a cryptographic hash algorithm; Putting the ciphertext obtained by encrypting the data encryption key using the key encryption key and the ID identifier of the master key into the security message header of the encrypted data message to obtain an outbound encrypted message; Sending the outbound encrypted message from the network interface connected to the external network; When the encryption gateway acts as a receiver, the method further includes converting a master key ID in a security message header of an inbound encrypted message from a master key corresponding to the master key ID in a master key pool into the key encryption key; decrypting the ciphertext in the security message header using the key encryption key to obtain the data encryption key; and decrypting the encrypted data message using the data encryption key; The master key is transformed into a key encryption key using a cryptographic hash algorithm, including: randomly selecting the master key mk from the master key pool; and performing a keyed cryptographic hash operation on the encrypted information using the master key to obtain the key encryption key kek, which is expressed as follows: kek=PRF(mk, source IP address | destination IP address | master key ID) Among them, PRF (key, msg) refers to using the key key to perform a keyed cryptographic hash operation on msg.
2. The method for encrypting and decrypting network data messages using quantum distributed keys according to claim 1, wherein: The method further comprises: Counting the selected master keys using a master key serial number generator, and when the count value exceeds the maximum number of pre-charged master keys, clearing the count value to zero and restarting from 1; The master key usage accumulator is used to count the number of times the master key is used. When the count value exceeds the set threshold, an early warning signal is generated and the master key is updated.
3. The method for encrypting and decrypting network data messages using quantum distributed keys according to claim 1, wherein: After receiving the outbound network data message from the network interface connected to the intranet, the method further includes: Determine whether the data length MSS of the network data message exceeds the length of the maximum data portion allowed to be transmitted; If yes, modify the data length of the network data message MSS=MSS-4-n, where n is the length of the key or initialization vector; If not, the network data message is encrypted using the data encryption key to obtain an encrypted data message.
4. The method for encrypting and decrypting network data messages using quantum distributed keys according to claim 1, wherein: Before sending the outbound encrypted message from the network interface connected to the external network, the method further includes: Determine whether the outbound encrypted message exceeds the MTU; If so, fragment the outbound encrypted message; If not, the outbound encrypted message is sent from the network interface connected to the external network.
5. The method for encrypting and decrypting network data messages using quantum distributed keys according to claim 1, wherein: Before reading the master key from the secure storage medium, the method further includes: Send a registration request to the control platform to bind to the corresponding security domain, which is divided by the control platform; Sending a key injection request to the control platform, so that the control platform forwards the key injection request to the quantum key distribution network, where the quantum key distribution network stores security domain division information and encryption gateway information within each security domain; The master key is injected offline into the secure storage medium through a key agent or a quantum network node, and the ID identifier of the master key injected into the secure storage medium connected to each encryption gateway in the same security domain is the same.
6. The method for encrypting and decrypting network data messages using quantum distributed keys according to claim 1, wherein: When the encryption gateway serves as a receiver, the method further includes: Receiving the outbound encrypted message from a network interface connected to an external network; Determining whether the outbound encrypted message is a fragmented message; If yes, then perform the sheet joining process; If not, select a master key corresponding to the ID identifier of the master key from the master key pool and convert it into the key encryption key; decrypting the ciphertext using the key encryption key to obtain the data encryption key; The encrypted data message is decrypted using the data encryption key.
7. A gateway for encrypting and decrypting network data messages using quantum distributed keys, characterized in that: The gateway includes a data encryption and decryption processing module, a key conversion module and a key injection module, wherein the key injection module is connected to a secure storage medium, and the secure storage medium stores a master key pre-filled by a quantum key distribution network; The key injection module is used to read the master key from the connected secure storage medium and establish a master key pool; The key conversion module is used to randomly select the master key from the master key pool and convert the master key into a key encryption key using a cryptographic hash algorithm; The data encryption and decryption processing module is configured to receive an outbound network data message from a network interface connected to the intranet, encrypt the network data message using a data encryption key, and obtain an encrypted data message. The data encryption key is a random number generated in real time. The ciphertext obtained by encrypting the data encryption key using the key encryption key and the ID of the master key are placed in the security message header of the encrypted data message to obtain an outbound encrypted message. and sending the outbound encrypted message from a network interface connected to an external network; The data encryption and decryption processing module is further configured to convert the master key ID in the security message header of the inbound encrypted message into the key encryption key from the master key corresponding to the ID identifier of the master key in the master key pool; decrypting the ciphertext in the security message header using the key encryption key to obtain the data encryption key; Decrypting the encrypted data message using the data encryption key; The master key is transformed into a key encryption key using a cryptographic hash algorithm, including: randomly selecting the master key mk from the master key pool; and performing a keyed cryptographic hash operation on the encrypted information using the master key to obtain the key encryption key kek, which is expressed as follows: kek=PRF(mk, source IP address | destination IP address | master key ID) Among them, PRF (key, msg) refers to using the key key to perform a keyed cryptographic hash operation on msg.
8. The gateway for implementing network data message encryption and decryption using quantum distributed keys as claimed in claim 7, characterized in that: The gateway further includes a counter module and an early warning module. The counter module includes a master key sequence number generator and a master key usage accumulator, wherein: The master key serial number generator is used to count the selected master keys and reset the count value to zero and start counting again from 1 when the count value exceeds the maximum number of pre-filled master keys; The master key usage accumulator is used to count the number of times the master key is used, and when the count value exceeds a set threshold, the master key is updated and an early warning signal is generated to the early warning module for early warning.
9. A system for encrypting and decrypting network data messages using quantum distributed keys, characterized in that: The system includes a first encryption gateway, a second encryption gateway, a management and control platform, and a quantum key distribution network, wherein the first encryption gateway and the second encryption gateway adopt the encryption and decryption gateway according to any one of claims 7 or 8, the first encryption gateway, the second encryption gateway, and the quantum key distribution network are all connected to the management and control platform, and the first encryption gateway and the second encryption gateway are both connected to the quantum key distribution network, wherein the first encryption gateway and the second encryption gateway each include a data encryption and decryption processing module, a key transformation module, and a key injection module, and the key injection module is connected to a secure storage medium, and the secure storage medium stores a master key pre-filled by the quantum key distribution network; The management and control platform is used to perform security domain division, and registration and identity binding services for the first encryption gateway and the second encryption gateway; The quantum key distribution network is used to pre-fill the secure storage medium with a master key; The key injection module is used to read the master key from the connected secure storage medium and establish a master key pool; The key conversion module is used to randomly select the master key from the master key pool and convert the master key into a key encryption key using a cryptographic hash algorithm; The data encryption and decryption processing module is used to receive outbound network data messages from the network interface connected to the intranet, and encrypt the network data messages using a data encryption key to obtain an encrypted data message, where the data encryption key is a random number generated in real time; place the ciphertext obtained by encrypting the data encryption key using the key encryption key and the ID identifier of the master key into the security message header of the encrypted data message to obtain an outbound encrypted message; and send the outbound encrypted message from the network interface connected to the external network.
Citation Information
Patent Citations
Dynamic secret key based data communication method, transmitting end and receiving end
CN103036675A
IPSec VPN method used for realizing quantum safety
CN107453869A
Key generation method and device and storage medium
CN110213050A
Quantum secret key synchronization method for distribution terminal
CN108667607A
Communication encryption method of unmanned mobile platform
CN110224821A
