NTP Working Group                                              D. Sibold Franke
Internet-Draft                                                       PTB                                                    Akamai
Intended status: Standards Track                             S. Roettger                               D. Sibold
Expires: March 26, May 4, 2017                                       Google Inc                                          K. Teichel
                                                                     PTB
                                                      September 22,
                                                        October 31, 2016

Using the Network Time Security Specification to Secure the Network Time
                                Protocol
                  draft-ietf-ntp-using-nts-for-ntp-06
                  draft-ietf-ntp-using-nts-for-ntp-07

Abstract

   This document describes how to use reach the measures objectives described in the
   Network Time Security (NTS) specification to secure when securing time
   synchronization with servers using the Network Time Protocol (NTP).

Requirements Language

   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 RFC 2119 [RFC2119].

Status of This Memo

   This Internet-Draft is submitted in full conformance with the
   provisions of BCP 78 and BCP 79.

   Internet-Drafts are working documents of the Internet Engineering
   Task Force (IETF).  Note that other groups may also distribute
   working documents as Internet-Drafts.  The list of current Internet-
   Drafts is at http://datatracker.ietf.org/drafts/current/.

   Internet-Drafts are draft documents valid for a maximum of six months
   and may be updated, replaced, or obsoleted by other documents at any
   time.  It is inappropriate to use Internet-Drafts as reference
   material or to cite them other than as "work in progress."

   This Internet-Draft will expire on March 26, May 4, 2017.

