Identity authentication and key exchange method, device and system and medium

CN118614037APending Publication Date: 2024-09-06CHINA ENTROPY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202380015552.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Priority Date
2022-12-30
Filing Date
2023-12-11
Publication Date
2024-09-06

AI Technical Summary

Technical Problem

In IoT terminals, existing PKI systems cannot effectively perform identity authentication and key exchange due to limitations in computing power and power consumption, resulting in data transmission security and battery consumption issues.

Method used

By obtaining the authentication serial number, authentication random number and session random number generated by the terminal device, two-way identity authentication and session key and serial number generation are performed, and the symmetric encryption algorithm and digest algorithm are used to reduce the number of communications and improve the security and efficiency of data transmission.

Benefits of technology

With low computing and communication overhead, two-way identity authentication and session key generation are achieved, maintaining the security of the original key and session data, reducing battery consumption, and improving the security of data transmission.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118614037A
    Figure CN118614037A
Patent Text Reader

Abstract

The invention discloses an identity authentication and key exchange method, device and system and a medium, and the method comprises the steps: obtaining an authentication serial number, an authentication random number and a session random number generated by terminal equipment, and initiating an authentication request; processing the authentication request, and judging whether a preset authentication strategy is met or not according to the authentication serial number, the authentication random number and the session random number; if the preset authentication strategy is met, authentication succeeds, data sending encryption and data integrity verification are carried out after authentication is completed, and communication is completed. According to the invention, identity authentication and key exchange are carried out through the authentication serial number, the authentication random number and the session random number, so that the security of data transmission is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Identity authentication and key exchange method, device, system and medium Technical Field

[0001] The present invention relates to the field of testing technology, and in particular to an identity authentication and key exchange method, device, system and medium. Background Art

[0002] With the development of the Internet of Things (IoT), a large number of devices are connected to servers, exposing sensitive data during transmission, raising data security concerns. Ensuring security is essential for the development of the IoT. Technologies based on PKI (public key infrastructure), commonly known as public key infrastructure, are already widely used. However, due to the computing power and power consumption limitations of IoT devices, it's difficult to completely replicate PKI systems. For example, the asymmetric encryption algorithms used by PKI are not well-suited for small IoT devices, while symmetric encryption algorithms can be implemented on virtually any device. Furthermore, PKI-based systems require multiple communications to establish a secure connection, and each communication carries a large amount of data, which can significantly drain the battery of low-power devices.

[0003] Summary of the Invention

[0004] In view of the above-mentioned deficiencies in the prior art, the purpose of the present invention is to provide an identity authentication and key exchange method, device, system and medium that can be applied to financial technology or other related fields, which solves the problems of two-way identity authentication and session key and serial number generation under low computing and communication overhead, and maintains the security of the original key and the security of the session data throughout the whole process.

[0005] The technical solutions of the present invention are as follows:

[0006] An identity authentication and key exchange method, comprising:

[0007] Obtain the authentication serial number, authentication random number, and session random number generated by the terminal device, and initiate an authentication request;

[0008] Process the authentication request and determine whether it complies with the preset authentication policy based on the authentication serial number, authentication random number and session random number;

[0009] If the preset authentication policy is met, the authentication is successful. After the authentication is completed, data transmission encryption and data integrity verification are performed to complete the communication.

[0010] In one embodiment, before obtaining the authentication serial number, authentication random number, and session random number generated by the terminal device and initiating the authentication request, the process further includes:

[0011] Generate device ID and authentication serial number and send them to the server to initialize the terminal device;

[0012] Generate a key based on the initialized device ID and authentication serial number for burning and storing.

[0013] In one embodiment, the processing of the authentication request and determining whether the authentication request complies with a preset authentication policy based on the authentication serial number, the authentication random number, and the session random number include:

[0014] When the authentication serial number is not of the timestamp type, the validity of the authentication serial number is determined by comparing the old and new authentication serial numbers.

