A multi-session design system and operation method based on IPSEC

By designing a multi-session design system based on IPSEC and using FPGA to realize the high bandwidth rate of IPSEC communication, it solves the problem of being unable to independently handle multiple sessions in the existing technology, realizes independent encryption and decryption data transmission of multiple source and destination IPs, and improves the efficiency of Accuracy and security of data transmission.

CN118540159BActive Publication Date: 2024-10-29ZHEJIANG LAB
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410996037.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-24
Publication Date
2024-10-29
Estimated Expiration
2044-07-24

AI Technical Summary

Technical Problem

Existing IPSEC data transmission technology cannot process multiple sessions independently, resulting in the inability to support more sessions and higher bandwidth requirements. At the same time, due to software implementation reasons, the bandwidth rate is low.

Method used

A multi-session design system based on IPSEC is designed, including a form module, an encapsulation module, a decapsulation module, an encryption module, a decryption module, a verification module and an arbitration module. It uses FPGA to implement encryption and decryption, and supports the independence of multiple source and destination IPs. Session processing, using AES encryption and MD5 verification algorithms, supports multiple encapsulation and decapsulation modes.

Benefits of technology

It realizes independent encryption and decryption data transmission between multiple source and destination IPs, ensuring the accuracy, security and reliability of data transmission, and improving the bandwidth rate of IPSEC communication.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118540159B_ABST
    Figure CN118540159B_ABST
Patent Text Reader

Abstract

The present invention provides a multi-session design system and operation method based on IPSEC. The system comprises: a form module, an encapsulation module, a decapsulation module, an encryption module, a decryption module, a verification module, a miscellaneous packet processing module and an arbitration module. The form module is used to adjust the IPSEC read and write rate and query the form to obtain SA related information. The encapsulation module encapsulates the received IP message into the IPSEC message format. The decapsulation module decapsulates the received IPSEC message into a normal IP message. Then the encryption module encrypts the message. The decryption module is used to decrypt the message. The encryption and decryption adopts the commonly used AES algorithm. The verification module adopts the commonly used MD5 verification for data signature to prevent data from being tampered. Finally, the miscellaneous packet processing module directly filters non-IP messages. The present invention adopts the commonly used AES encryption and decryption to ensure the accuracy, real-time and reliability of data transmission. At the same time, it realizes the separate processing of messages of different source and destination IPs, ensures high-speed data transmission, and realizes multi-session design.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of control, and in particular to an IPSEC-based multi-session design system and an operation method. Background Art

[0002] The IPSEC protocol (Internet Protocol Security) is a group of secure communication protocols based on the network layer and applied cryptography. It provides flexible security services for network layer traffic in the IPV4 and IPV6 environments. The IPSEC protocol is a secure virtual private network implemented at the IP layer based on the IPSec protocol family. It ensures the security of OSI upper layer protocol data by inserting a predefined header into the data packet. It is mainly used to protect TCP, UDP, ICMP and tunnel IP data packets.

[0003] At present, as more and more devices access application systems at high speeds, the network is required to be able to perform more detailed classification for different IP messages, and to support more sessions and higher bandwidth. In the original IPSEC design, the SPD form is used to store IPSEC traffic rules. These rules are used to indicate which traffic needs to go through IPSEC. The source and destination IP, source and destination port number, and protocol type are used to distinguish the type of message. The original IPSEC SAD form is used to store encryption and decryption algorithm types and keys, verification algorithm types and keys, protocol types and other parameters. The SAD form uses the SPI value as an index. Most of these SPI values ​​are random values ​​generated by both communicating parties. Since the SPI value is random, there is no way to independently process multiple sessions according to specific rules.

[0004] At the same time, since most of the existing IPSEC data transmission technologies are implemented using software and have a low bandwidth rate, the present invention uses FPGA to implement, which greatly increases the bandwidth of IPSEC communication. Further searches have not found any literature reports on multi-session designs for IPSEC. Summary of the invention

[0005] In view of the deficiencies of the prior art, in order to solve the problem that the existing IPSEC data transmission cannot independently process different sessions, the present invention proposes a multi-session design system and operation method based on IPSEC.

[0006] The technical solution of the present invention is as follows:

[0007] The first aspect of the present invention is a multi-session design system based on IPSEC, the system comprising: a form module, an encapsulation module, a decapsulation module, an encryption module, a decryption module, a verification module, a miscellaneous packet processing module and an arbitration module:

[0008] The form module is used to adjust the reading and writing speed of IPSEC messages and query the form to obtain SA related information;

