<?xml version="1.0" encoding="US-ASCII"?>
<!-- This template is for creating an Internet Draft using xml2rfc,
     which is available here: http://xml.resource.org. -->
<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
<!-- One method to get references from the online citation libraries.
     There has to be one entity for each item to be referenced. 
     An alternate method (rfc include) is described in the references. -->

<!ENTITY RFC2104 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2104.xml">
<!ENTITY RFC2119 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml">
<!ENTITY RFC2629 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2629.xml">
<!ENTITY RFC3552 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.3552.xml">
<!ENTITY RFC6023 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.6023.xml">
<!ENTITY RFC7296 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.7296.xml">
<!ENTITY I-D.narten-iana-considerations-rfc2434bis SYSTEM "http://xml.resource.org/public/rfc/bibxml3/reference.I-D.narten-iana-considerations-rfc2434bis.xml">
]>
<?xml-stylesheet type='text/xsl' href='rfc2629.xslt' ?>
<!-- used by XSLT processors -->
<!-- For a complete list and description of processing instructions (PIs), 
     please see http://xml.resource.org/authoring/README.html. -->
<!-- Below are generally applicable Processing Instructions (PIs) that most I-Ds might want to use.
     (Here they are set differently than their defaults in xml2rfc v1.32) -->
<?rfc strict="yes" ?>
<!-- give errors regarding ID-nits and DTD validation -->
<!-- control the table of contents (ToC) -->
<?rfc toc="yes"?>
<!-- generate a ToC -->
<?rfc tocdepth="4"?>
<!-- the number of levels of subsections in ToC. default: 3 -->
<!-- control references -->
<?rfc symrefs="yes"?>
<!-- use symbolic references tags, i.e, [RFC2119] instead of [1] -->
<?rfc sortrefs="yes" ?>
<!-- sort the reference entries alphabetically -->
<!-- control vertical white space 
     (using these PIs as follows is recommended by the RFC Editor) -->