[0015] When the authentication serial number is of a timestamp type, whether the authentication serial number is legal is determined by comparing whether the difference between the timestamps is less than a specified time difference.

[0016] In one embodiment, the processing of the authentication request and determining whether the authentication request complies with a preset authentication policy based on the authentication serial number, the authentication random number, and the session random number include:

[0017] Calculate the authentication digest using a digest algorithm based on the terminal ID, the authentication random number, the authentication serial number, and the specified salt;

[0018] Determine whether the authentication summary complies with the authentication policy; if so, the authentication is successful.

[0019] In one embodiment, the processing of the authentication request and determining whether the authentication request complies with a preset authentication policy based on the authentication serial number, the authentication random number, and the session random number include:

[0020] Calculate the authentication digest using a digest algorithm based on the terminal ID, the authentication random number, and the authentication serial number;

[0021] Performing an XOR operation on the authentication digest and the session random number to generate a ciphertext of the session random number;

[0022] A session key and a session sequence number are generated according to the session random number ciphertext, the session random number, the authentication sequence number and the specified salt.

[0023] In one embodiment, if the preset authentication policy is met, the authentication is successful. After the authentication is completed, data transmission encryption and data integrity verification are performed to complete the communication, including:

[0024] During data transmission, integrity check data is generated based on the transmitted data and its length;

[0025] Encrypt the sent data according to the integrity check data and the device ID to generate encrypted data;

[0026] Data transmission encryption and data integrity verification are performed based on the integrity verification data and the encrypted data to complete the communication.

[0027] In one embodiment, the terminal device and the service server perform mutual authentication and data transmission.

[0028] An identity authentication and key exchange device, comprising:

[0029] The request module is used to obtain the authentication serial number, authentication random number and session random number generated by the terminal device and initiate an authentication request;

[0030] An authentication module is used to process the authentication request and determine whether it complies with the preset authentication policy based on the authentication serial number, authentication random number and session random number;

[0031] The communication module is used to authenticate successfully if the preset authentication policy is met, and to perform data transmission encryption and data integrity verification after the authentication is completed to complete the communication.

[0032] An identity authentication and key exchange system, the system comprising at least one processor; and

[0033] a memory communicatively connected to the at least one processor; wherein,

[0034] The memory stores instructions that can be executed by the at least one processor. The instructions are executed by the at least one processor to enable the at least one processor to perform the above-mentioned identity authentication and key exchange method.

[0035] A non-volatile computer-readable storage medium stores computer-executable instructions. When the computer-executable instructions are executed by one or more processors, the one or more processors can perform the above-mentioned identity authentication and key exchange method.

[0036] Beneficial effects: The present invention discloses an identity authentication and key exchange method, device, system and medium. Compared with the existing technology, the embodiments of the present invention perform identity authentication and key exchange through authentication serial number, authentication random number and session random number, thereby improving the security of data transmission. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] The present invention will be further described below with reference to the accompanying drawings and embodiments, in which:

[0038] FIG1 is a flow chart of an identity authentication and key exchange method provided by an embodiment of the present invention;

[0039] FIG2 is a schematic diagram of functional modules of an identity authentication and key exchange device provided by an embodiment of the present invention;

[0040] FIG3 is a schematic diagram of the hardware structure of the identity authentication and key exchange system provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0041] To make the objectives, technical solutions, and effects of the present invention more clear and distinct, the present invention is further described in detail below. It should be understood that the specific embodiments described herein are merely for the purpose of explaining the present invention and are not intended to limit the present invention. The following describes embodiments of the present invention in conjunction with the accompanying drawings.

[0042] To solve the above problems, the present invention proposes an identity authentication and key exchange method. Please refer to Figure 1, which is a flow chart of an embodiment of the identity authentication and key exchange method provided by the present invention. As shown in Figure 1, the method specifically includes the following steps:

