<?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">
]>
<?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. -->
<?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="3"?>
<!-- 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-dhc-sedhcpv6-19" ipr="trust200902">
  <front>
    <title abbrev="SeDHCPv6">Secure DHCPv6</title>

    <author fullname="Sheng Jiang" initials="S." surname="Jiang">
      <organization>Huawei Technologies Co., Ltd</organization>

      <address>
        <postal>
          <street>Q14, Huawei Campus, No.156 Beiqing Road</street>

          <city>Hai-Dian District, Beijing, 100095</city>

          <country>CN</country>
        </postal>

        <email>jiangsheng@huawei.com</email>
      </address>
    </author>

    <author fullname="Lishan Li" initials="L." surname="Li">
      <organization>Tsinghua University</organization>

      <address>
        <postal>
          <street></street>

          <city>Beijing</city>

          <code>100084</code>

          <country>P.R.China</country>
        </postal>

        <phone>+86-15201441862</phone>

        <email>lilishan48@gmail.com</email>
      </address>
    </author>

    <author fullname="Yong Cui" initials="Y." surname="Cui">
      <organization>Tsinghua University</organization>

      <address>
        <postal>
          <street></street>

          <city>Beijing</city>

          <code>100084</code>

          <country>P.R.China</country>
        </postal>

        <phone>+86-10-6260-3059</phone>

        <email>yong@csnet1.cs.tsinghua.edu.cn</email>
      </address>
    </author>

    <author fullname="Tatuya Jinmei" initials="T." surname="Jinmei">
      <organization>Infoblox Inc.</organization>

      <address>
        <postal>
          <street>3111 Coronado Drive</street>

          <city>Santa Clara</city>

          <region>CA</region>

          <country>US</country>
        </postal>

        <email>jinmei@wide.ad.jp</email>
      </address>
    </author>

    <author fullname="Ted Lemon" initials="T." surname="Lemon">
      <organization>Nominum, Inc.</organization>

      <address>
        <postal>
          <street>2000 Seaport Blvd</street>

          <city>Redwood City, CA</city>

          <code>94063</code>

          <country>USA</country>
        </postal>

        <phone>+1-650-381-6000</phone>

        <email>Ted.Lemon@nominum.com</email>
      </address>
    </author>

    <author fullname="Dacheng Zhang" initials="D." surname="Zhang">
      <address>
        <postal>
          <street></street>

          <city>Beijing</city>

          <country>CN</country>
        </postal>

        <email>dacheng.zhang@gmail.com</email>
      </address>
    </author>

    <date month="" year="2017" />

    <area>Internet Area</area>

    <workgroup>DHC Working Group</workgroup>

    <keyword>Secure</keyword>

    <keyword>DHCPv6</keyword>

    <keyword>Public Key</keyword>

    <abstract>
      <t>DHCPv6 includes no deployable security mechanism that can protect 
      end-to-end communication between DHCP clients and servers. This 
      document describes a mechanism for using public key cryptography to
      provide such security. The mechanism provides encryption in all
      cases, and can be used for authentication based on pre-sharing 
      of authorized certificates.</t>
    </abstract>
  </front>

  <middle>
    <section title="Introduction">
      <t>The Dynamic Host Configuration Protocol for IPv6 (DHCPv6, <xref
      target="RFC3315"></xref>) allows DHCPv6 servers to flexibly provide 
      addressing and other configuration information relating to local 
      network infrastructure to DHCP clients. The protocol provides no 
      deployable security mechanism, and consequently is vulnerable to 
      various attacks.</t>

      <t>This document provides a brief summary of the security vulnerabilities
      of the DHCPv6 protocol and then describes a new extension to the 
      protocol that provides two additional types of security:<list style="symbols">
          <t>authentication of the DHCPv6 client and the DHCPv6 server to
          defend against active attacks, such as spoofing.</t>

          <t>encryption between the DHCPv6 client and the DHCPv6 server in
          order to protect the DHCPv6 communication from pervasive monitoring.</t>
        </list></t>

      <t>The extension specified in this document applies only to end-to-end
      communication between DHCP servers and clients. Options added by 
      relay agents in Relay-Forward messages, and options other than 
      the client message in Relay-Reply messages sent by DHCP servers, 
      are not protected. Such communications are already protected 
      using the mechanism described in section 21.1 in <xref target="RFC3315"></xref>.</t>

      <t>This extension introduces two new DHCPv6 messages: the Encrypted-
      Query and the Encrypted-Response messages. It defines six
      new DHCPv6 options: the Algorithm, Certificate, Signature, Increasing-number, 
      Encryption-Key-Tag option and Encrypted-message options.
      The Algorithm, Certificate, Signature, and Increasing-number options
      are used for authentication. The Encryption-Query message,
      Encryption-Response message, Encrypted-message option and 
      Encryption-Key-Tag option are used for encryption.</t>
      <!--  
      <t>The security mechanism specified in this document is based on DHCPv6 
      client/server's certificates with associated private keys. It also 
      integrates message signatures for the integrity
      and timestamps for anti-replay. The sender authentication procedure
      using certificates defined in this document depends on deployed Public
      Key Infrastructure (PKI, <xref target="RFC5280"></xref>). However, the
      deployment of PKI is out of the scope of this document.</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"></xref> when they appear in ALL CAPS. When these words
      are not in ALL CAPS (such as "should" or "Should"), they have their
      usual English meanings, and are not to be interpreted as <xref
      target="RFC2119"></xref> key words.</t>
    </section>

    <section title="Terminology">
      <t>This section defines terminology specific to secure DHCPv6 used in
      this document.</t>

      <t><list hangIndent="16" style="hanging">
          <t hangText="secure DHCPv6 client:">A node that initiates a DHCPv6 request on a
          link to obtain DHCPv6 configuration parameters
          from one or more DHCPv6 servers using the
          encryption and optional authentication mechanisms
          defined in this document.</t>

          <t hangText="secure DHCPv6 server:">A DHCPv6 server that implements 
          the authentication and encryption mechanisms
          defined in this document, and is configured
          to use them.</t>
        </list></t>
    </section>

    <section title="Security Issues of DHCPv6">
      <t><xref target="RFC3315"></xref> defines an authentication mechanism 
      with integrity protection. This mechanism uses a symmetric key that is 
      shared by the client and server for authentication. It does not provide 
      any key distribution mechanism.</t>

      <t>For this approach, operators can set up a key database for both
      servers and clients from which the client obtains a key before
      running DHCPv6. However, manual key distribution runs counter to
      the goal of minimizing the configuration data needed at each host.
      Consequently, there are no known deployments of this security
      mechanism.</t>

      <t><xref target="RFC3315"></xref> provides an additional mechanism for 
      preventing off-network timing attacks using the Reconfigure message: 
      the Reconfigure Key authentication method. However, this method protects 
      only the Reconfigure message. The key is transmitted in plaintext to 
      the client in earlier exchanges and so this method is vulnerable to
      on-path active attacks.</t>

      <t>Anonymity Profile for DHCP Clients <xref target="RFC7844"></xref> 
      explains how to generate DHCPv4 or DHCPv6 requests that minimize the
      disclosure of identifying information. However, the anonymity profile
      limits the use of the certain options. It also cannot anticipate
      new options that may contain private information. In addition, the 
      anonymity profile does not work in cases where the client wants to 
      maintain anonymity from eavesdroppers but must identify itself to the 
      DHCP server with which it intends to communicate.</t>

      <t>Privacy consideration for DHCPv6 <xref target="RFC7824"></xref> 
      presents an analysis of the privacy issues associated with the use 
      of DHCPv6 by Internet users. No solutions are presented.</t>

      <t>Current DHCPv6 messages are still transmitted in cleartext and the
      privacy information within the DHCPv6 message is not protected from
      passive attack, such as pervasive monitoring <xref target="RFC7258"></xref>.
      The privacy information of the IPv6 host, such as DUID, may be 
      gleaned to find location information, previous visited networks
      and so on. <xref target="RFC7258"></xref> claims that pervasive 
      monitoring should be mitigated in the design of IETF protocol, 
      where possible.</t>

      <t>To better address the problem of passive monitoring and to
      achieve authentication without requiring a symmetric key
      distribution solution for DHCP, this document defines an
      asymmetric key authentication and encryption mechanism.
      This protects against both active attacks, such as spoofing,
      and passive attacks, such as pervasive monitoring.</t>
    </section>

    <section title="Secure DHCPv6 Overview">
      <section title="Solution Overview">
        <t>The following figure illustrates the secure DHCPv6 procedure. 
        Briefly, this extension establishes the server's identity with an
        anonymous Information-Request exchange. Once the server's identity
        has been established, the client may either choose to communicate
        with the server or not. Not communicating with an unknown server
        avoids revealing private information, but if there is no known
        server on a particular link, the client will be unable to communicate
        with a DHCP server.</t>

        <t>If the client chooses to communicate with the selected server(s), 
        it uses the Encrypted-Query message to encapsulate its communications 
        to the DHCP server. The server responds with Encrypted-Response 
        messages. Normal DHCP messages are encapsulated in these two new 
        messages using the new defined Encrypted-message option. Besides the 
        Encrypted-message option, the Signature option is defined to verify
        the integrity of the DHCPv6 messages and then authentication of 
        the client and the server. The Increasing number option is defined 
        to detect a replay attack.</t>

        <figure align="center" title="Figure 1: Secure DHCPv6 Procedure">
          <artwork><![CDATA[
        +-------------+                           +-------------+
        |DHCPv6 Client|                           |DHCPv6 Server|
        +-------------+                           +-------------+
               |            Information-request           |                            
               |----------------------------------------->|
               |             Algorithm option             |     
               |           Option Request option          |
               |                                          |
               |                    Reply                 |
               |<-----------------------------------------|
               |             Certificate option           |
               |             Signature option             |
               |          Increasing-number option        |
               |         Server Identifier option         |
               |                                          |
               |            Encryption-Query              |                            
               |----------------------------------------->|
               |          Encrypted-message option        |
               |          Server Identifier option        |
               |         Encryption-Key-Tag option        |
               |                                          |
               |            Encryption-Response           |                            
               |<-----------------------------------------|
               |          Encrypted-message option        |
               |                                          |
      ]]></artwork>
        </figure>

		<!--
        <t>It is worth noticing that the signature on a Secure DHCPv6 message
        can be expected to significantly increase the size of the message. One
        example is normal DHCPv6 message length plus 1 KB for a X.509
        certificate and signature and 256 byte for a signature. IPv6 fragments
        <xref target="RFC2460"></xref> are highly possible. Hence, deployment of
        Secure DHCPv6 should also consider the issues of IP fragment, PMTU,
        etc. Also, if there are firewalls and relays between secure DHCPv6 clients 
		and secure DHCPv6 servers, it is RECOMMENDED that the firewalls and 
		relays are configured to pass ICMP Packet Too Big messages <xref target="RFC4443"></xref>.</t>
		-->
      </section>

      <section title="New Components">
        <t>The new components of the mechanism specified in this document are
        as follows:</t>

        <t><list style="symbols">
           <t>Servers and clients that use certificates first generate a
           public/private key pair and then obtain a certificate that signs 
			     the public key. The Certificate option is defined to carry the 
			     certificate of the sender.</t>

           <t>The algorithm option is defined to carry the algorithms lists for 
           algorithm agility.</t>

			     <t>The signature is generated using the private key to verify the 
           integrity of the DHCPv6 messages. The Signature option is defined 
           to carry the signature.</t>
			
           <t>The increasing number is used to detect replayed packet. The 
           Increasing-number option is defined to carry a strictly-increasing 
           serial number. </t>

           <t>The encryption key Tag is calculated from the public key data.
           The Encryption-Key-Tag option is defined to identify the used 
           public/private key pair.</t>

            <t>The Encrypted-message option is defined to contain the 
            encrypted DHCPv6 message.</t>

            <t>The Encrypted-Query message is sent from the secure DHCPv6 
			      client to the secure DHCPv6 server. The Encrypted-Query message 
			      MUST contain the Encrypted-message option and Encryption-Key-Tag
            option. In addition, the Server Identifier option MUST be included 
            if it is contained in the original DHCPv6 message. The Encrypted-Query 
            message MUST NOT contain any other options.</t>

            <t>The Encrypted-Response message is sent from the secure DHCPv6
			      server to the secure DHCPv6 client. The Encrypted-Response message 
			      MUST contain the Encrypted-message option. The Encrypted-Response 
            message MUST NOT contain any other options.</t>
          </list></t>
      </section>
 
      <section title="Support for Algorithm Agility">
        <t>In order to provide a means of addressing problems that may emerge 
		    with existing hash algorithms, signature algorithm and encryption 
        algorithms in the future, this document provides a mechanism 
		    to support algorithm agility. The support for algorithm agility 
        in this document is mainly a algorithm notification mechanism between
        the client and the server. The same client and server SHOULD use 
        the same algorithm in a single communication session. The sender 
        can offer a set of algorithms, and then the receiver selects one 
        algorithm for the future communication.</t>

        <!--
        In some scenario, the hash and signature 
        algorithms cannot be separated, with e.g. eddsa that goes away as 
        the hash is fixed for the curve. In this scenario, the signature 
        algorithm field is set to the corresponding value and the hash 
        algorithm field is set to zero.</t>
      

        <t>If the server does not support the algorithm used by the client,
        the server SHOULD reply with an AlgorithmNotSupported status code 
		    (defined in <xref target="StatusCodes"></xref>) to the client.
		    Upon receiving this status code, the client MAY resend the message 
		    protected with the mandatory algorithm.</t>
      -->
      </section>
	  
      <section title="Impact on RFC3315">
        <t>For secure DHCPv6, the Solicit and Rebind messages can be sent 
        only to the selected server(s) which share one common certificate.  
        If the client doesn't like the received Advertise(s) it could restart 
        the whole process and selects another certificate, but it will be 
        more expensive, and there's no guarantee that other servers can 
        provide better Advertise(s).</t>

        <t><xref target="RFC3315"></xref> provides an additional mechanism for 
        preventing off-network timing attacks using the Reconfigure message: 
        the Reconfigure Key authentication method. Secure DHCPv6 can protect
        the Reconfigure message using the encryption method. So the Reconfigure
        Key authentication method SHOULD NOT be used if Secure DHCPv6 is
        applied.</t>
      </section>
      <!--
      <section title="Support for Algorithm Agility">
        <t>Hash functions are used to provide message integrity checks. In
        order to provide a means of addressing problems that may emerge in the
        future with existing hash algorithms, as recommended in <xref
        target="RFC4270"></xref>, this document provides a mechanism for
        negotiating the use of more secure hashes in the future.</t>

        <t>In addition to hash algorithm agility, this document also provides
        a mechanism for signature algorithm agility.</t>

        <t>The support for algorithm agility in this document is a unilateral 
		notification mechanism from a server to a client through the Reply 
		message. A client MAY support various algorithms among different servers 
		simultaneously. It is NOT RECOMMENDED that the same client and server use 
		various algorithms in a single communication session.</t>

        <t>If the client does not support the hash and signature algorithms used by
		the server, the Reply message SHOULD be dropped. If both hash and signature
		algorithms are supported, the client then checks the authority of this
		server. The client SHOULD also use the same algorithms in the subsequent
		messages.</t>
		depending on the local policy on the client, the client can choose 
		to drop the message, or skip the check;
      </section>

      <section title="Imposed Additional Constraints">
        <t>The client/server that supports identity verification MAY
        impose additional constraints for verification. For example, it
        may impose limits on minimum and maximum key lengths.</t>

        <t><list style="hanging">
            <t hangText="Minbits">The minimum acceptable key length for public
            keys. An upper limit MAY also be set for the amount of computation
            needed when verifying packets that use these security
            associations. The appropriate lengths SHOULD be set according to
            the signature algorithm and also following prudent cryptographic
            practice. For example, minimum length 1024 and upper limit 2048
            may be used for RSA <xref target="RSA"></xref>.</t>
          </list></t>
      </section>
	  -->

      <section title="Applicability">
        <t>In principle, secure DHCPv6 is applicable in any environment where
        physical security on the link is not assured and attacks on DHCPv6
        are a concern. In practice, however, authenticated and encrypted 
        DHCPv6 configuration will rely on some operational assumptions mainly 
        regarding public key distribution and management. In order to achieve 
        the wider use of secure DHCPv6, opportunistic security <xref target="RFC7435"></xref>
        can be applied to secure DHCPv6 deployment, which allows DHCPv6 
        encryption in environments where support for authentication or a key 
        distribution mechanism is not available.</t>

        <t>Secure DHCPv6 can achieve authentication and encryption based on
        pre-sharing of authorized certificates.  The One feasible environment 
        in an early deployment stage would be enterprise networks. In enterprise 
        networks, the client is manually pre-configured with the trusted 
        servers' public key and the server is also manually pre-configured 
        with the trusted clients' public keys. In some scenario, such as 
        coffee shop where the certificate cannot be validated and one wants 
        access to the Internet, then the DHCPv6 configuration process can be 
        encrypted without authentication.</t>

        <t>Note that this deployment scenario based on manual operation is not
        much different from the existing, shared-secret based authentication 
        mechanisms defined in [RFC3315] in terms of operational costs. However, 
        Secure DHCPv6 is still securer than the shared-secret mechanism in 
        that even if clients' keys stored for the server are stolen that does 
        not mean an immediate threat as these are public keys. In addition, 
        if some kind of Public Key Infrastructure (PKI) is used with Secure 
        DHCPv6, even if the initial installation of the certificates is done 
        manually, it will help reduce operational costs of revocation in case 
        a private key (especially that of the server) is compromised.</t>
      </section>
    </section>

    <section title="DHCPv6 Client Behavior">
      <t>The secure DHCPv6 client is pre-configured with a certificate and its 
	    corresponding private key for client authentication. If the client does 
      not obtain a certificate from Certificate Authority (CA), it can generate 
      the self-signed certificate.</t>

      <t>The secure DHCPv6 client sends an Information-request message as per 
	    <xref target="RFC3315"></xref>. The Information-request message is used 
	    by the DHCPv6 client to request the server's certificate information 
	    without having addresses, prefixes or any non-security options assigned to 
	    it. The contained Option Request option MUST carry the option code of 
      the Certificate option. In addition, the contained Algorithm option MUST 
      be constructed as explained in <xref target="AlgoOption"></xref>. 
      The Information-request message MUST NOT include any other DHCPv6 options 
      except the above options to minimize the client's privacy information 
      leakage.</t>

      <t>When receiving the Reply messages from the DHCPv6 servers, a secure
      DHCPv6 client discards any DHCPv6 message that meets any of the
      following conditions:<list style="symbols">
          <t>the Signature option is missing,</t>

          <t>multiple Signature options are present,</t>

          <t>the Certificate option is missing.</t>
        </list></t>

	    <t>And then the client first checks acknowledged hash, signature and 
      encryption algorithms that the server supports. 
      <!--If the checks fails, the Reply message is dropped. -->
      If the hash algorithm field is zero, then it indicates that the hash 
      algorithm is fixed according to the corresponding signature algorithm. 
      The client also uses the acknowledged algorithms in the return messages.</t>
	  
      <t>Then the client checks the authority of the server. In some scenario
      where non-authenticated encryption can be accepted, such as coffee shop, 
      then authentication is optional and can be skipped. For the certificate 
      check method, the client validates the certificates through the pre-configured 
      local trusted certificates list or other methods. A certificate that finds 
      a match in the local trust certificates list is treated as verified.
	    <!--If the 
	    client want to check server's certificate to see whether it has been revoked, 
	    the OCSP stapling can be used. 
	    -->
	    If the certificate check fails, the Reply message is dropped.</t>
	  
	    <t>The client MUST now authenticate the server by verifying the signature
      and checking increasing number, if there is a Increasing-number option. 
      The order of two procedures is left as an implementation decision. It is 
      RECOMMENDED to check increasing number first, because signature verification 
      is much more computationally expensive. The client checks the Increasing-number
      option according to the rule defined in <xref target="IncreasingNumCheck"></xref>. 
      For the message without an Increasing-number option, according to the client's 
      local policy, it MAY be acceptable or rejected.
      <!--If the server rejects such a message, the 
      increasing number check fails.-->
      The Signature field verification MUST show that the signature has
      been calculated as specified in <xref target="SigOption"></xref>. Only
      the messages that get through both the signature verification and
      increasing number check (if there is a Increasing-number option) are 
      accepted. Reply message that does not pass the above tests MUST be 
      discarded.</t>

      <t>If there are multiple authenticated DHCPv6 certs, the client
      selects one DHCPv6 cert for the following communication. The selected
      certificate may correspond to multiple DHCPv6 servers.

      <!--The client can also choose other implementation 
      method depending on the client's local policy if the defined protocol 
      can also run normally. For example, the client can try multiple 
      transactions (each encrypted with different public key) at the "same" 
      time. It should be noted that the selected certificate may correspond
      to multiple DHCPv6 servers.</t>-->

      If there are no authenticated DHCPv6 certs or existing servers 
      fail authentication, the client should retry a number of times. The 
      client conducts the server discovery process as per section 18.1.5 
      of <xref target="RFC3315"></xref> to avoid a packet storm. In this way, 
      it is difficult for a rogue server to beat out a busy "real" server. 
      And then the client takes some alternative action depending on its 
      local policy, such as attempting to use an unsecured DHCPv6 server. 
      </t>

      <t>Once the server has been authenticated, the DHCPv6 client sends the
      Encrypted-Query message to the DHCPv6 server. The Encrypted-Query message 
	    contains the Encrypted-message option, which MUST be constructed as 
	    explained in <xref target="EncryMesOption"></xref>. The Encrypted-message 
      option contains the encrypted DHCPv6 message using the public key 
      contained in the selected cert. In addition, the Server Identifier 
      option MUST be included if it is in the original message 
      (i.e. Request, Renew, Decline, Release) to avoid the need for other servers 
      receiving the message to attempt to decrypt it. The Encrypted-Query message 
      MUST include the Encryption-Key-Tag option to identify the used public/private
      key pair, which is constructed as explained in <xref target="EncryKTOption"></xref>.
      The Encrypted-Query message MUST NOT contain any other DHCPv6 option 
      except the Server Identifier option, Encryption-Key-Tag option, 
      Encrypted-Message option.</t>
	  
	    <t>The first DHCPv6 message sent from the client to the server, such as 
      Solicit message, MUST contain the Certificate option, Signature option and 
      Increasing-number option for client authentication. The encryption 
      text SHOULD be formatted as explain in <xref target="RFC5652"></xref>. 
      The Certificate option MUST be constructed as explained in <xref target="CertOption"></xref>. 
      In addition, one and only one Signature option MUST be contained, 
      which MUST be constructed as explained in <xref target="SigOption"></xref>. 
      One and only one Increasing-number option SHOULD be contained, which MUST 
      be constructed as explained in <xref target="IncreasingNumOption"></xref>.
      In addition, the subsequent encrypted DHCPv6 message sent from the client
      can also contain the Increasing-number option to defend against replay attack.</t>

      <t>For the received Encrypted-Response message, the client MUST drop the 
      Encrypted-Response message if other DHCPv6 option except Encrypted-message 
      option is contained. Then, the client extracts the Encrypted-message 
      option and decrypts it using its private key to obtain the original DHCPv6 
      message. In this document, it is assumed that the client uses only one 
      certificate for the encrypted DHCPv6 configuration. So, the corresponding
      private key is used for decryption. After the decryption, it handles the 
      message as per <xref target="RFC3315"></xref>. If the decrypted DHCPv6 
      message contains the Increasing-number option, the DHCPv6 client checks 
      it according to the rule defined in <xref target="IncreasingNumCheck"></xref>.</t>

      <t>If the client fails to get the proper parameters from the chosen server(s), 
      it can select another authenticated certificate and send the Encrypted-Query 
      message to another authenticated server(s) for parameters configuration until 
      the client obtains the proper parameters.</t>

      <t>When the decrypted message is Reply message with an error status code,
      the error status code indicates the failure reason on the server side.
      According to the received status code, the client MAY take follow-up
      action:</t>

      <t><list style="symbols">
	      <!--<t>Upon receiving an AlgorithmNotSupported error status code, the
        client SHOULD resend the message protected with one of the
        mandatory algorithms.</t>-->
	  
        <t>Upon receiving an AuthenticationFail error status code, the
        client is not able to build up the secure communication with the
        server. However, there may be other DHCPv6 servers available that          
        successfully complete authentication. The client MAY use the
        AuthenticationFail as a hint and switch to other DHCPv6 server if 
		    it has another one. The client SHOULD retry with another authenticated
        certificate. However, if the client decides to retransmit 
		    using the same certificate after receiving AuthenticationFail, it MUST 
		    NOT retransmit immediately and MUST follow normal retransmission 
		    routines defined in <xref target="RFC3315"></xref>.</t>
		  
		    <t>Upon receiving a ReplayDetected error status code, the client 
        MAY resend the message with an adjusted Increasing-number option 
        according to the returned number from the DHCPv6 server.</t>
		  
		    <t>Upon receiving a SignatureFail error status code, the client MAY
        resend the message following normal retransmission routines defined
       in <xref target="RFC3315"></xref>.</t>
        </list></t>
    </section>

    <section title="DHCPv6 Server Behavior">
      <t>The secure DHCPv6 server is pre-configured with a certificate and its 
	    corresponding private key for server authentication. If the server does
      not obtain the certificate from Certificate Authority (CA), it can 
      generate the self-signed certificate.</t>

      <t>When the DHCPv6 server receives the Information-request message and
      the contained Option Request option identifies the request is for the server's
      certificate information, it SHOULD first check the hash, signature, 
      encryption algorithms sets that the client supports. The server selects 
      one hash, signature, encryption algorithm from the acknowledged algorithms 
      sets for the future communication. And then, the server replies with a Reply message 
      to the client. The Reply message MUST contain the requested Certificate 
      option, which MUST be constructed as explained in <xref target="CertOption"></xref>, 
	    and Server Identifier option. In addition, the Reply message MUST contain
	    one and only one Signature option, which MUST be constructed as explained 
	    in <xref target="SigOption"></xref>. Besides, the Reply message SHOULD 
	    contain one and only one Increasing-number option, which MUST be constructed 
      as explained in <xref target="IncreasingNumOption"></xref>.</t>

      <t>Upon the receipt of Encrypted-Query message, the server MUST drop 
      the message if the other DHCPv6 option is contained except Server Identifier 
      option, Encryption-Key-Tag option, Encrypted-message option. Then, the 
      server checks the Server Identifier option. The DHCPv6 server drops the 
      message that is not for it, thus not paying cost to decrypt messages. 
      If it is the target server, according to the Encryption-Key-Tag option, 
      the server identifies the used public/private key pair and decrypts the 
      Encrypted-message option using the corresponding private key. If the 
      decryption fails, the server discards the received message.</t>

      <t>If secure DHCPv6 server needs client authentication and decrypted message 
      is a Solicit/Information-request message which contains the information
      for client authentication, the secure DHCPv6 server discards the received 
      message that meets any of the following conditions:<list style="symbols">
          <t>the Signature option is missing,</t>

          <t>multiple Signature options are present,</t>

          <t>the Certificate option is missing.</t>
        </list></t>
	    <t>For the signature failure, the server SHOULD send an encrypted Reply 
      message with an UnspecFail (value 1, <xref target="RFC3315"></xref>) error 
      status code to the client.</t>
	  
	    <t>The server validates the client's certificate through the local 
      pre-configured trusted certificates list. A certificate that finds 
      a match in the local trust certificates list is treated as verified. 
      The message that fails authentication validation MUST be dropped. 
      In such failure, the DHCPv6 server replies with an encrypted Reply
      message with an AuthenticationFail error status code, defined in 
      <xref target="StatusCodes"></xref>, back to the client. At this 
      point, the server has either recognized the authentication of the 
      client, or decided to drop the message.</t>
	  
	    <t>If the decrypted message contains the Increasing-number option, the 
      server checks it according to the rule defined in <xref target="IncreasingNumCheck"></xref>.
      If the check fails, an encrypted Reply message with a ReplayDetected 
      error status code, defined in <xref target="StatusCodes"></xref>, 
      should be sent back to the client. In the Reply message, a Increasing-number 
      option is carried to indicate the server's stored number for the client
      to use. According to the server's local policy, the message without 
      an Increasing-number option MAY be acceptable or rejected.</t>

      <!--
	  <t>If the server does not send the Timestamp option, the client ignores
      the timestamp check and verifies the signature. If there is a timestamp
      option, the server MUST now authenticate the client by verifying the
      signature and checking timestamp (see details in <xref
      target="timestampCheck"></xref>). The order of two procedures is left as
      an implementation decision. It is RECOMMENDED to check timestamp first,
      because signature verification is much more computationally expensive.
      Depending on server's local policy, the message without a Timestamp
      option MAY be acceptable or rejected. If the server rejects such a
      message, a TimestampFail error status code, defined in <xref
      target="StatusCodes"></xref>, should be sent back to the client. The
      reply message that carries the TimestampFail error status code SHOULD
      carry a Timestamp option, which indicates the server's clock for the
      client to use.</t>
      -->

      <t>The Signature field verification MUST show that the signature has
      been calculated as specified in <xref target="SigOption"></xref>. 
      If the signature check fails, the DHCPv6 server SHOULD send an 
      encrypted Reply message with a SignatureFail error status code.
      Only the clients that get through both the signature verification and
      increasing number check (if there is a Increasing-number option) are 
      accepted as authenticated clients and continue to be handled their 
      message as defined in <xref target="RFC3315"></xref>.</t>
      <!--
      ; or
      a TimestampFail error status code, defined in <xref
      target="StatusCodes"></xref>, for the timestamp check failure, back to
      the client.
      -->
	  
      <t>Once the client has been authenticated, the DHCPv6 server sends the
      Encrypted-response message to the DHCPv6 client. The Encrypted-response
      message MUST only contain the Encrypted-message option, which MUST be 
      constructed as explained in <xref target="EncryMesOption"></xref>. The 
      encryption text SHOULD be formatted as explain in <xref target="RFC5652"></xref>. 
      The Encrypted-message option contains the encrypted DHCPv6 message that 
      is encrypted using the authenticated client's public key. To provide the 
	    replay protection, the Increasing-number option can be contained in the 
      encrypted DHCPv6 message.</t>
    </section>

    <section title="Relay Agent Behavior">
      <t>When a DHCPv6 relay agent receives an Encrypted-query or
      Encrypted-response message, it may not recognize this message. The
      unknown messages MUST be forwarded as described in <xref
      target="RFC7283"></xref>.</t>

      <t>When a DHCPv6 relay agent recognizes the Encrypted-query and
      Encrypted-response messages, it forwards the message according to
      section 20 of <xref target="RFC3315"></xref>. There is nothing more the
      relay agents have to do, it neither needs to verify the messages from
      client or server, nor add any secure DHCPv6 options. Actually, by
      definition in this document, relay agents MUST NOT add any secure
      DHCPv6 options.</t>

      <t>Relay-forward and Relay-reply messages MUST NOT contain any
      additional Certificate option or Increasing-number option, aside from those 
	  present in the innermost encapsulated messages from the client or 
	  server.</t>
	  
    <!--
	  <t>Relay agent is RECOMMENDED to cache server announcements to form 
	  the list of the available DHCPv6 server certs. If the relay agent 
	  receives the Information-request message, then it replies with  
	  a list of server certs available locally. In this way, the client 
	  can be confident of a quick response, and therefore treat the lack 
	  of a quick response as an indication that no authenticated DHCP servers 
	  exist.</t>
  -->
    </section>

    <!--
    <section title="Processing Rules">
      <section anchor="timestampCheck" title="Timestamp Check">
        <t>In order to check the Timestamp option, defined in <xref
        target="TimeStampOption"></xref>, recipients SHOULD be configured with
        an allowed timestamp Delta value, a "fuzz factor" for comparisons, and
        an allowed clock drift parameter. The recommended default value for
        the allowed Delta is 300 seconds (5 minutes); for fuzz factor 1
        second; and for clock drift, 0.01 second.</t>

        <t>Note: the Timestamp mechanism is based on the assumption that
        communication peers have roughly synchronized clocks, within certain
        allowed clock drift. So, an accurate clock is not necessary. If one has a
        clock too far from the current time, the timestamp mechanism would not
        work.</t>

        <t>To facilitate timestamp checking, each recipient SHOULD store the
        following information for each sender, from which at least one
        accepted secure DHCPv6 message is successfully verified (for 
        timestamp check and signature verification):</t>

        <t><list style="symbols">
            <t>The receive time of the last received and accepted DHCPv6
            message. This is called RDlast.</t>

            <t>The timestamp in the last received and accepted DHCPv6 message.
            This is called TSlast.</t>
          </list>A verified (for timestamp check and signature verification) 
		  secure DHCPv6 message initiates the update of the above variables 
		  in the recipient's record.</t>

        <t>Recipients MUST check the Timestamp field as follows:</t>

        <t><list style="symbols">
            <t>When a message is received from a new peer (i.e., one that is
            not stored in the cache), the received timestamp, TSnew, is
            checked, and the message is accepted if the timestamp is recent
            enough to the reception time of the packet, RDnew:<list
                style="empty">
                <t>-Delta &lt; (RDnew - TSnew) &lt; +Delta</t>
              </list><vspace blankLines="1" />After the signature verification
            also succeeds, the RDnew and TSnew values SHOULD be stored in the
            cache as RDlast and TSlast.</t>

            <t>When a message is received from a known peer (i.e., one that
            already has an entry in the cache), the timestamp is checked
            against the previously received Secure DHCPv6 message:<list
                style="empty">
                <t>TSnew + fuzz &gt; TSlast + (RDnew - RDlast) x (1 - drift) -
                fuzz</t>
              </list><vspace blankLines="1" />If this inequality does not hold
            or RDnew &lt; RDlast, the recipient SHOULD silently discard the
            message. If, on the other hand, the inequality holds, the
            recipient SHOULD process the message. <vspace
            blankLines="1" />Moreover, if the above inequality holds and TSnew
            &gt; TSlast, the recipient SHOULD update RDlast and TSlast after
            the signature verification also successes. Otherwise, the
            recipient MUST NOT update RDlast or TSlast.</t>
          </list>An implementation MAY use some mechanism such as a timestamp
        cache to strengthen resistance to replay attacks. When there is a very
        large number of nodes on the same link, or when a cache filling attack
        is in progress, it is possible that the cache holding the most recent
        timestamp per sender will become full. In this case, the node MUST
        remove some entries from the cache or refuse some new requested
        entries. The specific policy as to which entries are preferred over
        others is left as an implementation decision.</t>

        <t>An implementation MAY statefully record the latest timestamps from
        senders. In such implementation, the timestamps MUST be strictly
        monotonously increasing. This is reasonable given that DHCPv6 messages
        are rarely misordered.</t>
      </section>
    </section>
    -->
    <section title="Processing Rules">
	  <section anchor="IncreasingNumCheck" title="Increasing Number Check">
        <t>In order to check the Increasing-number option, defined in <xref
        target="IncreasingNumOption"></xref>, the client/server has one stable 
        stored number for replay attack detection. The server should keep a 
        record of the increasing number forever. And the client keeps a record 
        of the increasing number during the DHCPv6 configuration process with 
        the DHCPv6 server. And the client can forget the increasing number 
        information after the transaction is finished. The client's initial
        locally stored increasing number is zero.</t>

        <t>It is essential to remember that the increasing number is finite.
        All arithmetic dealing with sequence numbers must be performed modulo 
        2^64. This unsigned arithmetic preserves the relationship of sequence 
        numbers as they cycle from 2^64 - 1 to 0 again.</t>

        <t>In order to check the Increasing-number option, the following
        comparison is needed.</t>

        <t>NUM.STO = the stored number in the client/server</t>

        <t>NUM.REC = the acknowledged number from the received message</t>

        <t>The Increasing-number option in the received message passes the 
        increasing number check if NUM.REC is more than NUM.STO. And then, 
        the value of NUM.STO is changed into the value of NUM.REC.</t>

        <t>The increasing number check fails if NUM.REC is equal with or less 
        than NUM.STO</t>

        <t>It is should be noted that </t>
      </section>
    </section>

    <section title="Extensions for Secure DHCPv6">
      <t>This section describes the extensions to DHCPv6. Six new DHCPv6
      options, two new DHCPv6 messages and six new status codes are 
	    defined.</t>

      <section title="New DHCPv6 Options">
        <section anchor="AlgoOption" title="Algorithm Option">
          <t>The Algorithm option carries the algorithms sets for algorithm 
            agility, which is contained in the Information-request message.</t>
          <t><figure align="center" title="Figure 2: Algorithm Option">
              <artwork><![CDATA[ 0                   1                   2                   3
 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|      OPTION_ALGORITHM         |         option-len            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
.                          EA-id List                           .
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+  
.                          SA-id List                           .
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    
.                          HA-id List                           .
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
]]></artwork>
            </figure></t>

          <t><list style="symbols">
            <t>option-code: OPTION_ALGORITHM (TBA1).</t>  

            <t>option-len: length of EA-id List + length of SA-id List
                           + length of HA-id List in octets.</t>  

            <t>EA-id: The format of the EA-id List field is shown in Figure 3.