<?rfc compact="yes" ?>
<!-- do not start each main section on a new page -->
<?rfc subcompact="no" ?>
<!-- keep one blank line between list items -->
<!-- end of list of popular I-D processing instructions -->
<rfc category="info" docName="draft-fluhrer-qr-ikev2-03" ipr="trust200902">
  <!-- category values: std, bcp, info, exp, and historic
     ipr values: full3667, noModification3667, noDerivatives3667
     you can add the attributes updates="NNNN" and obsoletes="NNNN" 
     they will automatically be output with "(if approved)" -->

  <!-- ***** FRONT MATTER ***** -->

  <front>
    <!-- The abbreviated title is used in the page header - it is only necessary if the 
         full title is longer than 39 characters -->

    <title abbrev="Postquantum Security for IKEv2">Postquantum Preshared Keys for IKEv2</title>

    <!-- add 'role="editor"' below for the editors if appropriate -->

    <!-- Another author who claims to be an editor -->

    <author fullname="Scott Fluhrer" initials="S.F."
            surname="Fluhrer">
      <organization>Cisco Systems</organization>

      <address>
        <email>sfluhrer@cisco.com</email>
      </address>
    </author>
    <author fullname="David McGrew" initials="D.M."
            surname="McGrew">
      <organization>Cisco Systems</organization>

      <address>
        <email>mcgrew@cisco.com</email>
      </address>
    </author>
    <author fullname="Panos Kampanakis" initials="P.K."
            surname="Kampanakis">
      <organization>Cisco Systems</organization>

      <address>
        <email>pkampana@cisco.com</email>
      </address>
    </author>
    <date month="October" year="2016" />

    <!-- Meta-data Declarations -->

    <area>Security</area>

    <workgroup>Internet Engineering Task Force</workgroup>

    <!-- WG name at the upperleft corner of the doc,
         IETF is fine for individual submissions.  
	 If this element is not present, the default is "Network Working Group",
         which is used by the RFC Editor as a nod to the history of the IETF. -->

    <keyword>template</keyword>

    <!-- Keywords will be incorporated into HTML output
         files in a meta tag but they have no effect on text or nroff
         output. If you submit your draft to the RFC Editor, the
         keywords will be used for the search engine. -->

    <abstract>
      <t>   This document describes an extension of IKEv2 to allow it to
   be resistant to a Quantum Computer, by using preshared keys
      </t>
    </abstract>
  </front>

  <middle>
    <section title="Introduction">
      <t>   It is an open question whether or not it is feasible to build a quantum computer, but if it is, many of the cryptographic algorithms and protocols currently in use would be insecure.  A quantum computer would be able to solve DH and ECDH problems, and this
   would imply that the security of existing IKEv2 systems would be
   compromised.  IKEv1 when used with preshared keys does not share this
   vulnerability, because those keys are one of the inputs to the key derivation function.
   If the preshared key have sufficient entropy and the PRF and encryption and authentication transforms are postquantum secure, then the
   resulting system is believed to be quantum resistant, that is, believed to
   be invulnerable to an attacker with a Quantum Computer.</t>

   <t>This document describes a way to extend IKEv2 to have a similar
   property; assuming that the two end systems share a long secret key,
   then the resulting exchange is quantum resistant.
   By bringing postquantum security to IKEv2, this note removes the need
   to use an obsolete version of the Internet Key Exchange in order to achieve
   that security goal.</t>

   <t>The general idea is that we add an additional secret that is shared
   between the initiator and the responder; this secret is in addition
   to the authentication method that is already provided within IKEv2.
   We stir in this secret when generating the key material (KEYMAT) keys for the child SAs (along with the
   parameters that IKEv2 normally uses); this secret provides  quantum
   resistance to the IPsec SAs.</t>

   <t>It was considered important to minimize the changes to IKEv2.
   The existing mechanisms to do authentication and key exchange remain
   in place (that is, we continue to do (EC)DH, and potentially a PKI
   authentication if configured).  This does not replace the authentication
   checks that the protocol does; instead, it is done as a parallel check.
    </t>

      <section title="Changes">
        <t>Changes in this draft from the previous versions</t>

        <t>draft-02</t>
        <t>- Simplified the protocol by stirring in the