[0009] The encapsulation module is used to encapsulate the received IP message into an IPSEC message format;

[0010] The decapsulation module is used to decapsulate the received IPSEC message into a normal IP message;

[0011] The encryption module is used to encrypt the message data into garbled code for transmission;

[0012] The decryption module is used to restore the garbled data into a normal message;

[0013] The verification module is used to prevent data from being tampered with;

[0014] The miscellaneous packet processing module is used for directly transparently transmitting non-IP messages;

[0015] The arbitration module is used to encrypt the data of the part, decrypt the data of the part and the data of the miscellaneous packet module.

[0016] And the data is evenly arbitrated and transmitted.

[0017] Furthermore, the format of the IPSEC message has a total of 6 fields. The first field has 14 bytes for the MAC header, which is used to indicate the source and destination MAC addresses and TYPE. The second field has 20 bytes for the newly added IP header, which is used to indicate the source and destination IP information of this message. The third field has 8 bytes for the ESP header, of which 4 bytes are SPI values ​​and 4 bytes are sequence numbers. The fourth field is the data field, which is the specific information of data transmission; the fifth field is the ESP tail, which consists of two parts, namely the padding length and the next header. The sixth field is the verification data, which is used to prevent data tampering.

[0018] Furthermore, the form module includes a sender SPD form, a sender SAD form, a receiver SPD form, a receiver SAD form and a session number form; the sender SPD form index is the source IP, destination IP and protocol number, and the form content is the protocol operation mode, session number, packet processing method, security protocol type, SPI value and destination IP address; the sender SAD form index is SPI, and the form content is SA lifetime, IPSec protocol operation mode, encryption algorithm, key, initialization vector, verification algorithm, key and path maximum transmission unit PMTU; the receiver SPD form index is the source IP, destination IP and protocol number, and the form content is protocol Operation mode, session number, packet processing method, security protocol type, SPI value and destination IP address; the receiving end SAD form index is SPI, and the form content is SA lifetime, IPSec protocol operation mode, encryption algorithm, key, initialization vector, verification algorithm, key and path maximum transmission unit PMTU; the session number form index is session number, and the form content is initialization SPI value, update SPI value and sequence number value; because the multi-session design supports separate sessions with multiple source and destination IPs, the session number form index is session number, and the form content is initial SPI, updated SPI value and sequence number, and the initial SPI value and sequence number are different for different session numbers.

[0019] Furthermore, the encapsulation module is used to encapsulate the original IP message into an IPsec message. When an IP message is received, the message is stored in a FIFO, and then a checksum check is performed on the IP message. The message that passes the check generates a new AH header, ESP header and ESP tail according to different security protocols. The message that fails the check is directly discarded. Finally, the encrypted message is encapsulated with the AH header or ESP header, ESP tail and verification data and sent to the next module. The encapsulation module includes four encapsulation modes: AH protocol transmission mode, AH protocol tunnel mode, ESP protocol transmission mode and ESP protocol tunnel mode.

[0020] Furthermore, the decapsulation module is used to decapsulate the IPSEC message into a normal IP message. When the IPSEC message is received, it is first stored in FIFO, and then the message is verified using an anti-replay design to prevent the occurrence of attack messages. After the verification is correct, the positions of the new IP header, ESP header, ESP tail, and AH header are obtained by querying a form, and finally the new IP header, ESP header, ESP tail, and AH header are stripped to obtain a new IP message. After a verification error occurs, the message is directly discarded, and finally the IP message is passed to an upper layer; the decapsulation module includes four decapsulation modes: AH protocol transmission mode, AH protocol tunnel mode, ESP protocol transmission mode, and ESP protocol tunnel mode.

[0021] Furthermore, the encryption module adopts AES encryption to encrypt the IP message into garbled code for transmission; the decryption module adopts AES decryption to decrypt the received encrypted data and restore it into a normal IP message.

[0022] Furthermore, the arbitration module will eventually aggregate the encrypted data, the decrypted data and the data of the miscellaneous packet module into the arbitration module, and the arbitration module will eventually evenly arbitrate the data and transmit it out.

[0023] Furthermore, the verification module adopts the MD5 verification algorithm, which can transform a "byte string" of any length into a 128-bit large integer and is an irreversible string transformation algorithm.

[0024] Furthermore, when the miscellaneous packet processing module receives a non-IP packet, the system does not perform any processing and directly transmits the message.

[0025] An operating method of a multi-session design system based on IPSEC, the method comprising the following steps:

[0026] (1) Adjust the IPSEC read and write rates and query the form to obtain SA-related information of the message;