<figure align="center" title="Figure 3: EA-id List Field">
              <artwork><![CDATA[ 0                   1                   2                   3
 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|           EA-len              |               EA-id           |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
.                              ...                              .
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|               EA-id           |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

EA-len         The length of the following EA-ids.

EA-id          2-octets value to indicate the Encryption Algorithm id. 
               The client enumerates the list of encryption algorithms it 
               supports to the server. The encryption algorithm is used 
               for the encrypted DHCPv6 configuration process. This design 
               is adopted in order to provide encryption algorithm agility. 
               The value is from the Encryption Algorithm for Secure DHCPv6 
               registry in IANA. A registry of the initial assigned values 
               is defined in Section 12. The mandatory encryption
               algorithms MUST be included. 
]]></artwork>
</figure></t>

            <t>SA-id List: The format of the SA-id List field is shown in Figure 4.
<figure align="center" title="Figure 4: SA-id List Field">
              <artwork><![CDATA[ 0                   1                   2                   3
 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|           SA-len              |               SA-id           |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
.                              ...                              .
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|               SA-id           |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 

SA-len         The length of the following SA-ids.

SA-id          2-octets value to indicate the Signature Algorithm id. 
               The client enumerates the list of signature algorithms it 
               supports to the server. This design is adopted in 
               order to provide signature algorithm agility. The 
               value is from the Signature Algorithm for Secure 
               DHCPv6 registry in IANA. The support of RSASSA-PKCS1-v1_5 
               is mandatory. A registry of the initial assigned 
               values is defined in Section 12. The mandatory 
               signature algorithms MUST be included. 
]]></artwork>
</figure></t>

            <t>HA-id List: The format of the HA-id List field is shown in Figure 5.