[0043] S100. Obtain the authentication serial number, authentication random number, and session random number generated by the terminal device, and initiate an authentication request;

[0044] S200: Process the authentication request and determine whether it complies with the preset authentication policy based on the authentication serial number, authentication random number, and session random number.

[0045] S300: If the preset authentication policy is met, the authentication is successful. After the authentication is completed, data transmission encryption and data integrity verification are performed to complete the communication.

[0046] In this embodiment, relevant information about the terminal device is first obtained, including the certificate serial number, authentication random number, and session random number. The terminal device initiates an authentication request to the server, which includes a communication server and a security server. The server processes the authentication request and determines whether it complies with the preset authentication policy based on the authentication serial number, authentication random number, and session random number. The communication server receives the authentication request and determines whether the ID is registered. If not, it is directly discarded. The security server verifies the legitimacy of the authentication serial number Asnc. If it is not legal, it is directly discarded. Verification of compliance with the preset authentication policy indicates that the authentication is successful. After the authentication is completed, data encryption and data integrity verification are performed to complete the communication.

[0047] In one embodiment, before step S100, the method further includes:

[0048] Generate device ID and authentication serial number and send them to the server to initialize the terminal device;

[0049] Generate a key based on the initialized device ID and authentication serial number for burning and storing.

[0050] In this embodiment, before performing identity authentication and key exchange, the terminal device is initialized. When registering with the server, the terminal device generates a symmetric key. The terminal device and the server each store the symmetric key and simultaneously generate and store an authentication serial number. If the authentication serial number is a timestamp, the authentication serial number may not be generated. The terminal device then sends its terminal ID and authentication serial number to the communication server. The communication server registers and stores the terminal device ID, initializes the terminal device, and sends the initialized terminal device ID and authentication serial number to the security server. The security server stores the authentication serial number and generates and stores a key based on the terminal device ID and authentication serial number. The security server then sends the generated key to the communication server, which in turn sends the key to the terminal, which stores the key, completing the initialization of the terminal device.

[0051] In one embodiment, step S200 includes:

[0052] When the authentication serial number is not of the timestamp type, the validity of the authentication serial number is determined by comparing the old and new authentication serial numbers.

[0053] When the authentication serial number is of a timestamp type, whether the authentication serial number is legal is determined by comparing whether the difference between the timestamps is less than a specified time difference.

[0054] In this embodiment, the security server authenticates whether the authentication serial number Asnc is legal. When the authentication serial number is not of the timestamp type, the server compares the new authentication serial number with the old authentication serial number. If the new serial number is greater than the old serial number, it is a legal request; otherwise, it is discarded. If the authentication serial number is of the timestamp type, the server compares the authentication serial number Asnc sent by the device with the timestamp of the current server. If the deviation between the two is less than the specified time deviation, it is a legal request; otherwise, it is discarded. If an authentication request has been received within the deviation time period, it is an illegal repeated request and is also discarded.

[0055] Furthermore, when the terminal initiates authentication, it uses an upwardly increasing, non-repeating authentication serial number. If the server detects a duplicate serial number, it can refuse to provide authentication. The authentication serial number uses a value pre-set by both parties. Both parties need to save the authentication serial number and maintain its updates. A timestamp can also be used as the authentication serial number. When using a timestamp as the authentication serial number, neither party needs to maintain the serial number, and a certain deviation in the timestamps of both parties can be tolerated. The terminal needs to wait for a period of time exceeding the allowed deviation before initiating another new authentication, otherwise the server can refuse. The use of the authentication serial number ensures that the data exchanged during each authentication process is unique. Even if one party uses the same random number, there will be no problem of reduced security.

[0056] In one embodiment, step S200 includes:

[0057] Calculate the authentication digest using a digest algorithm based on the terminal ID, the authentication random number, the authentication serial number, and the specified salt;

[0058] Determine whether the authentication summary complies with the authentication policy; if so, the authentication is successful.

