ESP protocol VPN
Summary:The IP protocol number of ESP (Encapsulation Security Payload) is 50. ESP can provide privacy (encryption), integrity, and source authentication prote…
This book is available as an e-book in EPUB format
PayPal sponsors this website for any amount. I will send you an EPUB e-book via email. Please send me an email
Email: shuxueha@outlook.com
PayPal: https://paypal.me/zhipinglei
You can also scan the PayPal QR code below to sponsor
You can also purchase this book on Amazon: click to enter the Amazon official website
The IP protocol number of ESP (Encapsulation Security Payload) is 50. ESP can provide privacy (encryption), integrity, and source authentication protection for data, and can resist replay attacks (repeatedly sending the same packet, the receiver consumes system resources due to continuous decryption, achieving denial of service attacks (DOS)). ESP can only protect IP load data and does not provide any security protection for the original IP header!
The schematic diagram of the structure of the ESP packet, below we will introduce each field of the ESP packet one by one!
Security Parameter Index (SPI)
A 32-bit field used to identify the security association for processing data packets. We will introduce the content related to security associations in the later parts of this chapter!
Serial Number (SN)
A monotonically increasing sequence number used to identify an ESP packet, for example, if the current sent ESP packet sequence number is X, the next transmitted ESP packet sequence number is X+1, and the next one is X+2. The receiver uses sequence numbers to prevent replay attacks, and the principle is also very simple. When the receiver receives an ESP packet with sequence number X, if they receive another ESP packet with sequence number X, it is considered a replay attack and is discarded!
Initialization Vector
We have introduced CBC as a block encryption method earlier. Each packet that needs to be encrypted using CBC generates a random number, which is used to scramble the data during encryption. This randomly generated number is called the initialization vector (IV). Of course, IPsec VPN can also choose not to encrypt (encryption is not necessary, although we usually use it). If it is not encrypted, there will be no IV field. Therefore, there are two ESP packet structure diagrams in it. The ESP packet with a white background on the left does not have an IV field, indicating that it is not encrypted, while the one with a dark background on the right indicates that it needs to be encrypted.
Payload Data
The payload data is the data protected by IPsec encryption, which is likely to be the TCP header plus the corresponding application layer data. Of course, we will also introduce two encapsulation modes later, and the different encapsulation modes will also affect the content of the payload data.
Padding
Cisco's IPsec VPNs all use CBC block encryption, so since block encryption is used, it is necessary to fill in the block boundaries of the data. Taking DES as an example, it is necessary to fill in the 64 bit block boundary, and the data added to fill in the block boundary is called a shim. If it is not encrypted, there will be no shim field!
Pad Length
The length of the gasket, as the name suggests, tells the receiver how long the gasket data is, and after decryption, the receiver can clear this excess data. If not encrypted, there will be no pad length field!
Next Header
The next header identifies the next header in the IPSec encapsulated payload data. Depending on the encapsulation mode, the next header may also change. If it is a transport mode, the next header is usually the TCP/UDP transport layer header. If it is a tunnel mode, the next header is definitely IP. We will introduce the transport and tunnel modes in the later parts of this chapter. By the way, from the "next header" field, we can see the shadow of IPv6. The header of mIPv6 uses many "next headers" connected in series, which also indicates that IPsec was originally designed for IPv6!
Authentication Data
ESP will verify all data from the ESP header to the ESP tail, that is, perform a hash calculation using the hash function of the hash code. The resulting hash value will be placed in the authentication data section, and the receiver can use this authentication data section to verify the integrity and source authentication of the ESP data packet!
| High-speed VPN | Fast VPN | Preferred Accelerator VPN | Reliable VPN |
| High quality VPN | Old fashioned VPN | Stable VPN(Recommend) | Smooth VPN |