[0027] (2) When IPSEC encryption is performed, query the session number table;

[0028] (3) When IPSEC encrypts a message, the IP message needs to be encapsulated into the IPSEC message format;

[0029] (4) When performing IPSEC decryption on a message, it is necessary to decapsulate the message into a normal IP message format; when performing IPSEC encryption on a message, the message of the corresponding field is encrypted; when performing IPSEC decryption on a message, the message of the corresponding field is decrypted;

[0030] (5) After encryption and decryption are completed, the encrypted data, the decrypted data, and the miscellaneous packet processing data of the non-IP message are summarized, and the data is balanced and arbitrated, and the data is verified to prevent the data signature from being tampered with;

[0031] The specific process of encryption and decryption is as follows:

[0032] S1: After receiving the message, first check the SPD table according to the source IP address, destination IP address and protocol number in the IP header to find out the required packet processing result and encapsulation protocol mode. If the packet processing result is 0, the packet is discarded; 1 is transparent transmission; 2 is IPSEC encryption and decryption;

[0033] S2: Query the updated SPI value and sequence number according to the initial SPI value and session number, and fill them into the ESP header or AH header to be generated;

[0034] S3: When the AH protocol transmission mode is obtained through query, an AH header is generated, the SAD table is queried to obtain the verification algorithm and key, the IP header, AH header and data are verified to obtain the verification data, and the verification data is filled into the AH header. Finally, the IP header, AH header and data are spliced ​​and transmitted;

[0035] S4: When the query results in the AH tunnel protocol mode, a new IP header and AH header are generated, the SAD table is queried to obtain the verification algorithm and verification key, the new IP header, AH header, old IP header and data are verified to obtain verification data, and finally the verification data is filled into the AH header, and the new IP header, AH header, old IP header and data are sent out;

[0036] S5: When the query is in ESP transmission protocol mode, ESP data, i.e., ESP header, is generated; the SAD table is queried to obtain the encryption algorithm, encryption key, encryption initial vector, verification algorithm, and verification key; the data and ESP tail are encrypted; the ESP header, encrypted data, and ESP tail are verified to obtain verification data; finally, the IP header, ESP header, encrypted data, ESP tail, and verification data are transmitted;

[0037] S6: When the query is in ESP tunnel protocol mode, a new IP header, ESP header and ESP tail are generated, the SAD table is queried to obtain the encryption algorithm, encryption key, encryption initial vector, verification algorithm and verification key, the IP header, data and ESP tail are encrypted, the ESP header, IP header, encrypted data and ESP tail are verified to obtain the verification result, and finally the new IP header, ESP header, IP header, encrypted data, ESP tail and verification data are sent out;

[0038] The decryption process is specifically as follows:

[0039] S7: After receiving the message, first check the SPD table according to the source IP address, destination IP address and protocol number in the IP header to find out the required packet processing result and encapsulation protocol mode. If the packet processing result is 0, the packet is discarded; 1 is transparent transmission; 2 is IPSEC encryption and decryption;

[0040] S8: When the AH protocol transmission mode is obtained through query, the location of the AH header is obtained, and the verification data is extracted. The SAD table is queried to obtain the verification algorithm and verification key. After the data is verified, it is compared with the verification data in the AH header. Finally, the AH header is split and the IP header and data are sent out.

[0041] S9: When the AH protocol tunnel mode is found, the location of the new IP header and AH header is obtained, the SAD table is queried, the verification algorithm and verification key are obtained, and after the data is verified, it is compared with the verification data in the AH header, and finally the IP header and data are sent out;

[0042] S10: When the ESP protocol transmission mode is queried, the positions of the ESP header and the ESP tail are obtained, the SAD table is queried to obtain the encryption and decryption algorithm, encryption and decryption key, encryption and decryption initialization vector, verification algorithm and verification data, the data and the ESP tail are decrypted, and the ESP header and the decrypted data are verified, and the verification data is compared with the verification data in the last message, and finally the IP header and the data are sent out;

[0043] S11: When the ESP protocol tunnel mode is queried, the positions of the new IP header, ESP header, and ESP tail are obtained, and then the SAD table is queried to obtain the encryption and decryption algorithm, encryption and decryption key, encryption and decryption initialization vector, verification algorithm, and verification data, and the IP header, data, and ESP tail are decrypted, and the ESP header, IP header, data, and ESP tail are verified, and the verification result is compared with the verification result in the message, and finally the IP header and data are sent out.

[0044] The beneficial effects of the present invention are as follows:

[0045] The multi-session design method of IPSEC of the present invention supports independent encryption and decryption data transmission between multiple source IPs and destination IPs, and ensures the accuracy, security and reliability of data transmission. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] Figure 1 A schematic diagram of the structure of a multi-session design method for IPSEC of the present invention;

[0047] Figure 2 It is a schematic diagram of the message format of IPSEC AH transmission mode of the present invention;

[0048] Figure 3 It is a schematic diagram of the message format of IPSEC AH tunnel mode of the present invention;

[0049] Figure 4 It is a schematic diagram of the message format of IPSEC ESP transmission mode of the present invention;

[0050] Figure 5 It is a schematic diagram of the message format of IPSEC ESP tunnel mode of the present invention;

[0051] Figure 6 It is a schematic diagram of the SPD form of the present invention;

[0052] Figure 7It is a schematic diagram of the SAD form of the present invention;

[0053] Figure 8 A schematic diagram of a session number form of the present invention;

[0054] Fig. 9 AH header format schematic diagram of the present invention;

[0055] Fig.10 It is a schematic diagram of the ESP format of the present invention;

[0056] Fig.11 This is a schematic diagram of the new IP header format of the present invention;

[0057] Fig.12 It is a data flow chart of the encapsulation module of the present invention;

[0058] Fig.13 It is a data flow chart of the decapsulation module of the present invention. DETAILED DESCRIPTION

[0059] In order to make the purpose, technical scheme and technical effect of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and preferred embodiments. It should be understood that the specific implementation methods described herein are only used to explain the present invention and are not intended to limit the present invention.

[0060] like Figure 1 As shown, the present invention proposes an operation method based on a multi-session design of IPSEC, comprising: a form module, an encapsulation module, a decapsulation module, an encryption module, a decryption module, a verification module, a miscellaneous packet processing module and an arbitration module, wherein the form module is used to adjust the IPSEC read and write rate and query the form to obtain SA related information, the encapsulation module is used to encapsulate the received IP message into an IPSEC message format, the decapsulation module is used to decapsulate the received IPSEC message into a normal IP message, the encryption module encrypts the received message data into garbled code for transmission, the decryption module restores the garbled code data into a normal message, the encrypted part of the data, the decrypted part of the data and the miscellaneous packet processing data are finally summarized to the arbitration module, and the arbitration module finally balances and arbitrates the data and transmits the data; the verification module is used to verify the data signature to prevent the data from being tampered with by using the commonly used MD5, MD5 can transform a "byte string" of any length into a large integer of 128 bits, and is an irreversible string transformation algorithm; the miscellaneous packet processing module is used to directly transparently transmit non-IP messages, that is, the system does not do any processing and directly transmits the message; the encryption module and the decryption module use the commonly used AES encryption and decryption.

[0061] The form module includes: a sender SPD (Security Policy Database) form, a sender SAD (Security Association Database) form, a receiver SPD form, a receiver SAD form and a session number form. The sender SPD form and the receiver SPD form have the same format, and the sender SAD form and the receiver SAD form have the same format.

[0062] like Figure 6 As shown, the sender SPD table index is the source IP, destination IP and protocol number, and the table content is the protocol operation mode, session number, packet processing method, security protocol type, SPI value and destination IP address; the source IP field segment length is 32 bits, which is the IP address of the message initiator, the destination IP field segment length is 32 bits, which is the destination IP address of the message, the protocol number field segment length is 8 bits, which is the protocol number of the message, the protocol operation mode field segment length is 2 bits, 0 represents the transmission mode, 1 represents the tunnel mode, the session number field segment length is 8 bits, which is the session in which the current message is located, the packet processing field segment length is 2 bits, 0 represents discarding, 1 represents transparent transmission, 2 represents IPSEC encryption and decryption, the security protocol field segment length is 2 bits, 0 represents AH encapsulation protocol, 1 represents ESP encapsulation protocol, the SPI field segment length is 32 bits, security index, 32 bits. 0~255 is reserved, and 256~2^32–1 is available. The destination IP address field segment length is 32 bits, which is the IP address of the next hop IPSEC router.