[0059] In this embodiment, the server generates and stores the authentication random number Ras for the device ID and the session random number Rss. The authentication digest Has is calculated as HASH(ENC(ID||Rac||Ras||Asnc,Key)||Salt1), where ENC indicates encryption using the original key. The encrypted content includes the device ID, Rac, Ras, Asnc, and other optional content. The encrypted ciphertext is then salted with 1 and digested using the HASH algorithm. Has can use the entire digest result or calculate a partial length. The content of salt 1 can be freely defined, but the same salt must be used as the terminal. || represents byte string concatenation. The communication server composes the server authentication digest Has and the server authentication random number into an authentication response and sends it to the terminal. The terminal calculates the server authentication digest Has'=HASH(ENC(ID||Rac||Ras||Asnc,Key)||salt 1) in the same way. The terminal compares the server authentication digest Has' calculated by itself with the Has sent by the server. If the two are the same, the server authentication is successful and the next step is carried out. Otherwise, the authentication is re-initiated after a certain delay. The terminal calculates the terminal authentication digest Has' Hac=HASH(ENC(ID||Rac||Ras||Asnc, Key)||Salt 2); the terminal sends an authentication confirmation including the terminal authentication digest Hac and the terminal session random number ciphertext Xsc to the server; the communication server transfers the authentication confirmation to the security server for processing; 13) the server calculates the terminal authentication digest Hac'=HASH(ENC(ID||Rac||Ras||Asnc, Key)||Salt 2), the server compares the terminal authentication digest Hac' calculated by itself with the Hac sent by the device, if they are the same, the authentication of the terminal is successful and proceeds to the next step, otherwise it is discarded. It is implemented using symmetric encryption algorithm and digest algorithm, and does not require asymmetric implementation. It only needs to use symmetric keys and does not require the storage of large certificates. The authentication and key exchange process only requires 4 communications and can be further reduced to 3 times, which is faster.

[0060] In one embodiment, step S200 includes:

[0061] Calculate the authentication digest using a digest algorithm based on the terminal ID, the authentication random number, and the authentication serial number;

[0062] Performing an XOR operation on the authentication digest and the session random number to generate a ciphertext of the session random number;

[0063] A session key and a session sequence number are generated according to the session random number ciphertext, the session random number, the authentication sequence number and the specified salt.

