A secure method for establishing a communication tunnel
By prioritizing the use of national cryptographic algorithm suites and performing secure channel binding signatures during the communication tunnel establishment process, the security risks caused by uncontrollable algorithm negotiation in the communication link are resolved, and a high-security communication tunnel establishment is achieved.
Patent Information
- Application Number
- CN202611252113.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-18
- Publication Date
- 2026-11-17
AI Technical Summary
In the field of communication security, when the two ends of the communication cannot reach an agreement on a high-strength algorithm, the negotiation mechanism will automatically try a lower-strength algorithm, which will expose the communication link to security risks, and the negotiation process will repeatedly fail or fail to establish a valid connection.
The gateway device prioritizes sending security signals containing the national cryptographic algorithm suite. If the peer supports it, a national cryptographic algorithm tunnel is established; otherwise, a preset algorithm set is sent. If the peer does not support any algorithm, the tunnel is refused to be established. The integrity of the security parameter set is ensured through certificate exchange and signature binding mechanisms.
Ensure that the communication link always operates at an acceptable level of security, prevent man-in-the-middle attacks, avoid unchecked degradation to weaker algorithms, and guarantee the integrity and authenticity of the negotiation process.
Smart Images

Figure CN123123889A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of mobile communication and network security technology, and in particular to a method for securely establishing a communication tunnel. Background Technology
[0002] In the field of communication security, there are objective differences in the types and security strengths of encryption algorithms supported by different devices or systems. To ensure interoperability between devices from different manufacturers, the communication peer device usually has a pre-set compatibility list containing multiple algorithm suites, and automatically selects the algorithm supported by both parties through a negotiation mechanism when establishing a secure connection.
[0003] In existing technologies, when the two communicating ends cannot agree on a high-strength algorithm, the negotiation mechanism automatically tries lower-strength algorithms until a mutually supported combination of algorithms is found. If one device, due to its own limitations or configuration defects, only supports a low-strength algorithm, the other device, even if capable of supporting a high-strength algorithm, is forced to passively reduce its use to a lower-strength algorithm, exposing the entire communication link to known security risks. This can easily lead to repeated negotiation failures or forced adoption of weaker algorithms, increasing connection establishment delays, and even preventing the establishment of a valid connection due to security policy mismatches. Summary of the Invention
[0004] This invention provides a secure method for establishing a communication tunnel to solve the technical problems of uncontrollable security strength and easy tampering of negotiation results during algorithm negotiation between the two communicating parties. It aims to achieve the effects of prioritizing the use of national cryptographic algorithms to establish tunnels, using only secure algorithms during downgrades, and preventing the negotiation parameters from being tampered with.
[0005] To address the aforementioned technical problems, embodiments of the present invention provide a secure method for establishing a communication tunnel, applied to a gateway device, comprising: Send a first security signal to the communication peer device, the first security signal containing a suite of national cryptographic algorithms; Receive and parse the first response result signal sent by the communication peer device in response to the first security signal; If the first parsing result indicates that the communication peer device supports the national cryptographic algorithm suite, then a communication tunnel is established based on the national cryptographic algorithm suite; If the first parsing result indicates that the communication peer device does not support the national cryptographic algorithm suite, then a second degradation signal is sent to the communication peer device, the second degradation signal containing a preset algorithm set; Receive and parse the second response result signal sent by the communication peer device in response to the second degradation signal; If the second parsing result indicates that the communication peer device supports at least one algorithm in the preset algorithm set, then the communication tunnel is established based on the preset algorithm set. If the second parsing result indicates that the communication peer device does not support any of the algorithms in the preset algorithm set, then the communication tunnel establishment fails and a downgrade negotiation failure signal is issued.
[0006] As one preferred embodiment, during the construction of the communication tunnel, signature binding is performed, including: Establish a secure channel with the communication peer device, generate a first random number, and receive a second random number from the communication peer device; In the secure channel, a set of security parameters is negotiated and determined; The security parameter set, the first random number, and the second random number are integrated, and a binding signature is generated based on the user's private key. Send the binding signature to the communication peer device; Receive an acknowledgment message from the peer device and complete the establishment of the communication tunnel based on the acknowledgment message.
[0007] As one preferred embodiment, the integration of the security parameter set, the first random number, and the second random number, and the generation of a binding signature based on the user's private key, includes: The security parameter set, the first random number, and the second random number are concatenated and combined in a preset order to obtain the data sequence to be signed; The binding signature is generated by performing a digital signature operation on the data sequence to be signed based on its own private key.
[0008] As one preferred embodiment, the order of the algorithm suites in the preset algorithm set can be dynamically adjusted, and the dynamic adjustment includes: Obtain the historical negotiation records of the communication peer device, the historical negotiation records including information on the algorithm suites historically supported by the communication peer device; The number of times each of the algorithm suites successfully matched in the historical negotiation record was counted, and the algorithm suites in the preset algorithm set were rearranged according to the number of successful matches.
[0009] As one preferred embodiment, after issuing the downgrade negotiation failure signal, the method further includes: Re-execute the process of receiving and parsing the first response result signal sent by the communication peer device in response to the first security signal; The negotiation process terminates when the number of re-executions reaches a preset value.
[0010] As one preferred embodiment, before establishing the communication tunnel based on the national cryptographic algorithm suite, the method further includes: Send the first certificate to the communication peer device; Receive a second certificate from the communication peer device.
[0011] Another embodiment of the present invention provides a secure method for establishing a communication tunnel, applied to a communication peer device, comprising: Receive a first security signal from the gateway device, the first security signal containing a suite of Chinese cryptographic algorithms; Send a first response result signal to the gateway device; When the first response result signal indicates support for the national cryptographic algorithm suite, a communication tunnel is established with the gateway device; When the first response result signal indicates that the national cryptographic algorithm suite is not supported, a second degradation signal is received from the gateway device, the second degradation signal containing a preset algorithm set; Send a second response result signal to the gateway device; When the second response result signal indicates support for at least one algorithm in the preset algorithm set, a communication tunnel is established with the gateway device; The communication tunnel establishment fails when the second response result signal indicates that it does not support any of the algorithms in the preset algorithm set.
[0012] As one preferred embodiment, during the construction of the communication tunnel, signature binding is performed, including: Establish a secure channel with the gateway device, generate a second random number, and receive a first random number from the gateway device; In the secure channel, a set of security parameters is negotiated and determined; Receive the binding signature from the gateway device; The binding signature is verified using the security parameter set, the first random number, and the second random number based on the user's private key. Once the verification is successful, a confirmation message is sent to the gateway device to complete the establishment of the communication tunnel.
[0013] As one preferred embodiment, the step of verifying the binding signature based on the security parameter set, the first random number, and the second random number using its own private key includes: The security parameter set, the first random number, and the second random number are concatenated and combined in a preset order to form a data sequence to be verified. Using the public key corresponding to its own private key, a signature verification operation is performed on the bound signature and the data sequence to be verified.
[0014] As one preferred embodiment, before establishing the communication tunnel with the gateway device, the method further includes: Receive a first certificate from the gateway device and verify the validity of the first certificate; When the verification result is valid, a second certificate is sent to the gateway device.
[0015] Compared with the prior art, the beneficial effects of the embodiments of the present invention are at least one of the following: (1) When establishing a communication tunnel, the present invention first sends a first security signal containing a set of national cryptographic algorithms to the peer device. When the peer device supports the set of national cryptographic algorithms, the two parties directly establish a communication tunnel based on the set of national cryptographic algorithms. When the peer device does not support the set of national cryptographic algorithms, the gateway device does not, as in the prior art, infinitely support any weak algorithm, but only downgrades to a preset set of security algorithms (i.e., an algorithm whitelist). The algorithm sets in this preset set all meet the requirement that the security strength is not lower than the preset security threshold, and explicitly exclude publicly disclosed weak algorithms. If the peer device does not support any algorithm in the preset set, it directly refuses to establish a tunnel and sends a downgrade negotiation failure signal. Through the above technical solution, the present invention fundamentally avoids the security risks caused by the prior art's pursuit of compatibility and indiscriminate downgrading to weak algorithms such as SHA-1 and 3DES, ensuring that the communication link always operates at an acceptable security level.
[0016] (2) In the process of establishing a communication tunnel, the gateway device and the communication peer device establish a secure channel and exchange random numbers. After the two parties negotiate and determine the security parameter set, they bind the security parameter set with the random numbers of both parties and sign it, and send the signature to the peer for verification. In this way, the present invention binds the negotiation result with the random numbers of both parties, so that any tampering with the security parameter set will cause the signature verification to fail, thereby effectively defending against man-in-the-middle attacks and ensuring the integrity and authenticity of the negotiation process. Attached Figure Description
[0017] Figure 1 This is a flowchart illustrating a secure communication tunnel establishment method according to one embodiment of the present invention; Figure 2 This is a flowchart illustrating another secure communication tunnel establishment method in one embodiment of the present invention. Detailed Implementation
[0018] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. The purpose of providing these embodiments is to make the disclosure of the present invention more thorough and comprehensive. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present invention.
[0019] In the description of this application, the terms "first," "second," "third," etc., are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Therefore, a feature defined with "first," "second," "third," etc., may explicitly or implicitly include one or more of that feature. In the description of this application, unless otherwise stated, "a plurality of" means two or more.
[0020] In the description of this application, it should be noted that, unless otherwise expressly specified and limited, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to fixed connections, detachable connections, or integral connections; they can refer to mechanical connections or electrical connections; they can refer to direct connections or indirect connections through an intermediate medium; and they can refer to the internal communication between two components. The terms "vertical," "horizontal," "left," "right," "upper," "lower," and similar expressions used herein are for illustrative purposes only and do not indicate or imply that the device or component referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as limiting the invention. The term "and / or" as used herein includes any and all combinations of one or more of the associated listed items. Those skilled in the art can understand the specific meaning of the above terms in this application based on the specific circumstances.
[0021] In the description of this application, it should be noted that, unless otherwise defined, all technical and scientific terms used in this invention have the same meaning as commonly understood by one of ordinary skill in the art. The terminology used in this specification is for the purpose of describing specific embodiments only and is not intended to limit the invention. Those skilled in the art can understand the specific meaning of the above terms in this application based on the specific circumstances.
[0022] One embodiment of the present invention provides a secure method for establishing a communication tunnel. For details, please refer to [link / reference needed]. Figure 1 , Figure 1 The diagram shown is a flowchart illustrating a secure communication tunnel establishment method according to one embodiment of the present invention, which includes steps S11 to S17: S11: Send a first security signal to the communication peer device. The first security signal contains a suite of national cryptographic algorithms. The method described in this embodiment is applied to a gateway device, which may specifically be a VoWiFi gateway device in a 5G core network.
[0023] At the initial stage of establishing a communication tunnel, the gateway device proactively indicates to the peer device its preferred algorithm capabilities, namely, prioritizing support for and expecting to use the national cryptographic algorithm suite for subsequent key exchange and communication protection. By proactively sending a first security signal containing the national cryptographic algorithm suite, the gateway device can initiate a probe of the peer device's algorithm capabilities, providing a basis for subsequent branch decisions and tunnel establishment path selection.
[0024] Specifically, after establishing the initial communication connection with the peer device, the gateway device enters the algorithm capability detection phase. This first security signal is sent to the peer device via the initial exchange phase of the IKEv2 protocol (i.e., the IKE_SA_INIT message). The security proposal carried in the first security signal includes the following parameters: the DH group used for key exchange (including the Chinese national cryptographic curve group or the international standard group), the pseudo-random function PRF (such as SM3 or SHA-256), the symmetric encryption algorithm ENCR (such as SM4 or AES), and the integrity algorithm or authentication encryption algorithm with associated data (preferably AEAD mode, such as SM4-GCM or AES-GCM).
[0025] The "national cryptographic algorithm suite" refers to a combination of algorithms that conforms to the national cryptographic algorithm standards issued by the State Cryptography Administration. In one specific implementation of this embodiment, the national cryptographic algorithm suite includes: using the SM2 algorithm for key exchange and authentication, using the SM4 algorithm for data encryption, and using the SM3 algorithm for hash calculation.
[0026] The gateway device encapsulates the aforementioned Chinese cryptographic algorithm suites as security proposals within the first security signal, and arranges candidate algorithm suites in descending order of security strength. Specifically, the gateway device activates a dynamic priority sorting engine. This engine generates a list of algorithm suites ordered in descending order of security strength for the first security signal to be sent, based on a preset security policy database. The top of the list is the Chinese cryptographic algorithm suite, followed by the international standard algorithm whitelist (i.e., the preset algorithm set in subsequent steps) that has undergone security evaluation. This sorting ensures that, under any circumstances, the system prioritizes establishing connections with the highest security level. The Chinese cryptographic algorithm suites are placed with the highest priority because the SM2, SM3, and SM4 algorithms offer higher security strength than currently used international algorithms (such as RSA, AES-128, and SHA-1) in terms of mathematical principles and key length, and comply with national information security compliance requirements. Placing the Chinese cryptographic algorithm suites at the top of the list maximizes the guarantee that when the communicating peer device supports Chinese cryptography, both parties can immediately match the Chinese cryptographic algorithm combination, thereby establishing a high-security communication tunnel.
[0027] Step S11 involves actively sending a first security signal containing a national cryptographic algorithm suite and placing the national cryptographic algorithm suite at the highest priority in the algorithm suite list. This allows the gateway device to prioritize attempting to establish a high-security tunnel based on the national cryptographic algorithm, thus meeting national information security compliance requirements.
[0028] S12: Receive and parse the first response result signal sent by the communication peer device in response to the first security signal; After sending a first security signal containing the Chinese national cryptographic algorithm suite to the peer device, the gateway device needs to wait for and receive a response from the peer device. This is because it needs to obtain the peer device's support for the Chinese national cryptographic algorithm suite to determine whether the subsequent tunnel establishment process should follow the Chinese national cryptographic branch or the downgraded branch. The first response signal carries the algorithm capability information of the peer device and is the core basis for the gateway device's branch decision.
[0029] Specifically, after receiving the first security signal from the gateway device, the peer device parses the security proposal carried within and checks whether it supports the national cryptographic algorithm suite in the proposal. Subsequently, the peer device encapsulates the judgment result in a first response result signal and returns it to the gateway device. Upon receiving this signal, the gateway device parses it and extracts the indication information regarding whether the peer device supports the national cryptographic algorithm suite.
[0030] The format and content of the first response result signal are consistent with the format of the response message in the standard IKEv2 protocol. The communication peer device processes the security proposal as follows: it sequentially checks each algorithm suite carried in the first security signal. When it finds an algorithm suite it supports, it takes it as the negotiation result and indicates support in the first response result signal. Since the gateway device ranks the Chinese cryptographic algorithm suites with the highest priority in the algorithm suite list in step S11, the communication peer device will prioritize determining whether it supports the Chinese cryptographic algorithm suite during the check. If it supports it, the first response result signal indicates support for the Chinese cryptographic algorithm suite; if it does not support it, the communication peer device continues to check the next algorithm suite in the list (i.e., the algorithm suites in the international standard algorithm whitelist). If it still does not support it, the first response result signal indicates that it does not support the Chinese cryptographic algorithm suite.
[0031] In one specific implementation of the present invention, the first response result signal may also carry detailed information about the algorithm suite supported by the peer device, including the DH group type, pseudo-random function type, symmetric encryption algorithm type, integrity algorithm type, and authentication method supported by the device. By parsing this information, the gateway device can further understand the complete algorithm capabilities of the peer device, providing a data foundation for subsequent negotiation and optimization.
[0032] S13: If the first parsing result is that the communication peer device supports the national cryptographic algorithm suite, then establish a communication tunnel based on the national cryptographic algorithm suite; After parsing the first response result signal and obtaining the first parsing result, the gateway device executes branch processing based on the parsing result. Because when the communication peer device supports the national cryptographic algorithm suite, the gateway device will directly establish a communication tunnel with the peer based on the national cryptographic algorithm suite, thereby ensuring that the tunnel is protected by the highest level of national cryptographic algorithms, meeting national information security compliance requirements.
[0033] Specifically, when the first parsing result indicates that the peer device supports the Chinese national cryptographic algorithm suite, the gateway device and the peer device enter a security association negotiation process based on the Chinese national cryptographic algorithms. This process follows the authentication and key exchange phase of the IKEv2 protocol (i.e., the IKE_AUTH phase). Both parties complete identity authentication and key exchange based on the SM2, SM3, and SM4 algorithms in the Chinese national cryptographic algorithm suite, establishing a security association based on the Chinese national cryptographic algorithms. After the security association is established, the gateway device generates and applies an IPsec security policy based on the Chinese national cryptographic algorithms, completing the establishment of the IPsec tunnel.
[0034] Preferably, in one embodiment of the present invention, before establishing a communication tunnel based on the national cryptographic algorithm suite, the method further includes: Send the first certificate to the peer device in the communication; Receive a second certificate from the communication peer device.
[0035] Before establishing a communication tunnel based on the national cryptographic algorithm suite, the gateway device and the peer device first perform certificate-based mutual authentication. Specifically, the gateway device sends a first certificate to the peer device. This certificate is an X.509 / SM2 format certificate conforming to the national cryptographic standard, and the certificate chain explicitly indicates the supported SM2, SM3, and SM4 algorithms. After receiving the first certificate, the peer device verifies its validity; if the verification is successful, it sends a second certificate to the gateway device. The gateway device receives the second certificate from the peer device and verifies its validity. Through bidirectional certificate exchange and verification, both parties confirm each other's legitimacy, providing a trusted identity foundation for subsequent signature binding.
[0036] During the establishment of a communication tunnel, the gateway device and the communication peer device perform a signature binding process to prevent the negotiated parameters from being tampered with during transmission.
[0037] Preferably, in one embodiment of the present invention, signature binding is performed during the construction of a communication tunnel, including: Establish a secure channel with the peer device, generate a first random number, and receive a second random number from the peer device; In the secure channel, the set of security parameters is negotiated and determined. It integrates a set of security parameters, a first random number, and a second random number, and generates a binding signature based on its own private key; Send a binding signature to the peer device in the communication; Receive confirmation messages from the peer device and establish a communication tunnel based on the confirmation messages.
[0038] Specifically, the gateway device and the communication peer device first establish a secure channel. During the secure channel establishment process, the gateway device generates a first random number and receives a second random number from the communication peer device; the communication peer device generates a second random number and receives the first random number from the gateway device. By exchanging random numbers, both parties ensure the randomness and unpredictability of subsequent signature binding.
[0039] After the secure channel is established, both parties negotiate and determine the final set of security parameters to be used. This set of security parameters includes parameters such as encryption algorithms, pseudo-random functions, DH grouping, and authentication algorithms. The negotiated set of security parameters reflects the algorithm combination ultimately agreed upon by both parties and is the core protection object for subsequent signature binding.
[0040] Preferably, in one embodiment of the present invention, integrating a security parameter set, a first random number, and a second random number, and generating a binding signature based on its own private key, includes: The security parameter set, the first random number, and the second random number are concatenated and combined in a preset order to obtain the data sequence to be signed; The system performs digital signature operations on the sequence of data to be signed based on its own private key to generate a bound signature.
[0041] Specifically, the gateway device concatenates the negotiated security parameter set, its own generated first random number, and the received second random number in a preset order to obtain a complete data sequence to be signed. Then, it performs a digital signature operation on this data sequence using its private key to generate a bound signature. This bound signature binds the security parameter set to the random numbers from both parties, ensuring that any tampering with the security parameter set will cause signature verification to fail.
[0042] After generating the binding signature, the gateway device sends it to the peer device. Upon receiving the binding signature, the peer device verifies it using the public key corresponding to its private key. If the verification passes, it indicates that the security parameter set has not been tampered with during the negotiation process, and the peer device sends a confirmation message to the gateway device. After receiving the confirmation message from the peer device, the gateway device completes the establishment of the communication tunnel based on the confirmation message.
[0043] In step S13, when the peer device supports the national cryptographic algorithm suite, the gateway device can directly establish a communication tunnel based on the national cryptographic algorithm suite, ensuring that the tunnel is protected by the national cryptographic algorithm and meets the national information security compliance requirements; through certificate exchange and mutual authentication, the legitimacy of the identities of the two communicating parties is ensured, preventing identity forgery attacks; through the signature binding mechanism, the security parameter set is bound to the random numbers of both parties for signature, so that any tampering with the negotiated parameters will cause the signature verification to fail, thereby effectively defending against man-in-the-middle attacks.
[0044] S14: If the first parsing result is that the communication peer device does not support the national cryptographic algorithm suite, then send a second degradation signal to the communication peer device. The second degradation signal contains a preset algorithm set. When the peer device does not support the national cryptographic algorithm suite, the gateway device initiates a bottom-line degradation process, sending a second degradation signal containing a preset algorithm set to the peer device to avoid tunnel establishment failure due to inability to reach an agreement, and to prevent unlimited degradation to weak security algorithms.
[0045] Specifically, when the first parsing result indicates that the peer device does not support the Chinese national cryptographic algorithm suite, the gateway device dynamically switches to the international standard algorithm suite for negotiation. This international standard algorithm suite is not an arbitrary combination of algorithms, but rather selected from a preset algorithm whitelist. This preset algorithm set is a combination of algorithms that has undergone security assessment and whose security strength is not lower than a preset security threshold, explicitly excluding publicly available weak algorithms. In one specific implementation, this preset algorithm set includes using RSA for key exchange, using AES-256-GCM for data encryption, and using SHA-256 for hash calculation. The gateway device encapsulates this preset algorithm set in a second degradation signal and re-initiates the initial exchange phase of the IKEv2 protocol, i.e., sends the second degradation signal to the peer device.
[0046] Preferably, in one embodiment of the present invention, the order of the algorithm suites in the preset algorithm set can be dynamically adjusted, and the dynamic adjustment includes: Obtain the historical negotiation records of the communication peer device, which include information on the algorithm suites historically supported by the communication peer device; The algorithm suites are counted for the number of successful matches in the historical negotiation records, and then rearranged in the preset algorithm set according to the number of successful matches.
[0047] Before sending the second downgrade signal, the gateway device can dynamically adjust the order of algorithm suites in the preset algorithm set to improve negotiation success rate and efficiency. Specifically, the gateway device obtains the historical negotiation records of the communication peer device, which includes information on the algorithm suites historically supported by the communication peer device. After each successful negotiation, the gateway device records information such as the type of algorithm suite supported by the communication peer device, response time, and certificate version, forming a capability profile of the peer device.
[0048] When a second degradation signal needs to be sent, the gateway device counts the number of times each algorithm suite has successfully matched in the historical negotiation record. An algorithm suite with more successful matches indicates a higher probability that the peer device supports that algorithm suite. Then, based on the statistics of successful matches, the order of the algorithm suites in the preset algorithm set is rearranged, placing the algorithm suites with higher successful match counts first. In this way, the gateway device can prioritize trying the algorithm suites that the peer device is most likely to support historically, reducing the number of negotiation round trips.
[0049] In a specific implementation of this invention, if the historical negotiation records of the communication peer device show that the device successfully matched the AES-256-GCM encryption algorithm eight times and the AES-128-GCM encryption algorithm twice in the past ten negotiations, then the gateway device will prioritize matching AES-256-GCM over AES-128-GCM.
[0050] S15: Receive and parse the second response result signal sent by the communication peer device in response to the second degradation signal; Step S15 determines whether the subsequent tunnel establishment process can proceed with downgrade negotiation or should terminate negotiation and trigger an alarm by obtaining information on the support of the peer device for each algorithm suite in the preset algorithm set. The second response result signal carries information on the peer device's support capability for the international standard algorithm whitelist and is the core basis for the gateway device to make downgrade branch decisions and alarm judgments.
[0051] Specifically, after receiving the second degradation signal from the gateway device, the peer device parses the preset algorithm set carried within it and sequentially checks whether it supports each algorithm suite in that set. The specific processing method is as follows: according to the order of the algorithm suites in the second degradation signal, it checks whether it supports the current algorithm suite. When it finds a supported algorithm suite, it uses it as the negotiation result and indicates support in the second response result signal; if it still cannot find a supported algorithm suite after traversing all algorithm suites in the preset algorithm set, it indicates in the second response result signal that it does not support any algorithm in the preset algorithm set.
[0052] Since the gateway device can dynamically adjust the order of algorithm suites in the preset algorithm set according to the historical negotiation records of the communication peer device in step S14, and arrange the algorithm suites with high successful matching times first, the communication peer device will prioritize determining whether it supports the algorithm suite with the highest historical matching probability during the check. This helps to match the algorithm combination supported by both parties more quickly when the communication peer device supports multiple algorithms.
[0053] After completing the check on the preset algorithm set, the judgment result is encapsulated in a second response result signal and returned to the gateway device. Upon receiving this signal, the gateway device parses it and extracts indication information indicating whether the communication peer device supports at least one algorithm from the preset algorithm set. In one specific implementation of this invention, the second response result signal may also carry detailed information about the algorithm suite supported by the communication peer device, including which encryption algorithm, hash algorithm, DH group, and authentication method the device specifically supports.
[0054] S16: If the second parsing result is that the communication peer device supports at least one algorithm in the preset algorithm set, then a communication tunnel is established based on the preset algorithm set; When the peer device supports at least one algorithm from the preset algorithm set, the gateway device establishes a communication tunnel with the peer based on the preset algorithm set. In this way, even if the national cryptographic algorithm is unavailable, the tunnel can still be protected by an international standard algorithm with a security strength not lower than the preset security threshold, thus achieving a bottom-line security degradation.
[0055] Specifically, when the second parsing result indicates that the peer device supports at least one algorithm from a preset algorithm set, the gateway device and the peer device enter a security association negotiation process based on international standard algorithms. This process follows the authentication and key exchange phases of the IKEv2 protocol. Both parties complete identity authentication and key exchange based on the algorithm suite supported by the peer device and located in the preset algorithm set, establishing a security association based on international standard algorithms. After the security association is established, the gateway device generates and applies an IPsec security policy based on international standard algorithms to complete the establishment of the IPsec tunnel.
[0056] During the process of establishing a communication tunnel based on a preset algorithm set, the gateway device also performs certificate authentication and signature binding procedures. The implementation method is basically the same as that of establishing a communication tunnel based on the national cryptographic algorithm suite in step S13, the only difference being the certificate format and algorithm suite used: for international standard algorithms, both parties use standard X.509 / RSA format certificates for authentication; the algorithms included in the negotiated security parameter set are all selected from those supported by the communication peer device in the preset algorithm set. The specific implementation of signature binding, including random number exchange, security parameter set negotiation, concatenation of the data sequence to be signed, digital signature calculation, signature binding and sending, and confirmation message reception, is the same as described in step S13 and will not be repeated here.
[0057] S17: If the second parsing result is that the communication peer device does not support any of the algorithms in the preset algorithm set, then the communication tunnel establishment fails and a downgrade negotiation failure signal is issued.
[0058] When the peer device does not support any of the algorithms in the preset algorithm set, the gateway device terminates the tunnel establishment process and issues an alarm, thereby avoiding the forced establishment of a tunnel when the security strength does not meet the standard, realizing a bottom-line degradation strategy, and providing maintenance personnel with a basis for fault location.
[0059] Specifically, when the second parsing result indicates that the peer device does not support any algorithm in the preset algorithm set, it means that the peer device's algorithm capability cannot meet the minimum security baseline required by this embodiment. At this time, the gateway device will no longer execute the tunnel establishment process, i.e., the communication tunnel establishment fails. Simultaneously, the gateway device sends a downgrade negotiation failure signal, which is used to record this negotiation failure event and can be pushed to the operation and maintenance platform.
[0060] Preferably, in one embodiment of the present invention, after issuing a downgrade negotiation failure signal, the method further includes: Re-execute the receiving and parsing of the first response result signal sent by the communication peer device in response to the first security signal; The negotiation process terminates when the number of re-executions reaches a preset value.
[0061] Specifically, after issuing a downgrade negotiation failure signal, the gateway device can also execute a cyclic retry mechanism to improve the negotiation success rate in temporary failure scenarios. Specifically, the gateway device re-executes the step of receiving and parsing the first response result signal, that is, returns to step S12, and re-initiates the detection of the communication peer device's algorithm capability. Each time the gateway device performs a retry, it records the number of retryes. When the number of retryes reaches a preset threshold, the gateway device terminates the negotiation process and stops retrying. This preset threshold can be set according to the actual network environment and operation and maintenance strategy.
[0062] In one specific implementation of this invention, the preset threshold is set to three times. When the peer device does not support any algorithm in the preset algorithm set three times consecutively, the gateway device terminates the negotiation process and no longer attempts to establish a tunnel.
[0063] In this way, when the peer device fails to meet the minimum security baseline requirements, the gateway device refuses to establish a tunnel and issues an alarm, implementing a baseline degradation strategy and fundamentally ensuring communication security. Through a cyclic retry mechanism, this solution can cope with temporary network fluctuations or abnormal device status, avoiding permanent denial of service due to a single failure.
[0064] Another embodiment of the present invention provides another method for securely establishing a communication tunnel; for details, please refer to [link to relevant documentation]. Figure 2 , Figure 2 The diagram shown illustrates a flowchart of another secure communication tunnel establishment method in one embodiment of the present invention, which includes steps S21 to S27: S21: Receive a first security signal from the gateway device, the first security signal containing the national cryptographic algorithm suite; S22: Send the first response result signal to the gateway device; S23: When the first response result signal indicates support for the national cryptographic algorithm suite, establish a communication tunnel with the gateway device; S24: When the first response result signal indicates that the national cryptographic algorithm suite is not supported, a second degradation signal is received from the gateway device. The second degradation signal contains a preset algorithm set. S25: Send a second response result signal to the gateway device; S26: When the second response result signal indicates that at least one algorithm in the preset algorithm set is supported, a communication tunnel with the gateway device is established; S27: Communication tunnel establishment fails when the second response result signal indicates that it does not support any algorithm in the preset algorithm set.
[0065] Preferably, in one embodiment of the present invention, signature binding is performed during the construction of a communication tunnel, including: Establish a secure channel with the gateway device, generate a second random number, and receive a first random number from the gateway device; In the secure channel, the set of security parameters is negotiated and determined. Receive the binding signature from the gateway device; Verify the binding signature based on the security parameter set, the first random number, and the second random number using your own private key; Once the verification is successful, a confirmation message is sent to the gateway device to complete the establishment of the communication tunnel.
[0066] Preferably, in one embodiment of the present invention, verifying the binding signature based on the security parameter set, the first random number, and the second random number using one's own private key includes: The security parameter set, the first random number, and the second random number are concatenated and combined in a preset order to form a data sequence to be verified. Using the public key corresponding to its own private key, perform signature verification operations on the bound signature and the data sequence to be verified.
[0067] Preferably, in one embodiment of the present invention, before establishing a communication tunnel with the gateway device, the method further includes: Receive the first certificate from the gateway device and verify its validity; If the verification result is valid, a second certificate is sent to the gateway device.
[0068] Compared with the prior art, the beneficial effects of the embodiments of the present invention are at least one of the following: (1) When establishing a communication tunnel, the present invention first sends a first security signal containing a set of national cryptographic algorithms to the peer device. When the peer device supports the set of national cryptographic algorithms, the two parties directly establish a communication tunnel based on the set of national cryptographic algorithms. When the peer device does not support the set of national cryptographic algorithms, the gateway device does not, as in the prior art, infinitely support any weak algorithm, but only downgrades to a preset set of security algorithms. The algorithm sets in this preset set all meet the requirement that the security strength is not lower than the preset security threshold, and explicitly exclude publicly disclosed weak algorithms. If the peer device does not support any algorithm in the preset set, it directly refuses to establish the tunnel and sends a downgrade negotiation failure signal. Through the above technical solution, the present invention fundamentally avoids the security risks caused by the prior art's pursuit of compatibility and indiscriminate downgrading to weak algorithms such as SHA-1 and 3DES, ensuring that the communication link always operates at an acceptable security level.
[0069] (2) In the process of establishing a communication tunnel, the gateway device and the communication peer device establish a secure channel and exchange random numbers. After the two parties negotiate and determine the security parameter set, they bind the security parameter set with the random numbers of both parties and sign it, and send the signature to the peer for verification. In this way, the present invention binds the negotiation result with the random numbers of both parties, so that any tampering with the security parameter set will cause the signature verification to fail, thereby effectively defending against man-in-the-middle attacks and ensuring the integrity and authenticity of the negotiation process.
[0070] The embodiments described above are merely illustrative of several implementations of the present invention, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these modifications and improvements all fall within the scope of protection of the present invention. Therefore, the scope of protection of this patent should be determined by the appended claims.
Claims
1. A method for securely establishing a communication tunnel, characterized in that, Applied to gateway devices, including: Send a first security signal to the communication peer device, the first security signal containing a suite of national cryptographic algorithms; Receive and parse the first response result signal sent by the communication peer device in response to the first security signal; If the first parsing result indicates that the communication peer device supports the national cryptographic algorithm suite, then a communication tunnel is established based on the national cryptographic algorithm suite; If the first parsing result indicates that the communication peer device does not support the national cryptographic algorithm suite, then a second degradation signal is sent to the communication peer device, the second degradation signal containing a preset algorithm set; Receive and parse the second response result signal sent by the communication peer device in response to the second degradation signal; If the second parsing result indicates that the communication peer device supports at least one algorithm in the preset algorithm set, then the communication tunnel is established based on the preset algorithm set; If the second parsing result indicates that the communication peer device does not support any of the algorithms in the preset algorithm set, then the communication tunnel establishment fails and a downgrade negotiation failure signal is issued.
2. The secure establishment method for a communication tunnel as described in claim 1, characterized in that, During the construction of the communication tunnel, signature binding is performed, including: Establish a secure channel with the communication peer device, generate a first random number, and receive a second random number from the communication peer device; In the secure channel, a set of security parameters is negotiated and determined; The security parameter set, the first random number, and the second random number are integrated, and a binding signature is generated based on the user's private key. Send the binding signature to the communication peer device; Receive an acknowledgment message from the peer device and complete the establishment of the communication tunnel based on the acknowledgment message.
3. The secure establishment method for a communication tunnel as described in claim 2, characterized in that, The process of integrating the security parameter set, the first random number, and the second random number, and generating a binding signature based on its own private key, includes: The security parameter set, the first random number, and the second random number are concatenated and combined in a preset order to obtain the data sequence to be signed; The binding signature is generated by performing a digital signature operation on the data sequence to be signed based on its own private key.
4. The secure establishment method for a communication tunnel as described in claim 1, characterized in that, The order of the algorithm suites in the preset algorithm set can be dynamically adjusted, and the dynamic adjustment includes: Obtain the historical negotiation records of the communication peer device, the historical negotiation records including information on the algorithm suites historically supported by the communication peer device; The number of times each of the algorithm suites successfully matched in the historical negotiation record was counted, and the algorithm suites in the preset algorithm set were rearranged according to the number of successful matches.
5. The secure establishment method for a communication tunnel as described in claim 1, characterized in that, After issuing the downgrade negotiation failure signal, the method further includes: Re-execute the process of receiving and parsing the first response result signal sent by the communication peer device in response to the first security signal; The negotiation process terminates when the number of re-executions reaches a preset value.
6. The secure establishment method for a communication tunnel as described in claim 1, characterized in that, Before establishing the communication tunnel based on the national cryptographic algorithm suite, the method further includes: Send the first certificate to the communication peer device; Receive a second certificate from the communication peer device.
7. A secure method for establishing a communication tunnel, characterized in that, Applied to communication peer devices, including: Receive a first security signal from the gateway device, the first security signal containing a suite of Chinese cryptographic algorithms; Send a first response result signal to the gateway device; When the first response result signal indicates support for the national cryptographic algorithm suite, a communication tunnel is established with the gateway device; When the first response result signal indicates that the national cryptographic algorithm suite is not supported, a second degradation signal is received from the gateway device, the second degradation signal containing a preset algorithm set; Send a second response result signal to the gateway device; When the second response result signal indicates support for at least one algorithm in the preset algorithm set, a communication tunnel is established with the gateway device; The communication tunnel establishment fails when the second response result signal indicates that it does not support any of the algorithms in the preset algorithm set.
8. The secure establishment method for a communication tunnel as described in claim 7, characterized in that, During the construction of the communication tunnel, signature binding is performed, including: Establish a secure channel with the gateway device, generate a second random number, and receive a first random number from the gateway device; In the secure channel, a set of security parameters is negotiated and determined; Receive the binding signature from the gateway device; Verify the binding signature using the security parameter set, the first random number, and the second random number based on your own private key; Once the verification is successful, a confirmation message is sent to the gateway device to complete the establishment of the communication tunnel.
9. A secure method for establishing a communication tunnel as described in claim 8, characterized in that, The step of verifying the binding signature based on its own private key using the security parameter set, the first random number, and the second random number includes: The security parameter set, the first random number, and the second random number are concatenated and combined in a preset order to form a data sequence to be verified. Using the public key corresponding to its own private key, a signature verification operation is performed on the bound signature and the data sequence to be verified.
10. A secure method for establishing a communication tunnel as described in claim 7, characterized in that, Before establishing the communication tunnel with the gateway device, the method further includes: Receive a first certificate from the gateway device and verify the validity of the first certificate; When the verification result is valid, a second certificate is sent to the gateway device.