[0063] like Figure 7As shown in the figure, the sender SAD table index is SPI (Security Parameters Index), and the table content is SA (Security Association) lifetime, IPSec protocol operation mode, encryption algorithm, key, initialization vector, verification algorithm, key and path maximum transmission unit (PMTU); the session number table index is session number, and the table content is initialization SPI value, update SPI value and sequence number value; the SPI field length is 32 bits, security index, 32 bits, 0~255 reserved, available as 256~2^32 – 1. The SA lifetime field length is 11 bits, which represents the maximum time that each SA can exist. SA cannot be used after this time has passed; the default is 12h, i.e. 43200; the IPSec protocol operation mode field is 2 bits, 0 represents the transport mode, 1 represents the tunnel mode, the encryption algorithm field length is 3 bits, 0 represents the AES encryption and decryption algorithm, the encryption algorithm key field length is 128 bits, used to store the encryption algorithm key, the encryption algorithm initialization vector field length is 32 bits, used to store the encryption algorithm initialization vector, the verification algorithm field length is 3 bits, 0 represents the MD5 verification algorithm, the verification algorithm key field length is 128 bits, used to store the verification algorithm key, the path maximum transmission unit field length is 11 bits, each IP packet is up to a certain length of bytes, if it exceeds this length without fragmentation, the packet will be dropped. The default is 1500 bytes.

[0064] like Figure 8 As shown, the session number form index is the session number and the initial SPI value, the form content is the updated SPI value and the serial number, the session number field length is 8 bits, the initial SPI value field length is 32 bits, the updated SPI value length is 32 bits, and the serial number field length is 32 bits.

[0065] The encapsulation module is used to encapsulate the original IP message into an IPsec message. When an IP message is received, the message is stored in the FIFO, and then a header checksum is performed on the IP message. The message that passes the check generates a new AH header, ESP header and ESP tail according to different security protocols, and the message that fails the check is directly discarded. Finally, the encrypted message is encapsulated with the AH header or ESP header, ESP tail and verification data and sent to the next module.

[0066] The encapsulation module includes four encapsulation modes: AH protocol transmission mode, AH protocol tunnel mode, ESP protocol transmission mode and ESP protocol tunnel mode. The AH (Authentication Header) is an authentication header protocol; the ESP (Encapsulating Security Payload) is an encapsulating security payload.

[0067] like Figure 2 As shown, the AH protocol transmission mode needs to add an AH header, and the composition of the AH header is as follows Fig. 9 As shown, the next header field length is 8 bits, the encrypted data type: the protocol of the data part; the payload length field length is 8 bits, in units of 4 bytes, excluding the length of SPI and sequence number; the reserved field length is: 16 bits; all are set to 0 in the implementation, the SPI field length is 32 bits: security index; the sequence number field length is 32 bits, representing the current message is the number of the message in the session. The verification data field length of the present invention is 128 bits.

[0068] like Figure 3 As shown, the AH protocol tunnel mode needs to add a new IP header and AH header. The composition of the new IP header is as follows Fig.11 As shown, the version field is 4 bits long: it refers to the version number of the IP protocol. The current main versions are IPV4 and IPV6. IPV4 is 4 and IPV6 is 6, which are the same as the old IP header. The header length field is 4 bits, which refers to the length of the IP header, which is 20 bytes by default and has a length of 5; the service type field is 8 bits, which is the same as the old IP header; the total length field is 16 bits long, which refers to the total length of the message. Note that the unit here is bytes, not 4 bytes, so the maximum length of an IP message is 65535 bytes. The total length is the length of the old IP header + the new IP header (20) + ESP header (8 bytes) + ESP tail (4 bytes) + verification data (16 bytes); the identification field is 16 bits long, which is the same as the old IP header; the flag field is 3 bits long, which is the same as the old IP header; the fragment offset field is 13 bits long, which is the same as the old IP header. The length of the lifetime field is 8 bits, the same as the old IP header; the length of the protocol field is 8 bits, 50 represents the ESP protocol; the length of the header checksum field is 16 bits. The length of the source IP address field is 32 bits; the length of the destination IP address field is 32 bits.

[0069] like Figure 4 As shown, the ESP protocol transmission mode needs to add ESP header, ESP tail and ESP verification data. The composition of ESP header, ESP tail and ESP verification data is as follows: Fig.10As shown, SPI: security index, 32 bits; 0~255 reserved, available as 256~2^32 – 1; sequence number field length is 32 bits; payload data field length is 32 bits; padding field length is variable, the padded length is a multiple of 32 bits, generally filled with 0; padding length field is 8 bits, indicating the padding field length in bytes, the field length range is 0-255, used to expand the plaintext to the length required for encryption, while hiding the true length of the payload data. The next header field length is 8 bits, the encrypted data type: that is, the protocol of the data part; 6 represents TCP protocol, the value is 4, represents IP-in-IP, 17 (UDP), 50 (ESP protocol); the verification data field length is 128 bits, including verification data.