[0064] In this embodiment, the terminal calculates the terminal session random number ciphertext Xsc=RscXORHASH(ENC(ID||Rac||Ras||Asnc, Key)||Salt 3), where ENC indicates encryption using the original key, the encrypted ciphertext is added with Salt 3, and then a digest algorithm is used to generate a digest, and the digest is XORed with the terminal session random number to obtain the final ciphertext; the terminal sends an authentication confirmation containing the terminal authentication digest Hac and the terminal session random number ciphertext Xsc to the server, and the communication server transfers the authentication confirmation to the security server for processing; the server calculates the server session random number ciphertext Xss=RssX0 RHASH(ENC(ID||Rac||Ras||Asnc,Key)||Salt4); the server calculates and obtains the terminal session random number Rsc'=XscXORHASH(ENC(ID||Rac||Ras||Asnc,Key)||Salt3); 17) The server calculates and stores: session key SKey=HASH(Rsc'||Rss||Asnc||Salt5), session sequence number Snc||Sns=HASH(Rsc||Rss'||Asnc||Salt6), where Snc and Sns are respectively composed of partial bytes extracted from the digest result. The communication server sends the server session random number ciphertext Xss to the terminal. The terminal calculates and obtains the server session random number Rss' = XssXORHASH(ENC(ID||Rac||Ras||Asnc,Key)||Salt4). The terminal calculates and stores the session key SKey = HASH(Rsc||Rss'||Asnc||Salt5) and the session sequence number Snc||Sns = HASH(Rsc||Rss'||Asnc||Salt6). Because the same digest data is used as the server, the session key and sequence number calculated by the terminal are exactly the same as those calculated by the server. The terminal enters the authentication success state and can send application data at any time.

[0065] The session key encryption used in the present invention can be replaced by the original key encryption original intermediate block, or can be generated by splicing part of the bytes of the digest algorithm result of the session key, or by its multi-byte XOR operation; using the byte splicing of the session random number, or by its multi-byte XOR operation; using the byte XOR operation of the digest algorithm result (session random number) of the authentication serial number and the session key; using the XOR operation or digest composition of any combination of the authentication random number and the above three types of data to improve convenience.

[0066] Furthermore, both parties use their own generated session random numbers to generate session keys. The session random number is not directly encrypted and transmitted using the key. Instead, it is sent as an intermediate block after performing an XOR operation with the session random number. The intermediate block is generated by encrypting and digesting the authentication random numbers, device ID, authentication serial number, and salt of both parties. The actual session key is not directly concatenated from the session random numbers of both parties, but is derived by applying a digest algorithm to the session random number, authentication serial number, and salt. The key exchange process does not directly encrypt data with the original key, but rather uses its digest result, which is more secure. The use of the session key and session serial number can verify data integrity and ensure data resistance to replay attacks.

[0067] In one embodiment, step S300 includes:

[0068] During data transmission, integrity check data is generated based on the transmitted data and its length;

[0069] Encrypt the sent data according to the integrity check data and the device ID to generate encrypted data;

[0070] Data transmission encryption and data integrity verification are performed based on the integrity verification data and the encrypted data to complete the communication.

[0071] In this embodiment, first, prepare to send data Bc0 and let Bc = Snc || Bc0. Snc is the session serial number of the terminal, and || represents byte string concatenation; generate integrity check data HBc = HASH(Len || ID || Bc || salt7). HBc is obtained by reducing the digest result as needed. The reduction method can be extracting partial bytes, performing exclusive OR calculation on multiple bytes, performing addition and subtraction operations on multiple bytes, etc. Len represents the length of Bc; generate encrypted data DBc = ENC(Bc || HBc, Skey); send a data packet containing ID and DB to the server; the communication server verifies the ID and authentication status. If the ID is not registered or this ID is not in the authenticated state, discard the data packet; decrypt the data Bc' = DEC(DBc, Skey), and extract Bc' = Snc' || Bc0' and HBc from Bc'. Verify the legality of Snc'. Compare Snc’ with the SncLast sent by the device last time. If they are the same, the data is retransmitted data. If Snc’ is larger, it is new data. If Snc’ is smaller, the data packet is illegal and discarded; generate integrity data: HBc' = HASH(Len || ID || Bc' || salt7); compare Hbc' and Hbc. If they are equal, proceed to the next step. Otherwise, discard the data; parse and process Bc': save the new Snc’, and process the Bc0 data; generate response data Ac0; let Ac = Snc' || Ac0, where Snc’ is the same as that sent by the device. Generate integrity data: HAc = HASH(Len || ID || Ac || salt8). Len represents the length of Ac; generate encrypted data: DAc = ENC(Ac || HAc, Skey); send the response data for keep-alive DAc to the device; decrypt the data Ac' = DEC(DAc, Skey), and extract Ac' = Snc' || Ac0' and HAc from Ac'. Compare Snc' and Snc. If they are different, the data is illegal data, directly discard it and attempt to retransmit the data; generate integrity data: Hac' = HASH(Len || ID || Ac' || salt8), where Len is the length of Ac'; compare Hac' and Hac. If they are different, there is a problem with data integrity, directly discard it and attempt to retransmit the data; process the Ac0' data, increment Snc by 1, and complete the communication. The communication process only shows that the terminal actively sends data to the server. The process of the server actively sending data to the terminal is similar, except that different session serial numbers are used.

[0072] The integrity data used in this invention can also be implemented by filling an original intermediate block containing the length of the transmitted data, the device ID, the session sequence number, and the data to be transmitted. This is first encrypted using the session key, and then the encryption result is digested using a digest algorithm to obtain the integrity data. If necessary, the digest result can be reduced to a shorter, appropriate length using a multi-byte XOR calculation. The integrity data can be directly appended to the data packet for transmission, or it can be encrypted again along with the data to be transmitted.

[0073] Another embodiment of the present invention provides an identity authentication and key exchange device, as shown in FIG2 , wherein the device 1 includes:

[0074] Request module 11, used to obtain the authentication serial number, authentication random number and session random number generated by the terminal device, and initiate an authentication request;

[0075] The authentication module 12 is used to process the authentication request and determine whether it complies with the preset authentication policy based on the authentication serial number, authentication random number and session random number;

[0076] The communication module 13 is used to authenticate successfully if the preset authentication policy is met, and to perform data transmission encryption and data integrity verification after the authentication is completed to complete the communication.

[0077] The module referred to in the present invention refers to a series of computer program instruction segments that can perform specific functions. It is more suitable for describing the execution process of identity authentication and key exchange than a program. For the specific implementation of each module, please refer to the corresponding method embodiment above, which will not be repeated here.

[0078] Another embodiment of the present invention provides an identity authentication and key exchange system. As shown in FIG3 , the system 10 includes:

[0079] One or more processors 110 and memory 120. FIG3 takes one processor 110 as an example for introduction. The processor 110 and the memory 120 may be connected via a bus or other means. FIG3 takes the bus connection as an example.

[0080] The processor 110 is used to implement various control logics of the system 10. It can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), a single-chip microcomputer, an ARM (Acorn RICS Machine) or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or any combination of these components. In addition, the processor 110 can also be any traditional processor, microprocessor, or state machine. The processor 110 can also be implemented as a combination of computing devices, for example, a combination of a DSP and a microprocessor, multiple microprocessors, one or more microprocessors combined with a DSP, and / or any other such configuration.