preshared key into the child SAs; this avoids the problem of
having the responder decide which preshared key to use (as it
knows the initiator identity at that point); it does mean that
someone with a Quantum Computer can recover the initial IKE
negotation. </t>
        <t>- Removed positive endorsements of various algorithms.  Retained warnings about algorithms known to be weak against a Quantum Computer</t>

        <t>draft-01</t>
        <t>- Added explicit guidance as to what IKE and IPsec algorithms are Quantum Resistant</t>

        <t>draft-00</t>
        <t>- We switched from using vendor ID's to transmit the additional data to notifications</t>
        <t>- We added a mandatory cookie exchange to allow the server to communicate to the client before the initial exchange</t>
        <t>- We added algorithm agility by having the server tell the client what algorithm to use in the cookie exchange</t>
        <t>- We have the server specify the PPK Indicator Input, which allows
             the server to make a trade-off between the efficiency for
             the search of the clients PPK, and the anonymity of the client.</t>
        <t>- We now use the negotiated PRF (rather than a fixed HMAC-SHA256) to transform the nonces during the KDF</t>
      </section>

      <section title="Requirements Language">
        <t>The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
        "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
        document are to be interpreted as described in <xref
        target="RFC2119">RFC 2119</xref>.</t>
      </section>
    </section>

    <section title="Assumptions"><t>
   We assume that each IKE peer (both the initiator and the
responder) has an optional Postquantum Preshared Key (PPK)
(potentially on a per-peer basis, selected by peer identity),
and also has a configurable flag that determines whether this
postquantum preshared key is mandatory.
This preshared key is independent of the preshared key (if any
that the IKEv2 protocol uses to perform authentication.</t>
    </section>

    <section title="Exchanges"><t>
      If the initiator has a configured postquantum preshared key (whether
   or not it is optional), then it will include a notify payload in
   its initial encrypted exchange as follows:</t>
      <figure align="center">
        <artwork align="left"><![CDATA[
Initiator                       Responder
------------------------------------------------------------------
HDR, SK {IDi, [CERT,] [CERTREQ,]
    [IDr,] AUTH, SAi2,
    TS, TSr, N(PPK_NOTIFY)}  --->
            ]]></artwork>
      </figure>

   <t>N(PPK_NOTIFY) is a status notification payload with the type [TBA];
   it has a protocol ID of 0, and no SPI and no notification data associated with it.</t>

   <t>When the responder receives the initial encrypted exchange, it checks
to see if it received a notify within that exchange, is configured to support PPK
with the initiator's identity, and whether
that use is mandatory.  If the notify was
received, and the responder does have a PPK for that identity, then it responds
with the standard IKE response with the PPK_NOTIFY notify message included, namely:</t>
      <figure align="center">
        <artwork align="left"><![CDATA[
Initiator                       Responder
------------------------------------------------------------------
                          <--- HDR, SK {IDr, [CERT,] AUTH,
                                   SAr2, TSi, TSr, N(PPK_NOTIFY)}
            ]]></artwork>
      </figure>

    <t>If the responder is not configured to support PPK with that identity, it
continues with the standard IKE protocol, not including the notification.</t>

   <t>If the responder is configured to support PPK with that identity, and
   it does not receive the notification, then if the PPK usage is configured as
   mandatory, it MUST abort the exchange.  If the PPK usage is configured as
   optional, it continues with the standard IKE protocol, not including the
   notification.</t>

   <t>This table summarizes the above logic by the responder</t>

      <figure align="center">
        <artwork align="left"><![CDATA[
Received Nonce     Have PPK   PPK Mandatory    Action  
------------------------------------------------------------------
     No               No          *            Standard IKE protocol
     No              Yes         No            Standard IKE protocol
     No              Yes        Yes            Abort negotiation
    Yes               No          *            Standard IKE protocol
    Yes              Yes          *            Include PPK_NOTIFY Nonce
            ]]></artwork>
      </figure>

   <t>When the initiator receives the response, then (if it is configured to
   use a PPK with the responder), then it checks for the presense of the
   notification.  If it receives one, it marks the SA as using the
   configured PPK; if it does not receive one, it MUST either abort
   the exchange (if the PPK was configured as mandatory), or
   it MUST continue without using the PPK (if the PPK
   was configured as optional). </t>

<t>The protocol continues as standard until it comes time to compute the child
SA keying material.</t>
</section>

     <section title="Creating Child SA Keying Material"><t>
   When it comes time to generate the keying material for a child SA, the
implementation (both the initiator and the
responder) checks to see if they agreed to use a PPK. If they did,
then they look up (based on the peer's identity)
the configured PPK, and then both sides use one of
these alternative formula (based on whether an optional
Diffie-Hellman was included):</t>

     <figure align="center">
       <artwork align="left"><![CDATA[
 Ni&apos; = prf(PPK, Ni)
 Nr&apos; = prf(PPK, Nr)
 KEYMAT = prf+(SK_d, Ni&apos; | Nr&apos;)
            ]]></artwork>
     </figure>
   <t>or</t>
     <figure align="center">
       <artwork align="left"><![CDATA[
 Ni&apos; = prf(PPK, Ni)
 Nr&apos; = prf(PPK, Nr)
 KEYMAT = prf+(SK_d, g^ir (new) | Ni&apos; | Nr&apos;)
            ]]></artwork>
     </figure>

   <t>where PPK is the configured postquantum preshared key,
Ni, Nr are the nonces from the IKE_SA_INIT exchange if this
require is the first Child SA created or the fresh Ni and Nr
from the CREATE_CHILD_SA exchange if this is a subsequent
creation, and prf is the pseudorandom function that was
negotiated for this SA.</t>

<t>This is the standard IKE KEYMAT generation, except that the nonces are transformed (via the negotiated PRF function) using
the preshared PPK value</t>

   <t>We use this negotiated PRF,
   rather than negotiating a separate one, because this PRF is agreed by both sides to
   have sufficient security properties (otherwise, they would have negotiated something else), and
   so that we don't need to specify a separate negotiation procedure.</t>

   <t>When you rekey an IKE SA (generating a fresh SKEYSEED), the
   initiator and the responder will transform the nonces using the same
   PPK as they used during the original IKE SA negotiation.  That is,
   they will use the alternate derivation:</t>
    <figure align="center">
       <artwork align="left"><![CDATA[
 Ni&apos; = prf(PPK, Ni)
 Nr&apos; = prf(PPK, Nr)
 SKEYSEED = prf( SK_d (old), g^ir (new) | Ni&apos; | Nr&apos; )
 (SK_d | SK_ai | SK_ar | SK_ei | SK_er | SK_pi | SK_pr) =
       prf+(SKEYSEED, Ni&apos; | Nr&apos; | SPIi | SPIr)
            ]]></artwork>
     </figure>

    <t>An implementation MAY rekey the initial IKE SA immediately
after negotiating it; this would
reduce the amount of data available to an attacker with
a Quantum Computer</t>
    </section>

    <section anchor="Security" title="Security Considerations">
      <t>   Quantum computers are able to perform Grover&apos;s algorithm; that
   effectively halves the size of a symmetric key.  Because of this,
   the user SHOULD ensure that the postquantum preshared key used has
   at least 256 bits of entropy, in order to provide a 128 bit security level.</t>

   <t>Although this protocol preserves all the security properties of IKE against
   adversaries with conventional computers, this protocol allows an adversary with
   a Quantum Computer to decrypt all traffic encrypted with the initial IKE SA.
   In particular, it allows the adversary to recover the identities of both sides.
   If there is IKE traffic other than the identities that need to be protected
   against such an adversary, one suggestion would be to form an initial IKE SA
   (which is used to exchange identities), perhaps by using the protocol documented
   in RFC6023.  Then, you would immediately create a child
   IKE SA (which is used to exchange everything else).  Because the child IKE SA
   keys are a function of the PPK (among other things), traffic protected by that
   SA is secure against Quantum capable adversaries.</t>

   <t>In addition, the policy SHOULD be set to negotiate only quantum-resistant
   symmetric algorithms; while this RFC doesn't claim to give
   advise as to what algorithms are secure (as that may change
   based on future cryptographical results), here is a list of defined IKEv2 and IPsec algorithms that should NOT be used, as they are known not to be Quantum Resistant</t>

   <t>Any IKE Encryption algorithm, PRF or Integrity algorithm with key size &lt;256 bits</t> 
   <t>Any ESP Transform with key size &lt;256 bits</t>
   <t>PRF_AES128_XCBC and PRF_AES128_CBC; even though they are defined to be able to use an arbitrary key size, they convert it into a 128 bit key internally</t>
 
    </section>
  </middle>

  <!--  *****BACK MATTER ***** -->

  <back>
    <!-- References split into informative and normative -->

    <!-- There are 2 ways to insert reference entries from the citation libraries:
     1. define an ENTITY at the top, and use "ampersand character"RFC2629; here (as shown)
     2. simply use a PI "less than character"?rfc include="reference.RFC.2119.xml"?> here
        (for I-Ds: include="reference.I-D.narten-iana-considerations-rfc2434bis.xml")

     Both are cited textually in the same manner: by using xref elements.
     If you use the PI option, xml2rfc will, by default, try to find included files in the same
     directory as the including file. You can also define the XML_LIBRARY environment variable
     with a value containing a set of directories to search.  These can be either in the local
     filing system or remote ones accessed by http (http://domain/dir/... ).-->

    <references title="Normative References">
      &RFC2104;
      <!--?rfc include="http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml"?-->
      &RFC2119;
      &RFC7296;
    </references>

    <references title="Informational References">
      &RFC6023;
      <reference anchor="SPDP"
                 target="http://www.mindspring.com/~dmcgrew/spdp.txt">
          <front>
          <title>A Secure Peer Discovery Protocol (SPDP)</title>
          <author fullname="David McGrew" initials="D.M."
            surname="McGrew">
             <organization>Cisco Systems</organization>

          <address>
             <email>mcgrew@cisco.com</email>
          </address>
          </author>
          <date year="2001" />
          </front>
      </reference>
    </references>

    <section anchor="app-additional" title="Discussion and Rationale">
      <t>
  The idea behind this is that while a Quantum Computer can easily
  reconstruct the shared secret of an (EC)DH exchange, they cannot as
  easily recover a secret from a symmetric exchange this makes the
  IPsec KEYMAT and any child SA's SKEYSEED depend on both the symmetric PPK, and also the Diffie-Hellman
  exchange. If we assume that the attacker knows everything except the
  PPK during the key exchange, and there are 2**n plausible PPK&apos;s, then
  a Quantum Computer (using Grover&apos;s algorithm) would take O(2**(n/2))
  time to recover the PPK. So, even if the (EC)DH can be trivially
  solved, the attacker still can&apos;t recover any key material (except for the SK values for the initial IKE exchange) unless they
  can find the PPK, and that&apos;s too difficult if the PPK has enough
  entropy (say, 256 bits).
  Note that we do allow an attacker with a Quantum Computer to
rederive the keying material for the initial IKE SA; this was
a compromise to allow the responder to select the correct PPK
quickly.
</t>

  <t>Another goal of this protocol is to minimize the number of changes
  within the IKEv2 protocol, and in particular, within the cryptography
  of IKEv2.  By limiting our changes to notifications, and translating the
  nonces, it is hoped that this would be implementable, even on systems
  that perform much of the IKEv2 processing is in hardware.</t>

  <t>A third goal was to be friendly to incremental deployment in operational networks, for which
  we might not want to have a global shared key, and also if we&apos;re rolling
  this out incrementally.  This is why we specifically try to allow the
  PPK to be dependent on the peer, and why we allow the PPK to be
  configured as optional.</t>

  <t>A fourth goal was to avoid violating any of the security goals of IKEv2.</t>

  <t>The third and fourth goals are in partial conflict.
  In order to achieve postquantum security,
  we need to stir in the PPK when the keys are computed, however the keys
  are computed before we know who we&apos;re talking to (and so which PPK we should use).
  And, we can&apos;t just tell the other side which PPK to use, as we might use
  different PPK&apos;s for different peers, and so that would violate the anonymity goal.
  If we just (for example) included a hash of the PPK, someone listening in could easily tell
  when we&apos;re using the same PPK for different exchanges, and thus deduce
  that the systems are related.  The compromise we selected was to stir in
  the PPK in all the derived keys except the initial IKE SA keys,  While this
allows an attacker with a Quantum Computer to recover the identities, a poll on
the IPsecME mailing list indicated that
the majority of the people on the list did not think anonymity
was an important property within IKE.  We stir in the shared
secret within the Child SA keying material; this allows an
implementation that wants to protect the other IKE-based traffic
to create an initial IKE SA to exchange identities, and then
immediately create a Child SA, and use that Child SA to exchange
the rest of the negotiation.</t>

<t>In addition, when we stir in the PPK, we always use it to
modify a nonce (using the negotiated PRF).  We modify the nonce
(rather than, say, including the PPK in with the prf or prf+
computation directly) so that this would be easier to implement
on an hardware-based IKE implementation; the prf computations
might be built-in, but the nonces would be external inputs, and
so modifying those would minimize the changes.</t>

    </section>
    <section anchor="Acknowledgement" title="Acknowledgement">
      <t>   The idea of stirring in the PPK into the IPsec key
 generation process was originally suggested on the list by
Tero Kivinen.</t>
    </section>

  </back>
</rfc>