[0070] like Figure 5 As shown, the ESP protocol tunnel mode needs to add a new IP header, ESP header, ESP tail and ESP verification data, wherein the format is as described above.

[0071] An encryption process of an IPSEC multi-session design method is as follows: Fig.12As shown: after receiving the message, first check the SPD table according to the source IP address, destination IP address and protocol number in the IP header, query the required packet processing results and encapsulation protocol mode, query the packet processing result if it is 0, then the packet is lost, 1 is transparent transmission, 2 is IPSEC encryption and decryption, then query the updated SPI value and sequence number according to the initial SPI value and session number, and fill it into the ESP header and AH header to be generated later. When the AH protocol transmission mode is obtained through the query, the AH header is generated, the SAD table is queried to obtain the verification algorithm and key, the IP header + AH header + data are verified to obtain the verification data, and filled into the AH header, and finally the IP header + AH header + data are spliced ​​and transmitted. When the query results in the AH tunnel protocol mode, a new IP header and AH header are generated, the SAD table is queried to obtain the verification algorithm and verification key, the new IP header + AH header + old IP header + data are verified to obtain the verification data, and finally the verification data is filled into the AH header, and the new IP header + AH header + old IP header + data are sent out. When the query is in ESP transmission protocol mode, ESP data, i.e., ESP header, is generated; the SAD form is queried to obtain the encryption algorithm, encryption key, encryption initial vector, verification algorithm, and verification key, the data + ESP tail is encrypted, the ESP header + encrypted data + ESP tail is verified to obtain verification data, and finally the IP header + ESP header + encrypted data + ESP tail + verification data is transmitted. When the query is in ESP tunnel protocol mode, a new IP header, ESP header, and ESP tail are generated, the SAD form is queried to obtain the encryption algorithm, encryption key, encryption initial vector, verification algorithm, and verification key, the IP header + data + ESP tail is encrypted, the ESP header + IP header + encrypted data + ESP tail is verified to obtain the verification result, and finally the new IP header + ESP header + IP header + encrypted data + ESP tail + verification data is sent out.

[0072] The decryption process of an IPSEC multi-session design method is as follows: Fig.13As shown: After receiving the message, first check the SPD table according to the source IP address, destination IP address and protocol number in the IP header, and query the required packet processing results and encapsulation protocol mode. If the query packet processing result is 0, the packet is lost, 1 is transparent transmission, and 2 is IPSEC encryption and decryption. When the AH protocol transmission mode is obtained through the query, the location of the AH header is obtained, and the verification data is extracted. The SAD table is queried to obtain the verification algorithm and verification key. After the data is verified, it is compared with the verification data in the AH header. Finally, the AH header is split and the IP header + data is sent out. When the AH protocol tunnel mode is queried, the location of the new IP header and AH header is obtained, the SAD table is queried to obtain the verification algorithm and verification key. After the data is verified, it is compared with the verification data in the AH header, and finally the IP header + data is sent out. When the ESP protocol transmission mode is queried, the location of the ESP header and ESP tail is obtained, and the SAD form is queried to obtain the encryption and decryption algorithm, encryption and decryption key, encryption and decryption initialization vector, verification algorithm and verification data, and the data + ESP tail is decrypted, and the ESP header + decrypted data is verified, and the verification data is compared with the verification data in the last message, and finally the IP header + data is sent out. When the ESP protocol tunnel mode is queried, the location of the new IP header, ESP header, and ESP tail is obtained, and then the SAD form is queried to obtain the encryption and decryption algorithm, encryption and decryption key, encryption and decryption initialization vector, verification algorithm and verification data, and the IP header + data + ESP tail is decrypted, and the ESP header + IP header + data + ESP tail is verified, and the verification result is compared with the verification result in the message to determine that the data signature data has not been tampered with; finally, the IP header + data is sent out.

[0073] Those skilled in the art can understand that the above are only preferred examples of the invention and are not intended to limit the invention. Although the invention is described in detail with reference to the above examples, those skilled in the art can still modify the technical solutions recorded in the above examples or replace some of the technical features therein with equivalents. Any modification, equivalent replacement, etc. made within the spirit and principle of the invention shall be included in the protection scope of the invention.

Claims

