Authentication Header (AH) provides authentication, integrity, and anti-replay for the entire packet (both the IP header and the data payload carried in the packet). It does not provide confidentiality, which means it does not encrypt the data. The data is readable, but protected from modification. AH uses the HMAC algorithms described earlier to sign the packet for integrity.
For example, Alice on Computer A sends data to Bob on Computer B. The IP header, the AH header, and the data are protected with integrity. This means Alice can be certain it was really Bob who sent the data and that the data was unmodified.
Integrity and authentication are provided by the placement of the AH header between the IP header and the transport (layer 4) protocol header, which is shown as TCP/UDP in the Figure 8.1. AH uses an IP protocol ID of 51 to identify itself in the IP header.
Figure 8.1 Authentication Header
AH can be used alone or in combination with the Encapsulating Security Payload (ESP) protocol.
The AH header contains the following fields:
Next Header Identifies the next header that uses the IP protocol ID. For example, the value might be "6" to indicate TCP.
Length Indicates the length of the AH header.
Security Parameters Index (SPI) Used in combination with the destination address and the security protocol (AH or ESP) to identify the correct security association for the communication. (For more information, see the "Internet Key Exchange" section later in this chapter.) The receiver uses this value to determine with which security association this packet is identified.
Sequence Number Provides anti-replay protection for the SA. It is 32-bit, incrementally increasing number (starting from 1) that is never allowed to cycle and that indicates the packet number sent over the security association for the communication. The receiver checks this field to verify that a packet for a security association with this number has not been received already. If one has been received, the packet is rejected.
Authentication Data Contains the Integrity Check Value (ICV) that is used to verify the integrity of the message. The receiver calculates the hash value and checks it against this value (calculated by the sender) to verify integrity.
AH is inserted after the IP header and before an upper layer protocol such as TCP, UDP, or ICMP. If another security protocol is being used in addition to AH, the AH header is inserted before any other IPSec headers. The packet signature is shown graphically in Figure 8.2.
Figure 8.2 AH Integrity Signature
AH signs the entire packet for integrity, except certain fields in the IP header which may change such as the Time To Live and Type of Service fields.