Network Working Group M. Oehler
Request for Comments: 2085 NSA
Category: Standards Track R. Glenn
NIST
February 1997
HMAC-MD5 IP Authentication with Replay Prevention
1. Introduction
The Authentication Header (AH) [RFC-1826] provides integrity and authentication for IP datagrams. The transform specified in this document uses a keyed-MD5 mechanism [HMAC-MD5]. The mechanism uses the (key-less) MD5 hash function [RFC-1321] which produces a message digest. When combined with an AH Key, authentication data is produced. This value is placed in the Authentication Data field of the AH [RFC-1826]. This value is also the basis for the data integrity service offered by the AH protocol. To provide protection against replay attacks, a Replay Prevention field is included as a transform option. This field is used to help prevent attacks in which a message is stored and re-used later, replacing or repeating the original. The Security Parameters Index (SPI) [RFC-1825] is used to determine whether this option is included in the AH.
Oehler & Glenn Standards Track [Page 1]
RFC 2085 HMAC-MD5 February 1997
Familiarity with the following documents is assumed: "Security Architecture for the Internet Protocol" [RFC-1825], "IP Authentication Header" [RFC-1826], and "HMAC-MD5: Keyed-MD5 for Message Authentication" [HMAC-MD5].
1.1 Terminology
In this document, the words that are used to define the significance of each particular requirement are usually capitalized. These words are:
1.2 Keys
The "AH Key" is used as a shared secret between two communicating parties. The Key is not a "cryptographic key" as used in a traditional sense. Instead, the AH key (shared secret) is hashed with the transmitted data and thus, assures that an intervening party cannot duplicate the authentication data.
Oehler & Glenn Standards Track [Page 2]
RFC 2085 HMAC-MD5 February 1997
All conforming and compliant implementations MUST support a key length of 128 bits or less. Implementations SHOULD support longer key lengths as well. It is advised that the key length be chosen to be the length of the hash output, which is 128 bits for MD5. For other key lengths the following concerns MUST be considered.
1.3 Data Size
MD5 produces a 128-bit value which is used as the authentication data. It is naturally 64 bit aligned and thus, does not need any padding for machines with native double words.
2. Packet Format
+---------------+---------------+---------------+---------------+
| Next Header | Length | RESERVED |
+---------------+---------------+---------------+---------------+
| SPI |
+---------------+---------------+---------------+---------------+
| Replay Prevention |
| |
+---------------+---------------+---------------+---------------+
| |
+ Authentication Data |
| |
+---------------+---------------+---------------+---------------+
1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8
The Next Header, RESERVED, and SPI fields are specified in [RFC- 1826]. The Length field is the length of the Replay Prevention field and the Authentication Data in 32-bit words.
Oehler & Glenn Standards Track [Page 3]
RFC 2085 HMAC-MD5 February 1997 2.1 Replay PreventionThe Replay Prevention field is a 64-bit value used to guarantee that each packet exchanged between two parties is different. Each IPsec Security Association specifies whether Replay Prevention is used for that Security Association. If Replay Prevention is NOT in use, then the Authentication Data field will directly follow the SPI field.
2.2 Authentication Data Calculation
The authentication data is the output of the authentication algorithm (MD5). This value is calculated over the entire IP datagram. Fields within the datagram that are variant during transit and the authentication data field itself, must contain all zeros prior to the computation [RFC-1826]. The Replay Prevention field if present, is included in the calculation.
Oehler & Glenn Standards Track [Page 4]
RFC 2085 HMAC-MD5 February 1997
ipad = the byte 0x36 repeated 64 times opad = the byte 0x5C repeated 64 times.
3. Security Considerations
The security provided by this transform is based on the strength of MD5, the correctness of the algorithm's implementation, the security of the key management mechanism and its implementation, the strength of the associated secret key, and upon the correctness of the implementations in all of the participating systems. [HMAC-MD5] contains a detailed discussion on the strengths and weaknesses of MD5.
Oehler & Glenn Standards Track [Page 5]
RFC 2085 HMAC-MD5 February 1997
References