1. A multi-session design system based on IPSEC, characterized in that: The system includes: a form module, an encapsulation module, a decapsulation module, an encryption module, a decryption module, a verification module, a miscellaneous packet processing module and an arbitration module: The form module is used to adjust the reading and writing speed of IPSEC messages and query the form to obtain SA related information; the form module includes a sender SPD form, a sender SAD form, a receiver SPD form, a receiver SAD form and a session number form; the sender SPD form index is the source IP, the destination IP and the protocol number, and the form content is the protocol operation mode, the session number, the packet processing method, the security protocol type, the SPI value and the destination IP address; the sender SAD form index is the SPI, and the form content is the SA lifetime, the IPSec protocol operation mode, the encryption algorithm, the key, the initialization vector, the verification algorithm, the key and the path maximum transmission unit PMTU; the receiver SPD form index is the source IP, The destination IP and protocol number, the form content is the protocol operation mode, session number, packet processing method, security protocol type, SPI value and destination IP address; the receiving end SAD form index is SPI, the form content is SA lifetime, IPSec protocol operation mode, encryption algorithm, key, initialization vector, verification algorithm, key and path maximum transmission unit PMTU; the session number form index is session number, the form content is initialization SPI value, update SPI value and sequence number value; because the multi-session design supports multiple separate sessions with different source and destination IPs, the session number form index is session number, the form content is initial SPI, updated SPI value and sequence number, and the initial SPI value and sequence number are different for different session numbers; The format of the IPSEC message has 6 domains in total. The first domain has 14 bytes for the MAC header, which is used to indicate the source and destination MAC addresses and TYPE. The second domain has 20 bytes for the newly added IP header, which is used to indicate the source and destination IP information of this message. The third domain has 8 bytes for the ESP header, of which 4 bytes are the SPI value and 4 bytes are the sequence number. The fourth domain is the data domain, which is the specific information of data transmission; the fifth domain is the ESP tail, which consists of two parts, namely the padding length and the next header; the sixth domain is the verification data, which is used to prevent data tampering; The encapsulation module is used to encapsulate the received IP message into an IPSEC message format; The decapsulation module is used to decapsulate the received IPSEC message into a normal IP message; The encryption module is used to encrypt the message data into garbled code for transmission; The decryption module is used to restore the garbled data into a normal message; The verification module is used to prevent data from being tampered with; The miscellaneous packet processing module is used for directly transparently transmitting non-IP messages; The arbitration module is used to encrypt the data of the encrypted part, decrypt the data of the decrypted part and the data of the miscellaneous packet module. Balance arbitration and transmit data out.

2. A multi-session design system based on IPSEC according to claim 1, characterized in that: The encapsulation module is used to encapsulate the original IP message into an IPsec message. When an IP message is received, the message is stored in a FIFO, and then a checksum check is performed on the IP message. The message that passes the check generates a new AH header, ESP header and ESP tail according to different security protocols, and the message that fails the check is directly discarded. Finally, the encrypted message is encapsulated with the AH header or ESP header, ESP tail and verification data and sent to the next module. The encapsulation module includes four encapsulation modes: AH protocol transmission mode, AH protocol tunnel mode, ESP protocol transmission mode and ESP protocol tunnel mode.

3. A multi-session design system based on IPSEC according to claim 1, characterized in that: The decapsulation module is used for decapsulating IPSEC messages into normal IP messages. When the IPSEC message is received, it is first stored in FIFO, and then the message is verified by anti-replay design to prevent attack messages. After the verification is correct, the positions of the new IP header, ESP header, ESP tail and AH header are obtained by querying a form, and finally the new IP header, ESP header, ESP tail and AH header are stripped to obtain a new IP message. After the verification is wrong, the message is directly discarded, and finally the IP message is passed to the upper layer; the decapsulation module includes four decapsulation modes: AH protocol transmission mode, AH protocol tunnel mode, ESP protocol transmission mode and ESP protocol tunnel mode.

4. A multi-session design system based on IPSEC according to claim 1, characterized in that: The encryption module adopts AES encryption to encrypt IP messages into garbled codes for transmission; the decryption module adopts AES decryption to decrypt the received encrypted data and restore them into normal IP messages.

5. The multi-session design system based on IPSEC according to claim 1, characterized in that: The arbitration module will eventually aggregate the encrypted data, the decrypted data and the data of the miscellaneous packet module into the arbitration module, and the arbitration module will eventually evenly arbitrate the data and transmit it out.

6. The multi-session design system based on IPSEC according to claim 1, characterized in that: The verification module adopts the MD5 verification algorithm, which can transform a "byte string" of any length into a 128-bit large integer and is an irreversible string transformation algorithm.

7. The multi-session design system based on IPSEC according to claim 1, characterized in that: When the miscellaneous packet processing module receives a non-IP packet, the system does not perform any processing and directly transmits the message.

