idnits 2.17.1 draft-ietf-ipsec-ah-hmac-sha-01.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- ** Cannot find the required boilerplate sections (Copyright, IPR, etc.) in this document. Expected boilerplate is as follows today (2024-03-29) according to https://trustee.ietf.org/license-info : IETF Trust Legal Provisions of 28-dec-2009, Section 6.a: This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79. IETF Trust Legal Provisions of 28-dec-2009, Section 6.b(i), paragraph 2: Copyright (c) 2024 IETF Trust and the persons identified as the document authors. All rights reserved. IETF Trust Legal Provisions of 28-dec-2009, Section 6.b(i), paragraph 3: This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- ** Missing expiration date. The document expiration date should appear on the first and last page. ** The document seems to lack a 1id_guidelines paragraph about Internet-Drafts being working documents. ** The document seems to lack a 1id_guidelines paragraph about 6 months document validity. ** The document seems to lack a 1id_guidelines paragraph about the list of current Internet-Drafts. ** The document seems to lack a 1id_guidelines paragraph about the list of Shadow Directories. == No 'Intended status' indicated for this document; assuming Proposed Standard Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- ** The document seems to lack an IANA Considerations section. (See Section 2.2 of https://www.ietf.org/id-info/checklist for how to handle the case when there are no actions for IANA.) ** The document seems to lack an Authors' Addresses Section. ** The document seems to lack separate sections for Informative/Normative References. All references will be assumed normative when checking for downward references. ** There are 28 instances of too long lines in the document, the longest one being 14 characters in excess of 72. ** The abstract seems to contain references ([HMAC-MD5], [RFC-1826]), which it shouldn't. Please replace those with straight textual mentions of the documents in question. ** The document seems to lack a both a reference to RFC 2119 and the recommended RFC 2119 boilerplate, even if it appears to use RFC 2119 keywords. RFC 2119 keyword, line 79: '... Authentication Header specification [RFC-1826] MUST implement this...' RFC 2119 keyword, line 100: '...ant implementations MUST support a key...' RFC 2119 keyword, line 101: '... Implementations SHOULD support longer...' RFC 2119 keyword, line 104: '...following concerns MUST be considered....' RFC 2119 keyword, line 106: '...bited and implementations MUST prevent...' (4 more instances...) Miscellaneous warnings: ---------------------------------------------------------------------------- -- The document seems to lack a disclaimer for pre-RFC5378 work, but may have content which was first submitted before 10 November 2008. If you have contacted all the original authors and they are all willing to grant the BCP78 rights to the IETF Trust, then this is fine, and you can ignore this comment. If not, you may need to add the pre-RFC5378 disclaimer. (See the Legal Provisions document at https://trustee.ietf.org/license-info for more information.) -- The document date (July 15, 1996) is 10119 days in the past. Is this intentional? Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) == Unused Reference: 'RFC-1828' is defined on line 242, but no explicit reference was found in the text == Unused Reference: 'URL' is defined on line 248, but no explicit reference was found in the text ** Obsolete normative reference: RFC 1825 (Obsoleted by RFC 2401) ** Obsolete normative reference: RFC 1826 (Obsoleted by RFC 2402) ** Downref: Normative reference to an Historic RFC: RFC 1828 -- Possible downref: Non-RFC (?) normative reference: ref. 'HMAC-MD5' -- Possible downref: Non-RFC (?) normative reference: ref. 'FIPS-180-1' -- Possible downref: Non-RFC (?) normative reference: ref. 'URL' -- Possible downref: Non-RFC (?) normative reference: ref. 'SCHNEIER' -- Possible downref: Non-RFC (?) normative reference: ref. 'ESP-DES-MD5' Summary: 15 errors (**), 0 flaws (~~), 3 warnings (==), 7 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Network Working Group S. Chang (NIST) 3 R. Glenn (NIST) 4 July 15, 1996 5 Internet Draft 7 HMAC-SHA IP Authentication with Replay Prevention 8 10 Status of This Memo 12 Distribution of this memo is unlimited. 14 This document is an Internet-Draft. Internet Drafts are working 15 documents of the Internet Engineering Task Force (IETF), its Areas, 16 and its Working Groups. Note that other groups may also distribute 17 working documents as Internet Drafts. 19 Internet Drafts are draft documents valid for a maximum of six 20 months, and may be updated, replaced, or obsoleted by other documents 21 at any time. It is not appropriate to use Internet Drafts as 22 reference material, or to cite them other than as a ``working draft'' 23 or ``work in progress.'' 25 To learn the current status of any Internet-Draft, please check the 26 ``1id-abstracts.txt'' listing contained in the internet-drafts Shadow 27 Directories on: 29 ftp.is.co.za (Africa) 30 nic.nordu.net (Europe) 31 ds.internic.net (US East Coast) 32 ftp.isi.edu (US West Coast) 33 munnari.oz.au (Pacific Rim) 35 Abstract 37 This document describes a keyed-SHA transform to be used in 38 conjunction with the IP Authentication Header [RFC-1826]. The 39 particular transform is based on [HMAC-MD5]. An option is also 40 specified to guard against replay attacks. 42 Contents 44 1. Introduction...................................................3 45 1.1 Keys........................................................3 46 1.2 Data Size...................................................4 47 2 Packet Format..................................................4 48 2.1 Replay Prevention...........................................4 49 2.2 Authentication Data Calculation.............................5 50 3. Security Considerations........................................6 51 ACKNOWLEDGMENTS....................................................6 52 REFERENCES.........................................................6 53 CONTACTS...........................................................6 55 1. Introduction 57 The IP Authentication Header (AH) provides integrity and 58 authentication for IP datagrams [RFC-1826]. The transform specified 59 in this document uses a keyed-SHA mechanism based on [HMAC-MD5]. The 60 mechanism uses the (key-less) SHA hash function [FIPS-180-1] which 61 produces a message digest. When combined with an AH Key, 62 authentication data is produced. This value is placed in the 63 Authentication Data field of the AH [RFC-1826]. This value is also 64 the basis for the data integrity service offered by the AH protocol. 66 To provide protection against replay attacks, a Replay Prevention 67 field is included as a transform option. This field is used to help 68 prevent attacks in which a message is stored and re-used later, 69 replacing or repeating the original. The Security Parameters Index 70 (SPI) [RFC-1825] is used to determine whether this option is included 71 in the AH. 73 Familiarity with the following documents is assumed: "Security 74 Architecture for the Internet Protocol" [RFC-1825], "IP 75 Authentication Header" [RFC-1826], and "HMAC-MD5: Keyed-MD5 for 76 Message Authentication" [HMAC-MD5]. 78 All implementations that claim conformance or compliance with the IP 79 Authentication Header specification [RFC-1826] MUST implement this 80 HMAC-SHA transform. 82 1.1 Keys 84 The "AH Key" is used as a shared secret between two communicating 85 parties. The Key is not a "cryptographic key" as used in a 86 traditional sense. Instead, the AH key (shared secret) is hashed with 87 the transmitted data and thus, assures that an intervening party 88 cannot duplicate the authentication data. 90 Even though an AH key is not a cryptographic key, the rudimentary 91 concerns of cryptographic keys still apply. Consider that the 92 algorithm and most of the data used to produce the output is known. 93 The strength of the transform lies in the singular mapping of the key 94 (which needs to be strong) and the IP datagram (which is known) to 95 the authentication data. Thus, implementations should, and as 96 frequently as possible, change the AH key. Keys need to be chosen at 97 random, or generated using a cryptographically strong pseudo-random 98 generator seeded with a random seed. [HMAC-MD5] 100 All conforming and compliant implementations MUST support a key 101 length of 160 bits or less. Implementations SHOULD support longer 102 key lengths as well. It is advised that the key length be chosen to 103 be the length of the hash output, which is 160 bits for SHA. For 104 other key lengths the following concerns MUST be considered. 106 A key length of zero is prohibited and implementations MUST prevent 107 key lengths of zero from being used with this transform, since no 108 effective authentication could be provided by a zero-length key. SHA 109 operates on 64-byte blocks. Keys longer than 64-bytes are first 110 hashed using SHA. The resulting hash is then used to calculate the 111 authentication data." 113 1.2 Data Size 115 SHA generates a message digest of 160 bits. To maintain 64-bit word 116 alignment, all conforming and compliant implementations MUST include 117 the ability to pad the message digest to 192 bits as described in 118 this paragraph. Implementations MAY also include the ability to use 119 the 160 bit message digest with out the pad when 64-bit alignment is 120 not required. Padding is added by appending 32 zero bits to SHA 121 message digest. The length of the Authentication Data, specified in 122 the Length field of the AH in 32-bit words, should include the 123 padding bits, if present. Upon receipt, the value of the padded bits 124 MUST be zero and are otherwise ignored. 126 2. Packet Format 128 +---------------+---------------+---------------+---------------+ 129 | Next Header | Length | RESERVED | 130 +---------------+---------------+---------------+---------------+ 131 | SPI | 132 +---------------+---------------+---------------+---------------+ 133 | Replay Prevention (optional) | 134 +---------------+---------------+---------------+---------------+ 135 | | 136 + Authentication Data | 137 | | 138 +---------------+---------------+---------------+---------------+ 139 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 141 The Next Header, RESERVED, and SPI fields are specified in [RFC- 142 1826]. The Length field is the length of the Replay Prevention field 143 and the Authentication Data in 32-bit words. 145 2.1 Replay Prevention 147 The Replay Prevention field is a 32-bit value used to guarantee that 148 each packet exchanged between two parties is different. This field 149 is similar to the one specified in [ESP-DES-MD5]. Each IPsec 150 Security Association specifies whether Replay Protection is used for 151 that Security Association. If Replay Protection is NOT in use, then 152 the Authentication Data field will directly follow the SPI field. 153 This field is used to help prevent attacks in which a message is 154 stored and re-used later, replacing or repeating the original. 156 The 32-bit field is an up counter starting at a value of 1. 158 The secret shared key must not be used for a period of time that 159 allows the counter to wrap, that is, to transmit more than 2^32 160 packets using a single key. 162 Upon receipt, the replay value is assured to be increasing. The 163 implementation may accept out of order packets. The number of packets 164 to accept out of order is an implementation detail. If an "out of 165 order window" is supported, the implementation shall ensure that any 166 and all packets accepted out of order are guaranteed not to have 167 arrived before. That is, the implementation will accept any packet at 168 most once. 170 [ESP-DES-MD5] provides example code that implements a 32 packet 171 replay window and a test routine to show how it works. 173 2.2 Authentication Data Calculation 175 The computation of the 160-bit SHA digest is described 176 in [FIPS-180-1]. The digest is calculated over 177 the entire IP datagram. Fields within the datagram that are variant 178 during transit and the authentication data field itself must contain 179 all zeros prior to the computation [RFC-1826]. 180 The Replay Prevention field, if present, is included in the calculation. 182 To compute HMAC-SHA over the data 'text', the following is calculated: 184 SHA (K XOR opad, SHA (K XOR ipad, text)) 186 K denotes the secret key shared by the parties. If K is longer 187 than 64-bytes it MUST first be hashed using SHA. 188 In this case, K is the resulting hash. The variables 'ipad', 'opad' 189 denote fixed strings for inner and outer padding respectively. 190 The two strings are: 192 ipad = the byte 0x36 repeated 64 times, 193 opad = the byte 0x5C repeated 64 times. 195 The calculation of the authentication data consists of the following steps: 197 (1) append zeros to the end of K to create a 64 byte string (e.g., if K is 198 of length 20 bytes it will be appended with 44 zero bytes 0x00) 199 (2) XOR (bitwise exclusive-OR) the 64 byte string computed in step (1) with 200 ipad 201 (3) concatenate to the 64 byte string resulting from step (2) the data 202 stream 'text' 203 (4) apply SHA to the stream generated in step (3) 204 (5) XOR the 64 byte string computed in step (1) with opad 205 (6) concatenate to the 64 byte string resulting from step (5) the SHA result 206 of step (4) 207 (7) apply SHA to the stream generated in step (6) 208 (8) The sender then zero pads the resulting hash to a 64-bit boundary 209 for word alignment. The receiver compares the generated 160-bit hash 210 to the first 160-bits of authentication data contained in the AH. 212 A similar computation is described in more detail, along with example 213 code and performance improvements, in [HMAC-MD5]. Implementers 214 should consult [HMAC-MD5] for more information on this technique 215 for keying a cryptographic hash function. 217 3. Security Considerations 219 The security provided by this transform is based on the strength of 220 SHA, the correctness of the algorithm's implementation, the security 221 of the key management mechanism and its implementation, the strength 222 of the associated secret key, and upon the correctness of the 223 implementations in all of the participating systems. 225 At this time there are no known cryptographic attacks against SHA 226 [SCHNEIER]. The 160-bit digest makes SHA more resistant to brute 227 force attacks than MD4 and MD5 which produce a 128-bit digest. 229 Acknowledgments 231 This document is largely based on text written by Hugo Krawczyk. The 232 format used was derived from work by William Simpson and Perry Metzger. 233 The text on replay prevention is derived directly from work by Jim 234 Hughes. 236 References 238 [RFC-1825] R. Atkinson, "Security Architecture for the Internet Protocol", 239 RFC-1825, August 1995. 240 [RFC-1826] R. Atkinson, "IP Authentication Header", 241 RFC-1826, August 1995. 242 [RFC-1828] P. Metzger, W. A. Simpson, "IP Authentication using Keyed MD5", 243 RFC-1828, August 1995. 244 [HMAC-MD5] H. Krawczyk, M. Bellare, R. Canetti, "HMAC-MD5: Keyed-MD5 245 for Message Authentication", Internet Draft, March, 1996. 246 [FIPS-180-1] NIST, FIPS PUB 180-1: Secure Hash Standard, April 1995. 247 [URL] http://csrc.nist.gov/fips/fip180-1.txt (ascii) 248 [URL] http://csrc.nist.gov/fips/fip180-1.ps (postscript) 249 [SCHNEIER] B. Schneier, "Applied Cryptography Protocols, Algorithms, and 250 Source Code in C", John Wiley & Sons, Inc. 1994. 251 [ESP-DES-MD5] J. Hughes, "Combined DES-CBC, MD5, and Replay Prevention 252 Security Transform", Internet Draft, April, 1996. 254 Contacts 256 Shu-jen Chang 257 NIST 258 Building 820, Room 456 259 Gaithersburg, MD 20899 261 shu-jen.chang@nist.gov 263 Robert Glenn 264 NIST 265 Building 820, Room 455 266 Gaithersburg, MD 20899 268 rob.glenn@nist.gov