<figure align="center" title="Figure 5: HA-id List Field">
              <artwork><![CDATA[ 0                   1                   2                   3
 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|           HA-len              |               HA-id           |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
.                              ...                              .
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|               HA-id           |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 

HA-len         The length of the following HA-ids.

HA-id          2-octets value to indicate the Hash Algorithm id. 
               The client enumerates the list of hash algorithms it 
               supports to the server. This design is adopted in order to 
               provide hash algorithm agility. The value is from the 
               Hash Algorithm for Secure DHCPv6 registry in IANA. The 
               support of SHA-256 is mandatory. A registry of the 
               initial assigned values is defined in Section 12.
               The mandatory hash algorithms MUST be included.
]]></artwork>
</figure></t>
            </list></t>
        </section>

        <section anchor="CertOption" title="Certificate Option">
          <t>The Certificate option carries the certificate of the client/server, 
          which is contained in the Reply message. The format of the Certificate 
          option is described as follows:</t>

          <t><figure align="center" title="Figure 6: Certificate Option">
              <artwork><![CDATA[ 0                   1                   2                   3
 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|      OPTION_CERTIFICATE       |         option-len            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|              EA-id            |            SA-id              |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    
|                                                               |
.                           Certificate                         .
|                                                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
]]></artwork>
            </figure></t>

          <t><list style="symbols">
            <t>option-code: OPTION_CERTIFICATE (TBA2).</t>  

            <t>option-len: 4 + length of Certificate in octets.</t>  

            <t>EA-id: Encryption Algorithm id which is used for the certificate.</t>

            <t>SA-id: Signature Algorithm id which is used for the certificate.</t>
            
            <t>Certificate: A variable-length field containing certificates. The
                            encoding of certificate and certificate data MUST
                            be in format as defined in Section 3.6, [RFC7296].
                            The support of X.509 certificate is mandatory.</t>           
            </list></t>
            <t>It should be noticed that the scenario where the values of EA-id 
            and SA-id are both 0 makes no sense and the client MUST discard a 
            message with such values.</t>
        </section>
			   

        <section anchor="SigOption" title="Signature option">
          <t>The Signature option contains a signature that is signed by the
          private key to be attached to the Reply message. The Signature option
          could be in any place within the DHCPv6 message while it is logically
          created after the entire DHCPv6 header and options. It protects the 
		      entire DHCPv6 header and options, including itself. The format of 
          the Signature option is described as follows:</t>

          <t><figure align="center" title="Figure 7: Signature Option">
              <artwork><![CDATA[ 0                   1                   2                   3
 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|     OPTION_SIGNATURE          |        option-len             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|         SA-id                 |            HA-id              |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                                                               |
.                    Signature (variable length)                .
.                                                               .
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
]]></artwork>
            </figure></t>

          <t><list style="symbols">
            <t>option-code: OPTION_SIGNATURE (TBA3).</t>  

            <t>option-len: 4 + length of Signature field in octets.</t>  

            <t>SA-id: Signature Algorithm id. The signature algorithm is
                      used for computing the signature result. This 
                      design is adopted in order to provide signature 
                      algorithm agility. The value is from the Signature
                      Algorithm for Secure DHCPv6 registry in IANA. The
                      support of RSASSA-PKCS1-v1_5 is mandatory. A 
                      registry of the initial assigned values is defined
                      in Section 12.</t>

            <t>HA-id: Hash Algorithm id. The hash algorithm is used for 
                      computing the signature result. This design is 
                      adopted in order to provide hash algorithm agility.
                      The value is from the Hash Algorithm for Secure 
                      DHCPv6 registry in IANA. The support of SHA-256 is
                      mandatory. A registry of the initial assigned values
                      is defined in Section 12. If the hash algorithm 
                      is fixed according to the corresponding signature
                      algorithm, the HA-id field is set to zero.</t>

            <t>Signature: A variable-length field containing a digital 
                          signature. The signature value is computed with
                          the hash algorithm and the signature algorithm,
                          as described in HA-id and SA-id. 
                            <!--The signature
                            constructed by using the sender's private key
                            protects the following sequence of octets:

                            1. The DHCPv6 message header.

                            2. All DHCPv6 options including the Signature
                            option (fill the Signature field with zeroes).
                            -->

                          The Signature field MUST be padded, with all 0, to
                          the next octet boundary if its size is not a
                          multiple of 8 bits. The padding length depends on
                          the signature algorithm, which is indicated in the
                          SA-id field.</t>  
            </list>
          </t>  
                              
		      <t>Note: If Secure DHCPv6 is used, the DHCPv6 message is encrypted in a 
          way that the authentication mechanism defined in RFC3315 does not understand.
          So the Authentication option SHOULD NOT be used if Secure DHCPv6 is 
          applied.</t>
		  <!--Note: if both signature and authentication option are
          present, Signature option does not protect the Authentication
          Option. It allows the Authentication Option to be created after
          signature has been calculated and filled with the valid signature.
          It is because both options need to apply hash algorithm to whole
          message, so there must be a clear order and there can be only one
          last-created option. In order to avoid update <xref target="RFC3315"></xref> 
          because of changing auth option, the authors choose not to include 
          authentication option in the signature.</t>
		  -->
        </section>


        <section anchor="IncreasingNumOption" title="Increasing-number Option">
          <t>The Increasing-number option carries the strictly increasing number for
          anti-replay protection, which is contained in the Reply message and the 
          encrypted DHCPv6 message. It is optional.</t>

          <t><figure align="center" title="Figure 8: Increasing-number Option">
              <artwork><![CDATA[ 0                   1                   2                   3
 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|   OPTION_INCREASING_NUM       |        option-len             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                                                               |
|                  Increasing-Num (64-bit)                      |
|                                                               |
|                                                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

option-code    OPTION_INCREASING_NUM (TBA4).

option-len     8, in octets.

Increasing-Num A strictly increasing number for the replay attack detection 
               which is more than the local stored number.
               ]]></artwork>
            </figure></t>
        </section>

        <section anchor="EncryKTOption" title="Encryption-Key-Tag Option">
          <t>The Encryption-Key-Tag option carries the key identifier which 
            is calculated from the public key data. The Encrypted-Query message
            MUST contain the Encryption-Key-Tag option to identify the used
            public/private key pair.</t>

          <figure align="center" title="Figure 9: Encryption-Key-Tag Option">
            <artwork><![CDATA[
   0                   1                   2                   3
   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
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  |    OPTION_ENCRYPTION_KEY_TAG  |           option-len          |
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  |                                                               |
  .                    encryption key tag                         .
  .                       (variable)                              .
  .                                                               .
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
            ]]></artwork>
          </figure>

          <t><list style="hanging">
              <t hangText="option-code">OPTION_ENCRYPTION_KEY_TAG (TBA5).</t>

              <t hangText="option-len">Length of the encryption key tag.</t>

              <t hangText="encryption key tag">A variable length field
              containing the encryption key tag sent from the client to server
              to identify the used public/private key pair. The encryption
              key tag is calculated from the public key data, like fingerprint
              of a specific public key. How to generate the encryption key tag 
              adopts the method define in Appendix B in <xref target="RFC4034"></xref>
              and section 5.5 in <xref target="RFC6840"></xref>. The data of 
              the public key is used as input of the generation function.</t>
            </list></t>

        </section>

        <section anchor="EncryMesOption" title="Encrypted-message Option">
          <t>The Encrypted-message option carries the encrypted DHCPv6 message,
            which is calculated with the recipient's public key. The 
            Encrypted-message option is contained in the Encrypted-Query 
            message or the Encrypted-Response message.</t>

          <t>The format of the Encrypted-message option is:</t>

          <figure align="center" 
                  title="Figure 10: Encrypted-message Option">
            <artwork><![CDATA[
   0                   1                   2                   3
   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
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  |          option-code          |           option-len          |
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  |                                                               |
  .                  encrypted DHCPv6 message                     .
  .                       (variable)                              .
  .                                                               .
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
            ]]></artwork>
          </figure>

          <t><list style="hanging">
              <t hangText="option-code">OPTION_ENCRYPTED_MSG (TBA6).</t>

              <t hangText="option-len">Length of the encrypted DHCPv6
              message.</t>

              <t hangText="encrypted DHCPv6 message">A variable length field
              containing the encrypted DHCPv6 message. In Encrypted-Query 
              message, it contains encrypted DHCPv6 message sent from a client
              to server. In Encrypted-response message, it contains encrypted 
              DHCPv6 message sent from a server to client.</t>
            </list></t>
        </section>
      </section>

	  <section anchor="DHCPv6Messages" title="New DHCPv6 Messages">
        <t>Two new DHCPv6 messages are defined to achieve the DHCPv6 encryption:
        Encrypted-Query and Encrypted-Response. Both the DHCPv6 messages defined
        in this document share the following format:</t>
        <figure align="center" 
                  title="Figure 11: The format of Encrypted-Query and Encrypted-Response Messages">
          <artwork><![CDATA[
   0                   1                   2                   3
   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
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  |    msg-type   |               transaction-id                  |
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  |                                                               |
  .                             options                           .
  .                           (variable)                          .
  |                                                               |
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
]]></artwork>
        </figure>

        <t><list hangIndent="16" style="hanging">
            <t hangText="msg-type">Identifier of the message type. It can be either
              Encrypted-Query (TBA7) or DHCPv6-Response (TBA8).</t>

            <t hangText="transaction-id">The transaction ID for this message
            exchange.</t>

            <t hangText="options">The Encrypted-Query message MUST contain the 
            Encrypted-message option, Encryption-Key-Tag option and Server 
            Identifier option if the message in the Encrypted-message option 
            has a Server Identifier option. The Encrypted-Response message
            MUST only contain the Encrypted-message option.</t>
          </list></t>
      </section>

      <section anchor="StatusCodes" title="Status Codes">
        <t>The following new status codes, see Section 5.4 of <xref
        target="RFC3315"></xref> are defined. <list style="symbols">
            <t>AuthenticationFail (TBD9): indicates that the message from the
	          DHCPv6 client fails authentication check.</t>

            <t>ReplayDetected (TBD10): indicates the message from DHCPv6 client
            fails the increasing number check.</t>
			
			      <t>SignatureFail (TBD11): indicates the message from DHCPv6 client
            fails the signature check.</t>
        </list></t>
      </section>
    </section>

    <section anchor="Security" title="Security Considerations">
      <t>This document provides the authentication and encryption mechanisms
      for DHCPv6.</t>

      <t><xref target="RFC6273"></xref> has analyzed possible threats to the
      hash algorithms used in SEND. Since Secure DHCPv6 defined in this
      document uses the same hash algorithms in similar way to SEND, analysis
      results could be applied as well: current attacks on hash functions do
      not constitute any practical threat to the digital signatures used in
      the signature algorithm in Secure DHCPv6.</t>

      <t>There are some mandatory algorithm for encryption algorithm in this
      document. It may be at some point that the mandatory algorithm is no 
      longer safe to use.</t>
	  
      <t>A server or a client, whose local policy accepts messages without a 
      Increasing-number option, may have to face the risk of replay attacks.</t>

      <!--
      <t>A window of vulnerability for replay attacks exists until the
      timestamp expires. Secure DHCPv6 nodes are protected against replay
      attacks as long as they cache the state created by the message
      containing the timestamp. The cached state allows the node to protect
      itself against replayed messages. However, once the node flushes the
      state for whatever reason, an attacker can re-create the state by
      replaying an old message while the timestamp is still valid. In
      addition, the effectiveness of timestamps is largely dependent upon the
      accuracy of synchronization between communicating nodes. However, how
      the two communicating nodes can be synchronized is out of scope of this
      work.</t>
      -->

      <!--
      <t>Attacks against time synchronization protocols such as NTP <xref target="RFC5905"></xref>
      may cause Secure DHCPv6 nodes to have an incorrect timestamp value. This
      can be used to launch replay attacks, even outside the normal window of
      vulnerability. To protect against these attacks, it is recommended that
      Secure DHCPv6 nodes keep independently maintained clocks or apply
      suitable security measures for the time synchronization protocols.</t>
	    -->
	  
	    <t>If the client tries more than one cert for client authentication, the 
	    server can easily get a client that implements this to enumerate its 
	    entire cert list and probably learn a lot about a client that way. 
      For this security item, It is RECOMMENDED that client certificates 
      could be tied to specific server certificates by configuration.</t>
    </section>

    <section anchor="IANA" title="IANA Considerations">
	    <t>This document defines six new DHCPv6 <xref target="RFC3315"></xref>
      options. The IANA is requested to assign values for these six options
      from the DHCPv6 Option Codes table of the DHCPv6 Parameters registry
      maintained in http://www.iana.org/assignments/dhcpv6-parameters. The
      six options are:</t>

      <t><list style="empty">
          <t>The Algorithm Option (TBA1), described in <xref
          target="CertOption"></xref>.</t>

          <t>The Certificate Option (TBA2), described in <xref
          target="CertOption"></xref>.</t>

          <t>The Signature Option (TBA3), described in <xref
          target="SigOption"></xref>.</t>

          <t>The Increasing-number Option (TBA4),described in <xref
          target="IncreasingNumOption"></xref>.</t>

          <t>The Encryption-Key-Tag Option (TBA5),described in <xref
          target="EncryKTOption"></xref>.</t>          

          <t>The Encrypted-message Option (TBA6), described in <xref
          target="EncryMesOption"></xref>.</t>
        </list></t>

      <t>The IANA is also requested to assign value for these two messages
      from the DHCPv6 Message Types table of the DHCPv6 Parameters registry
      maintained in http://www.iana.org/assignments/dhcpv6-parameters. The two
      messages are:</t>

      <t><list style="empty">
          <t>The Encrypted-Query Message (TBA7), described in <xref
          target="DHCPv6Messages"></xref>.</t>

          <t>The Encrypted-Response Message (TBA8), described in <xref
          target="DHCPv6Messages"></xref>.</t>
        </list></t>

      <t>The IANA is also requested to add three new registry tables to the
      DHCPv6 Parameters registry maintained in
      http://www.iana.org/assignments/dhcpv6-parameters. The three tables are
      the Hash Algorithm for Secure DHCPv6 table, the Signature Algorithm
      for Secure DHCPv6 table and the Encryption Algorithm for Secure DHCPv6
	  table.</t>

      <t>Initial values for these registries are given below. Future
      assignments are to be made through Standards Action <xref
      target="RFC5226"></xref>. Assignments for each registry consist of a
      name, a value and a RFC number where the registry is defined.</t>

      <t>Hash Algorithm for Secure DHCPv6. The values in this table are 8-bit
      unsigned integers. The following initial values are assigned for Hash
      Algorithm for Secure DHCPv6 in this document:</t>

      <t><figure>
          <artwork><![CDATA[          Name        |  Value  |  RFCs
   -------------------+---------+--------------
      SigAlg-Combined |   ox00  | this document
         SHA-256      |   0x01  | this document
         SHA-512      |   0x02  | this document
]]></artwork>
        </figure>Signature Algorithm for Secure DHCPv6. The values in this
      table are 8-bit unsigned integers. The following initial values are
      assigned for Signature Algorithm for Secure DHCPv6 in this document:</t>

      <t><figure>
          <artwork><![CDATA[          Name        |  Value  |  RFCs
   -------------------+---------+--------------
      Non-SigAlg      |   0x00  | this document
    RSASSA-PKCS1-v1_5 |   0x01  | this document
]]></artwork>
        </figure>Encryption algorithm for Secure DHCPv6. The values in this table are 
	  8-bit unsigned integers. The following initial values are assigned for 
      encryption algorithm for Secure DHCPv6 in this document:</t>

      <t><figure>
          <artwork><![CDATA[          Name        |  Value  |  RFCs
   -------------------+---------+--------------
        Non-EncryAlg  |   0x00  | this document
           RSA        |   0x01  | this document
]]></artwork>
        </figure></t>
		
	  <t>IANA is requested to assign the following new DHCPv6 Status
      Codes, defined in <xref target="StatusCodes"></xref>, in the DHCPv6
      Parameters registry maintained in
      http://www.iana.org/assignments/dhcpv6-parameters:</t>

      <t><figure>
          <artwork><![CDATA[      Code  |           Name        |   Reference
   ---------+-----------------------+--------------
      TBD9  |   AuthenticationFail  | this document
      TBD10 |     ReplayDetected    | this document
      TBD11 |     SignatureFail     | this document
]]></artwork>
        </figure></t>
    </section>

    <section anchor="Acknowledgments" title="Acknowledgements">
      <t>The authors would like to thank Tomek Mrugalski, Bernie Volz, Jianping
	    Wu, Randy Bush, Yiu Lee, Sean Shen, Ralph Droms, Jari Arkko, Sean
      Turner, Stephen Farrell, Christian Huitema, Stephen Kent, Thomas Huth,
      David Schumacher, Francis Dupont, Gang Chen, Suresh Krishnan, Fred
      Templin, Robert Elz, Nico Williams, Erik Kline, Alan DeKok, Bernard
      Aboba, Sam Hartman, Zilong Liu and other members of the IETF
      DHC working group for their valuable comments.</t>

      <t>This document was produced using the xml2rfc tool <xref
      target="RFC2629"></xref>.</t>
    </section>
	
    
	
  </middle>

  <back>
    <references title="Normative References">
      <?rfc include='reference.RFC.2119'?>

      <?rfc include='reference.RFC.2460'?>

      <?rfc include='reference.RFC.3315'?>

      <?rfc include='reference.RFC.3971'?>

      <?rfc include='reference.RFC.4034'?>

      <?rfc include='reference.RFC.4443'?>

      <?rfc include='reference.RFC.5652'?>

      <?rfc include='reference.RFC.5905'?>

      <?rfc include='reference.RFC.6840'?>

      <?rfc include='reference.RFC.7296'?>

      <?rfc include='reference.RFC.7283'?>

      <?rfc include='reference.RFC.7435'?>

      <?rfc include='reference.RFC.7824'?>

      <?rfc include='reference.RFC.7844'?>
    </references>

    <references title="Informative References">
      <reference anchor="RSA">
        <front>
          <title>RSA Encryption Standard, Version 2.1, PKCS 1</title>

          <author fullname="">
            <organization>RSA Laboratories</organization>
          </author>

          <date month="November" year="2002" />
        </front>
      </reference>

      <?rfc include='reference.RFC.2629'?>

      <?rfc include='reference.RFC.5226'?>

      <?rfc include='reference.RFC.6273'?>

      <?rfc include='reference.RFC.7258'?>
    </references>
  </back>
</rfc>

