<?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 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 I-D.narten-iana-considerations-rfc2434bis SYSTEM "http://xml.resource.org/public/rfc/bibxml3/reference.I-D.narten-iana-considerations-rfc2434bis.xml">

<!ENTITY RFC4120 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.4120.xml">
<!ENTITY RFC4556 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.4556.xml">
<!ENTITY RFC5349 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.5349.xml">
<!ENTITY RFC6113 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.6113.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="std" docName="draft-ietf-kitten-pkinit-freshness-04" 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="PKINIT Freshness">Public Key Cryptography for Initial Authentication in Kerberos (PKINIT) Freshness Extension</title>

    <!-- add 'role="editor"' below for the editors if appropriate -->

    <!-- Another author who claims to be an editor -->

    <author fullname="Michiko Short" initials="M.S." role="editor"
            surname="Short">
      <organization>Microsoft Corporation</organization>

      <address>
        <postal>
          <street></street>

         <!-- Reorder these if your country does things differently -->

          <city></city>

          <region></region>

          <code></code>

          <country>USA</country>
        </postal>

        <phone></phone>

         <email>michikos@microsoft.com</email>

        <!-- uri and facsimile elements may also be added -->
      </address>
    </author>

    <author fullname="Seth Moore" initials="S.M." 
            surname="Moore">
      <organization>Microsoft Corporation</organization>

      <address>
        <postal>
          <street></street>

          <city></city>

          <region></region>

          <code></code>

          <country>USA</country>
        </postal>

        <phone></phone>


        <email>sethmo@microsoft.com</email>

        <!-- uri and facsimile elements may also be added -->
      </address>
    </author>

    <author fullname="Paul Miller" initials="P.M." 
            surname="Miller">
      <organization>Microsoft Corporation</organization>

      <address>
        <postal>
          <street></street>

          <city></city>

          <region></region>

          <code></code>

          <country>USA</country>
        </postal>

        <phone></phone>


        <email>paumil@microsoft.com</email>

        <!-- uri and facsimile elements may also be added -->
      </address>
    </author>


   <date month="March" year="2016" />

    <!-- If the month and year are both specified and are the current ones, xml2rfc will fill 
         in the current day for you. If only the current year is specified, xml2rfc will fill 
	 in the current day and month for you. If the year is not the current one, it is 
	 necessary to specify at least a month (xml2rfc assumes day="1" if not specified for the 
	 purpose of calculating the expiry date).  With drafts it is normally sufficient to 
	 specify just the year. -->

    <!-- Meta-data Declarations -->

    <area>Security</area>

    <workgroup>Kitten Working Group</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>Internet-Draft</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 how to further extend the Public Key Cryptography for Initial Authentication in Kerberos (PKINIT) extension <xref target="RFC4556"/> to exchange an opaque data blob that a KDC can validate to ensure that the client is currently in possession of the private key during a PKINIT AS exchange.</t>
    </abstract>
  </front>

  <middle>
    <section title="Introduction">
      <t>The Kerberos PKINIT extension <xref target="RFC4556"/> defines two schemes for using asymmetric cryptography in a Kerberos preauthenticator.  One uses Diffie-Hellman key exchange and the other depends on public key encryption.  The public key encryption scheme is less commonly used for two reasons:<list style="symbols">

         <t>Elliptic Curve Cryptography (ECC) Support for PKINIT <xref target="RFC5349" /> only specified Elliptic Curve Diffie-Hellman (ECDH) key agreement, so it cannot be used for public key encryption.</t>

         <t>Public key encryption requires certificates with an encryption key, that is not deployed on many existing smart cards.</t>

         </list> 
      </t>

      <t>In the Diffie-Hellman exchange, the client uses its private key only to sign the AuthPack structure (specified in Section 3.2.1 of <xref target="RFC4556"/>), that is performed before any traffic is sent to the KDC.  Thus a client can generate requests with future times in the PKAuthenticator, and then send those requests at those future times. Unless the time is outside the validity period of the client's certificate, the KDC will validate the PKAuthenticator and return a TGT the client can use without possessing the private key.</t>

      <t>As a result, a client performing PKINIT with the Diffie-Hellman key exchange does not prove current possession of the private key being used for authentication.  It proves only prior use of that key.  Ensuring that the client has current possession of the private key requires that the signed PKAuthenticator data include information that the client could not have predicted.</t>

    <section title="Kerberos message flow using KRB_AS_REQ without pre-authentication">

	<t>Today, password-based AS exchanges <xref target="RFC4120"/> often begin with the client sending a KRB_AS_REQ without pre-authentication. When the principal requires pre-authentication, the KDC responds with a KRB_ERROR containing information needed to complete an AS exchange, such as the supported encryption types and salt values. This message flow is illustrated below:</t>

      <figure align="center" anchor="PKINIT_message_flow">
        <preamble></preamble>

        <artwork align="left"><![CDATA[
KDC                     Client

              <----     AS-REQ without pre-authentication
KRB-ERROR     ---->

              <----     AS-REQ
AS-REP        ---->

              <----     TGS-REQ
TGS-REP       ---->
            ]]></artwork>

        <postamble></postamble>
      </figure>	

	<t>We can use a similar message flow with PKINIT, allowing the KDC to provide a token for the client to include in its KRB_AS_REQ to ensure that the PA_PK_AS_REQ <xref target="RFC4556"/> was not pregenerated.</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>   



    <!-- This PI places the pagebreak correctly (before the section title) in the text output. -->

    <?rfc needLines="8" ?>

    <section title="Message Exchanges">
   <t>The following summarizes the message flow with extensions to <xref target="RFC4120"/> and <xref target="RFC4556"/> required to support a KDC-provided freshness token during the initial request for a ticket:<list style="numbers">

        
            <t>The client generates a KRB_AS_REQ as specified in Section 2.9.3 <xref target="RFC4120"/> that contains no PA_PK_AS_REQ and includes a freshness token request.</t>

            <t>The KDC generates a KRB_ERROR as specified in Section 3.1.3 of <xref target="RFC4120"/> providing a freshness token.</t>

            <t>The client receives the error as specified in Section 3.1.4 of <xref target="RFC4120"/>, extracts the freshness token, and includes it as part of the KRB_AS_REQ as specified in <xref target="RFC4120"/> and <xref target="RFC4556"/>.</t>

            <t>The KDC receives and validates the KRB_AS_REQ as specified in Section 3.2.2 <xref target="RFC4556"/>, then additionally validates the freshness token.</t>

            <t>The KDC and client continue as specified in <xref target="RFC4120"/> and <xref target="RFC4556"/>.</t>

          </list> 
  