[0081] Memory 120, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules, such as program instructions corresponding to the identity authentication and key exchange methods in the embodiments of the present invention. Processor 110 executes the non-volatile software programs, instructions, and modules stored in memory 120 to execute various functional applications and data processing of system 10, thereby implementing the identity authentication and key exchange methods in the above-described method embodiments.

[0082] Memory 120 may include a program storage area and a data storage area. The program storage area may store an operating system and application programs required for at least one function; the data storage area may store data created based on the use of system 10, etc. In addition, memory 120 may include high-speed random access memory and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other non-volatile solid-state storage device. In some embodiments, memory 120 may optionally include memory remotely located relative to processor 110, and such remote memory may be connected to system 10 via a network. Examples of such networks include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0083] An embodiment of the present invention provides a non-volatile computer-readable storage medium storing computer-executable instructions. The computer-executable instructions are executed by one or more processors, for example, to execute steps S100 to S300 of the method described above in FIG. 1 .

[0084] As an example, non-volatile storage media can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) as external cache memory. By way of illustration and not limitation, RAM can be obtained in many forms such as synchronous RAM (SRAM), dynamic RAM, (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), Synchlink DRAM (SLDRAM), and direct Rambus RAM (DRRAM). The disclosed memory components or memories of the operating environment described herein are intended to include one or more of these and / or any other suitable types of memory.

[0085] In summary, the present invention discloses an identity authentication and key exchange method, device, system and medium. The method obtains the authentication serial number, authentication random number and session random number generated by the terminal device and initiates an authentication request; processes the authentication request and determines whether it complies with the preset authentication policy based on the authentication serial number, authentication random number and session random number; if it complies with the preset authentication policy, the authentication is successful. After the authentication is completed, data encryption and data integrity verification are performed to complete the communication.

[0086] Of course, those skilled in the art will appreciate that all or part of the processes in the above-described method embodiments can be implemented by instructing related hardware (such as a processor, controller, etc.) through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes in the above-described method embodiments. The storage medium can be a memory, a magnetic disk, a floppy disk, a flash memory, an optical storage device, etc.