Copyright Notice

   Copyright (c) 2016 IETF Trust and the persons identified as the
   document authors.  All rights reserved.

   This document is subject to BCP 78 and the IETF Trust's Legal
   Provisions Relating to IETF Documents
   (http://trustee.ietf.org/license-info) in effect on the date of
   publication of this document.  Please review these documents
   carefully, as they describe your rights and restrictions with respect
   to this document.  Code Components extracted from this document must
   include Simplified BSD License text as described in Section 4.e of
   the Trust Legal Provisions and are provided without warranty as
   described in the Simplified BSD License.

Table of Contents

   1.  Introduction  . . . . . . . . . . . . . . . . . . . . . . . .   3
   2.  Objectives  . . . . . . . . . . . . . . . . . . . . . . . . .   3
   3.  Terms and Abbreviations . . . . . . . . . . . . . . . . . . .   4
   4.  Overview of NTS-Secured NTP . . . . . . . . . . . . . . . . .   4
     4.1.  Symmetric and Client/Server  Client-Server Mode  . . . . . . . . . . . .   4
     4.2.  Broadcast Mode  . . . . . . . . . . .   5
     4.2.  Symmetric/Peer Mode and Control Modes . . . . . . . . . .   5
   5.  Protocol Sequence . . . . . . .  Employing DTLS for NTP Security . . . . . . . . . . . . . . .   5
     5.1.  The Client  . . . .  DTLS profile for Network Time Security  . . . . . . . . .   6
     5.2.  Transport mechanisms for DTLS records . . . . . . . . . .   5
       5.1.1.  The Client in Unicast Mode   7
       5.2.1.  Transport via NTS port  . . . . . . . . . . . . .   5
       5.1.2.  The Client in Broadcast Mode . .   7
       5.2.2.  Transport via NTP extension field . . . . . . . . . .   8
     5.2.   7
     5.3.  The Server  . . . . . . . . . . . . NTS-encapsulated NTPv4 protocol . . . . . . . . . . .   9
       5.2.1.
     5.4.  The Server in Unicast Mode NTS Key Establishment protocol  . . . . . . . . . . .  10
       5.4.1.  NTS-KE record types . .   9
       5.2.2.  The Server in Broadcast Mode . . . . . . . . . . . .  10
   6.  Implementation Notes: ASN.1 Structures and Use of the CMS . .  11
     6.1.  Unicast Messages .  11
       5.4.2.  Key Extraction (generally)  . . . . . . . . . . . . .  14
     5.5.  NTS Extensions for NTPv4  . . . . . .  13
       6.1.1.  Access Messages . . . . . . . . . .  14
       5.5.1.  Key Extraction (for NTPv4)  . . . . . . . . .  13
       6.1.2.  Association Messages . . . .  14
       5.5.2.  Packet structure overview . . . . . . . . . . . .  14
       6.1.3.  Cookie Messages . .  15
       5.5.3.  The Unique Identifier extension . . . . . . . . . . .  16
       5.5.4.  The NTS Cookie extension  . . . . . .  14
       6.1.4.  Time Synchronization Messages . . . . . . . .  16
       5.5.5.  The NTS Cookie Placeholder extension  . . . .  14
     6.2.  Broadcast Messages . . . .  16
       5.5.6.  The NTS Authenticator and Encrypted Extensions
               extension . . . . . . . . . . . . . . .  15
       6.2.1.  Broadcast Parameter Messages . . . . . . .  17
       5.5.7.  Protocol details  . . . . .  15
       6.2.2.  Broadcast Time Synchronization Message . . . . . . .  15
       6.2.3.  Broadcast Keycheck . . . . . .  18
     5.6.  Recommended format for NTS cookies  . . . . . . . . . . .  16
   7.  20
   6.  IANA Considerations . . . . . . . . . . . . . . . . . . . . .  16
     7.1.  21
     6.1.  Field Type Registry . . . . . . . . . . . . . . . . . . .  16
     7.2.  21
     6.2.  SMI Security for S/MIME CMS Content Type Registry . . . .  16
   8.  Security Considerations . . . .  21
     6.3.  DTLS-Based Key Exchange . . . . . . . . . . . . . . .  17
     8.1.  Employing Alternative Means for Access, Association and
           Cookie Exchange . .  21
   7.  Security Considerations . . . . . . . . . . . . . . . . . . .  17
     8.2.  25
     7.1.  Usage of NTP Pools  . . . . . . . . . . . . . . . . . . .  17
     8.3.  26
     7.2.  Initial Verification of the Server Seed Lifetime Certificates . . . . .  26
     7.3.  Treatment of Initial Messages . . . . . . . . . . . . .  17
     8.4.  Supported MAC Algorithms .  26
     7.4.  DTLS-Related Issues . . . . . . . . . . . . . . .  17
     8.5.  Protection for Initial Messages . . . .  26
     7.5.  Delay Attack  . . . . . . . . .  18
   9.  Acknowledgements . . . . . . . . . . . . .  26
   8.  Privacy Considerations  . . . . . . . . .  18
   10. References . . . . . . . . . .  27
     8.1.  Confidentiality . . . . . . . . . . . . . . .  18
     10.1.  Normative References . . . . . .  27
     8.2.  Unlinkability . . . . . . . . . . . .  18
     10.2.  Informative References . . . . . . . . . .  27

   9.  Acknowledgements  . . . . . . .  19
   Appendix A.  Flow Diagrams of Client Behaviour . . . . . . . . .  19
   Appendix B.  Bit Lengths for Employed Primitives . . . . . .  28
   10. References  . .  22
   Appendix C.  Error Codes . . . . . . . . . . . . . . . . . . . .  22
   Authors' Addresses . . .  28
     10.1.  Normative References . . . . . . . . . . . . . . . . . .  28
     10.2.  Informative References . . . . . . . . . . . . . . . . .  30
   Appendix A.  Flow Diagrams of Client Behaviour  . . . . . . . . .  31
   Authors' Addresses  . . . . . . . . . . . . . . . . . . . . . . .  22  32

1.  Introduction

   One of the most popular time synchronization protocols, the Network
   Time Protocol (NTP) [RFC5905], currently does not provide adequate
   intrinsic security precautions.

   The Network Time Security (NTS) draft
   [I-D.ietf-ntp-network-time-security] specifies security measures
   which can be used to enable time synchronization protocols to verify
   authenticity of the time server and integrity of the time
   synchronization protocol packets.

   This document provides detail on how to specifically use those
   measures to secure time synchronization between NTP clients and
   servers.  In particular, it describes a mechanism for using Datagram
   Transport Layer Security [RFC6347] (DTLS) to provide cryptographic
   security for NTP.  Certain sections, are not inherently NTP-specific
   and can be taken as guidance on how future work may apply the
   described techniques to other time synchronization protocols such as
   the Precision Time Protocol [IEC.61588_2009].

2.  Objectives

   The specific objectives of for applying the Network Time Security (NTS) NTS specification to the NTP
   are as follows:

   o  Authenticity: NTS enables an NTP client to authenticate its time
      server(s).

   o  Integrity: NTS protects the integrity of NTP time synchronization
      protocol packets via a message authentication code (MAC).

   o  Authorization: NTS optionally enables the server to verify the
      client's authorization.

   o  Confidentiality: NTS does not provide confidentiality protection
      of the time synchronization packets. data.

   o  Authorization:  Privacy: NTS optionally enables the server preserves unlinkability, i. e. it does not leak data
      that would allow a passive attacker to verify the
      client's authorization. track mobile NTP clients
      when they move between networks.

   o  Request-Response-Consistency: NTS enables a client to match an
      incoming response to a request it has sent.  NTS also enables the
      client to deduce from the response whether its request to the
      server has arrived without alteration.

   o  Modes of operation: Both the unicast client-server mode and the broadcast symmetric
      peer mode of NTP are supported.  The broadcast mode of NTP can NOT
      be secured with measures within this document.

   o  Hybrid mode: Both secure and insecure communication modes are
      possible for both NTP servers and clients.

   o  Compatibility:

      *  NTP associations which are not secured by NTS are not affected
         by NTS-secured communication.

      *  An NTP server that does not support NTS is not affected by NTS-
         secured authentication requests.

3.  Terms and Abbreviations

   CMS  Cryptographic Message Syntax [RFC5652]

   MAC  Message Authentication Code

   MITM   Man In The Middle

   NTP    Network Time Protocol [RFC5905] (RFC 5905 [RFC5905])

   NTS    Network Time Security

   TESLA  Timed Efficient Stream Loss-Tolerant Authentication [RFC4082]

   DTLS  Datagram Transport Layer Security

   AEAD  Authenticated Encryption with Associated Data (RFC 5116
      [RFC5116])

4.  Overview of NTS-Secured NTP

4.1.  Symmetric and Client/Server Mode

   The server does not keep Network Time Protocol includes many different operating modes to
   support various network topologies.  In addition to its best-known
   and most-widely-used client-server mode, it also includes modes for
   synchronization between symmetric peers, a state of the client.  NTS initially
   verifies the authenticity of the time control mode for server
   monitoring and exchanges a
   symmetric key, the so-called cookie administration and a key input value (KIV).  The
   "access", "association", and "cookie" message exchanges described in
   [I-D.ietf-ntp-network-time-security], Appendix B., can broadcast mode.  These various
   modes have differing and contradictory requirements for security and
   performance.  Symmetric and control modes demand mutual
   authentication and mutual replay protection, and for certain message
   types control mode may require confidentiality as well as
   authentication.  Client-server mode places more stringent
   requirements on resource utilization than other modes, because
   servers may have vast number of clients and be utilized unable to afford to
   maintain per-client state.  However, client-server mode also has more
   relaxed security needs, because only the client requires replay
   protection: it is harmless for servers to process replayed packets.

   The security demands of symmetric and control modes, on the exchange other
   hand, are in conflict with the resource-utilization demands of
   client-server mode: any scheme which provides replay protection
   inherently involves maintaining some state to keep track of what
   messages have already been seen.

   This document does not discuss how to add security to NTP's broadcast
   mode.

4.1.  Client-Server Mode

   The server does not keep a long-term state of the cookie client.  NTS
   initially verifies the authenticity of the time server and KIV. exchanges
   one or more symmetric keys.  The DTLS-based key exchange procedure
   described in Section 5 can be used for this exchange.  An
   implementation MUST support the use of these exchanges. this procedure.  It MAY
   additionally support the use of any alternative secure communication
   for this purpose, as long as it fulfills the preconditions given in
   [I-D.ietf-ntp-network-time-security], Section 6.1.1.

   After the cookie and KIV are keys have been exchanged, the participants then use them to
   protect the authenticity and the integrity of subsequent unicast-type
   time synchronization packets.  In order to do this, the server
   attaches a Message Authentication Code (MAC) to each time
   synchronization packet.  The calculation of the MAC includes the
   whole time synchronization packet and the cookie symmetric key which is shared
   between
   stored on the client and server. side.  Therefore, the client can perform a
   validity check for this MAC on reception of a time synchronization
   packet.

4.2.  Broadcast  Symmetric/Peer Mode

   After the client has accomplished the necessary initial time
   synchronization via client-server mode, and Control Modes

   In the necessary broadcast
   parameters symmetric ("peer") mode as well as in control modes, there is
   no requirement for statelessness on either side.  Both sides exchange
   and memorize one or more shared secrets.  The shared secrets
   exchanged are communicated from the server then used to the client. secure NTP peer mode or control packets by
   providing at least authenticity and integrity protection and possibly
   also confidentiality.  The
   "broadcast parameter" message DTLS-based key exchange procedure
   described in
   [I-D.ietf-ntp-network-time-security], Appendix B., Section 5.3 can be utilized used for this such communication.  An
   implementation MUST support the use of this exchange.  It MAY additionally support the use of any
   alternative secure communication procedure.

5.  Employing DTLS for this purpose, as long as it
   fulfills the necessary security goals (given NTP Security

   Since (as discussed in
   [I-D.ietf-ntp-network-time-security], Section 6.2.1.).

   After the client has received the necessary broadcast parameters,
   "broadcast time synchronization" message exchanges are utilized in
   combination with optional "broadcast keycheck" exchanges to protect
   authenticity and integrity of NTP broadcast time synchronization
   packets.  As in 4.1) no single approach can
   simultaneously satisfy the case needs of unicast time synchronization messages, all modes, this specification
   consists of not one protocol but a suite of them:

   o  The "NTS-encapsulated NTPv4" protocol is also achieved by MACs.

5.  Protocol Sequence

   Throughout this section, little more than "NTP
      over DTLS": the access key, two endpoints perform a DTLS handshake and then
      exchange NTP packets encapsulated as DTLS Application Data.  It is
      suitable for symmetric and control modes, and is also secure for
      client/server mode but relatively wasteful of server seed, resources.

   o  The "NTS Key Establishment" protocol (NTS-KE) uses DTLS to
      establish key material and negotiate some additional protocol
      options, but then quickly closes the nonces,
   cookies DTLS channel and MACs mentioned have bit lengths does not use
      it for the exchange of B_accesskey, B_seed,
   B_nonce, B_cookie time packets.  NTS-KE is designed to be
      extensible, and B_mac, respectively.  These bit lengths might be extended to support key establishment for
      other protocols such as PTP.

   o  The "NTS extensions for NTPv4" are
   defined in Appendix B (Appendix B).  If a message requires a MAC to
   cover its contents, this MAC MUST be calculated according to:

      mac = MSB_<B_mac> (HMAC(key, content)),

   where the application of the function MSB_<B_mac> returns only the
   B_mac most significant bits, where content is composed collection of the NTP
   header and all extension
      fields prior to the MAC-carrying extension
   field (see Section 6), and where for cryptographically securing NTPv4 using key is the cookie material
      previously negotiated using NTS-KE.  They are suitable for
      securing client/server mode because the given
   association.

   Note for clarification that different message exchanges use different
   nonces.  A nonce is always generated by server can implement them
      without retaining per-client state, but on the client other hand are
      suitable *only* for a request
   message, client/server mode because only the client,
      and then used by not the server in its response.  After this, it server, is not to be used again. protected from replay.

5.1.  The Client

5.1.1.  The Client in Unicast Mode

   For  DTLS profile for Network Time Security

   Since securing time protocols is (as of 2016) a unicast run, the client performs novel application of
   DTLS, no backward-compatibility concerns exist to justify using
   obsolete, insecure, or otherwise broken DTLS features or versions.
   We therefore put forward the following steps:

   NOTE:  Steps 1 through 6 MAY alternatively be replaced by an
      alternative secure mechanism for access, association requirements and cookie
      exchange.

   Step 1:  It sends a client_access message guidelines,
   roughly representing 2016's best practices.

   Implementations MUST NOT negotiate DTLS versions earlier than 1.2.

   Implementations willing to the server.

   Step 2:  It waits for a reply in the form negotiate more than one possible version
   of a server_access message.

   Step 3:  It sends a client_assoc message DTLS SHOULD NOT respond to the server.  It handshake failures by retrying with a
   downgraded protocol version.  If they do, they MUST
      include the access key from the previously received server_access
      message.  It implement
   [RFC7507].

   DTLS clients MUST keep the transmitted nonce as well as the values
      for NOT offer, and DTLS servers MUST not select, RC4
   cipher suites.  [RFC7465]

   DTLS clients SHOULD offer, and DTLS servers SHOULD accept, the version number TLS
   Renegotiation Indication Extension [RFC5746].  Regardless, they MUST
   NOT initiate or permit insecure renegotiation.  (*)

   DTLS clients SHOULD offer, and algorithms available for later checks.

   Step 4:  It waits for a reply in DTLS servers SHOULD accept, the form of a server_assoc message.
      After receipt TLS
   Session Hash and Extended Master Secret Extension [RFC7627]. (*)
   Use of the message Application-Layer Protocol Negotiation Extension [RFC7301]
   is integral to NTS and support for it performs the following checks:

      *  The client checks that the message contains a conforming
         version number.

      *  It checks is REQUIRED for
   interoperability.

   (*): Note that DTLS 1.3 or beyond may render the nonce sent back by the server matches the indicated
   recommendations inapplicable.

5.2.  Transport mechanisms for DTLS records

   This section specifies two mechanisms, one transmitted in client_assoc,

      * REQUIRED and one OPTIONAL,
   for exchanging NTS-related DTLS records.  It also verifies is intended that the server has chosen the encryption and
         MAC algorithms from its proposal sent in
   choice of transport mechanism be orthogonal to any concerns at the client_assoc
         message and that
   application layer: DTLS records SHOULD receive identical disposition
   regardless of which mechanism they arrive by.

5.2.1.  Transport via NTS port

   In this proposal was not altered.

      *  Furthermore, it performs authenticity checks transport mechanism, DTLS records, formatted according to RFC
   6347 [RFC6347] or a subsequent revision thereof, are exchanged
   directly on the certificate
         chain and the signature.

      If UDP port [[TBD]], with one DTLS record per UDP packet and
   no additional layer of encapsulation between the checks fails, the client MUST abort the run.

      Discussion:  Note that by performing the above message exchange UDP header and checks, the client validates the authenticity of its
         immediate
   DTLS record.  Servers which implement NTS MUST support this
   mechanism.

5.2.2.  Transport via NTP server only.  It does not recursively validate
         the authenticity extension field

   In this transport mechanism, DTLS records are exchanged within
   extension fields of each specially-formed NTP server on packets, which are
   themselves exchanged via the time synchronization
         chain.  Recursive authentication (and authorization) usual NTP service port (123/udp).  NTP
   packets conveying DTLS records SHALL be formatted as
         formulated in RFC 7384 [RFC7384] depends on the chosen trust
         anchor.

   Step 5:  Next it sends a client_cook message to the server.  The
      client Figure 1.
   They MUST save the included nonce until the reply has been
      processed.

   Step 6:  It awaits NOT contain any other extensions or a reply in the form legacy MAC field.

    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
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                                                               |
   .                                                               .
   .                     NTP Header (48 octets)                    .
   .                                                               .
   |                                                               |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |          Extension Type         |       Extension Length      |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                                                               |
   .                                                               .
   .                     DTLS Record (variable)                    .
   .                                                               .
   |                                                               |
   +               +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |               |                                               |
   +-+-+-+-+-+-+-+-+                                               +
   |                                                               |
   .                                                               .
   .                    Padding (1-24 octets)                      .
   .                                                               .
   |                                                               |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

          Figure 1: Format of a server_cook message; upon
      receipt it executes the following actions:

      *  It verifies that the received version number matches the one
         negotiated beforehand.

      *  It verifies the signature using NTP packets conveying DTLS records

   Within the server's public key. NTP header,

   o  The
         signature has Leap Indicator field SHALL be set to authenticate 3 (unsynchronized).

   o  The Version Number field SHALL be set to 4.

   o  DTLS clients SHALL set the encrypted data.

      *  It decrypts Mode field to 3, and DTLS servers SHALL
      set the encrypted data with its own private key.

      *  It checks that Mode field to 4, even if the decrypted message DTLS record is of the expected format: being used (in
      the concatenation of a B_nonce bit nonce and full-encapsulation protocol) to protect some NTP mode other
      than client/server.

   o  The Stratum field SHALL be set to 0 (unspecified or invalid).

   o  The Reference ID field (conveying a B_cookie bit
         cookie.

      *  It verifies that the received nonce matches kiss code) SHALL be set to
      "DTLS"

   o  DTLS servers SHALL set the nonce sent in origin timestamp field from the client_cook message.

      If one
      transmit timestamp field of those checks fails, the client MUST abort the run.

   Step 7:  The client sends a time_request message to packet most recently received from
      the server.  The
      client client.

   o  All other header fields MUST append a MAC to be ignored by the time_request message. receiver, and MAY
      contain arbitrary or bogus values.

   The client
      MUST save the included nonce Extension Type field SHALL be set to [[TBD]].  The Extension
   Length field SHALL be computed and the transmit_timestamp (from the
      time synchronization data) set as per RFC 7822 [RFC7822].

   The DTLS Record field SHALL contain a correlated pair for later
      verification steps.

   Step 8:  It awaits DTLS Record formatted as per
   RFC 6347 [RFC6347] or a reply in the form subsequent revision thereof.

   The Padding field SHALL contain between 1 and 24 octets of a time_response message.
      Upon receipt, it checks:

      *  that padding,
   with every octet set to the transmitted version number matches of padding octets included, e.g.,
   "01", "02 02", or "03 03 03".  The number of padding bytes should be
   chosen in order to comply with the one negotiated
         previously,

      * RFC 7822 [RFC7822] requirement
   that (in the transmitted nonce belongs to absence of a previous time_request
         message,

      *  that the transmit_timestamp legacy MAC) extensions have a total length
   in that time_request message
         matches the corresponding time stamp from octets (including the synchronization
         data received in four octets for the time_response, type and

      *  that the appended MAC verifies the received synchronization
         data, version number length fields)
   which is at least 28 and nonce.

      If divisible by 4.  Furthermore, since future
   revisions of DTLS may employ record formats that are not self-
   delimiting, at least one octet of the first three checks fails (i.e.  if the
      version number does not match, if the client has never used the
      nonce transmitted in the time_response message, or if it has used
      the nonce with initial time synchronization data different from padding MUST be included so that in
   receivers can unambiguously determine where the response), then DTLS record ends and
   the client MUST ignore this
      time_response message. padding begins.  If the MAC is invalid, the client MUST do
      one length of the following: abort the run or go back to step 5 (because
      the cookie might have changed due to DTLS record is already at
   least 24 and a server seed refresh).  If
      both checks are successful, the client SHOULD continue time
      synchronization by repeating multiple of 4, then the exchange correct amount of time_request and
      time_response messages.

   The client's behavior in unicast mode padding to
   include is also expressed in Figure 1.

5.1.2. 4 octets.

   The Client in Broadcast Mode

   To establish a secure broadcast association with a broadcast server,
   the client MUST initially authenticate NTP header values specified above are selected such that NTP
   implementations which do not understand NTS will interpret the broadcast server packet
   as an innocuous no-op and
   securely synchronize its time with it up not attempt to an upper bound use it for its time offset in unicast mode.  After that, the client performs the
   following steps:

   NOTE:  Steps 1 and 2 MAY be replaced by an alternative security
      mechanism for the broadcast parameter exchange.

   Step 1:  It sends
   synchronization.  To NTS-aware implementations, however, these
   packets are best understood as not being NTP packets at all, but
   simply a client_bpar message means of "smuggling" arbitrary DTLS records across port 123/
   udp.  Indeed, these records need not be pertinent to the server.  It MUST
      remember the transmitted values NTP at all --
   for the nonce, the version number
      and the signature algorithm.

   Step 2:  It waits example, they could be NTS-KE messages eventually intended for
   securing PTP traffic.

   This transport mechanism is intended for use as a reply fallback in
   situations where firewalls or other middleboxes are preventing
   communication on the form of a server_bpar message
      after which NTS port.  Support for it performs the following checks:

      * is OPTIONAL.

5.3.  The message must contain all the necessary information for NTS-encapsulated NTPv4 protocol

   The NTS-encapsulated NTPv4 protocol proceeds in two parts.  First,
   DTLS handshake records are exchanged using one of the
         TESLA protocol, as two transport
   mechanisms specified for a server_bpar message.

      * in Section 5.2.  The message must contain a nonce belonging to two endpoints carry out a client_bpar
         message that
   DTLS handshake in conformance with Section 5.1, with the client has previously sent.

      *  Verification
   offering (via an ALPN [RFC7301] extension), and the server accepting,
   an application-layer protocol of "ntp/4".  Second, once the message's signature.

      If any information handshake
   is missing or if the server's signature cannot
      be verified, successfully completed, the client MUST abort two endpoints use the broadcast run.  If all
      checks are successful, established
   channel to exchange arbitrary NTPv4 packets as DTLS-protected
   Application Data.

   In addition to the client requirements specified in Section 5.1,
   implementations MUST remember all enforce the broadcast
      parameters received for later checks.

   Step 3:  The client awaits time synchronization data anti-replay mechanism specified in the form
   Section 4.1.2.6 of RFC 6347 [RFC6347] (or an equivalent mechanism
   specified in a
      server_broadcast message.  Upon receipt, it performs the following
      checks:

      1.  Proof that the MAC is based on subsequent revision of DTLS).  Servers wishing to
   enforce access control SHOULD either demand a key that is not yet disclosed
          (packet timeliness).  This is achieved via client certificate or
   use a combination of
          checks.  First, PSK-based handshake in order to establish the disclosure schedule is used, which
          requires loose time synchronization.  If this client's
   identity.

   The NTS-encapsulated NTPv4 protocol is successful, the client obtains a stronger guarantee via a key check
          exchange: it sends a client_keycheck message RECOMMENDED mechanism for
   cryptographically securing mode 1 (symmetric active), 2 (symmetric
   passive), and waits 6 (control) NTPv4 traffic.  It is equally safe for the
          appropriate response.  Note that mode
   3/4 (client/server) traffic, but is NOT RECOMMENDED for this purpose
   because it needs scales poorly compared to memorize the
          nonce and the time interval number that it sends as a
          correlated pair.  For more detail on both of the mentioned
          timeliness checks, see [I-D.ietf-ntp-network-time-security].
          If its timeliness is verified, the packet will be buffered using NTS Extensions for
          later authentication.  Otherwise, the client MUST discard it.
          Note that NTPv4
   (Section 5.5).

5.4.  The NTS Key Establishment protocol

   The NTS Key Establishment (NTS-KE) protocol is carried out by
   exchanging DTLS records using one of the time information included two transport mechanisms
   specified in the packet will not
          be used for synchronization until its authenticity could also
          be verified.

      2. Section 5.2.  The client checks that it does not already know the disclosed
          key.  Otherwise, the client SHOULD discard the packet to avoid two endpoints carry out a buffer overrun.  If verified, DTLS
   handshake in conformance with Section 5.1, with the client ensures that the
          disclosed key belongs to the one-way key chain by applying offering
   (via an ALPN [RFC7301] extension), and the
          one-way function until equality with server accepting, an
   application-layer protocol of "ntske/1".  Immediately following a previous disclosed key
          is shown.  If it is falsified,
   successful handshake, the client MUST discard the
          packet.

      3.  If SHALL send a single request (as
   Application Data encapsulated in the disclosed key is legitimate, DTLS-protected channel), then
   the client verifies
          the authenticity of any packet that it has received during the
          corresponding time interval.  If authenticity of server SHALL send a packet is
          verified it is released from the buffer single response followed by a "Close notify"
   alert and the packet's time
          information can be utilized.  If the verification fails, then
          authenticity is no longer given.  In this case, discard the client
          MUST channel state.

   The client's request authentic time from and the server by means server's response each SHALL consist of
   a
          unicast time request message.  Also, the client MUST re-
          initialize the broadcast sequence with of records formatted according to Figure 2.  The sequence
   SHALL be terminated by a "client_bpar" message
          if the one-way key chain expires, "End of Message" record, which it can check via the
          disclosure schedule.

      See RFC 4082 [RFC4082] for has a detailed description Record
   Type of the packet
      verification process.

   The client MUST restart the broadcast sequence with zero and a client_bpar
   message ([I-D.ietf-ntp-network-time-security]) zero-length body.  Furthermore, requests and non-
   error responses each SHALL include exactly one NTS Next Protocol
   Negotiation record.

   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
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |C|         Record Type         |          Body Length          |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                                                               |
   .                                                               .
   .                           Record Body                         .
   .                                                               .
   |                                                               |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

                                 Figure 2

   [[Ed.  Note: this ad-hoc binary format should be fine as long as we
   continue to keep things very simple.  However, if the one-way key
   chain expires. we think there's
   any reasonable probability of wanting to include more complex data
   structures, we should consider using some semi-structured data format
   such as JSON, Protocol Buffers, or (ugh) ASN.1]]

   The client's behavior in broadcast mode can also requirement that all NTS-KE messages be seen in Figure 2.

5.2.  The Server

5.2.1.  The Server in Unicast Mode

   To support unicast mode, the server MUST terminated by an End of
   Message record makes them self-delimiting.  One DTLS record MAY, and
   typically will, contain multiple NTS-KE records.  NTS-KE records MAY
   be ready split across DTLS record boundaries.  If, likely due to perform the
   following actions:

   o  Upon receipt of packet
   loss, an incomplete NTS-KE message is received, implementations MUST
   treat this an error, which clients SHOULD handle by restarting with a client_access message, the server constructs
   fresh DTLS handshake and
      sends a reply in the form trying again.

   The fields of a server_access message an NTS-KE record are defined as described
      in Appendix B of[I-D.ietf-ntp-network-time-security].  The server
      MUST construct the access key according to:

         access_key = MSB _<B_accesskey> (MAC(server seed; Client's IP
         address)). follows:

   o  Upon receipt of  C (Critical Bit): Determines the disposition of unrecognized
      Record Types.  Implementations which receive a client_assoc message, the server checks record with an
      unrecognized Record Type MUST ignore the
      included access key.  To this end it reconstructs record if the access key Critical
      Bit is 0, and compares MUST treat it against the received one.  If they match, the
      server constructs and sends a reply in the form of a server_assoc
      message as described an error if the Critical Bit is 1.

   o  Record Type: A 15-bit integer in [I-D.ietf-ntp-network-time-security].  In network byte order (from most-to-
      least significant, its bits are record bits 7-1 and then 15-8).
      The semantics of record types 0-5 are specified in this memo;
      additional type numbers SHALL be tracked through the case where IANA Network
      Time Security Key Establishment Record Types registry.

   o  Body Length: the validity length of the included access key can Record Body field, in octets, as a
      16-bit integer in network byte order.  Record bodies may have any
      representable length and need not be
      verified, the server MUST NOT reply aligned to the received request.

   o  Upon receipt of a client_cook message, word boundary.

   o  Record Body: the server checks whether
      it supports syntax and semantics of this field shall be
      determined by the given cryptographic algorithms. Record Type.

5.4.1.  NTS-KE record types

   The following NTS-KE Record Types are defined.

5.4.1.1.  End of Message

   The End of Message record has a Record Type number of 0 and an zero-
   length body.  It then
      calculates the cookie according to MUST occur exactly once as the formula given in
      [I-D.ietf-ntp-network-time-security].  With this, it final record of every
   NTS-KE request and response.  The Critical Bit MUST
      construct be set.

5.4.1.2.  NTS Next Protocol Negotiation

   The NTS Next Protocol Negotiation record has a server_cook message as described record type of 1.  It
   MUST occur exactly once in
      [I-D.ietf-ntp-network-time-security].

   o  Upon receipt every NTS-KE request and response.  Its
   body consists of a time_request message, the server re-calculates
      the cookie and the MAC for that time_request packet and compares
      this value with sequence of 16-octet strings.  Each 16-octet
   string represents a Protocol Name from the MAC IANA Network Time Security
   Next Protocols registry.  The Critical Bit MUST be set.

   The Protocol Names listed in the received data.

      *  If client's NTS Next Protocol
   Negotiation record denote those protocols which the re-calculated MAC does not match client wishes to
   speak using the MAC key material established through this NTS-KE session.
   The Protocol Names listed in the received
         data the server server's response MUST stop the processing comprise a
   subset of the request.

      *  If the re-calculated MAC matches the MAC those listed in the received data request, and denote those protocols
   which the server computes the necessary time synchronization data is willing and
         constructs a time_response message as given in
         [I-D.ietf-ntp-network-time-security].

   If the time_request message was received in the context of an NTP
   peer association, able to speak using the server MUST look up whether it has information
   about the authentication and authorization status for the given hash
   value key material
   established through this NTS-KE session.  The client MAY proceed with
   one or more of the client's certificate.  If it does not, it them.  The request MUST NOT use
   the NTP message contents for adjusting its own clock.

   In addition to items above, list at least one protocol,
   but the server response MAY be ready to perform the
   following action:

   o  If an external mechanism for association and key exchange is used,
      the server empty.

5.4.1.3.  Error

   The Error record has to react accordingly.

5.2.2. a Record Type number of 2.  Its body is exactly
   two octets long, consisting of an unsigned 16-bit integer in network
   byte order, denoting an error code.  The Server in Broadcast Mode

   A broadcast server Critical Bit MUST also support unicast mode be set.

   Clients MUST NOT include Error records in order to provide
   the initial time synchronization, which is their request.  If clients
   receive a precondition for any
   broadcast association.  To support NTS broadcast, the server response which includes an Error record, they MUST
   additionally be ready
   discard any negotiated key material and MUST NOT proceed to perform the Next
   Protocol.

   The following actions: error code are defined.

   o  Upon receipt of  Error code 0 means "Unrecognized Critical Record".  The server
      MUST respond with this error code if the request included a client_bpar message, record
      which the server constructs did not understand and
      sends a server_bpar message as described in
      [I-D.ietf-ntp-network-time-security]. which had its Critical Bit
      set.  The client SHOULD NOT retry its request without
      modification.

   o  Upon receipt of a client_keycheck message, the  Error code 1 means "Bad Request".  The server re-
      calculates the cookie and the MAC for that client_keycheck packet
      and compares this value MUST respond with
      this error if, upon the MAC in the received data.

      *  If the re-calculated MAC does expiration of an implementation-defined
      timeout, it has not match the MAC in the yet received
         data a complete and syntactically
      well-formed request from the server MUST stop client.  This error is likely to be
      the processing result of a dropped packet, so the client SHOULD start over
      with a new DTLS handshake and retry its request.

      *  If the re-calculated MAC matches the MAC in the received data
         the server looks up whether it

5.4.1.4.  Warning

   The Warning record has already disclosed the key
         associated with the interval a Record Type number transmitted of 3.  Its body is
   exactly two octets long, consisting of an unsigned 16-bit integer in that
         message.
   network byte order, denoting a warning code.  The Critical Bit MUST
   be set.

   Clients MUST NOT include Warning records in their request.  If it has not disclosed it, it constructs
   clients receive a server response which includes an Warning record,
   they MAY discard any negotiated key material and sends abort without
   proceeding to the appropriate server_keycheck message Next Protocol.  Unrecognized warning codes MUST be
   treated as described in
         [I-D.ietf-ntp-network-time-security].

   o errors.

   This memo defines no warning codes.

5.4.1.5.  AEAD Algorithm Negotiation

   The AEAD Algorithm Negotiation record has a Record Type number of 4.
   Its body consists of a sequence of unsigned 16-bit integers in
   network byte order, denoting Numeric Identifiers from the IANA AEAD
   registry [RFC5116].  The server follows Critical Bit MAY be set.

   If the TESLA protocol in all other aspects, by
      regularly sending server_broad messages NTS Next Protocol Negotiation record offers "ntp/4",this
   record MUST be included exactly once.  Other protocols MAY require it
   as described well.

   When included in
      [I-D.ietf-ntp-network-time-security], adhering to its own
      disclosure schedule.

   The server a request, this record denotes which AEAD algorithms
   the client is responsible willing to watch for the expiration date of the
   one-way key chain and generate a new key chain accordingly.

   In addition use to secure the items above, Next Protocol, in
   decreasing preference order.  When included in a response, this
   record denotes which algorithm the server MAY be ready chooses to perform
   the following action:

   o  Upon receipt of external communication for use, or is empty
   if the purpose server supports none of
      broadcast parameter exchange, the server reacts according to algorithms offered.. In requests,
   the
      way list MUST include at least one algorithm.  In responses, it MUST
   include at most one.  Honoring the external communication client's preference order is specified.

6.  Implementation Notes: ASN.1 Structures and Use
   OPTIONAL: servers may select among any of the CMS

   This section presents client's offered
   choices, even if they are able to support some hints about other algorithm which
   the structures client prefers more.

   Server implementations of the
   communication packets NTS extensions for NTPv4 (Section 5.5) MUST
   support AEAD_AES_128_GCM (Numeric Identifier 1).  That is, if the different message types when one wishes
   to implement
   client includes AEAD_AES_128_GCM in its AEAD Algorithm Negotiation
   record, and the server accepts the "ntp/4" protocol in its NTS for NTP.  See document
   [I-D.ietf-ntp-cms-for-nts-message] for descriptions of Next
   Protocol Negotiation record, then the archetypes server's AEAD Algorithm
   Negotiation record MUST NOT be empty.

5.4.1.6.  New Cookie for CMS structures as well as NTPv4

   The New Cookie for the ASN.1 structures that are
   referenced here. NTPv4 record has a Record Type number of 5.  The NTP extension field structure is defined in RFC 5905 [RFC5905]
   and clarified in [I-D.ietf-ntp-extension-field].  It looks as
   follows:

    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
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |          Field Type           |            Length             |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   .                                                               .
   .                            Value                              .
   .                                                               .
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                       Padding (as needed)                     |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

   All extension fields mentioned in the rest of this section do not
   require an NTP MAC field.  If nothing else is explicitly stated, all
   contents of those extension fields its body SHALL be implementation-defined and clients MUST have
   NOT attempt to interpret them.  See [[TODO]] for a length RECOMMENDED
   construction.

   Clients MUST NOT send records of this type.  Servers MUST send at
   least 28 octets.

   Furthermore, all extension fields mentioned in the rest of this
   section are notified by one record of three Field Type identifiers,
   signaling content related to NTS:

   +------------+------------------------------------------------------+
   | Field Type | ASN.1 Object this type, and SHOULD send eight of NTS Message                          |
   +------------+------------------------------------------------------+
   | TBD1       | ClientAccessData, ServerAccessData                   |
   | TBD1       | ClientAssocData, ServerAssocData                     |
   | TBD1       | ClientCookieData, ServerCookieData                   |
   | TBD1       | BroadcastParameterRequest,                           |
   |            | BroadcastParameterResponse                           |
   | TBD2       | TimeRequestSecurityData, TimeResponseSecurityData    |
   | TBD2       | BroadcastTime                                        |
   | TBD2       | ClientKeyCheckSecurityData,                          |
   |            | ServerKeyCheckSecurityData                           |
   | TBD3       | NTSMessageAuthenticationCode                         |
   +------------+------------------------------------------------------+

   (see IANA considerations (Section 7)). them, if they
   accept "ntp/4" as a Next Protocol.  The outermost structure Critical Bit SHOULD NOT be
   set.

5.4.2.  Key Extraction (generally)

   Following a successful run of the extension field's Value field MUST NTS-KE protocol, key material SHALL
   be
   an ASN.1 object that is structured as follows:

   NTSExtensionFieldContent := SEQUENCE {
       oid      OBJECT IDENTIFIER,
       errnum   OCTET STRING (SIZE(2)),
       content  ANY DEFINED BY oid
   }

   The field errnum represents the error code of any message.  The
   client and server MAY ignore this field in any incoming message.  The
   server MUST set this extracted according to zero if the response RFC 5705 [RFC5705].  Inputs to the request was
   generated successfully.  If it could not successfully generate exporter
   function are to be constructed in a
   response, manner specific to the field errnum negotiated
   Next Protocol.  However, all protocols which utilize NTS-KE MUST be set
   conform to a non-zero value. the following two rules:

   o  The
   different values of this field is defined in disambiguating label string MUST be "EXPORTER-network-time-
      security/1".

   o  The per-association context value MUST be provided, and MUST begin
      with the Appendix C.

   Whenever NTS requires 16-octet Protocol Name which was negotiated as a MAC Next
      Protocol.

5.5.  NTS Extensions for protection NTPv4

5.5.1.  Key Extraction (for NTPv4)

   Following a successful run of the NTS-KE protocol wherein "ntp/4" is
   selected as a message, this MAC
   MUST Next Protocol, two AEAD keys SHALL be included in an additional extension field.  This MAC-carrying
   extension field MUST extracted: a
   client-to-server (C2S) key and a server-to-client (S2C) key.  These
   keys SHALL be placed after computed according to RFC 5705 [RFC5705], using the other NTS-related extension
   field, and it SHOULD
   following inputs.

      The disambiguating label string SHALL be "EXPORTER-network-time-
      security/1".

      The per-association context value SHALL consist of the last extension field following
      19 octets:

         The first 16 octets SHALL be (in hexadecimal):

         6E 74 70 2F 34 00 00 00 00 00 00 00 00 00 00 00
         The next two octets SHALL be the Numeric Identifier of the message.  Any
   MAC supplied by NTS
         negotiated AEAD Algorithm, in a MAC-carrying extension field MUST network byte order.

         The final octet SHALL be
   generated over 0x00 for the NTP header C2S key and all extension fields prior 0x01 for the
         S2C key.

   Implementations wishing to derive additional keys for private or
   experimental use MUST NOT do so by extending the
   MAC-carrying extension field.

   Content above-specified
   syntax for per-association context values.  Instead, they SHOULD use
   their own disambiguating label string.  Note that RFC 5705 provides
   that disambiguating label strings beginning with "EXPERIMENTAL" MAY
   be added to used without IANA registration.

5.5.2.  Packet structure overview

   In general, an NTS-protected NTPv4 packet consists of:

      The usual 48-octet NTP message after the MAC
   provided by NTS.  However, it header, which is RECOMMENDED to authenticated but not make use of this
   option and to apply the MAC protection of
      encrypted.

      Some extensions which are authenticated but not encrypted.

      An NTS to the whole of an NTP
   message.

   The MAC-carrying extension field which contains AEAD output (i.e., an NTSExtensionFieldContent
   object, whose content field is structured according to NTS-Plain.
      authentication tag and possible ciphertext).  The included NTS message object is as follows:

   NTSMessageAuthenticationCode := SEQUENCE {
       mac      OCTET STRING (SIZE(16))
   }

   It is identified corresponding
      plaintext, if non-empty, consists of some extensions which benefit
      from both encryption and authentication.

      Possibly, some additional extensions which are neither encrypted
      nor authenticated.  These are discarded by the following object identifier:

 id-ct-nts-ntsForNtpMessageAuthenticationCode OBJECT IDENTIFIER ::= TBD4 receiver.  [[Ed.
      Note:  In the following sections right now there's no good reason for the word MAC is always used as
      described above.  In particular it is not sender to be confused with
      NTP's MAC field.

6.1.  Unicast Messages

6.1.1.  Access Messages

6.1.1.1.  Message Type: "client_access"

   This message is realized include
      anything here, but eventually there might be.  We've seen Checksum
      Complement [RFC7821] and LAST-EF as an NTP packet with an extension field
   which holds an "NTS-Plain" archetype structure.  This structure
   consists only two examples of an NTS message object semantically-
      void extensions that are included to satsify constraints imposed
      lower on the protocol stack, and while there's no reason to use
      either of these on NTS-protected packets, I think we could see
      similar examples in the type
   "ClientAccessData".

6.1.1.2.  Message Type: "server_access"

   Like "client_access", this message is realized as an NTP packet future.  So, rejecting packets with
   an extension field which holds an "NTS-Plain" archetype structure,
   i.e. just an NTS message object
      unauthenticated extensions could cause interoperability problems,
      while accepting and processing those extensions would of course be
      a security risk.  Thus, I think "allow and discard" is the type "ServerAccessData".  The
   latter holds all correct
      policy.]]

   Always included among the data necessary for NTS.

6.1.2.  Association Messages

6.1.2.1.  Message Type: "client_assoc"

   This message is realized as an NTP packet with an authenticated or authenticated-and-
   encrypted extensions are a cookie extension field
   which holds an "NTS-Plain" archetype structure.  This structure
   consists only of an NTS message object and a unique-identifier
   extension.  The purpose of the type "ClientAssocData",
   which holds all the data necessary for the NTS security mechanisms.

6.1.2.2.  Message Type: "server_assoc"

   Like "client_assoc", this message is realized as an NTP packet with
   an cookie extension field which holds an "NTS-Plain" archetype structure,
   i.e. just an NTS message object is to enable the
   server to offload storage of session state onto the type "ServerAssocData". client.  The
   latter holds all
   purpose of the data necessary for NTS.

6.1.3.  Cookie Messages

6.1.3.1.  Message Type: "client_cook"

   This message type unique-identifier extension is realized as an NTP packet with an to protect the client
   from replay attacks.

5.5.3.  The Unique Identifier extension
   field which holds

   The Unique Identifier extension has a CMS structure Field Type of archetype "NTS-Plain",
   containing [[TBD]].  When
   the extension is included in a client packet (mode 3), its core an NTS message object body SHALL
   consist of the type
   "ClientCookieData". a string of octets generated uniformly at random.  The latter holds all the data necessary for
   string SHOULD be 32 octets long.  When the
   NTS security mechanisms.

6.1.3.2.  Message Type: "server_cook"

   This message type extension is realized included in a
   server packet (mode 4), its body SHALL contain the same octet string
   as an NTP was provided in the client packet with an to which the server is
   responding.  Its use in modes other than client/server is not
   defined.

   The Unique Identifier extension
   field containing provides the client with a CMS structure
   cryptographically strong means of archetype "NTS-Encrypted-and-
   Signed".  The NTS message object detecting replayed packets.  It may
   also be used standalone, without NTS, in that structure is a
   "ServerCookieData" object, which holds all data required by NTS for
   this message type.

6.1.4.  Time Synchronization Messages

6.1.4.1.  Message Type: "time_request"

   This message type is realized as an NTP packet with regular NTP time
   synchronization data.  Furthermore, case it provides the packet has an extension field
   which contains an ASN.1 object of type "TimeRequestSecurityData"
   (packed in
   client with a CMS structure means of archetype "NTS-Plain").  Finally, detecting spoofed packets from off-path
   attackers.  Historically, NTP's origin timestamp field has played
   both these roles, but for cryptographic purposes this
   message MUST be protected by a MAC.

6.1.4.2.  Message Type: "time_response"

   This message is also realized as an NTP packet with regular NTP time
   synchronization data.  The packet also has an extension field which
   contains an ASN.1 object suboptimal
   because it is only 64 bits long and, depending on implementation
   details, most of type "TimeResponseSecurityData".
   Finally, this message MUST those bits may be protected by a MAC.

   Note: predictable.  In these two messages, where two extension fields are present, contrast, the respective first
   Unique Identifier extension field (the one not containing enables a degree of unpredictability and
   collision-resistance more consistent with cryptographic best
   practice.

   [[TODO: consider using separate extension types for request and
   response, thus allowing for use in symmetric mode.  But proper
   handling in the
      MAC) only presence of dropped packets needs to have be documented
   and involves a length lot of at least 16 octets. subtlety.]]

5.5.4.  The NTS Cookie extension fields holding the MACs need to have the usual length of
      at least 28 octets.

6.2.  Broadcast Messages

6.2.1.  Broadcast Parameter Messages

6.2.1.1.  Message Type: "client_bpar"

   This first broadcast message is realized as an NTP packet which is
   empty except for an

   The NTS Cookie extension field which contains an ASN.1 object of
   type "BroadcastParameterRequest" (packed in has a CMS structure Field Type of
   archetype "NTS-Plain").  This [[TBD]].  Its purpose is sufficient
   to transport all data
   specified by NTS.

6.2.1.2.  Message Type: "server_bpar"

   This message type is realized as an NTP packet whose extension field
   carries carry information which enables the necessary CMS structure (archetype: "NTS-Signed"). server to recompute keys and
   other session state without having to store any per-client state.
   The
   NTS message object in this case is an ASN.1 object contents of type
   "BroadcastParameterResponse".

6.2.2.  Broadcast Time Synchronization Message

6.2.2.1.  Message Type: "server_broad"

   This message's realization works via an NTP packet which carries
   regular its body SHALL be implementation-defined and clients
   MUST NOT attempt to interpret them.  See [[TODO]] for a RECOMMENDED
   construction.  The NTS Cookie extension MUST NOT be included in NTP broadcast time data as well as an
   packets whose mode is other than 3 (client) or 4 (server).

5.5.5.  The NTS Cookie Placeholder extension field, which
   contains an ASN.1 object

   The NTS Cookie Placeholder extension has a Field Type of type "BroadcastTime" (packed [[TBD]].
   When this extension is included in a CMS
   structure with archetype "NTS-Plain").  Finally, this message client packet (mode 3), it
   communicates to the server that the client wishes it to send
   additional cookies in its response.  This extension MUST NOT be
   protected
   included in NTP packets whose mode is other than 3.

   Whenever an NTS Cookie Placeholder extension is present, it MUST be
   accompanied by a MAC.

   Note:  In this message, an NTS Cookie extension, and the first body length of the
   NTS Cookie Placeholder extension field (the one MUST be the same as the body length
   of the NTS Cookie Extension.  (This length requirement serves to
   ensure that the response will not
      containing be larger than the MAC) only needs request, in
   order to have a length improve timekeeping precision and prevent DDoS
   amplification).  The contents of at least 16
      octets. the NTS Cookie Placeholder
   extension's body are undefined and, aside from checking its length,
   MUST be ignored by the server.

5.5.6.  The NTS Authenticator and Encrypted Extensions extension field holding

   The NTS Authenticator and Encrypted Extensions extension is the MACs needs to have
   central cryptographic element of an NTS-protected NTP packet.  Its
   Field Type is [[TBD]] and the format of its body SHALL be as follows:

      Nonce length: two octets in network byte order, giving the
      usual length
      of at least 28 octets.

6.2.3.  Broadcast Keycheck

6.2.3.1.  Message Type: "client_keycheck"

   This message is realized the Nonce field.

      Nonce: a nonce as required by the negotiated AEAD Algorithm.

      Ciphertext: the output of the negotiated AEAD Algorithm.  The
      structure of this field is determined by the negotiated algorithm,
      but it typically contains an NTP packet authentication tag in addition to the
      actual ciphertext.

      Padding: between 1 and 24 octets of padding, with an extension field,
   which transports a CMS structure every octet set
      to the number of padding octets included, e.g., "01", "02 02", or
      "03 03 03".  The number of padding bytes should be chosen in order
      to comply with the RFC 7822 [RFC7822] requirement that (in the
      absence of a legacy MAC) extensions have a total length in octets
      (including the four octets for the type and length fields) which
      is at least 28 and divisible by 4.  At least one octet of padding
      MUST be included, so that implementations can unambiguously
      delimit the end of the ciphertext from the start of the padding.

   The Ciphertext field SHALL be formed by providing the following
   inputs to the negotiated AEAD Algorithm:

      K: For packets sent from the client to the server, the C2S key
      SHALL be used.  For packets sent from the server to the client,
      the S2C key SHALL be used.

      A: The associated data SHALL consist of the portion of the NTP
      packet beginning from the start of the NTP header and ending at
      the end of the last extension which precedes the NTS Authenticator
      and Encrypted Extensions extension.

      P: The plaintext SHALL consist of all (if any) extensions to be
      encrypted.

      N: The nonce SHALL be formed however required by the negotiated
      AEAD Algorithm.

   The NTS Authenticator and Encrypted Extensions extension MUST NOT be
   included in NTP packets whose mode is other than 3 (client) or 4
   (server).

5.5.7.  Protocol details

   A client sending an NTS-protected request SHALL include the following
   extensions:

      Exactly one Unique Identifier extension, which MUST be
      authenticated and MUST NOT be encrypted [[Ed.  Note: so that if
      the server can't decrypt the request, it can still echo back the
      Unique Identifier in the NTS NAK it sends]].  MUST NOT duplicate
      those of any previous request.

      Exactly one NTS Cookie extension, which MUST be authenticated and
      MUST NOT be encrypted.  The cookie MUST be one which the server
      previously provided the client; it may have been provided during
      the NTS-KE handshake or in response to a previous NTS-protected
      NTP request.  To protect client's privacy, the same cookie SHOULD
      NOT be included in multiple requests.  If the client does not have
      any cookies that it has not already sent, it SHOULD re-run the
      NTS-KE protocol before continuing.

      Exactly one NTS Authenticator and Encrypted Extensions extension,
      generated using an AEAD Algorithm and C2S key established through
      NTS-KE.

   The client MAY include one or more NTS Cookie Placeholder extensions,
   which MUST be authenticated and MAY be encrypted.  The number of NTS
   Cookie Placeholder extensions that the client includes SHOULD be such
   that if the client includes N placeholders and the server sends back
   N+1 cookies, the number of unused cookies stored by the client will
   come to eight.  When both the client and server adhere to all cookie-
   management guidance provided in this memo, the number of placeholder
   extensions will equal the number of dropped packets since the last
   successful volley.

   The client MAY include additional (non-NTS-related) extensions, which
   MAY appear prior to the NTS Authenticator and Encrypted Extensions
   extension (therefore authenticated but not encrypted), within it
   (therefore encrypted and authenticated), or after it (therefore
   neither encrypted nor authenticated).  In general, however, the
   server MUST discard any unauthenticated extensions and process the
   packet as though they were not present.  Servers MAY implement
   exceptions to this requirement for particular extensions if their
   specification explicitly provides for such.

   Upon receiving an NTS-protected request, the server SHALL (through
   some implementation-defined mechanism) use the cookie to recover the
   AEAD Algorithm, C2S key, and S2C key associated with the request, and
   then use the C2S key to authenticate the packet and decrypt the
   ciphertext.  If the cookie is valid and authentication and decryption
   succeed, then the server SHALL include the following extensions in
   its response:

      Exactly one Unique Identifier extension, which MUST be
      authenticated, MUST NOT be encrypted, and whose contents SHALL
      echo those provided by the client.

      Exactly one NTS Authenticator and Encrypted Extensions extension,
      generated using the AEAD algorithm and S2C key recovered from the
      cookie provided by the client.

      One or more NTS Cookie extensions, which MUST be authenticated and
      encrypted.  The number of NTS Cookie extensions included SHOULD be
      equal to, and MUST NOT exceed, one plus the number of valid NTS
      Cookie Placeholder extensions included in the request.

   The server MAY include additional (non-NTS-related) extensions, which
   MAY appear prior to the NTS Authenticator and Encrypted Extensions
   extension (therefore authenticated but not encrypted), within it
   (therefore encrypted and authenticated), or after it (therefore
   neither encrypted nor authenticated).  In general, however, the
   client MUST discard any unauthenticated extensions and process the
   packet as though they were not present.  Clients MAY implement
   exceptions to this requirement for particular extensions if their
   specification explicitly provides for such.

   If the server is unable to validate the cookie or authenticate the
   request, it SHOULD respond with a Kiss-o'-Death packet (see RFC 5905,
   Section 7.4) [RFC5905]) with kiss code "NTSN" (meaning "NTS NAK").
   Such a response MUST include exactly one Unique Identifier extension
   whose contents SHALL echo those provided by the client.  It MUST NOT
   include any NTS Cookie or NTS Authenticator and Encrypted Extensions
   extension.  [[Ed.  Note: RFC 5905 already provides the kiss code
   "CRYP" meaning "Cryptographic authentication or identification
   failed" but I think this is meant to be Autokey-specific.]]

   Upon receiving an NTS-protected response, the client MUST verify that
   the Unique Identifier matches that of an outstanding request, and
   that the packet is authentic under the S2C key associated with that
   request.  If either of these checks fails, the packet MUST be
   discarded without further processing.

   Upon receiving an NTS NAK, the client MUST verify that the Unique
   Identifier matches that of an outstanding request.  If this check
   fails, the packet MUST be discarded without further processing.  If
   this check passes, the client SHOULD discard all cookies and AEAD
   keys associated with the server which sent the NAK and initiate a
   fresh NTS-KE handshake.

5.6.  Recommended format for NTS cookies

   This section provides a RECOMMENDED way for servers to construct NTS
   cookies.  Clients MUST NOT examine the cookie under the assumption
   that it is constructed according to this section.

   The role of cookies in NTS is closely analagous to that of session
   cookies in TLS.  Accordingly, the thematic resemblance of this
   section to RFC 5077 [RFC5077] is deliberate, and the reader should
   likewise take heed of its security considerations.

   Servers should select an AEAD algorithm which they will use to
   encrypt and authenticate cookies.  The chosen algorithm should be one
   such as AEAD_AES_SIV_CMAC_256 [RFC5297] which resists accidential
   nonce reuse, and it need not be the same as the one that was
   negotiated with the client.  Servers should randomly generate and
   store a master AEAD key `K`. Servers should additionally choose a
   non-secret, unique value `I` as key-identifier for `K`.

   Servers should periodically (e.g., once daily) generate a new pair
   (I,K) and immediately switch to using these values for all newly-
   generated cookies.  Immediately following each such key rotation,
   servers should securely erase any keys generated two or more rotation
   periods prior.  Servers should continue to accept any cookie
   generated using keys that they have not yet erased, even if those
   keys are no longer current.  Erasing old keys provides for forward
   secrecy, limiting the scope of what old information can be stolen if
   a master key is somehow compromised.  Holding on to a limited number
   of old keys allows clients to seamlessly transition from one
   generation to the next without having to perform a new NTS-KE
   handshake.

   [[TODO: discuss key management considerations for load-balanced
   servers]]

   To form a cookie, servers should first form a plaintext `P`
   consisting of the following fields:

      The AEAD algorithm negotiated during NTS-KE

      The S2C key

      The C2S key

   Servers should the generate a nonce `N` uniformly at random, and form
   AEAD output `C` by encrypting `P` under key `K` with nonce `N` and no
   associated data.

   The cookie should consist of the tuple `(I,N,C)`.

   [[TODO: explicitly specify how to verify and decrypt a cookie, not
   just how to form one]]

6.  IANA Considerations

6.1.  Field Type Registry

   Within the "NTP Extensions Field Types" registry table, add the field
   types:

   Field Type  Meaning                              References
   ----------  ------------------------------------ ----------
   TBD1        NTS-Related Content                  [this doc]
   TBD2        NTS-Related Content                  [this doc]
   TBD3        NTS-Related Content                  [this doc]

6.2.  SMI Security for S/MIME CMS Content Type Registry

   Within the "SMI Security for S/MIME CMS Content Type
   (1.2.840.113549.1.9.16.1)" table, add one content type identifier:

   Decimal  Description                                   References
   -------  --------------------------------------------  ----------
   TBD4     id-ct-nts-ntsForNtpMessageAuthenticationCode  [this doc]

6.3.  DTLS-Based Key Exchange

   IANA is requested to allocate an entry in the Service Name and
   Transport Protocol Port Number Registry as follows:

      Service Name: nts

      Transport Protocol: udp

      Assignee: IESG <iesg@ietf.org>
      Contact: IETF Chair <chair@ietf.org>

      Description: Network Time Security

      Reference: [[this memo]]

      Port Number: selected by IANA from the user port range

   IANA is requested to allocate the following two entries in the
   Application-Layer Protocol Negotiation (ALPN) Protocol IDs registry:

      Protocol: Network Time Security Key Establishment, version 1

      Identification Sequence:
      0x6E 0x74 0x73 0x6B 0x65 0x2F 0x31 ("ntske/1")

      Reference: [[this memo]]

      Protocol: Network Time Protocol, version 4

      Identification Sequence:
      0x6E 0x74 0x70 0x2F 0x34 ("ntp/4")

      Reference: [[this memo]]

   IANA is requested to allocate the following entry in the TLS Exporter
   Label Registry:

   +----------------------------------+---------+---------------+------+
   | Value                            | DTLS-OK | Reference     | Note |
   +----------------------------------+---------+---------------+------+
   | EXPORTER-network-time-security/1 | Y       | [[this memo]] |      |
   +----------------------------------+---------+---------------+------+

   IANA is requested to allocate the following entries in the registry
   of NTP Kiss-o'-Death codes:

                  +------+------------------------------+
                  | Code | Meaning                      |
                  +------+------------------------------+
                  | DTLS | Packet conveys a DTLS record |
                  | NTSN | NTS NAK                      |
                  +------+------------------------------+

   IANA is requested to allocate the following entries in the NTP
   Extensions Field Types registry:

   +------------+---------------------------------------+--------------+
   | Field Type | Meaning                               | Reference    |
   +------------+---------------------------------------+--------------+
   | [[TBD]]    | DTLS Record                           | [[this       |
   |            |                                       | memo]]       |
   | [[TBD]]    | Unique Identifier                     | [[this       |
   |            |                                       | memo]]       |
   | [[TBD]]    | NTS Cookie                            | [[this       |
   |            |                                       | memo]]       |
   | [[TBD]]    | NTS Authenticator and Encrypted       | [[this       |
   |            | Extensions                            | memo]]       |
   +------------+---------------------------------------+--------------+

   IANA is requested to create a new registry entitled "Network Time
   Security Key Establishment Record Types".  Entries SHALL have the
   following fields:

      Type Number (REQUIRED): An integer in the range 0-32767 inclusive

      Description (REQUIRED): short text description of the purpose of
      the field

      Set Critical Bit (REQUIRED): One of "MUST", "SHOULD", "MAY",
      "SHOULD NOT", or "MUST NOT"

      Reference (REQUIRED): A reference to a document specifying the
      semantics of the record.

   The policy for allocation of new entries in this registry SHALL vary
   by the Type Number, as follows:

      0-1023: Standards Action

      1024-16383: Specification Required

      16384-32767: Private and Experimental Use

   Applications for new entries SHALL specify the contents of the
   Description, Set Critical Bit and Reference fields and which of the
   above ranges the Type Number should be allocated from.  Applicants
   MAY request a specific Type Number, and such requests MAY be granted
   at the registrar's discretion.

   The initial contents of this registry SHALL be as follows:

   +-------------+-----------------------------+----------+------------+
   | Field       | Description                 | Critical | Reference  |
   | Number      |                             |          |            |
   +-------------+-----------------------------+----------+------------+
   | 0           | End of message              | MUST     | [[this     |
   |             |                             |          | memo]]     |
   | 1           | NTS next protocol           | MUST     | [[this     |
   |             | negotiation                 |          | memo]]     |
   | 2           | Error                       | MUST     | [[this     |
   |             |                             |          | memo]]     |
   | 3           | Warning                     | MUST     | [[this     |
   |             |                             |          | memo]]     |
   | 4           | AEAD algorithm negotation   | MAY      | [[this     |
   |             |                             |          | memo]]     |
   | 5           | New cookie for NTPv4        | SHOULD   | [[this     |
   |             |                             | NOT      | memo]]     |
   | 16384-32767 | Reserved for Private &      | MAY      | [[this     |
   |             | Experimental Use            |          | memo]]     |
   +-------------+-----------------------------+----------+------------+

   IANA is requested to create a new registry entitled "Network Time
   Security Next Protocols".  Entries SHALL have the following fields:

      Protocol Name (REQUIRED): a sequence of 16 octets.  Shorter
      sequences SHALL implicitly be right-padded with null octets
      (0x00).

      Human-Readable Name (OPTIONAL): if the sequence of archetype "NTS-Plain", containing
   an ASN.1 object octets making
      up the protocol name intentionally represent a valid UTF-8
      [RFC3629] string, this field SHALL consist of type "ClientKeyCheckSecurityData".  Finally, that string.

      Reference (RECOMMENDED): a reference to a relevant specification
      document.  If no relevant document exists, a point-of-contact for
      questions regarding the entry SHOULD be listed here in lieu.

   Applications for new entries in this
   message MUST registry SHALL specify all
   desired fields, and SHALL be protected by granted on a MAC.

6.2.3.2.  Message Type: "server_keycheck"

   This message is also realized as an NTP packet First Come, First Serve
   basis.  Protocol Names beginning with an extension
   field, which contains an ASN.1 object of type
   "ServerKeyCheckSecurityData" (packed in 0x78 0x2D ("x-") SHALL be
   reserved for Private or Experimental Use, and SHALL NOT be
   registered.  The reserved entry "ptp/2" may be updated or released by
   a CMS structure future Standards Action.

   The initial contents of archetype
   "NTS-Plain").  Finally, this message MUST registry SHALL be protected as follows:

   +---------------------------+-----------------+---------------------+
   | Protocol Name             | Human-Readable  | Reference           |
   |                           | Name            |                     |
   +---------------------------+-----------------+---------------------+
   | 0x6E 0x74 0x70 0x2F 0x34  | ntp/4           | [[this memo]]       |
   | 0x70 0x74 0x70 0x2F 0x32  | ptp/2           | Reserved by a MAC.

   Note:  In this message, the first extension field (the one not
      containing the MAC) only needs [[this  |
   |                           |                 | memo]]              |
   +---------------------------+-----------------+---------------------+

   IANA is requested to create two new registries entitled "Network Time
   Security Error Codes" and "Network Time Security Warning Codes".
   Entries in each SHALL have the following fields:

      Number (REQUIRED): a 16-bit unsigned integer

      Description (REQUIRED): a length short text description of at least 16
      octets.  The extension field holding the MACs needs condition.

      Reference (REQUIRED): a reference to have the
      usual length a relevant specification
      document.

   The policy for allocation of new entries in these registries SHALL
   vary by their Number, as follows:

      0-1023: Standards Action

      1024-32767: Specification Required

      32768-65535: Private and Experimental Use

   The initial contents of at least 28 octets.

7.  IANA Considerations

7.1.  Field Type Registry

   Within the "NTP Extensions Field Types" registry table, add the field
   types:

   Field Type  Meaning                              References
   ----------  ------------------------------------ ----------
   TBD1        NTS-Related Content                  [this doc]
   TBD2        NTS-Related Content                  [this doc]
   TBD3        NTS-Related Content                  [this doc]

7.2.  SMI Network Time Security for S/MIME CMS Content Type Error Codes
   Registry

   Within the "SMI Security for S/MIME CMS Content Type
   (1.2.840.113549.1.9.16.1)" table, add one content type identifier:

   Decimal  Description                                   References
   -------  --------------------------------------------  ----------
   TBD4     id-ct-nts-ntsForNtpMessageAuthenticationCode  [this doc]

8. SHALL be as follows:

       +--------+---------------------------------+---------------+
       | Number | Description                     | Reference     |
       +--------+---------------------------------+---------------+
       | 0      | Unrecognized Critical Extension | [[this memo]] |
       | 1      | Bad Request                     | [[this memo]] |
       +--------+---------------------------------+---------------+

   The Network Time Security Warning Codes Registry SHALL initially be
   empty.

7.  Security Considerations

   All security considerations described in
   [I-D.ietf-ntp-network-time-security] have to be taken into account.
   The application of NTS to NTP requires the following additional
   considerations.

8.1.  Employing Alternative Means for Access, Association and Cookie
      Exchange

   If an implementation uses alternative means

7.1.  Usage of NTP Pools

   The certification-based authentication scheme described in
   [I-D.ietf-ntp-network-time-security] is not applicable to perform access, the concept
   of NTP pools.  Therefore, NTS is unable to provide secure usage of
   NTP pools.

7.2.  Initial Verification of the Server Certificates

   The client may wish to verify the validity of certificates during the
   initial association and cookie exchange, phase.  Since it generally has no reliable time
   during this initial communication phase, it is impossible to verify
   the period of validity of the certificates.

7.3.  Treatment of Initial Messages

   NTP packets which contains extension fields with key exchange
   messages do not provide integrity and authenticity protection of the
   included time stamps.  Therefore these NTP packets MUST make sure that NOT be used
   for clock synchronization.  Otherwise an initial attack on the
   client's clock [attacking-ntp] can potentially circumvent the
   employed security measures of later messages [delorean].

7.4.  DTLS-Related Issues

   ... TBD

7.5.  Delay Attack

   In a packet delay attack, an adversary
   cannot abuse with the server ability to obtain act as a cookie belonging
   MITM delays time synchronization packets between client and server
   asymmetrically [RFC7384].  This prevents the client from accurately
   measuring the network delay, and hence its time offset to the server
   [Mizrahi].  The delay attack does not modify the content of the
   exchanged synchronization packets.  Therefore, cryptographic means do
   not provide a chosen KIV.

8.2. feasible way to mitigate this attack.  However, the
   maximum error that an adversary can introduced is bounded by half of
   the round trip delay.  Also, several non-cryptographic precautions
   can be taken in order to detect this attack.

   1.  Usage of multiple time servers: this enables the client to detect
       the attack, provided that the adversary is unable to delay the
       synchronization packets between the majority of servers.  This
       approach is commonly used in NTP Pools to exclude incorrect time
       servers [RFC5905].

   2.  Multiple communication paths: The certification-based authentication scheme client and server utilize
       different paths for packet exchange as described in
   [I-D.ietf-ntp-network-time-security] is not applicable to the concept
   of NTP pools.  Therefore, NTS I-D

       [I-D.ietf-tictoc-multi-path-synchronization].  The client can
       detect the attack, provided that the adversary is unable to provide secure usage
       manipulate the majority of the available paths [Shpiner].  Note
       that this approach is not yet available, neither for NTP pools.

8.3.  Server Seed Lifetime

   According to Clause 5.6.1 in RFC 7384 [RFC7384] nor for
       PTP.

   3.  Usage of an encrypted connection: the server MUST
   provide a means to refresh client exchanges all
       packets with the value of its server seed from time to
   time.  A generally valid value for the server seed lifetime cannot be
   given.  The value depends on over an encrypted connection (e.g.
       IPsec).  This measure does not mitigate the required security level, delay attack, but it
       makes it more difficult for the current
   threat situation, and adversary to identify the chosen MAC mechanisms.

   As guidance, time
       synchronization packets.

   4.  Introduction of a threshold value for the lifetime delay time of the
       synchronization packets.  The client can be determined by
   stipulating discard a maximum number of time requests for which the exchanged
   cookie remains unchanged.  For example, server if
       the packet delay time of this value time server is 1000 and larger than the
   client sends a
       threshold value.

8.  Privacy Considerations

8.1.  Confidentiality

   The actual time request every 64 seconds, the server seed
   lifetime should synchronization data in NTP packets does not involve
   any information that needs to be no longer than 64000 seconds.  Corresponding
   considerations can kept secret.  There also does not
   seem to be made for a minimum number any necessity to disguise the nature of requests.

8.4.  Supported MAC Algorithms an NTP
   association.  This is why content confidentiality is a non-objective
   for this document.

8.2.  Unlinkability

   The list of the MAC algorithms supported by the server has scenario that is to fulfill
   the following requirements:

   o  it MUST NOT include HMAC be prevented is one where whenever a new
   network address is associated with SHA-1 or weaker algorithms,

   o  it MUST include HMAC a device (e.g. because said device
   moved between different networks), a passive attacker is able to link
   said new address with SHA-256 or stronger algorithms.

8.5.  Protection for Initial Messages

   Any NTS message providing access, association, or one that was formerly used by the device,
   because of recognizable data that the device persistently sends as
   part of an NTS-secured NTP association.  This is the justification
   for continually supplying the client with fresh cookies, so that a
   cookie exchange can
   be encapsulated never represents recognizable data in NTP an extension field which the sense outlined
   above.

   Note that the objective of NTS regarding unlinkability is piggybacked onto
   an NTP packet. merely to
   not leak any additional data that would cause linkability.  NTS does
   not itself provide MAC protection to rectify legacy linkability issues that are already present in
   NTP.  To minimize the NTP
   header risk of such being tracked by a packet, because it only offers MAC protection passive adversary
   the NTP client has to minimize the information it transmits within a
   client request (mode 3 packet) as described in the draft "I-D.draft-
   dfranke-ntp-data-minimization".

   Also note that normal NTP header once clients should not act as NTP servers.
   Otherwise, an active adversary may be able to abuse the cookie has been successfully exchanged. client's
   server responses (mode 4 packets) for its tracking.  This is done by
   [tbd].

9.  Acknowledgements

   The authors would like to thank Russ Housley, Richard Barnes, Steven Bellovin, David
   Mills and
   Sharon Goldberg, Russ Housley, Martin Langer, Miroslav Lichvar,
   Aanchal Malhotra, Dave Mills, Danny Mayer, Karen O'Donoghue, Eric K.
   Rescorla, Stephen Roettger, Kurt Roeckx for discussions and comments on the design of
   NTS.  Also, thanks to Roeckx, Kyle Rose, Rich Salz, Brian
   Sniffen, Susan Sons, Douglas Stebila, Harlan Stenn, Danny Mayer, Martin Thomson,
   and Richard Welty and
   Martin Langer for their technical review and specific text contributions to this document. on the design
   of NTS.

10.  References

10.1.  Normative References

   [I-D.ietf-ntp-cms-for-nts-message]
              Sibold, D., Teichel, K., Roettger, S., and R. Housley,
              "Protecting Network Time Security Messages with the
              Cryptographic Message Syntax (CMS)", draft-ietf-ntp-cms-
              for-nts-message-06 (work in progress), February 2016.

   [I-D.ietf-ntp-extension-field]
              Mizrahi, T. and D. Mayer, "The Network Time Protocol
              Version 4 (NTPv4) Extension Fields", draft-ietf-ntp-
              extension-field-07 (work in progress), February 2016.

   [I-D.ietf-ntp-network-time-security]
              Sibold, D., Roettger, S., and K. Teichel, "Network Time
              Security", draft-ietf-ntp-network-time-security-13 (work
              in progress), February 2016.

   [I-D.ietf-tictoc-multi-path-synchronization]
              Shpiner, A., Tse, R., Schelp, C., and T. Mizrahi, "Multi-
              Path Time Synchronization", draft-ietf-tictoc-multi-path-
              synchronization-06 (work in progress), October 2016.

   [RFC2119]  Bradner, S., "Key words for use in RFCs to Indicate
              Requirement Levels", BCP 14, RFC 2119,
              DOI 10.17487/RFC2119, March 1997,
              <http://www.rfc-editor.org/info/rfc2119>.

   [RFC3394]  Schaad, J. and R. Housley, "Advanced Encryption Standard
              (AES) Key Wrap Algorithm", RFC 3394, DOI 10.17487/RFC3394,
              September 2002, <http://www.rfc-editor.org/info/rfc3394>.

   [RFC3629]  Yergeau, F., "UTF-8, a transformation format of ISO
              10646", STD 63, RFC 3629, DOI 10.17487/RFC3629, November
              2003, <http://www.rfc-editor.org/info/rfc3629>.

   [RFC4082]  Perrig, A., Song, D., Canetti, R., Tygar, J., and B.
              Briscoe, "Timed Efficient Stream Loss-Tolerant
              Authentication (TESLA): Multicast Source Authentication
              Transform Introduction", RFC 4082, DOI 10.17487/RFC4082,
              June 2005, <http://www.rfc-editor.org/info/rfc4082>.

   [RFC4634]  Eastlake 3rd, D. and T. Hansen, "US Secure Hash Algorithms
              (SHA and HMAC-SHA)", RFC 4634, DOI 10.17487/RFC4634, July
              2006, <http://www.rfc-editor.org/info/rfc4634>.

   [RFC5116]  McGrew, D., "An Interface and Algorithms for Authenticated
              Encryption", RFC 5116, DOI 10.17487/RFC5116, January 2008,
              <http://www.rfc-editor.org/info/rfc5116>.

   [RFC5297]  Harkins, D., "Synthetic Initialization Vector (SIV)
              Authenticated Encryption Using the Advanced Encryption
              Standard (AES)", RFC 5297, DOI 10.17487/RFC5297, October
              2008, <http://www.rfc-editor.org/info/rfc5297>.

   [RFC5652]  Housley, R., "Cryptographic Message Syntax (CMS)", STD 70,
              RFC 5652, 5652, DOI 10.17487/RFC5652, September 2009,
              <http://www.rfc-editor.org/info/rfc5652>.

   [RFC5705]  Rescorla, E., "Keying Material Exporters for Transport
              Layer Security (TLS)", RFC 5705, DOI 10.17487/RFC5705,
              March 2010, <http://www.rfc-editor.org/info/rfc5705>.

   [RFC5746]  Rescorla, E., Ray, M., Dispensa, S., and N. Oskov,
              "Transport Layer Security (TLS) Renegotiation Indication
              Extension", RFC 5746, DOI 10.17487/RFC5746, February 2010,
              <http://www.rfc-editor.org/info/rfc5746>.

   [RFC5905]  Mills, D., Martin, J., Ed., Burbank, J., and W. Kasch,
              "Network Time Protocol Version 4: Protocol and Algorithms
              Specification", RFC 5905, DOI 10.17487/RFC5905, June 2010,
              <http://www.rfc-editor.org/info/rfc5905>.

   [RFC6347]  Rescorla, E. and N. Modadugu, "Datagram Transport Layer
              Security Version 1.2", RFC 6347, DOI 10.17487/RFC6347,
              January 2012, <http://www.rfc-editor.org/info/rfc6347>.

   [RFC7301]  Friedl, S., Popov, A., Langley, A., and E. Stephan,
              "Transport Layer Security (TLS) Application-Layer Protocol
              Negotiation Extension", RFC 7301, DOI 10.17487/RFC7301,
              July 2014, <http://www.rfc-editor.org/info/rfc7301>.

   [RFC7465]  Popov, A., "Prohibiting RC4 Cipher Suites", RFC 7465,
              DOI 10.17487/RFC7465, February 2015,
              <http://www.rfc-editor.org/info/rfc7465>.

   [RFC7507]  Moeller, B. and A. Langley, "TLS Fallback Signaling Cipher
              Suite Value (SCSV) for Preventing Protocol Downgrade
              Attacks", RFC 7507, DOI 10.17487/RFC7507, April 2015,
              <http://www.rfc-editor.org/info/rfc7507>.

   [RFC7627]  Bhargavan, K., Ed., Delignat-Lavaud, A., Pironti, A.,
              Langley, A., and M. Ray, "Transport Layer Security (TLS)
              Session Hash and Extended Master Secret Extension",
              RFC 7627, DOI 10.17487/RFC5652, 10.17487/RFC7627, September 2009,
              <http://www.rfc-editor.org/info/rfc5652>.

   [RFC5905]  Mills, D., Martin, J., Ed., Burbank, J., 2015,
              <http://www.rfc-editor.org/info/rfc7627>.

   [RFC7822]  Mizrahi, T. and W. Kasch, D. Mayer, "Network Time Protocol Version 4: Protocol and Algorithms
              Specification", 4
              (NTPv4) Extension Fields", RFC 5905, 7822, DOI 10.17487/RFC5905, June 2010,
              <http://www.rfc-editor.org/info/rfc5905>. 10.17487/RFC7822,
              March 2016, <http://www.rfc-editor.org/info/rfc7822>.

10.2.  Informative References

   [attacking-ntp]
              "Attacking the Network Time Protocol", October 2015.

   [delorean]
              "Bypassing HTTP Strict Transport Security", 2014.

   [IEC.61588_2009]
              IEEE/IEC, "Precision clock synchronization protocol for
              networked measurement and control systems",
              IEEE 1588-2008(E), IEC 61588:2009(E),
              DOI 10.1109/IEEESTD.2009.4839002, February 2009,
              <http://ieeexplore.ieee.org/servlet/
              opac?punumber=4839000>.

   [Mizrahi]  Mizrahi, T., "A game theoretic analysis of delay attacks
              against time synchronization protocols", in Proceedings
              of Precision Clock Synchronization for Measurement Control
              and Communication, ISPCS 2012, pp. 1-6, September 2012.

   [RFC5077]  Salowey, J., Zhou, H., Eronen, P., and H. Tschofenig,
              "Transport Layer Security (TLS) Session Resumption without
              Server-Side State", RFC 5077, DOI 10.17487/RFC5077,
              January 2008, <http://www.rfc-editor.org/info/rfc5077>.

   [RFC7384]  Mizrahi, T., "Security Requirements of Time Protocols in
              Packet Switched Networks", RFC 7384, DOI 10.17487/RFC7384,
              October 2014, <http://www.rfc-editor.org/info/rfc7384>.

   [RFC7821]  Mizrahi, T., "UDP Checksum Complement in the Network Time
              Protocol (NTP)", RFC 7821, DOI 10.17487/RFC7821, March
              2016, <http://www.rfc-editor.org/info/rfc7821>.

   [Shpiner]  "Multi-path Time Protocols", in Proceedings of IEEE
              International Symposium on Precision Clock Synchronization
              for Measurement, Control and Communication (ISPCS),
              September 2013.

Appendix A.  Flow Diagrams of Client Behaviour
                           +---------------+
                           |Access Messages|
                           +-------+-------+
                                   |
                                   v
                        +---------------------+
                        |Association Messages |
                        +----------+----------+
                                   |
   +------------------------------>o
   |                               |
   |                               v
   |                       +---------------+                        +-------------+
   |                       |Cookie Messages|                        |Key Exchange |                       +-------+-------+
   |                        +------+------+
   |                               |
   |                               o<------------------------------+
   |                               |                               |
   |                               v                               |
   |                     +-------------------+                     |
   |                     |Time Sync. Messages|                     |
   |                     +---------+---------+                     |
   |                               |                               |
   |                               v                               |
   |                            +-----+                            |
   |                            |Check|                            |
   |                            +--+--+                            |
   |                               |                               |
   |            /------------------+------------------\            |
   |           v                   v                   v           |
   |     .-----------.      .-------------.        .-------.       |
   |    ( MAC Failure )    ( Nonce Failure )      ( Success )      |
   |     '-----+-----'      '------+------'        '---+---'       |
   |           |                   |                   |           |
   |           v                   v                   v           |
   |    +-------------+     +-------------+     +--------------+   |
   |    |Discard Data |     |Discard Data |     |Sync. Process |   |
   |    +-------------+     +------+------+     +------+-------+   |
   |           |                   |                   |           |
   |           |                   |                   v           |
   +-----------+                   +------------------>o-----------+

           Figure 1: 3: The client's behavior in NTS unicast mode.

                            +-----------------------------+
                            |Broadcast Parameter Messages |
                            +--------------+--------------+
                                           |
                                           o<--------------------------+
                                           |                           |
                                           v                           |
                            +-----------------------------+            |
                            |Broadcast Time Sync. Message |            |
                            +--------------+--------------+            |
                                           |                           |
   +-------------------------------------->o                           |
   |                                       |                           |
   |                                       v                           |
   |                             +-------------------+                 |
   |                             |Key and Auth. Check|                 |
   |                             +---------+---------+                 |
   |                                       |                           |
   |                      /----------------*----------------\          |
   |                     v                                   v         |
   |                .---------.                         .---------.    |
   |               ( Verified  )                       ( Falsified )   |
   |                '----+----'                         '----+----'    |
   |                     |                                   |         |
   |                     v                                   v         |
   |              +-------------+                        +-------+     |
   |              |Store Message|                        |Discard|     |
   |              +------+------+                        +---+---+     |
   |                     |                                   |         |
   |                     v                                   +---------o
   |             +---------------+                                     |
   |             |Check Previous |                                     |
   |             +-------+-------+                                     |
   |                     |                                             |
   |            /--------*--------\                                    |
   |           v                   v                                   |
   |      .---------.         .---------.                              |
   |     ( Verified  )       ( Falsified )                             |
   |      '----+----'         '----+----'                              |
   |           |                   |                                   |
   |           v                   v                                   |
   |    +-------------+   +-----------------+                          |
   |    |Sync. Process|   |Discard Previous |                          |
   |    +------+------+   +--------+--------+                          |
   |           |                   |                                   |
   +-----------+                   +-----------------------------------+

          Figure 2: The client's behaviour in NTS broadcast mode.

Appendix B.  Bit Lengths for Employed Primitives

   Define the following bit lengths for server seed, nonces, cookies and
   MACs:

      B_accesskey = 128,

      B_seed = 128,

      B_nonce = 128,

      B_cookie = 128, and

      B_mac = 128.

Appendix C.  Error Codes

                             +-----+---------+
                             | Bit | Meaning |
                             +-----+---------+
                             | 1   | D2      |
                             +-----+---------+

Authors' Addresses

   Daniel Fox Franke
   Akamai Technologies, Inc.
   150 Broadway
   Cambridge, MA  02142
   United States

   Email: dafranke@akamai.com
   URI:   https://www.dfranke.us
   Dieter Sibold
   Physikalisch-Technische Bundesanstalt
   Bundesallee 100
   Braunschweig  D-38116
   Germany

   Phone: +49-(0)531-592-8420
   Fax:   +49-531-592-698420
   Email: dieter.sibold@ptb.de

   Stephen Roettger
   Google Inc

   Email: stephen.roettger@googlemail.com

   Kristof Teichel
   Physikalisch-Technische Bundesanstalt
   Bundesallee 100
   Braunschweig  D-38116
   Germany

   Phone: +49-(0)531-592-8421
   Email: kristof.teichel@ptb.de