</t>
    <section title="Generation of KRB_AS_REQ Message">
            <t>The client indicates support of freshness tokens by adding a padata element with padata-type PA_AS_FRESHNESS and padata-value of an empty octet string.</t>
    </section>

    <section title="Generation of KRB_ERROR Message">
            <t>The KDC will respond with a KRB_ERROR <xref target="RFC4120"/> message with the error-code KDC_ERR_PREAUTH_REQUIRED <xref target="RFC4120"/> adding a padata element with padata-type PA_AS_FRESHNESS and padata-value of the freshness token to the METHOD-DATA object.</t>
    </section>

    <section title="Generation of KRB_AS_REQ Message">
            <t>After the client receives the KRB-ERROR message containing a freshness token, it extracts the PA_AS_FRESHNESS padata-value field of the PA-DATA structure as an opaque data blob. The PA_AS_FRESHNESS padata-value field of the PA-DATA structure SHALL then be added as an opaque blob in the freshnessToken field when the client generates the PKAuthenticator for the PA_PK_AS_REQ message. This ensures that the freshness token value will be included in the signed data portion of the KRB_AS_REQ value.</t>
    </section>

    <section title="Receipt of KRB_AS_REQ Message">
            <t>If the realm requires freshness and the PA_PK_AS_REQ message does not contain the freshness token, the KDC MUST return a KRB_ERROR <xref target="RFC4120"/> message with the error-code KDC_ERR_PREAUTH_FAILED <xref target="RFC6113"/> with a padata element with padata-type PA_AS_FRESHNESS and padata-value of the freshness token to the METHOD-DATA object.</t>
            <t>When the PA_PK_AS_REQ message contains a freshness token, after validating the PA_PK_AS_REQ message normally, the KDC will validate the freshnessToken value in the PKAuthenticator in an implementation-specific way. If the freshness token is not valid, the KDC MUST return a KRB_ERROR <xref target="RFC4120"/> message with the error-code KDC_ERR_PREAUTH_EXPIRED <xref target="RFC6113"/>. The e-data field of the error  contains a METHOD-DATA object <xref target="RFC4120"/> which specifies a valid PA_AS_FRESHNESS padata-value. Since the freshness tokens are validated by KDCs in the same realm, standardizing the contents of the freshness token is not a concern for interoperability.</t>
    </section>

    <section title="Receipt of second KRB_ERROR Message">
            <t>If a client receives a KDC_ERR_PREAUTH_EXPIRED KRB_ERROR message that includes a freshness token, it MUST retry using the new freshness token.</t>
    </section>

    </section>

    <section title="PreAuthentication Data Types">

        <texttable>
          <preamble>The following are the new PreAuthentication data types:</preamble>

          <ttcol align="center">Padata and Data Type</ttcol>

          <ttcol align="center">Padata-type Value</ttcol>

          <c>PA_AS_FRESHNESS</c>
          <c>TBD</c>

          <postamble></postamble>
        </texttable>

    </section>

    <section title="Extended PKAuthenticator">

      <figure>
        <preamble>The PKAuthenticator structure specified in Section 3.2.1 <xref target="RFC4556"/> is extended to include a new freshnessToken as follows:</preamble>

        <artwork><![CDATA[
PKAuthenticator ::= SEQUENCE {
   cusec        [0] INTEGER (0..999999),
   ctime        [1] KerberosTime,
             -- cusec and ctime are used as in [RFC4120], for
             -- replay prevention.
   nonce        [2] INTEGER (0..4294967295),
             -- Chosen randomly;  this nonce does not need to
             -- match with the nonce in the KDC-REQ-BODY.
   paChecksum   [3] OCTET STRING OPTIONAL,
             -- MUST be present.
             -- Contains the SHA1 checksum, performed over
             -- KDC-REQ-BODY.
   ...,
   freshnessToken     [4] OCTET STRING OPTIONAL,
             -- PA_AS_FRESHNESS padata value as recieved from the 
             -- KDC. MUST be present if sent by KDC
   ...
}

            ]]></artwork>
      </figure>

    </section>


    <section anchor="Acknowledgements" title="Acknowledgements">
      <t>Douglas E. Engert, Sam Hartman,  Henry B. Hotz, Nikos Mavrogiannopoulos, Martin Rex, Nico Williams, and Tom Yu were key contributors to the discovery of the freshness issue in PKINIT.</t>
      <t>Sam Hartman, Greg Hudson, Jeffrey Hutzelman, Nathan Ide, Benjamin Kaduk, Bryce Nordgren, Magnus Nystrom, Nico Williams and Tom Yu reviewed the document and provided suggestions for improvements.</t>
    </section>

    <!-- Possibly a 'Contributors' section ... -->

    <section anchor="IANA" title="IANA Considerations">
        <texttable>
          <preamble>IANA is requested to assign numbers for PA_AS_FRESHNESS listed in the Kerberos Parameters registry Pre-authentication and Typed Data as follows:</preamble>

          <ttcol align="center">Type</ttcol>

          <ttcol align="center">Value</ttcol>

          <ttcol align="center">Reference</ttcol>

          <c>TBD</c>

          <c>PA_AS_FRESHNESS</c>

          <c>[This RFC]</c>

          <postamble></postamble>
        </texttable>

    </section>

    <section anchor="Security" title="Security Considerations">
      <t>The freshness token SHOULD include signing, encrypting or sealing data from the KDC to determine authenticity and prevent tampering.</t>
      <t>Freshness tokens serve to guarantee that the client had the key when constructing the AS-REQ. They are not required to be single use tokens or bound to specific AS exchanges. Part of the reason the token is opaque is to allow KDC implementers the freedom to add additional functionality as long as the "freshness" guarantee remains.</t>

    </section>

    <section anchor="InterOp" title="Interoperability Considerations">
      <t>Since the client treats the KDC provided data blob as opaque, changing the contents will not impact existing clients. Thus extensions to the freshness token do not impact client interoperability.</t>
      <t>Clients SHOULD NOT reuse freshness tokens across multiple exchanges. There is no guarantee that a KDC will allow a once-valid token to be used again. Thus clients that do not retry with a new freshness token may not be compatible with KDCs depending on how they choose to implement "freshness" validation.</t>
      <t>Since upgrading clients takes time, implementers may consider allowing both freshness-token based exchanges as well as "legacy" exchanges without use of freshness tokens. However, until freshness tokens are required by the realm, existing risks of pre-generated PKAuthenticators will remain.</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">
      <!--?rfc include="http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml"?-->
      &RFC2119;&RFC4556;&RFC5349;&RFC4120;&RFC6113;

    </references>

  </back>
</rfc>
