home *** CD-ROM | disk | FTP | other *** search
/ Internet Core Protocols / Oreilly-InternetCoreProtocols.iso / RFCs / rfc2404.txt < prev    next >
Encoding:
Text File  |  1999-10-14  |  13.2 KB  |  396 lines

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