| 1 |
<pre>Network Working Group C. Madson |
| 2 |
Request for Comments: 2403 Cisco Systems Inc. |
| 3 |
Category: Standards Track R. Glenn |
| 4 |
NIST |
| 5 |
November 1998 |
| 6 |
|
| 7 |
|
| 8 |
<span class="h1">The Use of HMAC-MD5-96 within ESP and AH</span> |
| 9 |
|
| 10 |
Status of this Memo |
| 11 |
|
| 12 |
This document specifies an Internet standards track protocol for the |
| 13 |
Internet community, and requests discussion and suggestions for |
| 14 |
improvements. Please refer to the current edition of the "Internet |
| 15 |
Official Protocol Standards" (STD 1) for the standardization state |
| 16 |
and status of this protocol. Distribution of this memo is unlimited. |
| 17 |
|
| 18 |
Copyright Notice |
| 19 |
|
| 20 |
Copyright (C) The Internet Society (1998). All Rights Reserved. |
| 21 |
|
| 22 |
Abstract |
| 23 |
|
| 24 |
This memo describes the use of the HMAC algorithm [<a href="./rfc2104" title=""HMAC: Keyed-Hashing for Message Authentication"">RFC-2104</a>] in |
| 25 |
conjunction with the MD5 algorithm [<a href="./rfc1321" title=""MD5 Digest Algorithm"">RFC-1321</a>] as an authentication |
| 26 |
mechanism within the revised IPSEC Encapsulating Security Payload |
| 27 |
[<a href="#ref-ESP" title=""IP Encapsulating Security Payload"">ESP</a>] and the revised IPSEC Authentication Header [<a href="#ref-AH" title=""IP Authentication Header"">AH</a>]. HMAC with MD5 |
| 28 |
provides data origin authentication and integrity protection. |
| 29 |
|
| 30 |
Further information on the other components necessary for ESP and AH |
| 31 |
implementations is provided by [<a href="#ref-Thayer97a" title=""IP Security Document Roadmap"">Thayer97a</a>]. |
| 32 |
|
| 33 |
<span class="h2"><a class="selflink" id="section-1" href="#section-1">1</a>. Introduction</span> |
| 34 |
|
| 35 |
This memo specifies the use of MD5 [<a href="./rfc1321" title=""MD5 Digest Algorithm"">RFC-1321</a>] combined with HMAC |
| 36 |
[<a href="./rfc2104" title=""HMAC: Keyed-Hashing for Message Authentication"">RFC-2104</a>] as a keyed authentication mechanism within the context of |
| 37 |
the Encapsulating Security Payload and the Authentication Header. |
| 38 |
The goal of HMAC-MD5-96 is to ensure that the packet is authentic and |
| 39 |
cannot be modified in transit. |
| 40 |
|
| 41 |
HMAC is a secret key authentication algorithm. Data integrity and |
| 42 |
data origin authentication as provided by HMAC are dependent upon the |
| 43 |
scope of the distribution of the secret key. If only the source and |
| 44 |
destination know the HMAC key, this provides both data origin |
| 45 |
authentication and data integrity for packets sent between the two |
| 46 |
parties; if the HMAC is correct, this proves that it must have been |
| 47 |
added by the source. |
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
<span class="grey">Madson & Glenn Standards Track [Page 1]</span></pre> |
| 53 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-2" ></span> |
| 54 |
<span class="grey"><a href="./rfc2403">RFC 2403</a> The Use of HMAC-MD5-96 within ESP and AH November 1998</span> |
| 55 |
|
| 56 |
|
| 57 |
In this memo, HMAC-MD5-96 is used within the context of ESP and AH. |
| 58 |
For further information on how the various pieces of ESP - including |
| 59 |
the confidentiality mechanism -- fit together to provide security |
| 60 |
services, refer to [<a href="#ref-ESP" title=""IP Encapsulating Security Payload"">ESP</a>] and [<a href="#ref-Thayer97a" title=""IP Security Document Roadmap"">Thayer97a</a>]. For further information on |
| 61 |
AH, refer to [<a href="#ref-AH" title=""IP Authentication Header"">AH</a>] and [<a href="#ref-Thayer97a" title=""IP Security Document Roadmap"">Thayer97a</a>]. |
| 62 |
|
| 63 |
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", |
| 64 |
"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this |
| 65 |
document are to be interpreted as described in [<a href="./rfc2119" title=""Key words for use in RFCs to Indicate Requirement Levels"">RFC-2119</a>]. |
| 66 |
|
| 67 |
<span class="h2"><a class="selflink" id="section-2" href="#section-2">2</a>. Algorithm and Mode</span> |
| 68 |
|
| 69 |
[<a id="ref-RFC-1321">RFC-1321</a>] describes the underlying MD5 algorithm, while [<a href="./rfc2104" title=""HMAC: Keyed-Hashing for Message Authentication"">RFC-2104</a>] |
| 70 |
describes the HMAC algorithm. The HMAC algorithm provides a framework |
| 71 |
for inserting various hashing algorithms such as MD5. |
| 72 |
|
| 73 |
HMAC-MD5-96 operates on 64-byte blocks of data. Padding requirements |
| 74 |
are specified in [<a href="./rfc1321" title=""MD5 Digest Algorithm"">RFC-1321</a>] and are part of the MD5 algorithm. If |
| 75 |
MD5 is built according to [<a href="./rfc1321" title=""MD5 Digest Algorithm"">RFC-1321</a>], there is no need to add any |
| 76 |
additional padding as far as HMAC-MD5-96 is concerned. With regard |
| 77 |
to "implicit packet padding" as defined in [<a href="#ref-AH" title=""IP Authentication Header"">AH</a>], no implicit packet |
| 78 |
padding is required. |
| 79 |
|
| 80 |
HMAC-MD5-96 produces a 128-bit authenticator value. This 128-bit |
| 81 |
value can be truncated as described in <a href="./rfc2104">RFC 2104</a>. For use with either |
| 82 |
ESP or AH, a truncated value using the first 96 bits MUST be |
| 83 |
supported. Upon sending, the truncated value is stored within the |
| 84 |
authenticator field. Upon receipt, the entire 128-bit value is |
| 85 |
computed and the first 96 bits are compared to the value stored in |
| 86 |
the authenticator field. No other authenticator value lengths are |
| 87 |
supported by HMAC-MD5-96. |
| 88 |
|
| 89 |
The length of 96 bits was selected because it is the default |
| 90 |
authenticator length as specified in [<a href="#ref-AH" title=""IP Authentication Header"">AH</a>] and meets the security |
| 91 |
requirements described in [<a href="./rfc2104" title=""HMAC: Keyed-Hashing for Message Authentication"">RFC-2104</a>]. |
| 92 |
|
| 93 |
<span class="h3"><a class="selflink" id="section-2.1" href="#section-2.1">2.1</a> Performance</span> |
| 94 |
|
| 95 |
[<a id="ref-Bellare96a">Bellare96a</a>] states that "(HMAC) performance is essentially that of |
| 96 |
the underlying hash function". [<a href="./rfc1810" title=""Report on MD5 Performance"">RFC-1810</a>] provides some performance |
| 97 |
analysis and recommendations of the use of MD5 with Internet |
| 98 |
protocols. As of this writing no performance analysis has been done |
| 99 |
of HMAC or HMAC combined with MD5. |
| 100 |
|
| 101 |
[<a id="ref-RFC-2104">RFC-2104</a>] outlines an implementation modification which can improve |
| 102 |
per-packet performance without affecting interoperability. |
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
<span class="grey">Madson & Glenn Standards Track [Page 2]</span></pre> |
| 109 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-3" ></span> |
| 110 |
<span class="grey"><a href="./rfc2403">RFC 2403</a> The Use of HMAC-MD5-96 within ESP and AH November 1998</span> |
| 111 |
|
| 112 |
|
| 113 |
<span class="h2"><a class="selflink" id="section-3" href="#section-3">3</a>. Keying Material</span> |
| 114 |
|
| 115 |
HMAC-MD5-96 is a secret key algorithm. While no fixed key length is |
| 116 |
specified in [<a href="./rfc2104" title=""HMAC: Keyed-Hashing for Message Authentication"">RFC-2104</a>], for use with either ESP or AH a fixed key |
| 117 |
length of 128-bits MUST be supported. Key lengths other than 128- |
| 118 |
bits MUST NOT be supported (i.e. only 128-bit keys are to be used by |
| 119 |
HMAC-MD5-96). A key length of 128-bits was chosen based on the |
| 120 |
recommendations in [<a href="./rfc2104" title=""HMAC: Keyed-Hashing for Message Authentication"">RFC-2104</a>] (i.e. key lengths less than the |
| 121 |
authenticator length decrease security strength and keys longer than |
| 122 |
the authenticator length do not significantly increase security |
| 123 |
strength). |
| 124 |
|
| 125 |
[<a id="ref-RFC-2104">RFC-2104</a>] discusses requirements for key material, which includes a |
| 126 |
discussion on requirements for strong randomness. A strong pseudo- |
| 127 |
random function MUST be used to generate the required 128-bit key. |
| 128 |
|
| 129 |
At the time of this writing there are no specified weak keys for use |
| 130 |
with HMAC. This does not mean to imply that weak keys do not exist. |
| 131 |
If, at some point, a set of weak keys for HMAC are identified, the |
| 132 |
use of these weak keys must be rejected followed by a request for |
| 133 |
replacement keys or a newly negotiated Security Association. |
| 134 |
|
| 135 |
[<a id="ref-ARCH">ARCH</a>] describes the general mechanism for obtaining keying material |
| 136 |
when multiple keys are required for a single SA (e.g. when an ESP SA |
| 137 |
requires a key for confidentiality and a key for authentication). |
| 138 |
|
| 139 |
In order to provide data origin authentication, the key distribution |
| 140 |
mechanism must ensure that unique keys are allocated and that they |
| 141 |
are distributed only to the parties participating in the |
| 142 |
communication. |
| 143 |
|
| 144 |
[<a id="ref-RFC-2104">RFC-2104</a>] makes the following recommendation with regard to |
| 145 |
rekeying. Current attacks do not indicate a specific recommended |
| 146 |
frequency for key changes as these attacks are practically |
| 147 |
infeasible. However, periodic key refreshment is a fundamental |
| 148 |
security practice that helps against potential weaknesses of the |
| 149 |
function and keys, reduces the information avaliable to a |
| 150 |
cryptanalyst, and limits the damage of an exposed key. |
| 151 |
|
| 152 |
<span class="h2"><a class="selflink" id="section-4" href="#section-4">4</a>. Interaction with the ESP Cipher Mechanism</span> |
| 153 |
|
| 154 |
As of this writing, there are no known issues which preclude the use |
| 155 |
of the HMAC-MD5-96 algorithm with any specific cipher algorithm. |
| 156 |
|
| 157 |
|
| 158 |
|
| 159 |
|
| 160 |
|
| 161 |
|
| 162 |
|
| 163 |
|
| 164 |
<span class="grey">Madson & Glenn Standards Track [Page 3]</span></pre> |
| 165 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-4" ></span> |
| 166 |
<span class="grey"><a href="./rfc2403">RFC 2403</a> The Use of HMAC-MD5-96 within ESP and AH November 1998</span> |
| 167 |
|
| 168 |
|
| 169 |
<span class="h2"><a class="selflink" id="section-5" href="#section-5">5</a>. Security Considerations</span> |
| 170 |
|
| 171 |
The security provided by HMAC-MD5-96 is based upon the strength of |
| 172 |
HMAC, and to a lesser degree, the strength of MD5. [<a href="./rfc2104" title=""HMAC: Keyed-Hashing for Message Authentication"">RFC-2104</a>] claims |
| 173 |
that HMAC does not depend upon the property of strong collision |
| 174 |
resistance, which is important to consider when evaluating the use of |
| 175 |
MD5, an algorithm which has, under recent scrutiny, been shown to be |
| 176 |
much less collision-resistant than was first thought. At the time of |
| 177 |
this writing there are no practical cryptographic attacks against |
| 178 |
HMAC-MD5-96. |
| 179 |
|
| 180 |
[<a id="ref-RFC-2104">RFC-2104</a>] states that for "minimally reasonable hash functions" the |
| 181 |
"birthday attack", the strongest attack know against HMAC, is |
| 182 |
impractical. For a 64-byte block hash such as HMAC-MD5-96, an attack |
| 183 |
involving the successful processing of 2**64 blocks would be |
| 184 |
infeasible unless it were discovered that the underlying hash had |
| 185 |
collisions after processing 2**30 blocks. A hash with such weak |
| 186 |
collision-resistance characteristics would generally be considered to |
| 187 |
be unusable. |
| 188 |
|
| 189 |
It is also important to consider that while MD5 was never developed |
| 190 |
to be used as a keyed hash algorithm, HMAC had that criteria from the |
| 191 |
onset. While the use of MD5 in the context of data security is |
| 192 |
undergoing reevaluation, the combined HMAC with MD5 algorithm has |
| 193 |
held up to cryptographic scrutiny. |
| 194 |
|
| 195 |
[<a id="ref-RFC-2104">RFC-2104</a>] also discusses the potential additional security which is |
| 196 |
provided by the truncation of the resulting hash. Specifications |
| 197 |
which include HMAC are strongly encouraged to perform this hash |
| 198 |
truncation. |
| 199 |
|
| 200 |
As [<a href="./rfc2104" title=""HMAC: Keyed-Hashing for Message Authentication"">RFC-2104</a>] provides a framework for incorporating various hash |
| 201 |
algorithms with HMAC, it is possible to replace MD5 with other |
| 202 |
algorithms such as SHA-1. [<a href="./rfc2104" title=""HMAC: Keyed-Hashing for Message Authentication"">RFC-2104</a>] contains a detailed discussion |
| 203 |
on the strengths and weaknesses of HMAC algorithms. |
| 204 |
|
| 205 |
As is true with any cryptographic algorithm, part of its strength |
| 206 |
lies in the correctness of the algorithm implementation, the security |
| 207 |
of the key management mechanism and its implementation, the strength |
| 208 |
of the associated secret key, and upon the correctness of the |
| 209 |
implementation in all of the participating systems. [<a href="./rfc2202" title=""Test Cases for HMAC-MD5 and HMAC-SHA-1"">RFC-2202</a>] |
| 210 |
contains test vectors and example code to assist in verifying the |
| 211 |
correctness of HMAC-MD5-96 code. |
| 212 |
|
| 213 |
|
| 214 |
|
| 215 |
|
| 216 |
|
| 217 |
|
| 218 |
|
| 219 |
|
| 220 |
<span class="grey">Madson & Glenn Standards Track [Page 4]</span></pre> |
| 221 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-5" ></span> |
| 222 |
<span class="grey"><a href="./rfc2403">RFC 2403</a> The Use of HMAC-MD5-96 within ESP and AH November 1998</span> |
| 223 |
|
| 224 |
|
| 225 |
<span class="h2"><a class="selflink" id="section-6" href="#section-6">6</a>. Acknowledgments</span> |
| 226 |
|
| 227 |
This document is derived in part from previous works by Jim Hughes, |
| 228 |
those people that worked with Jim on the combined DES/CBC+HMAC-MD5 |
| 229 |
ESP transforms, the ANX bakeoff participants, and the members of the |
| 230 |
IPsec working group. |
| 231 |
|
| 232 |
We would also like to thank Hugo Krawczyk for his comments and |
| 233 |
recommendations regarding some of the cryptographic specific text in |
| 234 |
this document. |
| 235 |
|
| 236 |
<span class="h2"><a class="selflink" id="section-7" href="#section-7">7</a>. References</span> |
| 237 |
|
| 238 |
[<a id="ref-RFC-1321">RFC-1321</a>] Rivest, R., "MD5 Digest Algorithm", <a href="./rfc1321">RFC 1321</a>, April |
| 239 |
1992. |
| 240 |
|
| 241 |
[<a id="ref-RFC-2104">RFC-2104</a>] Krawczyk, H., Bellare, M., and R. Canetti, "HMAC: |
| 242 |
Keyed-Hashing for Message Authentication", <a href="./rfc2104">RFC 2104</a>, |
| 243 |
February 1997. |
| 244 |
|
| 245 |
[<a id="ref-RFC-1810">RFC-1810</a>] Touch, J., "Report on MD5 Performance", <a href="./rfc1810">RFC 1810</a>, June |
| 246 |
1995. |
| 247 |
|
| 248 |
[<a id="ref-Bellare96a">Bellare96a</a>] Bellare, M., Canetti, R., and H. Krawczyk, "Keying Hash |
| 249 |
Functions for Message Authentication", Advances in |
| 250 |
Cryptography, Crypto96 Proceeding, June 1996. |
| 251 |
|
| 252 |
[<a id="ref-ARCH">ARCH</a>] Kent, S., and R. Atkinson, "Security Architecture for |
| 253 |
the Internet Protocol", <a href="./rfc2401">RFC 2401</a>, November 1998. |
| 254 |
|
| 255 |
[<a id="ref-ESP">ESP</a>] Kent, S., and R. Atkinson, "IP Encapsulating Security |
| 256 |
Payload", <a href="./rfc2406">RFC 2406</a>, November 1998. |
| 257 |
|
| 258 |
[<a id="ref-AH">AH</a>] Kent, S., and R. Atkinson, "IP Authentication Header", |
| 259 |
<a href="./rfc2402">RFC 2402</a>, November 1998. |
| 260 |
|
| 261 |
[<a id="ref-Thayer97a">Thayer97a</a>] Thayer, R., Doraswamy, N., and R. Glenn, "IP Security |
| 262 |
Document Roadmap", <a href="./rfc2411">RFC 2411</a>, November 1998. |
| 263 |
|
| 264 |
[<a id="ref-RFC-2202">RFC-2202</a>] Cheng, P., and R. Glenn, "Test Cases for HMAC-MD5 and |
| 265 |
HMAC-SHA-1", <a href="./rfc2202">RFC 2202</a>, March 1997. |
| 266 |
|
| 267 |
[<a id="ref-RFC-2119">RFC-2119</a>] Bradner, S., "Key words for use in RFCs to Indicate |
| 268 |
Requirement Levels", <a href="https://www.rfc-editor.org/bcp/bcp14">BCP 14</a>, <a href="./rfc2119">RFC 2119</a>, March 1997. |
| 269 |
|
| 270 |
|
| 271 |
|
| 272 |
|
| 273 |
|
| 274 |
|
| 275 |
|
| 276 |
<span class="grey">Madson & Glenn Standards Track [Page 5]</span></pre> |
| 277 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-6" ></span> |
| 278 |
<span class="grey"><a href="./rfc2403">RFC 2403</a> The Use of HMAC-MD5-96 within ESP and AH November 1998</span> |
| 279 |
|
| 280 |
|
| 281 |
<span class="h2"><a class="selflink" id="section-8" href="#section-8">8</a>. Editors' Address</span> |
| 282 |
|
| 283 |
Cheryl Madson |
| 284 |
Cisco Systems, Inc. |
| 285 |
|
| 286 |
EMail: [email protected] |
| 287 |
|
| 288 |
|
| 289 |
Rob Glenn |
| 290 |
NIST |
| 291 |
|
| 292 |
EMail: <[email protected]> |
| 293 |
|
| 294 |
The IPsec working group can be contacted through the chairs: |
| 295 |
|
| 296 |
Robert Moskowitz |
| 297 |
ICSA |
| 298 |
|
| 299 |
EMail: [email protected] |
| 300 |
|
| 301 |
|
| 302 |
Ted T'so |
| 303 |
Massachusetts Institute of Technology |
| 304 |
|
| 305 |
EMail: [email protected] |
| 306 |
|
| 307 |
|
| 308 |
|
| 309 |
|
| 310 |
|
| 311 |
|
| 312 |
|
| 313 |
|
| 314 |
|
| 315 |
|
| 316 |
|
| 317 |
|
| 318 |
|
| 319 |
|
| 320 |
|
| 321 |
|
| 322 |
|
| 323 |
|
| 324 |
|
| 325 |
|
| 326 |
|
| 327 |
|
| 328 |
|
| 329 |
|
| 330 |
|
| 331 |
|
| 332 |
<span class="grey">Madson & Glenn Standards Track [Page 6]</span></pre> |
| 333 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-7" ></span> |
| 334 |
<span class="grey"><a href="./rfc2403">RFC 2403</a> The Use of HMAC-MD5-96 within ESP and AH November 1998</span> |
| 335 |
|
| 336 |
|
| 337 |
<span class="h2"><a class="selflink" id="section-9" href="#section-9">9</a>. Full Copyright Statement</span> |
| 338 |
|
| 339 |
Copyright (C) The Internet Society (1998). All Rights Reserved. |
| 340 |
|
| 341 |
This document and translations of it may be copied and furnished to |
| 342 |
others, and derivative works that comment on or otherwise explain it |
| 343 |
or assist in its implementation may be prepared, copied, published |
| 344 |
and distributed, in whole or in part, without restriction of any |
| 345 |
kind, provided that the above copyright notice and this paragraph are |
| 346 |
included on all such copies and derivative works. However, this |
| 347 |
document itself may not be modified in any way, such as by removing |
| 348 |
the copyright notice or references to the Internet Society or other |
| 349 |
Internet organizations, except as needed for the purpose of |
| 350 |
developing Internet standards in which case the procedures for |
| 351 |
copyrights defined in the Internet Standards process must be |
| 352 |
followed, or as required to translate it into languages other than |
| 353 |
English. |
| 354 |
|
| 355 |
The limited permissions granted above are perpetual and will not be |
| 356 |
revoked by the Internet Society or its successors or assigns. |
| 357 |
|
| 358 |
This document and the information contained herein is provided on an |
| 359 |
"AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING |
| 360 |
TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING |
| 361 |
BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION |
| 362 |
HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF |
| 363 |
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. |
| 364 |
|
| 365 |
|
| 366 |
|
| 367 |
|
| 368 |
|
| 369 |
|
| 370 |
|
| 371 |
|
| 372 |
|
| 373 |
|
| 374 |
|
| 375 |
|
| 376 |
|
| 377 |
|
| 378 |
|
| 379 |
|
| 380 |
|
| 381 |
|
| 382 |
|
| 383 |
|
| 384 |
|
| 385 |
|
| 386 |
|
| 387 |
|
| 388 |
Madson & Glenn Standards Track [Page 7] |
| 389 |
</pre> |