home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1997 December / Internet_Info_CD-ROM_Walnut_Creek_December_1997.iso / drafts / draft_ietf_i / draft-ietf-ipsec-isakmp-oakley-04.txt < prev    next >
Text File  |  1997-07-16  |  67KB  |  1,683 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6. IPSEC Working Group                                D. Harkins, D. Carrel
  7. INTERNET-DRAFT                                             cisco Systems
  8. draft-ietf-ipsec-isakmp-oakley-04.txt                          July 1997
  9.  
  10.  
  11.                   The resolution of ISAKMP with Oakley
  12.                 <draft-ietf-ipsec-isakmp-oakley-04.txt>
  13.  
  14.  
  15.                           Status of this Memo
  16.  
  17.    This document is an Internet Draft. Internet Drafts are working
  18.    documents of the Internet Engineering Task Force (IETF), its areas,
  19.    and working groups.  Note that other groups may also distribute
  20.    working documents as Internet Drafts.
  21.  
  22.    Internet Drafts are draft documents valid for a maximum of six months
  23.    and may be updated, replaced, or obsoleted by other documents at any
  24.    time. It is inapproporiate to use Internet Drafts as reference
  25.    material or to cite them other than as "work in progress."
  26.  
  27.    To learn the current status of any Internet Draft, please check the
  28.    "1id-abstracts.txt" listing contained in the Internet Drafts Shadow
  29.    Directories on ftp.is.co.za (Africa), nic.nordu.net (Europe),
  30.    munnari.oz.au (Australia), ds.internic.net (US East Coast), or
  31.    ftp.isi.edu (US West Coast).
  32.  
  33.  
  34. 1. Abstract
  35.  
  36.    [MSST96] (ISAKMP) provides a framework for authentication and key
  37.    exchange but does not define them.  ISAKMP is designed to be key
  38.    exchange independant; that is, it is designed to support many
  39.    different key exchanges.
  40.  
  41.    [Orm96] (Oakley) describes a series of key exchanges-- called
  42.    "modes"-- and details the services provided by each (e.g. perfect
  43.    forward secrecy for keys, identity protection, and authentication).
  44.  
  45.    [Kra96] (SKEME) describes a versatile key exchange technique which
  46.    provides anonymity, repudiability, and quick key refreshment.
  47.  
  48.    This document describes a protocol using part of Oakley and part of
  49.    SKEME in conjunction with ISAKMP to obtain authenticated keying
  50.    material for use with ISAKMP, and for other security associations
  51.    such as AH and ESP for the IETF IPsec DOI.
  52.  
  53.  
  54.  
  55.  
  56.  
  57. Harkins, Carrel                                             [Page 1]
  58.  
  59. INTERNET DRAFT                                                 July 1997
  60.  
  61.  
  62. 2. Discussion
  63.  
  64.    This draft describes a hybrid protocol. The purpose is to negotiate,
  65.    and provide authenticated keying material for, security associations
  66.    in a protected manner.
  67.  
  68.    Processes which implement this draft can be used for negotiating
  69.    virtual private networks (VPNs) and also for providing a remote user
  70.    from a remote site (whose IP address need not be known beforehand)
  71.    access to a secure host or network.
  72.  
  73.    Proxy negotiation is supported.  Proxy mode is where the negotiating
  74.    parties are not the endpoints for which security association
  75.    negotiation is taking place.  When used in proxy mode, the identities
  76.    of the end parties remain hidden.
  77.  
  78.    This does not implement the entire Oakley protocol, but only a subset
  79.    necessary to satisfy its goals. It does not claim conformance or
  80.    compliance with the entire Oakley protocol.
  81.  
  82.    Likewise, this does not implement the entire SKEME protocol, but only
  83.    the method of public key encryption for authentication and its
  84.    concept of fast re-keying using an exchange of nonces.
  85.  
  86. 3. Terms and Definitions
  87.  
  88. 3.1 Requirements Terminology
  89.  
  90.    Keywords "MUST", "MUST NOT", "REQUIRED", "SHOULD", "SHOULD NOT" and
  91.    "MAY" that appear in this document are to be interpreted as described
  92.    in [Bra97].
  93.  
  94. 3.2 Notation
  95.  
  96.    The following notation is used throughout this draft.
  97.  
  98.       HDR is an ISAKMP header whose exchange type is the mode.  When
  99.       writen as HDR* it indicates payload encryption.
  100.  
  101.       SA is an SA negotiation payload with one or more proposals. An
  102.       initiator MAY provide multiple proposals for negotiation; a
  103.       responder MUST reply with only one.
  104.  
  105.       SAp is the entire body of the SA payload (minus the ISAKMP generic
  106.       header)-- i.e. the DOI, situation, all proposals and all
  107.       transforms offered by the Initiator.
  108.  
  109.       g^xi and g^xr are the Diffie-Hellman public values of the
  110.  
  111.  
  112.  
  113. Harkins, Carrel                                             [Page 2]
  114.  
  115. INTERNET DRAFT                                                 July 1997
  116.  
  117.  
  118.       initiator and responder respectively.
  119.  
  120.       KE is the key exchange payload.
  121.  
  122.       Nx is the nonce payload; x can be: i or r for the ISAKMP initiator
  123.       and responder respectively.
  124.  
  125.       IDx is the identity payload for "x".  x can be: "ii" or "ir" for
  126.       the ISAKMP initiator and responder respectively during phase one
  127.       negotiation; or "ui" or "ur" for the user initiator and responder
  128.       respectively during phase two.  The ID payload format for the
  129.       Internet DOI is defined in [Pip96].
  130.  
  131.       SIG is the signature payload. The data to sign is exchange-
  132.       specific.
  133.  
  134.       CERT is the certificate payload.
  135.  
  136.       HASH (and any derivitive such as HASH(2) or HASH_I) is the hash
  137.       payload. The contents of the hash are specific to the
  138.       authentication method.
  139.  
  140.       prf(key, msg) is the keyed pseudo-random function-- often a keyed
  141.       hash function-- used to generate a deterministic output that
  142.       appears pseudo-random.  prf's are used both for key derivations
  143.       and for authentication (i.e. as a keyed MAC). (See [KBC96]).
  144.  
  145.       SKEYID is a string derived from secret material known only to the
  146.       active players in the exchange.
  147.  
  148.       SKEYID_e is the keying material used by the ISAKMP SA to protect
  149.       it's messages.
  150.  
  151.       SKEYID_a is the keying material used by the ISAKMP SA to
  152.       authenticate it's messages.
  153.  
  154.       SKEYID_d is the keying material used to derive keys for non-ISAKMP
  155.       security associations.
  156.  
  157.       <x>y indicates that "x" is encrypted with the key "y".
  158.  
  159.       --> signifies "initiator to responder" communication (requests).
  160.  
  161.       <-- signifies "responder to initiator" communication (replies).
  162.  
  163.        |  signifies concatenation of information-- e.g. X | Y is the
  164.       concatentation of X with Y.
  165.  
  166.  
  167.  
  168.  
  169. Harkins, Carrel                                             [Page 3]
  170.  
  171. INTERNET DRAFT                                                 July 1997
  172.  
  173.  
  174.       [x] indicates that x is optional.
  175.  
  176.    Payload encryption (when noted by a '*' after the ISAKMP header) MUST
  177.    begin immediately after the ISAKMP header. When communication is
  178.    protected, all payloads following the ISAKMP header MUST be
  179.    encrypted.  Encryption keys are generated from SKEYID_e in a manner
  180.    that is defined for each algorithm.
  181.  
  182.    When used to describe the payloads contained in complete message
  183.    exchanges, the ISAKMP generic header is implicitly included. When
  184.    used as part of a prf computation, the ISAKMP generic header is not
  185.    included unless specifically noted. For example, the initiator may
  186.    send the responder the following message:
  187.      HDR, KE, Ni
  188.    The ISAKMP header is included in the KE and Ni payloads. But if the
  189.    initiator generates the following pseudo-random output:
  190.      HASH = prf(key, Ni | Nr)
  191.    the ISAKMP headers of the two nonce payloads are not included-- only
  192.    the body of the payload-- the nonce itself-- is used.
  193.  
  194. 3.3 Perfect Forward Secrecy
  195.  
  196.    When used in the draft Perfect Forward Secrecy (PFS) refers to the
  197.    notion that compromise of a single key will permit access to only
  198.    data protected by a single key. For PFS to exist the key used to
  199.    protect transmission of data MUST NOT be used to derive any
  200.    additional keys, and if the key used to protect transmission of data
  201.    was derived from some other keying material, that material MUST NOT
  202.    be used to derive any more keys.
  203.  
  204.    Perfect Forward Secrecy for both keys and identities is provided in
  205.    this protocol. (Sections 5.8 and 7).
  206.  
  207. 3.4 Security Association
  208.  
  209.    A security association (SA) is a set of policy and key used to
  210.    protect information. The ISAKMP SA is the shared policy and key used
  211.    by the negotiating peers in this protocol to protect their
  212.    communication.
  213.  
  214. 4. Introduction
  215.  
  216.    Oakley defines a method to establish an authenticated key exchange.
  217.    This includes how payloads are constructed, the information they
  218.    carry, the order in which they are processed and how they are used.
  219.  
  220.    While Oakley defines "modes", ISAKMP defines "phases".  The
  221.    relationship between the two is very straightforward.  ISAKMP's phase
  222.  
  223.  
  224.  
  225. Harkins, Carrel                                             [Page 4]
  226.  
  227. INTERNET DRAFT                                                 July 1997
  228.  
  229.  
  230.    1 is where the two ISAKMP peers establish a secure, authenticated
  231.    channel with which to communicate.  This is called the ISAKMP
  232.    Security Association (SA). "Main Mode" and "Aggressive Mode" each
  233.    accomplish a phase 1 exchange.  "Main Mode" and "Aggressive Mode"
  234.    MUST ONLY be used in phase 1.
  235.  
  236.    Phase 2 is where Security Associations are negotiated on behalf of
  237.    services such as IPsec or any other service which needs key material
  238.    and/or parameter negotiation. "Quick Mode" accomplishes a phase 2
  239.    exchange. "Quick Mode" MUST ONLY be used in phase 2.
  240.  
  241.    "New Group Mode" is not really a phase 1 or phase 2.  It follows
  242.    phase 1, but serves to establish a new group which can be used in
  243.    future negotiations. "New Group Mode" MUST ONLY be used in phase 2.
  244.  
  245.    The ISAKMP SA is bi-directional. That is, once established, either
  246.    party may initiate Quick Mode, Informational, and New Group Mode
  247.    Exchanges.  Per the base ISAKMP document, the ISAKMP SA is identified
  248.    by the Initiator's cookie followed by the Responder's cookie-- the
  249.    role of each party in the phase 1 exchange dictates which cookie is
  250.    the Initiator's. The cookie order established by the phase 1 exchange
  251.    continues to identify the ISAKMP SA regardless of the direction the
  252.    Quick Mode, Informational, or New Group exchange. In other words, the
  253.    cookies MUST NOT swap places when the direction of the ISAKMP SA
  254.    changes.
  255.  
  256.    With the use of ISAKMP phases, an implementation can accomplish very
  257.    fast keying when necessary.  A single phase 1 negotiation may be used
  258.    for more than one phase 2 negotiation.  Additionally a single phase 2
  259.    negotiation can request multiple Security Associations.  With these
  260.    optimizations, an implementation can see less than one round trip per
  261.    SA as well as less than one DH exponentiation per SA.  "Main Mode"
  262.    for phase 1 provides identity protection.  When identity protection
  263.    is not needed, "Aggressive Mode" can be used to reduce round trips
  264.    even further.  Developer hints for doing these optimizations are
  265.    included below. It should also be noted that using public key
  266.    encryption to authenticate an Aggressive Mode exchange will still
  267.    provide identity protection.
  268.  
  269.    The following attributes are used by ISAKMP/Oakley and are negotiated
  270.    as part of the ISAKMP Security Association.  (These attributes
  271.    pertain only to the ISAKMP Security Association and not to any
  272.    Security Associations that ISAKMP may be negotiating on behalf of
  273.    other services.)
  274.  
  275.       - encryption algorithm (e.g. DES, IDEA, Blowfish).
  276.  
  277.       - hash algorithm (e.g. MD5, SHA)
  278.  
  279.  
  280.  
  281. Harkins, Carrel                                             [Page 5]
  282.  
  283. INTERNET DRAFT                                                 July 1997
  284.  
  285.  
  286.       - authentication method (e.g. DSS sig, RSA sig, RSA encryption,
  287.       pre-shared key)
  288.  
  289.       - information about a group over which to do Diffie-Hellman.
  290.  
  291.       - prf (e.g. 3DES-CBC-MAC)
  292.  
  293.    All of these attributes are mandatory and MUST be negotiated except
  294.    for the "prf".  The "prf" MAY be negotiated, but if it is not, the
  295.    HMAC (see [KBC96]) version of the negotiated hash algorithm is used
  296.    as a pseudo-random function. Other non-mandatory attributes are
  297.    described in Appendix A. The selected hash algorithm MUST support
  298.    both native and HMAC modes.
  299.  
  300.    ISAKMP/Oakley implementations MUST support the following attribute
  301.    values:
  302.  
  303.       - DES-CBC with a weak, and semi-weak, key check (weak and semi-
  304.       weak keys are referenced in [Sch94] and listed in Appendix A). The
  305.       key is derived according to Appendix B.
  306.  
  307.       - MD5 and SHA.
  308.  
  309.       - Authentication via pre-shared keys. The Digital Signature
  310.       Standard SHOULD be supported; RSA SHOULD also be supported.
  311.  
  312.       - MODP over the default group (see below). ECP groups MAY be
  313.       supported.
  314.  
  315.    The ISAKMP/Oakley modes described here MUST be implemented whenever
  316.    the IETF IPsec DOI [Pip96] is implemented. Other DOIs MAY use the
  317.    modes described here.
  318.  
  319. 5. Exchanges
  320.  
  321.    There are two basic methods used to establish an authenticated key
  322.    exchange: Main Mode and Aggressive Mode. Each generates authenticated
  323.    keying material from an ephemeral Diffie-Hellman exchange. Main Mode
  324.    MUST be implemented; Aggressive Mode SHOULD be implemented. In
  325.    addition, Quick Mode MUST be implemented as a mechanism to generate
  326.    fresh keying material and negotiate non-ISAKMP security services. In
  327.    additon, New Group Mode SHOULD be implemented as a mechanism to
  328.    define private groups for Diffie-Hellman exchanges. Implementations
  329.    MUST NOT switch exchange types in the middle of an exchange.
  330.  
  331.    Exchanges conform to standard ISAKMP [MSST96] payload syntax,
  332.    attribute encoding, timeouts and retransmits of messages, and
  333.    informational messages-- e.g a notify response is sent when, for
  334.  
  335.  
  336.  
  337. Harkins, Carrel                                             [Page 6]
  338.  
  339. INTERNET DRAFT                                                 July 1997
  340.  
  341.  
  342.    example, a proposal is unacceptable, or a signature verification or
  343.    decryption was unsuccessful, etc.
  344.  
  345.    Main Mode is an instantiation of the ISAKMP Identity Protect
  346.    Exchange: The first two messages negotiate policy; the next two
  347.    exchange Diffie-Hellman public values and ancillary data (e.g.
  348.    nonces) necessary for the exchange; and the last two messages
  349.    authenticate the Diffie-Hellman Exchange. The authentication method
  350.    negotiated as part of the initial ISAKMP exchange influences the
  351.    composition of the payloads but not their purpose. The XCHG for Main
  352.    Mode is ISAKMP Identity Protect.
  353.  
  354.    Similarly, Aggressive Mode is an instantiation of the ISAKMP
  355.    Aggressive Exchange. The first two messages negotiate policy,
  356.    exchange Diffie-Hellman public values and ancillary data necessary
  357.    for the exchange, and identities.  In addition the second message
  358.    authenticates the responder. The third message authenticates the
  359.    initiator and provides a proof of participation in the exchange. The
  360.    XCHG for Aggressive Mode is ISAKMP Aggressive.  The final message is
  361.    not sent under protection of the ISAKMP SA allowing each party to
  362.    postpone exponentiation, if desired, until negotiation of this
  363.    exchange is complete.
  364.  
  365.    Quick Mode and New Group Mode have no analog in ISAKMP. The XCHG
  366.    values for Quick Mode and New Group Mode are defined in Appendix A.
  367.  
  368.    Except where noted, there is no requirement for ISAKMP payloads in
  369.    any exchagen to be in any particular order.
  370.  
  371.    Three different authentication methods are allowed with either Main
  372.    Mode or Aggressive Mode-- digital signature, public key encryption,
  373.    or pre-shared key. The value SKEYID is computed seperately for each
  374.    authentication method.
  375.  
  376.        For signatures:             SKEYID = prf(Ni | Nr, g^xy)
  377.        For public key encryption:  SKEYID = prf(Ni | Nr, CKY-I | CKY-R)
  378.        For pre-shared keys:        SKEYID = prf(pre-shared-key, Ni | Nr)
  379.  
  380.    The result of either Main Mode or Aggressive Mode is three groups of
  381.    authenticated keying material:
  382.  
  383.       SKEYID_d = prf(SKEYID, g^xy | CKY-I | CKY-R | 0)
  384.       SKEYID_a = prf(SKEYID, SKEYID_d | g^xy | CKY-I | CKY-R | 1)
  385.       SKEYID_e = prf(SKEYID, SKEYID_a | g^xy | CKY-I | CKY-R | 2)
  386.  
  387.    and agreed upon policy to protect further communications. The values
  388.    of 0, 1, and 2 above are represented by a single octet. The key used
  389.    for encryption is derived from SKEYID_e in an algorithm-specific
  390.  
  391.  
  392.  
  393. Harkins, Carrel                                             [Page 7]
  394.  
  395. INTERNET DRAFT                                                 July 1997
  396.  
  397.  
  398.    manner (see appendix B).
  399.  
  400.    To authenticate either exchange the initiator of the protocol
  401.    generates HASH_I and the responder generates HASH_R where:
  402.  
  403.       HASH_I = prf(SKEYID, g^xi | g^xr | CKY-I | CKY-R | SAp | IDii)
  404.       HASH_R = prf(SKEYID, g^xr | g^xi | CKY-R | CKY-I | SAp | IDir)
  405.  
  406.    For authentication with digital signatures, HASH_I and HASH_R are
  407.    signed and verified; for authentication with either public key
  408.    encryption or pre-shared keys, HASH_I and HASH_R directly
  409.    authenticate the exchange.
  410.  
  411.    As mentioned above, the negotiated authentication method influences
  412.    the content and use of messages for Phase 1 Modes, but not their
  413.    intent.  When using public keys for authentication, the Phase 1
  414.    exchange can be accomplished either by using signatures or by using
  415.    public key encryption (if the algorithm supports it). Following are
  416.    Main Mode Exchanges with different authentication options.
  417.  
  418. 5.1 ISAKMP/Oakley Phase 1 Authenticated With Signatures
  419.  
  420.    Using signatures, the ancillary information exchanged during the
  421.    second roundtrip are nonces; the exchange is authenticated by signing
  422.    a mutually obtainable hash. Main Mode with signature authentication
  423.    is described as follows:
  424.  
  425.         Initiator                          Responder
  426.        ----------                         -----------
  427.         HDR, SA                     -->
  428.                                     <--    HDR, SA
  429.         HDR, KE, Ni                 -->
  430.                                     <--    HDR, KE, Nr
  431.         HDR*, IDii, [ CERT, ] SIG_I -->
  432.                                     <--    HDR*, IDir, [ CERT, ] SIG_R
  433.  
  434.    Aggressive mode with signatures in conjunction with ISAKMP is
  435.    described as follows:
  436.  
  437.         Initiator                          Responder
  438.        -----------                        -----------
  439.         HDR, SA, KE, Ni, IDii       -->
  440.                                     <--    HDR, SA, KE, Nr, IDir,
  441.                                                 [ CERT, ] SIG_R
  442.         HDR, [ CERT, ] SIG_I        -->
  443.  
  444.    In both modes, the signed data, SIG_I or SIG_R, is the result of the
  445.    negotiated digital signature algorithm applied to HASH_I or HASH_R
  446.  
  447.  
  448.  
  449. Harkins, Carrel                                             [Page 8]
  450.  
  451. INTERNET DRAFT                                                 July 1997
  452.  
  453.  
  454.    respectively.
  455.  
  456.    In general the signature will be over HASH_I and HASH_R as above
  457.    using the negotiated prf, or the HMAC version of the negotiated hash
  458.    function (if no prf is negotiated). However, this can be overridden
  459.    for construction of the signature if the signature algorithm is tied
  460.    to a particular hash algorithm (e.g. DSS is only defined with SHA's
  461.    160 bit output). In this case, the signature will be over HASH_I and
  462.    HASH_R as above, except using the HMAC version of the hash algorithm
  463.    associated with the signature method.  The negotiated prf and hash
  464.    function would continue to be used for all other proscribed pseudo-
  465.    random functions.
  466.  
  467.    Since the hash algorithm used is already known there is no need to
  468.    encode its OID into the signature. In addition, there is no binding
  469.    between the OIDs used for RSA signatures in PKCS #1 and those used in
  470.    this document. Therefore, RSA signatures MUST be encoded as a private
  471.    key encryption in PKCS #1 format. DSS signatures MUST be encoded as r
  472.    followed by s.
  473.  
  474.    One or more certificate payloads MAY be optionally passed.
  475.  
  476. 5.2 Phase 1 Authenticated With Public Key Encryption
  477.  
  478.    Using public key encryption to authenticate the exchange, the
  479.    ancillary information exchanged is encrypted nonces. Each party's
  480.    ability to reconstruct a hash (proving that the other party decrypted
  481.    the nonce) authenticates the exchange.
  482.  
  483.    In order to perform the public key encryption, the initiator must
  484.    already have the responder's public key. In the case where the
  485.    responder has multiple public keys, a hash of the certificate the
  486.    initiator is using to encrypt the ancillary information is passed as
  487.    part of the third message. In this way the responder can determine
  488.    which corresponding private key to use to decrypt the encrypted
  489.    payloads and identity protection is retained.
  490.  
  491.    In addition to the nonce, the identities of the parties (IDii and
  492.    IDir) are also encrypted with the other party's public key. If the
  493.    authentication method is public key encryption, the nonce and
  494.    identity payloads MUST be encrypted with the public key of the other
  495.    party. Only the body of the payloads are encrypted, the payload
  496.    headers are left in the clear.
  497.  
  498.  
  499.  
  500.  
  501.  
  502.  
  503.  
  504.  
  505. Harkins, Carrel                                             [Page 9]
  506.  
  507. INTERNET DRAFT                                                 July 1997
  508.  
  509.  
  510.    When using encrytion for authentication, Main Mode is defined as
  511.    follows.
  512.  
  513.         Initiator                        Responder
  514.        -----------                      -----------
  515.         HDR, SA                   -->
  516.                                   <--    HDR, SA
  517.         HDR, KE, [ HASH(1), ]
  518.           <IDii>PubKey_r,
  519.             <Ni>PubKey_r          -->
  520.                                          HDR, KE, <IDir>PubKey_i,
  521.                                   <--            <Nr>PubKey_i
  522.         HDR*, HASH_I              -->
  523.                                   <--    HDR*, HASH_R
  524.  
  525.    Aggressive Mode authenticated with encryption is described as
  526.    follows:
  527.  
  528.         Initiator                        Responder
  529.        -----------                      -----------
  530.         HDR, SA, [ HASH(1),] KE,
  531.           <IDii>Pubkey_r,
  532.            <Ni>Pubkey_r           -->
  533.                                          HDR, SA, KE, <IDir>PubKey_i,
  534.                                   <--         <Nr>PubKey_r, HASH_R
  535.         HDR, HASH_I               -->
  536.  
  537.    Where HASH(1) is a hash (using the negotiated hash function) of the
  538.    certificate which the initiator is using to encrypt the nonce and
  539.    identity.
  540.  
  541.    RSA encryption MUST be encoded in PKCS #1 format. The payload length
  542.    is the length of the entire encrypted payload plus header. The PKCS
  543.    #1 encoding allows for determination of the actual length of the
  544.    cleartext payload upon decryption.
  545.  
  546.    Using encryption for authentication provides for a plausably deniable
  547.    exchange. There is no proof (as with a digital signature) that the
  548.    conversation ever took place since each party can completely
  549.    reconstruct both sides of the exchange. In addition, security is
  550.    added to secret generation since an attacker would have to
  551.    successfully break not only the Diffie-Hellman exchange but also both
  552.    RSA encryptions. This exchange was motivated by [Kra96].
  553.  
  554.    Note that, unlike other authentication methods, authentication with
  555.    public key encryption allows for identity protection with Aggressive
  556.    Mode.
  557.  
  558.  
  559.  
  560.  
  561. Harkins, Carrel                                            [Page 10]
  562.  
  563. INTERNET DRAFT                                                 July 1997
  564.  
  565.  
  566. 5.3 Phase 1 Authenticated With a Pre-Shared Key
  567.  
  568.    A key derived by some out-of-band mechanism may also be used to
  569.    authenticate the exchange. The actual establishment of this key is
  570.    out of the scope of this document.
  571.  
  572.    When doing a pre-shared key authentication, Main Mode is defined as
  573.    follows:
  574.  
  575.               Initiator                        Responder
  576.              ----------                       -----------
  577.               HDR, SA             -->
  578.                                   <--    HDR, SA
  579.               HDR, KE, Ni         -->
  580.                                   <--    HDR, KE, Nr
  581.               HDR*, IDii, HASH_I  -->
  582.                                   <--    HDR*, IDir, HASH_R
  583.  
  584.    Aggressive mode with a pre-shared key is described as follows:
  585.  
  586.             Initiator                        Responder
  587.            -----------                      -----------
  588.             HDR, SA, KE, Ni, IDii -->
  589.                                   <--    HDR, SA, KE, Nr, IDir, HASH_R
  590.             HDR, HASH_I           -->
  591.  
  592.    When using pre-shared key authentication with Main Mode the key can
  593.    only be identified by the IP address of the peers since HASH_I must
  594.    be computed before the initiator has processed IDir. Aggressive Mode
  595.    allows for a wider range of identifiers of the pre-shared secret to
  596.    be used. In addition, Aggressive Mode allows two parties to maintain
  597.    multiple, different pre-shared keys and identify the correct one for
  598.    a particular exchange.
  599.  
  600. 5.4 Phase 2 - Quick Mode
  601.  
  602.    Quick Mode is not a complete exchange itself, but is used as part of
  603.    the ISAKMP SA negotiation process (phase 2) to derive keying material
  604.    and negotiate shared policy for non-ISAKMP SAs. The information
  605.    exchanged along with Quick Mode MUST be protected by the ISAKMP SA--
  606.    i.e. all payloads except the ISAKMP header are encrypted. In Quick
  607.    Mode, a HASH payload must immediately follow the ISAKMP header. This
  608.    HASH authenticates the message and also provides liveliness proofs.
  609.  
  610.    Quick Mode is essentially an exchange of nonces that provides replay
  611.    protection. The nonces are used to generate fresh key material and
  612.    prevent replay attacks from generating bogus security associations.
  613.    An optional Key Exchange payload can be exchanged to allow for an
  614.  
  615.  
  616.  
  617. Harkins, Carrel                                            [Page 11]
  618.  
  619. INTERNET DRAFT                                                 July 1997
  620.  
  621.  
  622.    additional Diffie-Hellman exchange and exponentiation per Quick Mode.
  623.    While use of the key exchange payload with Quick Mode is optional it
  624.    MUST be supported.
  625.  
  626.    Base Quick Mode (without the KE payload) refreshens the keying
  627.    material derived from the exponentiation in phase 1. This does not
  628.    provide PFS.  Using the optional KE payload, an additional
  629.    exponentiation is performed and PFS is provided for the keying
  630.    material. If a KE payload is sent, a Diffie-Hellman group (see
  631.    section 5.7.1 and [Pip96]) MUST be sent as attributes of the SA being
  632.    negotiated.
  633.  
  634.    Quick Mode is defined as follows:
  635.  
  636.         Initiator                        Responder
  637.        -----------                      -----------
  638.         HDR*, HASH(1), SA, Ni
  639.           [, KE ] [, IDui, IDur ] -->
  640.                                   <--    HDR*, HASH(2), SA, Nr
  641.                                                [, KE ] [, IDui, IDur ]
  642.         HDR*, HASH(3)             -->
  643.  
  644.    Where:
  645.       HASH(1) is the prf over the message id (M-ID) from the ISAKMP
  646.    header concatenated with the entire message that follows the hash
  647.    including all payload headers, but excluding any padding added for
  648.    encryption.  HASH(2) is identical to HASH(1) except the initiator's
  649.    nonce-- Ni, minus the payload header-- is added after M-ID but before
  650.    the complete message.  The addition of the nonce to HASH(2) is for a
  651.    liveliness proff. HASH(3)-- for liveliness-- is the prf over the
  652.    value zero represented as a single octet, followed by a concatenation
  653.    of the message id and the two nonces-- the initiator's followed by
  654.    the responder's-- minus the payload header. In other words, the
  655.    hashes for the above exchange are:
  656.  
  657.       HASH(1) = prf(SKEYID_a, M-ID | SA | Ni [ | KE ] [ | IDui | IDur ])
  658.       HASH(2) = prf(SKEYID_a, M-ID | Ni | SA | Nr [ | KE ] [ | IDui |
  659.    IDur ])
  660.       HASH(3) = prf(SKEYID_a, 0 | M-ID | Ni | Nr)
  661.  
  662.    If PFS is not needed, and KE payloads are not exchanged, the new
  663.    keying material is defined as KEYMAT = prf(SKEYID_d, protocol | SPI |
  664.    Ni | Nr).
  665.  
  666.    If PFS is desired and KE payloads were exchanged, the new keying
  667.    material is defined as KEYMAT = prf(SKEYID_d, g(qm)^xy | protocol |
  668.    SPI | Ni | Nr), where g(qm)^xy is the shared secret from the
  669.    ephemeral Diffie-Hellman exchange of this Quick Mode.
  670.  
  671.  
  672.  
  673. Harkins, Carrel                                            [Page 12]
  674.  
  675. INTERNET DRAFT                                                 July 1997
  676.  
  677.  
  678.    In either case, "protocol" and "SPI" are from the ISAKMP Proposal
  679.    Payload that contained the negotiated Transform.
  680.  
  681.    A single SA negotiation results in two security assocations-- one
  682.    inbound and one outbound. Different SPIs for each SA (one chosen by
  683.    the initiator, the other by the responder) guarantee a different key
  684.    for each direction.  The SPI chosen by the destination of the SA is
  685.    used to derive KEYMAT for that SA.
  686.  
  687.    For situations where the amount of keying material desired is greater
  688.    than that supplied by the prf, KEYMAT is expanded by feeding the
  689.    results of the prf back into itself and concatenating results until
  690.    the required keying material has been reached. In other words,
  691.  
  692.       KEYMAT = K1 | K2 | K3 | ...
  693.       where
  694.         K1 = prf(SKEYID_d, [ g(qm)^xy | ] SPI | Ni | Nr)
  695.         K2 = prf(SKEYID_d, K1 | [ g(qm)^xy | ] SPI | Ni | Nr)
  696.         K3 = prf(SKEYID_d, K2 | [ g(qm)^xy | ] SPI | Ni | Nr)
  697.         etc.
  698.  
  699.    This keying material (whether with PFS or without, and whether
  700.    derived directly or through concatenation) MUST be used with the
  701.    negotiated SA. It is up to the service to define how keys are derived
  702.    from the keying material.
  703.  
  704.    In the case of an ephemeral Diffie-Hellman exchange in Quick Mode,
  705.    the exponential (g(qm)^xy) is irretreivably removed from the current
  706.    state and SKEYID_e and SKEYID_a (derived from phase 1 negotiation)
  707.    continue to protect and authenticate the ISAKMP SA and SKEYID_d
  708.    continues to be used to derive keys.
  709.  
  710.    If ISAKMP is acting as a proxy negotiator on behalf of another party
  711.    the identities of the parties MUST be passed as IDui and then IDur.
  712.    Local policy will dictate whether the proposals are acceptible for
  713.    the identities specified.  If IDs are not exchanged, the negotiation
  714.    is assumed to be done on behalf of each ISAKMP peer.  If an ID range
  715.    (see Appendix A of [Pip96]) is not acceptable (for example, the
  716.    specified subnet is too large) a BAD_ID_RANGE notify message followed
  717.    by an acceptible ID range, in an ID payload, MUST be sent.
  718.  
  719.  
  720.  
  721.  
  722.  
  723.  
  724.  
  725.  
  726.  
  727.  
  728.  
  729. Harkins, Carrel                                            [Page 13]
  730.  
  731. INTERNET DRAFT                                                 July 1997
  732.  
  733.  
  734.    Using Quick Mode, multiple SA's and keys can be negotiated with one
  735.    exchange as follows:
  736.  
  737.         Initiator                        Responder
  738.        -----------                      -----------
  739.         HDR*, HASH(1), SA0, SA1, Ni,
  740.           [, KE ] [, IDui, IDur ] -->
  741.                                   <--    HDR*, HASH(2), SA0, SA1, Nr,
  742.                                             [, KE ] [, IDui, IDur ]
  743.         HDR*, HASH(3)             -->
  744.  
  745.    The keying material is derived identically as in the case of a single
  746.    SA. In this case (negotiation of two SA payloads) the result would be
  747.    four security associations-- two each way for both SAs.
  748.  
  749. 5.5 New Group Mode
  750.  
  751.    New Group Mode MUST NOT be used prior to establishment of an ISAKMP
  752.    SA. The description of a new group MUST only follow phase 1
  753.    negotiation.  (It is not a phase 2 exchange, though).
  754.  
  755.         Initiator                        Responder
  756.        -----------                      -----------
  757.         HDR*, HASH(1), SA        -->
  758.                                  <--     HDR*, HASH(2), SA
  759.  
  760.    where HASH(1) is the prf output, using SKEYID_a as the key, and the
  761.    message-ID from the ISAKMP header concatenated with the entire SA
  762.    proposal, body and header, as the data; HASH(2) is the prf output,
  763.    using SKEYID_a as the key, and the message-ID from the ISAKMP header
  764.    concatenated with the reply as the data. In other words the hashes
  765.    for the above exchange are:
  766.  
  767.       HASH(1) = prf(SKEYID_a, M-ID | SA)
  768.       HASH(2) = prf(SKEYID_a, M-ID | SA)
  769.  
  770.    The proposal will specify the characteristics of the group (see
  771.    appendix A, "Attribute Assigned Numbers"). Group descriptions for
  772.    private Groups MUST be greater than or equal to 2^15.  If the group
  773.    is not acceptable, the responder MUST reply with a Notify payload
  774.    with the message type set to GROUP_NOT_ACCEPTABLE (13).
  775.  
  776.    ISAKMP implementations MAY require private groups to expire with the
  777.    SA under which they were established.
  778.  
  779.    Groups may be directly negotiated in the SA proposal with Main Mode.
  780.    To do this the Prime, Generator (using the Generator One attribute
  781.    class from Appendix A), and Group Type are passed as SA attributes
  782.  
  783.  
  784.  
  785. Harkins, Carrel                                            [Page 14]
  786.  
  787. INTERNET DRAFT                                                 July 1997
  788.  
  789.  
  790.    (see Appendix A in [MSST96]). Alternately, the nature of the group
  791.    can be hidden using New Group Mode and only the group identifier is
  792.    passed in the clear during phase 1 negotiation.
  793.  
  794. 5.6 ISAKMP Informational Exchanges
  795.  
  796.    This protocol protects ISAKMP Informational Exchanges when possible.
  797.    Once the ISAKMP security association has been established (and
  798.    SKEYID_e and SKEYID_a have been generated) ISAKMP Information
  799.    Exchanges, when used with this protocol, are as follows:
  800.  
  801.         Initiator                        Responder
  802.        -----------                      -----------
  803.         HDR*, HASH(1), N/D      -->
  804.  
  805.    where N/D is either an ISAKMP Notify Payload or an ISAKMP Delete
  806.    Payload and HASH(1) is the prf output, using SKEYID_a as the key, and
  807.    the entire informational payload (either a Notify or Delete) as the
  808.    data. In other words, the hash for the above exchange is:
  809.  
  810.       HASH(1) = prf(SKEYID_a, M-ID | N/D)
  811.  
  812.    If the ISAKMP security association has not yet been established at
  813.    the time of the Informational Exchange, the exchange is done in the
  814.    clear without an accompanying HASH payload.
  815.  
  816. 5.7 Oakley Groups
  817.  
  818.    With ISAKMP/Oakley, the group in which to do the Diffie-Hellman
  819.    exchange is negotiated. The value 0 indicates no group. The values 1
  820.    and 2 indicate the default groups described below. The attribute
  821.    class for "Group" is defined in Appendix A. Other groups are also
  822.    defined in [Orm96]. All values 2^15 and higher are used for private
  823.    group identifiers. For a discussion on the strength of the default
  824.    Oakley groups please see the Security Considerations section below.
  825.  
  826. 5.7.1 First Oakley Default Group
  827.  
  828.    Oakley implementations MUST support a MODP group with the following
  829.    prime and generator. This group is assigned id 1 (one).
  830.  
  831.       The prime is: 2^768 - 2 ^704 - 1 + 2^64 * { [2^638 pi] + 149686 }
  832.       Its hexadecimal value is
  833.  
  834.          FFFFFFFF FFFFFFFF C90FDAA2 2168C234 C4C6628B 80DC1CD1
  835.          29024E08 8A67CC74 020BBEA6 3B139B22 514A0879 8E3404DD
  836.          EF9519B3 CD3A431B 302B0A6D F25F1437 4FE1356D 6D51C245
  837.          E485B576 625E7EC6 F44C42E9 A63A3620 FFFFFFFF FFFFFFFF
  838.  
  839.  
  840.  
  841. Harkins, Carrel                                            [Page 15]
  842.  
  843. INTERNET DRAFT                                                 July 1997
  844.  
  845.  
  846.       The generator is: 2.
  847.  
  848. 5.7.2 Second Oakley Group
  849.  
  850.    ISAKMP/Oakley implementations MUST support a MODP group with the
  851.    following prime and generator. This group is assigned id 2 (two).
  852.  
  853.    The prime is 2^1024 - 2^960 - 1 + 2^64 * { [2^894 pi] + 129093 }.
  854.    Its hexadecimal value is
  855.  
  856.       FFFFFFFF FFFFFFFF C90FDAA2 2168C234 C4C6628B 80DC1CD1
  857.       29024E08 8A67CC74 020BBEA6 3B139B22 514A0879 8E3404DD
  858.       EF9519B3 CD3A431B 302B0A6D F25F1437 4FE1356D 6D51C245
  859.       E485B576 625E7EC6 F44C42E9 A637ED6B 0BFF5CB6 F406B7ED
  860.       EE386BFB 5A899FA5 AE9F2411 7C4B1FE6 49286651 ECE65381
  861.       FFFFFFFF FFFFFFFF
  862.  
  863.    The generator is 2 (decimal)
  864.  
  865.    Other groups can be defined using New Group Mode. These default
  866.    groups were generated by Richard Schroeppel at the University of
  867.    Arizona.  Properties of these primes are described in [Orm96].
  868.  
  869. 5.8 Payload Explosion for Complete a ISAKMP/Oakley Exchange
  870.  
  871.    This section illustrates how the ISAKMP/Oakley protocol is used to:
  872.  
  873.       - establish a secure and authenticated channel between ISAKMP
  874.       processes (phase 1); and
  875.  
  876.       - generate key material for, and negotiate, an IPsec SA (phase 2).
  877.  
  878.  
  879.  
  880.  
  881.  
  882.  
  883.  
  884.  
  885.  
  886.  
  887.  
  888.  
  889.  
  890.  
  891.  
  892.  
  893.  
  894.  
  895.  
  896.  
  897. Harkins, Carrel                                            [Page 16]
  898.  
  899. INTERNET DRAFT                                                 July 1997
  900.  
  901.  
  902. 5.8.1 Phase 1 using Main Mode
  903.  
  904.    The following diagram illustrates the payloads exchanged between the
  905.    two parties in the first round trip exchange. The initiator MAY
  906.    propose several proposals; the responder MUST reply with one.
  907.  
  908.        0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  909.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  910.       ~             ISAKMP Header with XCHG of Main Mode,             ~
  911.       ~                  and Next Payload of ISA_SA                   ~
  912.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  913.       !       0       !    RESERVED   !        Payload Length         !
  914.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  915.       !             Domain of Interpretation (IPsec DOI)              !
  916.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  917.       !                          Situation                            !
  918.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  919.       !       0       !    RESERVED   !        Payload Length         !
  920.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  921.       !  Proposal #1  ! PROTO_ISAKMP  !    SPI size   | # Transforms  !
  922.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  923.       ~                        SPI (8 octets)                         ~
  924.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  925.       !    ISA_TRANS  !    RESERVED   !        Payload Length         !
  926.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  927.       !  Transform #1 !  KEY_OAKLEY   |          RESERVED2            !
  928.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  929.       ~                   prefered SA attributes                      ~
  930.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  931.       !       0       !    RESERVED   !        Payload Length         !
  932.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  933.       !  Transform #2 !  KEY_OAKLEY   |          RESERVED2            !
  934.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  935.       ~                   alternate SA attributes                     ~
  936.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  937.  
  938.    The responder replies in kind but selects, and returns, one transform
  939.    proposal (the ISAKMP SA attributes).
  940.  
  941.  
  942.  
  943.  
  944.  
  945.  
  946.  
  947.  
  948.  
  949.  
  950.  
  951.  
  952.  
  953. Harkins, Carrel                                            [Page 17]
  954.  
  955. INTERNET DRAFT                                                 July 1997
  956.  
  957.  
  958.    The second exchange consists of the following payloads:
  959.  
  960.        0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  961.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  962.       ~             ISAKMP Header with XCHG of Main Mode,             ~
  963.       ~                  and Next Payload of ISA_KE                   ~
  964.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  965.       !    ISA_NONCE  !    RESERVED   !        Payload Length         !
  966.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  967.       ~   D-H Public Value  (g^xi from initiator g^xr from responder) ~
  968.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  969.       !       0       !    RESERVED   !        Payload Length         !
  970.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  971.       ~         Ni (from initiator) or  Nr (from responder)           ~
  972.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  973.  
  974.    The shared keys, SKEYID_e and SKEYID_a, are now used to protect and
  975.    authenticate all further communication. Note that both SKEYID_e and
  976.    SKEYID_a are unauthenticated.
  977.  
  978.        0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  979.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  980.       ~            ISAKMP Header with XCHG of Main Mode,              ~
  981.       ~     and Next Payload of ISA_ID and the encryption bit set     ~
  982.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  983.       !    ISA_SIG    !    RESERVED   !        Payload Length         !
  984.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  985.       ~        Identification Data of the ISAKMP negotiator           ~
  986.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  987.       !       0       !    RESERVED   !        Payload Length         !
  988.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  989.       ~       signature verified by the public key of the ID above    ~
  990.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  991.  
  992.    The key exchange is authenticated over a signed hash as described in
  993.    section 5.1. Once the signature has been verified using the
  994.    authentication algorithm negotiated as part of the ISAKMP SA, the
  995.    shared keys, SKEYID_e and SKEYID_a can be marked as authenticated.
  996.    (For brevity, certificate payloads were not exchanged).
  997.  
  998. 5.8.2 Phase 2 using Quick Mode
  999.  
  1000.      The following payloads are exchanged in the first round of Quick
  1001.    Mode with ISAKMP SA negotiation. In this hypothetical exchange, the
  1002.    ISAKMP negotiators are proxies for other parties which have requested
  1003.    authentication.
  1004.  
  1005.  
  1006.  
  1007.  
  1008.  
  1009. Harkins, Carrel                                            [Page 18]
  1010.  
  1011. INTERNET DRAFT                                                 July 1997
  1012.  
  1013.  
  1014.        0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  1015.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1016.       ~            ISAKMP Header with XCHG of Quick Mode,             ~
  1017.       ~   Next Payload of ISA_HASH and the encryption bit set         ~
  1018.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1019.       !     ISA_SA    !    RESERVED   !        Payload Length         !
  1020.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1021.       ~                 keyed hash of message                         ~
  1022.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1023.       !   ISA_NONCE   !    RESERVED   !         Payload Length        !
  1024.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1025.       !                 Domain Of Interpretation (DOI)                !
  1026.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1027.       !                          Situation                            !
  1028.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1029.       !       0       !    RESERVED   !        Payload Length         !
  1030.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1031.       !  Proposal #1  ! PROTO_IPSEC_AH!  SPI size   |  # Transforms   !
  1032.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1033.       ~                        SPI (8 octets)                         ~
  1034.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1035.       !    ISA_TRANS  !    RESERVED   !        Payload Length         !
  1036.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1037.       !  Transform #1 !     AH_SHA    |          RESERVED2            !
  1038.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1039.       !                       other SA attributes                     !
  1040.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1041.       !       0       !    RESERVED   !        Payload Length         !
  1042.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1043.       !  Transform #1 !     AH_MD5    |          RESERVED2            !
  1044.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1045.       !                       other SA attributes                     !
  1046.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1047.       !    ISA_ID     !    RESERVED   !        Payload Length         !
  1048.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1049.       ~                            nonce                              ~
  1050.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1051.       !    ISA_ID     !    RESERVED   !        Payload Length         !
  1052.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1053.       ~              ID of source for which ISAKMP is a proxy         ~
  1054.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1055.       !      0        !    RESERVED   !        Payload Length         !
  1056.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1057.       ~           ID of destination for which ISAKMP is a proxy       ~
  1058.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1059.  
  1060.    where the contents of the hash are described in 5.4 above. The
  1061.    responder replies with a similar message which only contains one
  1062.  
  1063.  
  1064.  
  1065. Harkins, Carrel                                            [Page 19]
  1066.  
  1067. INTERNET DRAFT                                                 July 1997
  1068.  
  1069.  
  1070.    transform-- the selected AH transform. Upon receipt, the initiator
  1071.    can provide the key engine with the negotiated security association
  1072.    and the keying material.  As a check against replay attacks, the
  1073.    responder waits until receipt of the next message.
  1074.  
  1075.        0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  1076.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1077.       ~          ISAKMP Header with XCHG of Quick Mode,               ~
  1078.       ~   Next Payload of ISA_HASH and the encryption bit set         ~
  1079.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1080.       !       0       !    RESERVED   !        Payload Length         !
  1081.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1082.       ~                         hash data                             ~
  1083.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1084.  
  1085.    where the contents of the hash are described in 5.4 above.
  1086.  
  1087. 5.9 Perfect Forward Secrecy Example
  1088.    This protocol can provide PFS of both keys and identities. The
  1089.    identies of both the ISAKMP negotiating peer and, if applicable, the
  1090.    identities for whom the peers are negotiating can be protected with
  1091.    PFS.
  1092.  
  1093.    To provide Perfect Forward Secrecy of both keys and all identities,
  1094.    two parties would perform the following:
  1095.       o A Main Mode Exchange to protect the identities of the ISAKMP
  1096.       peers.
  1097.         This establishes an ISAKMP SA.
  1098.       o A Quick Mode Exchange to negotiate other security protocol
  1099.       protection.
  1100.         This establishes a SA on each end for this protocol.
  1101.       o Delete the ISAKMP SA and its associated state.
  1102.    Since the key for use in the non-ISAKMP SA was derived from the
  1103.    single ephemeral Diffie-Hellman exchange PFS is preserved.
  1104.  
  1105.    To provide Perfect Forward Secrecy of merely the keys of a non-ISAKMP
  1106.    security association, it in not necessary to do a phase 1 exchange if
  1107.    an ISAKMP SA exists between the two peers. A single Quick Mode in
  1108.    which the optional KE payload is passed, and an additional Diffie-
  1109.    Hellman exchange is performed, is all that is required. At this point
  1110.    the state derived from this Quick Mode must be deleted from the
  1111.    ISAKMP SA as described in section 5.4.
  1112.  
  1113.  
  1114.  
  1115.  
  1116.  
  1117.  
  1118.  
  1119.  
  1120.  
  1121. Harkins, Carrel                                            [Page 20]
  1122.  
  1123. INTERNET DRAFT                                                 July 1997
  1124.  
  1125.  
  1126. 6. Implementation Hints
  1127.  
  1128.    Using a single ISAKMP Phase 1 negotiation makes subsequent Phase 2
  1129.    negotiations extremely quick.  As long as the Phase 1 state remains
  1130.    cached, and PFS is not needed, Phase 2 can proceed without any
  1131.    exponentiation. How many Phase 2 negotiations can be performed for a
  1132.    single Phase 1 is a local policy issue. The decision will depend on
  1133.    the strength of the algorithms being used and level of trust in the
  1134.    peer system.
  1135.  
  1136.    An implementation may wish to negotiate a range of SAs when
  1137.    performing Quick Mode.  By doing this they can speed up the "re-
  1138.    keying". Quick Mode defines how KEYMAT is defined for a range of SAs.
  1139.    When one peer feels it is time to change SAs they simply use the next
  1140.    one within the stated range. A range of SAs can be established by
  1141.    negotiating multiple SAs (identical attributes, different SPIs) with
  1142.    one Quick Mode.
  1143.  
  1144.    An optimization that is often useful is to establish Security
  1145.    Associations with peers before they are needed so that when they
  1146.    become needed they are already in place. This ensures there would be
  1147.    no delays due to key management before initial data transmission.
  1148.    This optimization is easily implemented by setting up more than one
  1149.    Security Association with a peer for each requested Security
  1150.    Association and caching those not immediately used.
  1151.  
  1152.    Also, if an ISAKMP implementation is alerted that a SA will soon be
  1153.    needed (e.g. to replace an existing SA that will expire in the near
  1154.    future), then it can establish the new SA before that new SA is
  1155.    needed.
  1156.  
  1157.    The base ISAKMP specification describes conditions in which one party
  1158.    of the protocol may inform the other party of some activity-- either
  1159.    deletion of a security association or in response to some error in
  1160.    the protocol such as a signature verification failed or a payload
  1161.    failed to decrypt. It is strongly suggested that these Informational
  1162.    exchanges not be responded to under any circumstances. Such a
  1163.    condition may result in a "notify war" in which failure to understand
  1164.    a message results in a notify to the peer who cannot understand it
  1165.    and sends his own notify back which is also not understood.
  1166.  
  1167. 7. Security Considerations
  1168.  
  1169.    This entire draft discusses a hybrid protocol, combining Oakley with
  1170.    ISAKMP, to negotiate, and derive keying material for, security
  1171.    associations in a secure and authenticated manner.
  1172.  
  1173.    Confidentiality is assured by the use of a negotiated encryption
  1174.  
  1175.  
  1176.  
  1177. Harkins, Carrel                                            [Page 21]
  1178.  
  1179. INTERNET DRAFT                                                 July 1997
  1180.  
  1181.  
  1182.    algorithm.  Authentication is assured by the use of a negotiated
  1183.    method: a digital signature algorithm; a public key algorithm which
  1184.    supports encryption; or, a pre-shared key. The confidentiality and
  1185.    authentication of this exchange is only as good as the attributes
  1186.    negotiated as part of the ISAKMP security association.
  1187.  
  1188.    Repeated re-keying using Quick Mode can consume the entropy of the
  1189.    Diffie- Hellman shared secret. Implementors should take note of this
  1190.    fact and set a limit on Quick Mode Exchanges between exponentiations.
  1191.    This draft does not prescribe such a limit.
  1192.  
  1193.    Perfect Forward Secrecy (PFS) of both keying material and identities
  1194.    is possible with this protocol. By specifying a Diffie-Hellman group,
  1195.    and passing public values in KE payloads, ISAKMP peers can establish
  1196.    PFS of keys-- the identities would be protected by SKEYID_e from the
  1197.    ISAKMP SA and would therefore not be protected by PFS. If PFS of both
  1198.    keying material and identities is desired, an ISAKMP peer MUST
  1199.    establish only one non-ISAKMP security association (e.g. IPsec
  1200.    Security Association) per ISAKMP SA. PFS for keys and identities is
  1201.    accomplished by deleting the ISAKMP SA (and optionally issuing a
  1202.    DELETE message) upon establishment of the single non-ISAKMP SA. In
  1203.    this way a phase one negotiation is uniquely tied to a single phase
  1204.    two negotiation, and the ISAKMP SA established during phase one
  1205.    negotiation is never used again.
  1206.  
  1207.    The strength of a key derived from a MODP Diffie-Hellman exchange
  1208.    depends on the size of the prime used and also the inherent strength
  1209.    of the group. The first default Oakley group for Diffie-Hellman
  1210.    exchanges defined in this document provides enough strength for DES--
  1211.    56 bits-- with an exponent no less than 160 bits. The second default
  1212.    Oakley group for Diffie-Hellman exchanges defined in this document
  1213.    provides around 80 bits of strength with an exponent no less than 160
  1214.    bits. Implementations should make note of these conservative
  1215.    estimates when establishing policy and negotiating security
  1216.    parameters.
  1217.  
  1218.    Note that these limitations are on the Diffie-Hellman groups
  1219.    themselves.  There is nothing in ISAKMP/Oakley which prohibits using
  1220.    stronger groups nor is there anything which will dilute the strength
  1221.    obtained from stronger groups. In fact, the extensible framework of
  1222.    ISAKMP/Oakley encourages the definition of more groups; use of
  1223.    elliptical curve groups will greatly increase strength using much
  1224.    smaller numbers. At the time of this writing there were no Elliptical
  1225.    Curve groups to use with ISAKMP/Oakley.
  1226.  
  1227.    For situations where defined groups provide insufficient strength New
  1228.    Group Mode can be used to exchange a Diffie-Hellman group which
  1229.    provides the necessary strength. In is incumbent upon implementations
  1230.  
  1231.  
  1232.  
  1233. Harkins, Carrel                                            [Page 22]
  1234.  
  1235. INTERNET DRAFT                                                 July 1997
  1236.  
  1237.  
  1238.    to check the primality in groups being offered and independently
  1239.    arrive at strength estimates.
  1240.  
  1241.    It is assumed that the Diffie-Hellman exponents in this exchange are
  1242.    erased from memory after use. In particular, these exponents must not
  1243.    be derived from long-lived secrets like the seed to a pseudo-random
  1244.    generator.
  1245.  
  1246. 8. Acknowledgements
  1247.  
  1248.    This document is the result of close consultation with Hugo Krawczyk,
  1249.    Douglas Maughan, Hilarie Orman, Mark Schertler, Mark Schneider, and
  1250.    Jeff Turner. It relies on protocols which were written by them.
  1251.    Without their interest and dedication, this would not have been
  1252.    written.
  1253.  
  1254.    We would also like to thank Cheryl Madson, Harry Varnis, and Elfed
  1255.    Weaver for technical input.
  1256.  
  1257. 9. References
  1258.  
  1259.    [Acm97] Adams, C.M., "Constructing Symmetric Ciphers Using the CAST
  1260.    Design Procedure", Designs, Codes and Cryptorgraphy (to appear).
  1261.  
  1262.    [Bra97] Bradner, S., "Key Words for use in RFCs to indicate
  1263.    Requirement Levels", RFC2119, March 1997.
  1264.  
  1265.    [KBC96] Krawczyk, H., Bellare, M., Canetti, R., "HMAC: Keyed-Hashing
  1266.    for Message Authentication", RFC 2104, February 1997.
  1267.  
  1268.    [Kra96] Krawczyk, H., "SKEME: A Versatile Secure Key Exchange
  1269.    Mechanism for Internet", from IEEE Proceedings of the 1996 Symposium
  1270.    on Network and Distributed Systems Security.
  1271.  
  1272.    [MSST96] Maughhan, D., Schertler, M., Schneider, M., and Turner, J.,
  1273.    "Internet Security Association and Key Management Protocol (ISAKMP)",
  1274.    version 8, draft-ietf-ipsec-isakmp-08.{ps,txt}.
  1275.  
  1276.    [Orm96] Orman, H., "The Oakley Key Determination Protocol", version
  1277.    1, TR97-92, Department of Computer Science Technical Report,
  1278.    University of Arizona.
  1279.  
  1280.    [Pip96] Piper, D., "The Internet IP Security Domain Of Interpretation
  1281.    for ISAKMP", version 3, draft-ietf-ipsec-ipsec-doi-03.txt.
  1282.  
  1283.    [Sch94] Schneier, B., "Applied Cryptography, Protocols, Algorithms,
  1284.    and Source Code in C", 2nd edition.
  1285.  
  1286.  
  1287.  
  1288.  
  1289. Harkins, Carrel                                            [Page 23]
  1290.  
  1291. INTERNET DRAFT                                                 July 1997
  1292.  
  1293.  
  1294. Appendix A
  1295.  
  1296.    This is a list of DES Weak and Semi-Weak keys.  The keys come from
  1297.    [Sch94].  All keys are listed in hexidecimal.
  1298.  
  1299.        DES Weak Keys
  1300.        0101 0101 0101 0101
  1301.        1F1F 1F1F E0E0 E0E0
  1302.        E0E0 E0E0 1F1F 1F1F
  1303.        FEFE FEFE FEFE FEFE
  1304.  
  1305.        DES Semi-Weak Keys
  1306.        01FE 01FE 01FE 01FE
  1307.        1FE0 1FE0 0EF1 0EF1
  1308.        01E0 01E0 01F1 01F1
  1309.        1FFE 1FFE 0EFE 0EFE
  1310.        011F 011F 010E 010E
  1311.        E0FE E0FE F1FE F1FE
  1312.  
  1313.        FE01 FE01 FE01 FE01
  1314.        E01F E01F F10E F10E
  1315.        E001 E001 F101 F101
  1316.        FE1F FE1F FE0E FE0E
  1317.        1F01 1F01 0E01 0E01
  1318.        FEE0 FEE0 FEF1 FEF1
  1319.  
  1320.  
  1321.    Attribute Assigned Numbers
  1322.  
  1323.    Attributes negotiated during phase one use the following definitions.
  1324.    Phase two attributes are defined in the applicable DOI specification
  1325.    (for example, IPsec attributes are defined in the IPsec DOI), with
  1326.    the exception of a group description when Quick Mode includes an
  1327.    ephemeral Diffie-Hellman exchange.  Attribute types can be either
  1328.    Basic (B) or Variable-length (V). Encoding of these attributes is
  1329.    defined in the base ISAKMP specification.
  1330.  
  1331.  
  1332.  
  1333.  
  1334.  
  1335.  
  1336.  
  1337.  
  1338.  
  1339.  
  1340.  
  1341.  
  1342.  
  1343.  
  1344.  
  1345. Harkins, Carrel                                            [Page 24]
  1346.  
  1347. INTERNET DRAFT                                                 July 1997
  1348.  
  1349.  
  1350.    Attribute Classes
  1351.  
  1352.           class                         value              type
  1353.      -------------------------------------------------------------------
  1354.       Encryption Algorithm                1                 B
  1355.       Hash Algorithm                      2                 B
  1356.       Authentication Method               3                 B
  1357.       Group Description                   4                 B
  1358.       Group Type                          5                 B
  1359.       Group Prime                         6                 V
  1360.       Group Generator One                 7                 V
  1361.       Group Generator Two                 8                 V
  1362.       Group Curve A                       9                 V
  1363.       Group Curve B                      10                 V
  1364.       Life Type                          11                 B
  1365.       Life Duration                      12                B/V
  1366.       PRF                                13                 B
  1367.       Key Length                         14                 B
  1368.  
  1369.  
  1370.    Class Values
  1371.  
  1372.    - Encryption Algorithm
  1373.       DEC-CBC                             1
  1374.       IDEA-CBC                            2
  1375.       Blowfish-CBC                        3
  1376.       RC5-R16-B64-CBC                     4
  1377.       3DES-CBC                            5
  1378.       CAST-CBC                            6
  1379.  
  1380.      values 7-65000 are reserved. Values 65001-65535 are for private use
  1381.      among mutually consenting parties.
  1382.  
  1383.    - Hash Algorithm
  1384.       MD5                                 1
  1385.       SHA                                 2
  1386.       Tiger                               3
  1387.  
  1388.      values 4-65000 are reserved. Values 65001-65535 are for private use
  1389.      among mutually consenting parties.
  1390.  
  1391.    - Authentication Method
  1392.       pre-shared key                      1
  1393.       DSS signatures                      2
  1394.       RSA signatures                      3
  1395.       RSA encryption                      4
  1396.  
  1397.      values 5-65000 are reserved. Values 65001-65535 are for private use
  1398.  
  1399.  
  1400.  
  1401. Harkins, Carrel                                            [Page 25]
  1402.  
  1403. INTERNET DRAFT                                                 July 1997
  1404.  
  1405.  
  1406.      among mutually consenting parties.
  1407.  
  1408.    - Group Description
  1409.       default group (section 5.7.1)       1
  1410.  
  1411.      values 2-32767 are reserved. Values 32768-65535 are for private use
  1412.      among mutually consenting parties.
  1413.  
  1414.    - Group Type
  1415.       MODP (modular exponentiation group)            1
  1416.       ECP  (elliptic curve group over GF[P])         2
  1417.       EC2N (elliptic curve group over GF[2^N])       3
  1418.  
  1419.      values 4-65000 are reserved. Values 65001-65535 are for private use
  1420.      among mutually consenting parties.
  1421.  
  1422.    - Life Type
  1423.       seconds                             1
  1424.       kilobytes                           2
  1425.  
  1426.      values 3-65000 are reserved. Values 65001-65535 are for private use
  1427.      among mutually consenting parties. For a given "Life Type" the
  1428.      value of the "Life Duration" attribute defines the actual length of
  1429.      the SA life-- either a number of seconds, or a number of kbytes
  1430.      protected.
  1431.  
  1432.    - PRF
  1433.       3DES-CBC-MAC                        1
  1434.  
  1435.      values 2-65000 are reserved. Values 65001-65535 are for private use
  1436.      among mutually consenting parties
  1437.  
  1438.    - Key Length
  1439.  
  1440.      When using an Encryption Algorithm that has a variable length key,
  1441.      this attribute specifies the key length in bits. (MUST use network
  1442.      byte order).
  1443.  
  1444.    Additional Exchanges Defined-- XCHG values
  1445.       Quick Mode                         32
  1446.       New Group Mode                     33
  1447.  
  1448.  
  1449.  
  1450.  
  1451.  
  1452.  
  1453.  
  1454.  
  1455.  
  1456.  
  1457. Harkins, Carrel                                            [Page 26]
  1458.  
  1459. INTERNET DRAFT                                                 July 1997
  1460.  
  1461.  
  1462. Appendix B
  1463.  
  1464.    This appendix describes encryption details to be used ONLY when
  1465.    encrypting ISAKMP messages.  When a service (such as an IPSEC
  1466.    transform) utilizes ISAKMP to generate keying material, all
  1467.    encryption algorithm specific details (such as key and IV generation,
  1468.    padding, etc...) MUST be defined by that service.  ISAKMP does not
  1469.    purport to ever produce keys that are suitable for any encryption
  1470.    algorithm.  ISAKMP produces the requested amount of keying material
  1471.    from which the service MUST generate a suitable key.  Details, such
  1472.    as weak key checks, are the responsibility of the service.
  1473.  
  1474.    Use of negotiated PRFs may require the PRF output to be expanded. For
  1475.    instance, 3DES-CBC-MAC produces 8 bytes of output which must be used
  1476.    as a key to another 3DES-CBC-MAC function call. The output of a PRF
  1477.    is expanded by feeding back the results of the PRF into itself to
  1478.    generate successive blocks. These blocks are concatenated until the
  1479.    requisite number of bytes has been acheived. For example, for pre-
  1480.    shared key authentication with 3DES-CBC-MAC as the negotiated PRF:
  1481.  
  1482.      BLOCK1-8 = prf(pre-shared-key, Ni | Nr)
  1483.      BLOCK9-16 = prf(pre-shared-key, BLOCK1-8 | Ni | Nr)
  1484.      BLOCK17-24 = prf(pre-shared-key, BLOCK9-16 | Ni | Nr)
  1485.    and
  1486.      SKEYID = BLOCK1-8 | BLOCK9-16 | BLOCK17-24
  1487.  
  1488.    so therefore to derive SKEYID_d:
  1489.  
  1490.      BLOCK1-8 = prf(SKEYID, g^xy | CKY-I | CKY-R)
  1491.      BLOCK9-16 = prf(SKEYID, BLOCK1-8 | g^xy | CKY-I | CKY-R)
  1492.      BLOCK17-24 = prf(SKEYID, BLOCK9-16 | g^xy | CKY-I | CKY-R)
  1493.    and
  1494.      SKEYID_d = BLOCK1-8 | BLOCK9-16 | BLOCK17-24
  1495.  
  1496.    Subsequent PRF derivations are done similarly.
  1497.  
  1498.    Encryption keys used to protect the ISAKMP SA are derived from
  1499.    SKEYID_e in an algorithm-specific manner. When SKEYID_e is not long
  1500.    enough to supply all the necessary keying material an algorithm
  1501.    requires, the key is derived from feeding the results of a pseudo-
  1502.    random function into itself, concatenating the results, and taking
  1503.    the highest necessary bits.
  1504.  
  1505.    For example, if (ficticious) algorithm AKULA requires 320-bits of key
  1506.    (and has no weak key check) and the prf used to generate SKEYID_e
  1507.    only generates 120 bits of material, the key for AKULA, would be the
  1508.    first 320-bits of Ka, where:
  1509.  
  1510.  
  1511.  
  1512.  
  1513. Harkins, Carrel                                            [Page 27]
  1514.  
  1515. INTERNET DRAFT                                                 July 1997
  1516.  
  1517.  
  1518.        Ka = K1 | K2 | K3
  1519.    and
  1520.        K1 = prf(SKEYID_e, 0)
  1521.        K2 = prf(SKEYID_e, K1)
  1522.        K3 = prf(SKEYID_e, K2)
  1523.  
  1524.    where prf is the HMAC version of the negotiated hash function or the
  1525.    negotiated prf. and 0 is represented by a single octet. Each result
  1526.    of the prf provides 120 bits of material for a total of 360 bits.
  1527.    AKULA would use the first 320 bits of that 360 bit string.
  1528.  
  1529.    In phase 1, material for the initialization vector (IV material) for
  1530.    CBC mode encryption algorithms is derived from a hash of a
  1531.    concatenation of the initiator's public Diffie-Hellman value and the
  1532.    responder's public Diffie-Hellman value using the negotiated hash
  1533.    algorithm. This is used for the first message only. Each message
  1534.    should be padded up to the nearest block size using bytes containing
  1535.    0x00. The message length in the header MUST include the length of the
  1536.    pad since this reflects the size of the cyphertext. Subsequent
  1537.    messages MUST use the last CBC encryption block from the previous
  1538.    message as their initialization vector.
  1539.  
  1540.    In phase 2, material for the initialization vector for CBC mode
  1541.    encryption of the first message of a Quick Mode exchange is derived
  1542.    from a hash of a concatenation of the last phase 1 CBC output block
  1543.    and the phase 2 message id using the negotiated hash algorithm. The
  1544.    IV for subsequent messages within a Quick Mode exchange is the CBC
  1545.    output block from the previous message. Padding and IVs for
  1546.    subsequent messages are done as in phase 1.
  1547.  
  1548.    Note that the final phase 1 CBC output block, the result of
  1549.    encryption/decryption of the last phase 1 message, must be retained
  1550.    in the ISAKMP SA state to allow for generation of unique IVs for each
  1551.    Quick Mode. Each phase 2 exchange generates IVs independantly to
  1552.    prevent IVs from getting out of sync when two different Quick Modes
  1553.    are started simultaneously.
  1554.  
  1555.    The key for DES-CBC is derived from the first eight (8) non-weak and
  1556.    non-semi-weak (see Appendix A) bytes of SKEYID_e. The IV is the first
  1557.    8 bytes of the IV material derived above.
  1558.  
  1559.    The key for IDEA-CBC is derived from the first sixteen (16) bytes of
  1560.    SKEYID_e.  The IV is the first eight (8) bytes of the IV material
  1561.    derived above.
  1562.  
  1563.    The key for Blowfish-CBC is either the negotiated key size, or the
  1564.    first fifty-six (56) bytes of a key (if no key size is negotiated)
  1565.    derived in the aforementioned pseudo-random function feedback method.
  1566.  
  1567.  
  1568.  
  1569. Harkins, Carrel                                            [Page 28]
  1570.  
  1571. INTERNET DRAFT                                                 July 1997
  1572.  
  1573.  
  1574.    The IV is the first eight (8) bytes of the IV material derived above.
  1575.  
  1576.    The key for RC5-R16-B64-CBC is the negotiated key length, or the
  1577.    first sixteen (16) bytes of a key (if no key size is negotiated)
  1578.    derived from the aforementioned pseudo-random function feedback
  1579.    method if necessary. The IV is the first eight (8) bytes of the IV
  1580.    material derived above. The number of rounds MUST be 16 and the block
  1581.    size MUST be 64.
  1582.  
  1583.    The key for 3DES-CBC is the first twenty-four (24) bytes of a key
  1584.    derived in the aforementioned pseudo-random function feedback method.
  1585.    3DES-CBC is an encrypt-decrypt-encrypt operation using the first,
  1586.    middle, and last eight (8) bytes of the entire 3DES-CBC key.  The IV
  1587.    is the first eight (8) bytes of the IV material derived above.
  1588.  
  1589.    The key for CAST-CBC is either the negotiated key size, or the first
  1590.    sixteen (16) bytes of a key derived in the aforementioned pseudo-
  1591.    random function feedback method.  The IV is the first eight (8) bytes
  1592.    of the IV material derived above.
  1593.  
  1594.    Support for algorithms other than DES-CBC is purely optional. Some
  1595.    optional algorithms may be subject to intellectual property claims.
  1596.  
  1597.  
  1598.  
  1599.  
  1600.  
  1601.  
  1602.  
  1603.  
  1604.  
  1605.  
  1606.  
  1607.  
  1608.  
  1609.  
  1610.  
  1611.  
  1612.  
  1613.  
  1614.  
  1615.  
  1616.  
  1617.  
  1618.  
  1619.  
  1620.  
  1621.  
  1622.  
  1623.  
  1624.  
  1625. Harkins, Carrel                                            [Page 29]
  1626.  
  1627. INTERNET DRAFT                                                 July 1997
  1628.  
  1629.  
  1630. Authors'  Addresses:
  1631.  
  1632.    Dan Harkins <dharkins@cisco.com>
  1633.    cisco Systems
  1634.    170 W. Tasman Dr.
  1635.    San Jose, California, 95134-1706
  1636.    United States of America
  1637.    +1 408 526 4000
  1638.  
  1639.    Dave Carrel <carrel@ipsec.org>
  1640.    76 Lippard Ave.
  1641.    San Francisco, CA 94131-2947
  1642.    United States of America
  1643.    +1 415 337 8469
  1644.  
  1645. Authors' Note:
  1646.  
  1647.    The authors encourage independent implementation, and
  1648.    interoperability testing, of this hybrid protocol.
  1649.  
  1650.  
  1651.  
  1652.  
  1653.  
  1654.  
  1655.  
  1656.  
  1657.  
  1658.  
  1659.  
  1660.  
  1661.  
  1662.  
  1663.  
  1664.  
  1665.  
  1666.  
  1667.  
  1668.  
  1669.  
  1670.  
  1671.  
  1672.  
  1673.  
  1674.  
  1675.  
  1676.  
  1677.  
  1678.  
  1679.  
  1680.  
  1681. Harkins, Carrel                                            [Page 30]
  1682.  
  1683.