Key negotiation method, system and computer-readable medium for preventing man-in-the-middle attacks
By using the signature mechanism and identity certificate verification in the ECDH key negotiation process, the problem of man-in-the-middle attacks is solved, information security is improved, and the security of the key negotiation process and the integrity of data transmission are ensured.
Patent Information
- Application Number
- CN202111385100.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-22
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2041-11-22
AI Technical Summary
Because the identity of the public key sender is not verified during ECDH key negotiation, there is a risk of man-in-the-middle attack, which threatens information security.
The transmission process is verified through the signature mechanism between the client and the key distribution host to prevent data packet tampering, and the identities of both communicating parties are verified through identity certificates to ensure the security of the key negotiation process.
It effectively prevents man-in-the-middle attacks, improves user information security, and ensures the integrity of authentication and data transmission in the key agreement process.
Smart Images

Figure CN114024673B_ABST
Abstract
Description
Technical Field
[0001] The present invention mainly relates to the field of information security, and in particular to a key negotiation method, system and computer-readable medium for preventing man-in-the-middle attacks. Background Art
[0002] Elliptic Curve Diffie-Hellman key exchange (ECDH) is mainly used to establish secure shared encryption data in an insecure channel. Generally speaking, private keys are exchanged, and this key is generally used as a "symmetric encryption" key by both parties in subsequent data transmission. Since the identity of the sender of the public key is not verified in ECDH key negotiation, it is impossible to prevent man-in-the-middle attacks. For example, when ECDH key negotiation is performed between POS (Point of sale) machine manufacturers and acquiring institutions, there is a risk of man-in-the-middle attacks.
[0003] Therefore, there is an urgent need for a key negotiation method and system that can prevent man-in-the-middle attacks and improve user information security. Summary of the invention
[0004] The technical problem to be solved by the present invention is to provide a key negotiation method, system and computer-readable medium for preventing man-in-the-middle attacks, so as to solve the problem of man-in-the-middle attacks in ECDH key negotiation.
[0005] In order to solve the above technical problems, the present invention proposes a key negotiation method for preventing man-in-the-middle attacks, comprising: a user terminal generates a first request packet, the first request packet includes a user terminal identity certificate, and the user terminal identity certificate includes a first signature public key; the user terminal uses a first signature private key to sign the first request packet to obtain a first signature request packet, and sends the first signature request packet to a key distribution host; the key distribution host receives the first signature request packet, extracts the first signature public key from the user terminal identity certificate, and verifies the signature of the first signature request packet according to the first signature public key; the key distribution host generates a second request packet, the second request packet includes a key distribution host identity certificate, and the key distribution host identity certificate includes a second signature public key; the key distribution host uses a second signature private key to sign the second request packet to obtain a second signature request packet, and sends the second signature request packet to the user terminal; and the user terminal receives the second signature request packet, extracts the second signature public key from the key distribution host identity certificate, and verifies the signature of the second signature request packet according to the second signature public key.
[0006] In one embodiment of the present application, the key negotiation method for preventing man-in-the-middle attacks also includes: the user end generates a first ECDH private key, and the first request packet also includes a first ECDH public key generated based on the first ECDH private key; the key distribution host generates a second ECDH private key, and the second request packet also includes a second ECDH public key generated based on the second ECDH private key, and the length of the first ECDH public key is equal to the length of the second ECDH public key.
[0007] In one embodiment of the present application, the key distribution host also obtains a first transmission key based on the second ECDH private key and the first ECDH public key, and generates a first transmission key verification value based on the first transmission key; the second request packet also includes the first transmission key verification value.
[0008] In one embodiment of the present application, the key negotiation method for preventing man-in-the-middle attacks also includes: generating a second transmission key based on the first ECDH private key and the second ECDH public key, generating a second transmission key check value of the second transmission key, comparing the first transmission key check value and the second transmission key check value, if the first transmission key check value and the second transmission key check value are equal, the key negotiation between the user terminal and the key distribution host is successful.
[0009] In an embodiment of the present application, after the key distribution host receives the first signature request packet, the step further includes: using a certificate chain to verify the user terminal identity certificate.
[0010] In an embodiment of the present application, after the user terminal receives the second signature request packet, the method further includes: using a certificate chain to verify the key distribution host identity certificate.
[0011] In one embodiment of the present application, the certificate chain includes a root certificate and a secondary certificate.
[0012] In one embodiment of the present application, the first request packet also includes the terminal serial number of the user terminal.
[0013] In order to solve the above technical problems, the present invention proposes a key negotiation system for preventing man-in-the-middle attacks, comprising: a user terminal; a key distribution host; a memory for storing instructions executable by a controller; and a controller for controlling the user terminal and the key distribution host to execute the instructions to implement the key negotiation method as described above.
[0014] In order to solve the above technical problems, the present invention proposes a computer-readable medium storing computer program codes, and the computer program codes implement the key negotiation method as described above when executed by a processor.
[0015] Compared with the prior art, the key negotiation method of the present application verifies whether the data packet has been tampered with during the transmission process through a signature mechanism between the user end and the key distribution host, thereby preventing the middleman from tampering with the information; the key negotiation method of the present application verifies the identities of the communicating parties through an identity certificate between the user end and the key distribution host, thereby preventing the middleman from impersonating the identity; the present application solves the problem of man-in-the-middle attacks during the key negotiation process, thereby improving user information security. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to make the above-mentioned objects, features and advantages of the present invention more clearly understood, the specific embodiments of the present invention are described in detail below in conjunction with the accompanying drawings, wherein:
[0017] Figure 1 is an exemplary flow chart of a key negotiation method according to an embodiment of the present invention;
[0018] Figure 2 is a schematic diagram of an interaction process of a key negotiation method according to an embodiment of the present invention;
[0019] Figure 3 is a system block diagram of a key agreement system according to an embodiment of the present invention. DETAILED DESCRIPTION
[0020] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following is a brief introduction to the drawings required for the description of the embodiments. Obviously, the drawings described below are only some examples or embodiments of the present application. For ordinary technicians in this field, the present application can also be applied to other similar scenarios based on these drawings without creative work. Unless it is obvious from the language environment or otherwise explained, the same reference numerals in the figures represent the same structure or operation.
[0021] As shown in this application and claims, unless the context clearly indicates an exception, the words "a", "an", "an" and / or "the" do not refer to the singular and may also include the plural. Generally speaking, the terms "include" and "comprise" only indicate the inclusion of the steps and elements that have been clearly identified, and these steps and elements do not constitute an exclusive list. The method or device may also include other steps or elements.
[0022] At the same time, the present application uses specific words to describe the embodiments of the present application. For example, "one embodiment", "an embodiment", and / or "some embodiments" refer to a certain feature, structure or characteristic related to at least one embodiment of the present application. Therefore, it should be emphasized and noted that "one embodiment" or "an embodiment" or "an alternative embodiment" mentioned twice or more in different positions in this specification does not necessarily refer to the same embodiment. In addition, some features, structures or characteristics in one or more embodiments of the present application can be appropriately combined.
[0023] Unless otherwise specifically stated, the relative arrangement, numerical expressions and numerical values of the parts and steps set forth in these embodiments do not limit the scope of the present application. At the same time, it should be understood that, for ease of description, the sizes of the various parts shown in the accompanying drawings are not drawn according to the actual proportional relationship. The technology, method and equipment known to those of ordinary skill in the relevant field may not be discussed in detail, but in appropriate cases, the technology, method and equipment should be considered as a part of the authorization specification. In all examples shown and discussed here, any specific value should be interpreted as being merely exemplary, rather than as a limitation. Therefore, other examples of exemplary embodiments may have different values. It should be noted that similar reference numerals and letters represent similar items in the following drawings, so that once a certain item is defined in an accompanying drawing, it does not need to be further discussed in subsequent drawings.
[0024] Flowcharts are used in the present application to illustrate the operations performed by the system according to the embodiments of the present application. It should be understood that the preceding or following operations are not necessarily performed accurately in order. On the contrary, various steps may be processed in reverse order or simultaneously. At the same time, other operations may be added to these processes, or one or more operations may be removed from these processes.
[0025] Figure 1 FIG. 1 is an exemplary flow chart of a key negotiation method according to an embodiment of the present invention. Figure 1 As shown, the key negotiation method 10 of this embodiment includes the following steps:
[0026] Step S11: The user terminal generates a first request packet, which includes the user terminal identity certificate, and the user terminal identity certificate includes a first signature public key.
[0027] Step S12: The user terminal signs the first request package using the first signature private key to obtain a first signature request package, and sends the first signature request package to the key distribution host.
[0028] Step S13: The key distribution host receives the first signature request package, extracts the first signature public key from the user's identity certificate, and verifies the signature of the first signature request package according to the first signature public key.
[0029] Step S14: the key distribution host generates a second request packet, the second request packet includes the key distribution host identity certificate, and the key distribution host identity certificate includes the second signature public key.
[0030] Step S15: The key distribution host uses the second signature private key to sign the second request package, obtains a second signature request package, and sends the second signature request package to the user end.
[0031] Step S16: The user terminal receives the second signature request package, extracts the second signature public key from the key distribution host identity certificate, and verifies the signature of the second signature request package according to the second signature public key.
[0032] Combine the following Figure 1-Figure 2 The above steps S11 to S16 are described in detail.
[0033] Figure 2 1 is a schematic diagram of the interaction process of the key negotiation method according to an embodiment of the present invention. According to steps S11-S16, the key negotiation method of the present invention includes two task execution entities, namely the user end (Device) and the key distribution host (Key Distribution Host, referred to as KDH). Figure 2 As shown:
[0034] In step S11, the user generates a first request packet, which includes a device authenticate certificate (DA_CERT) for the user. The device authenticate certificate is used to prove the identity of the user, wherein the device authenticate certificate contains a first signature public key (DA_PUK) for the user. The first signature public key is used to verify the data signature to prevent man-in-the-middle attacks. The signature is used to verify whether the transmitted content is the data sent by the real server and whether the sent data has been tampered with. The signature is usually encrypted with a private key and decrypted with a public key. The workflow of the signature can be that when A sends data to B, A first generates a pair of public and private keys through an asymmetric encryption algorithm and makes the public key public; uses a message digest algorithm (such as SHA, MD5, etc.) to generate summary information of the data; uses the private key to "encrypt" to obtain a signature, and attaches the signature to the data and sends it to B together. The workflow of verifying the data signature is that after B receives the signature, it generates a summary using a message digest algorithm; uses the public key to "decrypt" the signature to obtain the summary generated by A; compares the two summaries, and if they are consistent, it means that there is no third-party modification.
[0035] In some embodiments, the first request packet also includes a first ECDH public key. Figure 2As shown, the user end generates a first ECDH private key DE_ECDH_PVK according to a pre-agreed configuration; then generates a first ECDH public key DE_ECDH_PUK according to the first ECDH private key using the elliptic curve principle. The configuration parameters may be a prime number P, a base number g, and a random number a, etc., which are not limited in this application.
[0036] In some embodiments, the first request packet also includes the terminal serial number SN of the user terminal. The user terminal can determine the configuration parameters according to the terminal serial number SN, and this application does not limit this.
[0037] In step S12, the user terminal includes a first signature private key (Device private key, referred to as DA_PVK) corresponding to the first signature public key, and the first signature private key is used to sign the first request packet to prevent man-in-the-middle attacks. Figure 2 As shown, the user end uses the first signature private key DA_PVK to sign the first request package to obtain the first signature request package, and then the user end sends the first signature request package to the key distribution host KDH.
[0038] The present invention does not limit the communication method between the user terminal and the key distribution host KDH. In step S12, the user terminal can send the first signature request packet to the key distribution host KDH through a network, and the network can be / or include a public network (e.g., the Internet), a private network (e.g., a local area network (LAN), a wide area network (WAN), etc.), a wired network (e.g., Ethernet), a wireless network (e.g., an 802.11 network, a Wi-Fi network, etc.), a cellular network (e.g., a long-term evolution (LTE) network), a frame relay network, a virtual private network ("VPN"), a satellite network, a telephone network, a router, a hub, a switch, a server computer and / or any combination thereof. By way of example only, the network may include a cable network, a wired network, a fiber optic network, a telecommunications network, an intranet, a wireless local area network (WLAN), a metropolitan area network (MAN), a public switched telephone network (PSTN), a Bluetooth TM Network, ZigBee TM network, near field communication (NFC) network, etc., or any combination thereof.
[0039] The first signature request packet includes the first request packet and the signature, specifically, the user terminal identity certificate and the signature. In some embodiments, the first signature request packet includes the first request packet and the first request packet after being signed.
[0040] In some embodiments, the first request packet also includes a request (Req) for remote key injection. When the user terminal sends the first signature request packet to the key distribution host KDH, the key distribution host KDH receives the first request packet according to the request.
[0041] In step S13, the key distribution host KDH receives the first signature request packet; the key distribution host KDH extracts the first signature public key DA_PUK from the user identity certificate DA_CERT, and verifies the signature of the first signature request packet according to the first signature public key DA_PUK. If the verification is successful, it means that the data packet has not been tampered with by the middleman during the transmission process.
[0042] like Figure 2 As shown, in some embodiments, before verifying the first signature request packet, the authentication of the user's identity is also included. The digital signature can verify whether the data packet has been tampered with by the middleman during the transmission process, but when the middleman replaces the public key of the user with his own public key and sends it to the key distribution host, the first signature request packet sent by the user will not be able to pass the signature verification because the first signature public key for verifying the signature has been replaced. Therefore, it is necessary to verify the identity of the user. Specifically, the key distribution host KDH includes a pre-set certificate chain, and the key distribution host KDH uses the existing certificate chain to verify the user's identity certificate DA_CERT. If the verification is successful, the user's identity is recognized. The certificate chain is a sequence of digital certificates issued by a series of certificates, and finally ends with a root certificate. Digital certificates are generally issued by a digital certificate certification body CA (Certificate Authority). CA will sign the certificate's issuing authority, validity period, public key, holder (subject) and other information with CA's private key, and put the signature result and this information together to form a digital certificate. The key distribution host KDH uses the CA's public key for verification. If the verification is successful, it proves that this is indeed the user's certificate, and the first signature public key included in the certificate can be used to verify the first signature request package.
[0043] In some embodiments, the certificate chain of the key distribution host KDH includes a root certificate (Root Certificate Authority, Root CA for short) and a secondary certificate (Sub Certificate Authority, Sub CA for short). The root certificate is issued by the root CA itself, and the secondary certificate is generated by the root CA. A pair of public keys and private keys are used, and the private key is used to "encrypt" the information and public key of the intermediate CA to generate a signature, and finally encapsulate to obtain a secondary certificate. The root certificate is located at the top level of the certificate system and is used to verify the Sub CA. It is preset to the key distribution host KDH when the device leaves the factory. The secondary CA certificate is used to verify ordinary certificates and is preset to the key distribution host KDH when the device leaves the factory.
[0044] In step S14, the key distribution host generates a second request packet, which includes a key distribution host identity certificate (KDH Authenticate Certificate, referred to as KDH_CERT). The key distribution host identity certificate is used to prove the identity of the key distribution host, wherein the key distribution host identity certificate contains a second signature public key (KDH public key, referred to as KDH_PUK), and the second signature public key is used to verify the data signature to prevent man-in-the-middle attacks.
[0045] In some embodiments, the second request packet further includes a second ECDH public key (KDH ECDH public key, referred to as KDH_ECDH_PUK). The length of the first ECDH public key is equal to the length of the second ECDH public key. Figure 2 As shown, the second ECDH public key is generated by the key distribution host according to the pre-agreed configuration, and the second ECDH private key (KDH ECDH private key, referred to as KDH_ECDH_PVK) is then generated according to KDH_ECDH_PVK using the elliptic curve principle. The configuration parameters can be prime number P, base number g, and random number b, etc., and this application does not limit this.
[0046] In some embodiments, the second request packet further includes a first transmission key verification value. Figure 2 As shown, the key distribution host KDH uses the second ECDH private key KDH_ECDH_PVK and the first ECDH public key DE_ECDH_PUK to perform ECDH operation to obtain the first transport key (Transport Key 1, referred to as TK1), and generates the first transport key verification value KCV1 according to the first transport key. Among them, TK1 is used to encrypt the transport key of the transmission working key.
[0047] In step S15, the key distribution host KDH includes a second signature private key (KDH private key, KDH_PVK for short) corresponding to the second signature public key KDH_PUK. The second signature private key is used to sign the data transmitted to the user end to prevent man-in-the-middle attacks. Figure 2 As shown, the key distribution host KDH uses the second signature private key KDH_PVK to sign the second request package to obtain a second signature request package, and the key distribution host KDH sends the second signature request package to the user end through the network.
[0048] In step S16, the user terminal receives the second signature request packet, extracts the second signature public key KDH_PUK from the key distribution host identity certificate, and verifies the signature of the second signature request packet according to the second signature public key. If the verification is successful, it means that the second request packet has not been tampered with by the middleman during the transmission process. Figure 2 As shown, the user extracts the public key KDH_PUK from KDH_CERT and uses KDH_PUK to verify the second signature request packet. If the verification is successful, it means that the data packet has not been tampered with by the middleman during the transmission process.
[0049] In some embodiments, before verifying the second signature request packet, the key distribution host identity is also authenticated. Figure 2 As shown, the user end includes a pre-set certificate chain, which is a sequence of certificates issued by a series of CA certificates, and ends with a root certificate. The user end uses the existing certificate chain to verify the key distribution host identity certificate. If the verification is successful, the key distribution host identity is recognized. The certificate chain is a sequence of certificates issued by a series of certificates, and ends with a root certificate. Digital certificates are generally issued by a digital certificate certification body CA (Certificate Authority). CA will sign the certificate's issuing authority, validity period, public key, holder (subject) and other information with CA's private key, and put the signature result and this information together to form a digital certificate. The user end uses CA's public key for verification. If the verification is successful, it proves that this is indeed the certificate of the key distribution host, and the second signature public key contained in the certificate can be used to verify the second signature request package.
[0050] In some embodiments, the certificate chain of the key distribution host KDH includes a root certificate Root CA and a secondary certificate SubCA. The root certificate is issued by the root CA itself, and the secondary certificate is generated by the root CA. A pair of public keys and private keys are used, and the private key is used to "encrypt" the information and public key of the intermediate CA to generate a signature, and finally encapsulate to obtain a secondary certificate. The root certificate is located at the top level of the certificate system and is used to verify the Sub CA. It is preset to the user end when the device leaves the factory. The secondary CA certificate is used to verify the ordinary certificate and is preset to the user end when the device leaves the factory.
[0051] like Figure 2As shown, in some embodiments, the key negotiation method further includes the following steps: the user end generates a second transport key according to the first ECDH private key and the second ECDH public key, generates a second transport key check value for the second transport key, compares the first transport key check value and the second transport key check value, and if the first transport key check value and the second transport key check value are equal, the key negotiation between the user end and the key distribution host is successful. Specifically, the user end uses the first ECDH private key and the second ECDH public key to perform ECDH operation to obtain the second transport key (Transport Key 2, referred to as TK2), and generates a second transport key check value KCV2 according to the second transport key. Among them, TK2 is used to encrypt the transport key of the transmission working key. Determined by the principle of ECDH, TK1=TK2, it can be known that the first transport key check value and the second transport key check value should also be equal, that is, KCV1=KCV2, compare the first transport key check value and the second transport key check value, if the first transport key check value and the second transport key check value are equal, the key negotiation between the user end and the key distribution host is successful.
[0052] The key negotiation method of the present application verifies whether the data packet has been tampered with during the transmission process through a signature mechanism between the user end and the key distribution host, thereby preventing the middleman from tampering with the information; the key negotiation method of the present application verifies the identities of the communicating parties through an identity certificate between the user end and the key distribution host, thereby preventing the middleman from impersonating the identity; the present application solves the problem of man-in-the-middle attacks during the key negotiation process, thereby improving user information security.
[0053] The present application also provides a key negotiation system for preventing man-in-the-middle attacks, comprising: a user terminal; a key distribution host; a memory for storing instructions executable by a controller; and a controller for controlling the user terminal and the key distribution host to execute the instructions to implement the key negotiation method as described above. Specifically, the memory and the controller may respectively include a user terminal memory, a key distribution host memory, a user terminal controller, and a key distribution host controller.
[0054] Figure 3 is a system block diagram of a key agreement system according to an embodiment of the present invention. Figure 3As shown, the system includes a user terminal 31, a user terminal memory 311, a user terminal controller 312, a key distribution host 32, a key distribution host memory 321, a key distribution host controller 322, and a network 33. The user terminal 31 and the key distribution host 32 perform key negotiation through the network 33. The user terminal memory 311 is used to store instructions that can be executed by the user terminal controller 312. The key distribution host memory 321 is used to store instructions that can be executed by the key distribution host controller 322. The user terminal controller 312 is used to control the user terminal 31 to execute instructions to implement the key negotiation method of the present invention. The key distribution host controller 322 is used to control the key distribution host 32 to execute instructions to implement the key negotiation method of the present invention.
[0055] The present application also provides a computer-readable medium storing computer program codes, and the computer program codes implement the key negotiation method of the present invention when executed by a processor.
[0056] When the key agreement method is implemented as a computer program, it can also be stored in a computer-readable storage medium as an article of manufacture. For example, a computer-readable storage medium can include, but is not limited to, magnetic storage devices (e.g., hard disks, floppy disks, magnetic strips), optical disks (e.g., compact disks (CDs), digital versatile disks (DVDs)), smart cards, and flash memory devices (e.g., electrically erasable programmable read-only memories (EPROMs), cards, sticks, key drives). In addition, the various storage media described herein can represent one or more devices and / or other machine-readable media for storing information. The term "machine-readable medium" can include, but is not limited to, wireless channels and various other media (and / or storage media) that can store, contain and / or carry code and / or instructions and / or data.
[0057] It should be understood that the embodiments described above are only illustrative. The embodiments described herein may be implemented in hardware, software, firmware, middleware, microcode, or any combination thereof. For hardware implementation, the processor may be implemented in one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), processors, controllers, microcontrollers, microprocessors, and / or other electronic units designed to perform the functions described herein, or a combination thereof.
[0058] Some aspects of the present application may be performed entirely by hardware, entirely by software (including firmware, resident software, microcode, etc.), or by a combination of hardware and software. The above hardware or software may be referred to as "data blocks", "modules", "engines", "units", "components" or "systems". The processor may be one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DAPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), processors, controllers, microcontrollers, microprocessors, or combinations thereof. In addition, various aspects of the present application may be expressed as computer products located in one or more computer-readable media, which include computer-readable program codes. For example, computer-readable media may include, but are not limited to, magnetic storage devices (e.g., hard disks, floppy disks, tapes ...), optical disks (e.g., compact disks CDs, digital versatile disks DVDs ...), smart cards, and flash memory devices (e.g., cards, sticks, key drives ...).
[0059] A computer-readable medium may include a propagated data signal containing computer program code, such as in baseband or as part of a carrier wave. The propagated signal may have a variety of manifestations, including electromagnetic, optical, etc., or a suitable combination. A computer-readable medium may be any computer-readable medium other than a computer-readable storage medium, which may be connected to an instruction execution system, device or apparatus to communicate, propagate or transmit a program for use. The program code on the computer-readable medium may be propagated via any suitable medium, including radio, cable, fiber optic cable, radio frequency signal, or similar medium, or any combination of the above mediums.
[0060] The basic concepts have been described above. Obviously, for those skilled in the art, the above invention disclosure is only used as an example and does not constitute a limitation of the present application. Although not explicitly stated herein, those skilled in the art may make various modifications, improvements and amendments to the present application. Such modifications, improvements and amendments are suggested in the present application, so such modifications, improvements and amendments still belong to the spirit and scope of the exemplary embodiments of the present application.
Claims
1. A key negotiation method for preventing man-in-the-middle attacks, characterized in that: include: The user terminal generates a first request packet, the first request packet includes the user terminal identity certificate, and the user terminal identity certificate includes a first signature public key; The user end signs the first request packet using the first signature private key to obtain a first signature request packet, and sends the first signature request packet to the key distribution host; The key distribution host receives the first signature request packet, extracts the first signature public key from the user terminal identity certificate, and verifies the signature of the first signature request packet according to the first signature public key; The key distribution host generates a second request packet, the second request packet includes a key distribution host identity certificate, and the key distribution host identity certificate includes a second signature public key; The key distribution host signs the second request packet using the second signature private key to obtain a second signature request packet, and sends the second signature request packet to the user terminal; as well as The user terminal receives the second signature request packet, extracts the second signature public key from the key distribution host identity certificate, and verifies the signature of the second signature request packet according to the second signature public key; It also includes: the user end generates a first ECDH private key, and the first request packet also includes a first ECDH public key generated according to the first ECDH private key; the key distribution host generates a second ECDH private key, and the second request packet also includes a second ECDH public key generated according to the second ECDH private key, and the length of the first ECDH public key is equal to the length of the second ECDH public key; the key distribution host also obtains a first transmission key according to the second ECDH private key and the first ECDH public key, and generates a first transmission key verification value according to the first transmission key; the second request packet also includes the first transmission key verification value; it also includes: generating a second transmission key according to the first ECDH private key and the second ECDH public key, generating a second transmission key verification value for the second transmission key, comparing the first transmission key verification value and the second transmission key verification value, if the first transmission key verification value and the second transmission key verification value are equal, the key negotiation between the user end and the key distribution host is successful.
2. The key negotiation method according to claim 1, wherein: After the key distribution host receives the first signature request package, the method further includes: using a certificate chain to verify the user terminal identity certificate.
3. The key negotiation method according to claim 1, wherein: After the user terminal receives the second signature request packet, the method further includes: using a certificate chain to verify the key distribution host identity certificate.
4. The key negotiation method according to claim 2 or 3, characterized in that: The certificate chain includes a root certificate and a secondary certificate.
5. The key negotiation method according to claim 1, wherein: The first request packet also includes the terminal serial number of the user terminal.
6. A key negotiation system for preventing man-in-the-middle attacks, comprising: User end; Key distribution host; a memory for storing instructions executable by the controller; A controller is used to control the user terminal and the key distribution host to execute the instruction to implement the key negotiation method as described in any one of claims 1-5.
7. A computer-readable medium storing computer program code, wherein the computer program code, when executed by a processor, implements the key agreement method according to any one of claims 1 to 5.