8. An operating method of a multi-session design system based on IPSEC as described in any one of claims 1 to 7, characterized in that: The method comprises the following steps: (1) Adjust the IPSEC read and write rates and query the form to obtain SA-related information of the message; (2) When IPSEC encryption is performed, query the session number table; (3) When IPSEC encrypts a message, it is necessary to encapsulate the IP message into the IPSEC message format; when IPSEC encrypts a message, the message of the corresponding field is encrypted; (4) When performing IPSEC decryption on a message, it is necessary to decapsulate the message into a normal IP message format; when performing IPSEC decryption on a message, the message of the corresponding field is decrypted; (5) After encryption and decryption are completed, the encrypted data, decrypted data, and miscellaneous packet processing data of non-IP packets directly transmitted are summarized, balanced arbitration is performed, and the data is verified to prevent the data signature from being tampered with; The specific encryption process of step (3) is as follows: S1: After receiving the message, first check the SPD table according to the source IP address, destination IP address and protocol number in the IP header to find out the required packet processing result and encapsulation protocol mode. If the packet processing result is 0, the packet is discarded; 1 is transparent transmission; 2 is IPSEC encryption and decryption; S2: Query the updated SPI value and sequence number according to the initial SPI value and session number, and fill them into the ESP header or AH header to be generated; S3: When the AH protocol transmission mode is obtained through query, an AH header is generated, the SAD table is queried to obtain the verification algorithm and key, the IP header, AH header and data are verified to obtain the verification data, and the verification data is filled into the AH header. Finally, the IP header, AH header and data are spliced ​​and transmitted; S4: When the query results in the AH tunnel protocol mode, a new IP header and AH header are generated, the SAD table is queried to obtain the verification algorithm and verification key, the new IP header, AH header, old IP header and data are verified to obtain verification data, and finally the verification data is filled into the AH header, and the new IP header, AH header, old IP header and data are sent out; S5: When the query is in ESP transmission protocol mode, ESP data, i.e., ESP header, is generated; the SAD table is queried to obtain the encryption algorithm, encryption key, encryption initial vector, verification algorithm, and verification key; the data and ESP tail are encrypted; the ESP header, encrypted data, and ESP tail are verified to obtain verification data; finally, the IP header, ESP header, encrypted data, ESP tail, and verification data are transmitted; S6: When the query is in ESP tunnel protocol mode, a new IP header, ESP header and ESP tail are generated, the SAD table is queried to obtain the encryption algorithm, encryption key, encryption initial vector, verification algorithm and verification key, the IP header, data and ESP tail are encrypted, the ESP header, IP header, encrypted data and ESP tail are verified to obtain the verification result, and finally the new IP header, ESP header, IP header, encrypted data, ESP tail and verification data are sent out; The specific process of the decryption process in step (4) is as follows: S7: After receiving the message, first check the SPD table according to the source IP address, destination IP address and protocol number in the IP header to find out the required packet processing result and encapsulation protocol mode. If the packet processing result is 0, the packet is discarded; 1 is transparent transmission; 2 is IPSEC encryption and decryption; S8: When the AH protocol transmission mode is obtained through query, the location of the AH header is obtained, and the verification data is extracted. The SAD table is queried to obtain the verification algorithm and verification key. After the data is verified, it is compared with the verification data in the AH header. Finally, the AH header is split and the IP header and data are sent out. S9: When the AH protocol tunnel mode is found, the location of the new IP header and AH header is obtained, the SAD table is queried, the verification algorithm and verification key are obtained, and after the data is verified, it is compared with the verification data in the AH header, and finally the IP header and data are sent out; S10: When the ESP protocol transmission mode is queried, the positions of the ESP header and the ESP tail are obtained, the SAD table is queried to obtain the encryption and decryption algorithm, encryption and decryption key, encryption and decryption initialization vector, verification algorithm and verification data, the data and the ESP tail are decrypted, and the ESP header and the decrypted data are verified, and the verification data is compared with the verification data in the last message, and finally the IP header and the data are sent out; S11: When the ESP protocol tunnel mode is queried, the positions of the new IP header, ESP header, and ESP tail are obtained, and then the SAD table is queried to obtain the encryption and decryption algorithm, encryption and decryption key, encryption and decryption initialization vector, verification algorithm, and verification data, and the IP header, data, and ESP tail are decrypted, and the ESP header, IP header, data, and ESP tail are verified, and the verification result is compared with the verification result in the message, and finally the IP header and data are sent out.