[0087] It should be understood that the application of the present invention is not limited to the above examples. For those skilled in the art, improvements or changes can be made based on the above description. All these improvements and changes should fall within the scope of protection of the claims attached to the present invention.

Claims

1. An identity authentication and key exchange method, characterized in that: include: Obtain the authentication serial number, authentication random number, and session random number generated by the terminal device, and initiate an authentication request; Process the authentication request and determine whether it complies with the preset authentication policy based on the authentication serial number, authentication random number and session random number; If the preset authentication policy is met, the authentication is successful. After the authentication is completed, data transmission encryption and data integrity verification are performed to complete the communication.

2. The identity authentication and key exchange method according to claim 1, characterized in that: Before obtaining the authentication serial number, authentication random number, and session random number generated by the terminal device and initiating the authentication request, the method further includes: Generate device ID and authentication serial number and send them to the server to initialize the terminal device; Generate a key based on the initialized device ID and authentication serial number for burning and storing.

3. The identity authentication and key exchange method according to claim 1, characterized in that: The processing of the authentication request and determining whether it complies with the preset authentication policy based on the authentication serial number, the authentication random number, and the session random number include: When the authentication serial number is not of the timestamp type, the validity of the authentication serial number is determined by comparing the old and new authentication serial numbers. When the authentication serial number is of a timestamp type, whether the authentication serial number is legal is determined by comparing whether the difference between the timestamps is less than a specified time difference.

4. The identity authentication and key exchange method according to claim 1, characterized in that: The processing of the authentication request and determining whether it complies with the preset authentication policy based on the authentication serial number, the authentication random number, and the session random number include: Calculate the authentication digest using a digest algorithm based on the terminal ID, the authentication random number, the authentication serial number, and the specified salt; Determine whether the authentication summary complies with the authentication policy; if so, the authentication is successful.

5. The identity authentication and key exchange method according to claim 1, characterized in that: The processing of the authentication request and determining whether it complies with the preset authentication policy based on the authentication serial number, the authentication random number, and the session random number include: Calculate the authentication digest using a digest algorithm based on the terminal ID, the authentication random number, the authentication serial number, and the specified salt; Performing an XOR operation on the authentication digest and the session random number to generate a ciphertext of the session random number; A session key and a session sequence number are generated according to the session random number ciphertext, the session random number, the authentication sequence number and the specified salt.

6. The identity authentication and key exchange method according to claim 1, characterized in that: If the preset authentication policy is met, the authentication is successful. After the authentication is completed, data transmission encryption and data integrity verification are performed to complete the communication, including: During data transmission, integrity check data is generated based on the transmitted data and its length; Encrypt the sent data according to the integrity check data and the device ID to generate encrypted data; Data transmission encryption and data integrity verification are performed based on the integrity verification data and the encrypted data to complete the communication.

7. The identity authentication and key exchange method according to claims 1-6, characterized in that: The terminal device and the server perform mutual authentication and communication.

8. An identity authentication and key exchange device, characterized in that: include: The request module is used to obtain the authentication serial number, authentication random number and session random number generated by the terminal device and initiate an authentication request; An authentication module is used to process the authentication request and determine whether it complies with the preset authentication policy based on the authentication serial number, authentication random number and session random number; The communication module is used to authenticate successfully if the preset authentication policy is met, and to perform data transmission encryption and data integrity verification after the authentication is completed to complete the communication.

9. An identity authentication and key exchange system, characterized in that: The system includes at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the identity authentication and key exchange method described in any one of claims 1 to 7.

10. A non-volatile computer-readable storage medium, characterized in that: The non-volatile computer-readable storage medium stores computer-executable instructions, which, when executed by one or more processors, enable the one or more processors to execute the identity authentication and key exchange method described in any one of claims 1 to 7.