<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd">
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" category="exp" ipr="trust200902" docName="draft-mccollum-ntp-tsq-00" consensus="false">
  <front>
    <title abbrev="TSQ">Time Synchronization over QUIC</title>
    <author fullname="Garrett McCollum" initials="G." surname="McCollum">
      <organization>Cisco Systems</organization>
      <address>
        <email>gmccollu@cisco.com</email>
      </address>
    </author>
    <date day="04" month="August" year="2025"/>
    <workgroup>Network Time Protocols</workgroup>
    <abstract>
      <t>This document proposes a modern, secure, and extensible time synchronization protocol designed to operate over the QUIC transport protocol. Known as TSQ (Time Synchronization over QUIC), this protocol aims to address the limitations of traditional NTP by leveraging QUIC's encryption, widespread UDP/443 acceptance, and multiplexed stream capabilities. TSQ is designed for contemporary deployment environments, including enterprise networks, cloud-native systems, containers, and mobile devices, where traditional UDP-based NTP struggles with security, scalability, or operational reliability.</t>

      <t>This specification is published as an Experimental RFC. See <xref target="Experimental Criteria"/> for details.</t>
    </abstract>
  </front>
  
  <middle>
    <section title="Introduction">
      <t>Time synchronization is foundational to modern computing. It underpins authentication systems, log correlation, distributed transactions, and more. NTP, the current standard, was designed in a different era and brings challenges related to security, deployment compatibility, and extensibility. TSQ is proposed as a new protocol built directly on top of QUIC, leveraging its modern transport features to provide secure, authenticated, and operationally-friendly time synchronization.</t>
    </section>

    <section title="Terminology">
      <t>The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED",  "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 <xref target="RFC2119"/> <xref target="RFC8174"/> when, and only when, they appear in all capitals, as shown here.</t>
      <list style="symbols">
        <li>
          <t><spanx style="strong">TSQ:</spanx> Time Synchronization over QUIC protocol.</t>
        </li>
        <li>
          <t><spanx style="strong">QUIC:</spanx> A secure, multiplexed transport protocol over UDP.</t>
        </li>
        <li>
          <t><spanx style="strong">TLV:</spanx> Type-Length-Value, a flexible message format.</t>
        </li>
        <li>
          <t><spanx style="strong">Precision Mode:</spanx> An OPTIONAL TSQ feature for low-jitter synchronization.</t>
        </li>
        <li>
          <t><spanx style="strong">RTT:</spanx> Round-trip time.</t>
        </li>
        <li>
          <t><spanx style="strong">NTP:</spanx> Network Time Protocol. A widely deployed protocol for synchronizing clocks over IP networks, formally specified in <xref target="RFC5905"/>. TSQ inherits its timestamp format from NTP but differs in transport, security, and extensibility.</t>
        </li>
      </list>
    </section>

    <section title="Scope and Goals">
      <t>TSQ is intended to:</t>
      <list style="symbols">
        <t>Provide secure and authenticated time synchronization</t>
        <t>Support modern deployment scenarios</t>
        <t>Operate in environments where UDP/123 is blocked</t>
        <t>Be extensible and future-proof</t>
        <t>Scale for enterprise and cloud</t>
      </list>
      <t>TSQ is <em>not</em> intended to:</t>
      <list style="symbols">
        <t>Replace NTP in ultra-precise or constrained devices</t>
        <t>Replace public NTP infrastructure without optimization</t>
      </list>
    </section>

    <section title="Protocol Overview">
      <t>TSQ uses QUIC as its transport protocol, establishing secure connections for the exchange of time synchronization messages. TSQ supports two transport modes: QUIC streams and QUIC datagrams. Both modes carry the same TLV-formatted message content, but differ in reliability, latency, and use cases.</t>

      <t><spanx style="strong">Stream Mode:</spanx> Uses QUIC’s reliable, ordered streams. This mode ensures delivery and supports features like message signatures, making it suitable for authenticated and auditable time synchronization exchanges.</t>

      <t><spanx style="strong">Datagram Mode:</spanx> Uses QUIC DATAGRAM frames <xref target="RFC9221"/> for lower-latency, unordered delivery. This mode is suitable for fast, opportunistic synchronization but offers no retransmission or delivery guarantees. Applications requiring integrity validation SHOULD use Stream Mode.</t>

      <t>A typical TSQ exchange (in either mode) consists of the following steps:</t>
      <list style="numbers">
        <t>Client opens a QUIC connection to the TSQ server (typically using UDP/443) and negotiates the TSQ protocol via ALPN.</t>
        <t>Client sends a TSQ Request with a nonce and a transmit timestamp (T1). To support stateless server deployments and ensure robustness against replay attacks, clients MUST generate nonces that are cryptographically secure, unpredictable, and sufficiently long to avoid collisions.</t>
        <t>Server replies with a TSQ Response containing the echoed nonce, the current server time, and two timestamps: the time the request was received (T2) and the time the response was sent (T3).</t>
        <t>Client locally records its own receive time (T4), computes the round-trip time (RTT), and derives the clock offset for synchronization.</t>
      </list>
    </section>


    <section title="TSQ Protocol Operation">
      <section title="Connection Establishment">
        <t>TSQ uses QUIC for transport, leveraging its handshake for mutual authentication and encryption. Clients MUST negotiate the TSQ protocol using the ALPN identifier "tsq" during the QUIC handshake. Short-lived or resumed QUIC connections MAY be used to optimize performance.</t>
      </section>
      <section title="Message Exchange Flow">
        <t>Each TSQ exchange consists of a request and response over a QUIC stream. Clients and servers MUST capture the following timestamps:</t>
        <list style="symbols">
          <li>
            <t><spanx style="strong">T1 (Client Transmit Time):</spanx> The moment the client sends the TSQ Request.</t>
          </li>
          <li>
            <t><spanx style="strong">T2 (Server Receive Time):</spanx> The moment the server receives the TSQ Request.</t>
          </li>
          <li>
            <t><spanx style="strong">T3 (Server Transmit Time):</spanx> The moment the server sends the TSQ Response.</t>
          </li>
          <li>
            <t><spanx style="strong">T4 (Client Receive Time):</spanx> The moment the client receives the TSQ Response.</t>
          </li>
        </list>
        <t>These timestamps enable the client to calculate round-trip time (RTT) and clock offset. T1 and T4 are recorded by the client and are not transmitted. T2 and T3 are included in the TSQ Response message payload.</t>
        <artwork><![CDATA[
               Client                                   Server
                 |                                         |
                 | -------- QUIC Connection (tsq) -------> |
                 |                                         |
                 | ------ TSQ Request (T1, Nonce) -------> |
                 |                                         |
                 | <--- TSQ Response (T2, T3, Nonce) ----- |
                 |                                         |
                 |  (Records T4, computes offset & RTT)    |
        ]]></artwork>

      </section>
    <section title="Message Format and TLVs">
      <section title="TSQ Message Formats">
        <t>TSQ uses a Type-Length-Value (TLV) format to encode fields within TSQ Request and Response messages. Each TLV is self-contained and designed for easy extensibility. The structure is as follows:</t>

        <artwork><![CDATA[
           0                   1                   2                   3
           0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
          +--------+--------+--------------------------------------------+
          | Type   | Length | Value (Length bytes)                       |
          | (1 B)  | (1 B)  |                                            |
          +--------+--------+--------------------------------------------+

          - Type:   8-bit unsigned integer identifying the TLV type.
          - Length: 8-bit unsigned integer specifying the length of the Value field.
          - Value:  A variable-length field determined by Length.
        ]]></artwork>

        <t>All multi-byte fields within the Value are encoded in network byte order (big-endian).</t>

        <t>TSQ messages consist of a sequence of TLVs (Type-Length-Value elements). This format is consistent across both stream-based and Datagram modes. In Datagram Mode, all TLVs MUST still appear in a well-defined order, beginning with the Nonce (Type 1). Since QUIC DATAGRAM frames do not provide ordering or framing guarantees, implementations MUST treat the entire datagram payload as a single TSQ message. Partial or fragmented TLVs MUST NOT be used.</t>

        <t>All TLVs follow a consistent format: a one-byte Type, a one-byte Length, and a variable-length Value. TLVs MUST be processed sequentially, and unknown TLV types MUST be ignored unless policy dictates otherwise. The Signature Block TLV, if present, MUST appear last.</t>

        <t>TSQ Request Message TLVs:</t>
        <list style="symbols">
          <li>
            <t><spanx style="strong">Nonce (Type 1):</spanx> 16 bytes. A cryptographically secure random value generated by the client. Used to associate responses and ensure freshness. Copied back verbatim in the response.</t>
          </li>
          <li>
            <t><spanx style="strong">Transmit Timestamp (Type 2):</spanx> 8 bytes. The time at which the client sends the request. Encoded as a 64-bit unsigned fixed-point NTP timestamp.</t>
          </li>
        </list>

        <t>TSQ Response Message TLVs:</t>
        <list style="symbols">
          <li>
            <t><spanx style="strong">Nonce (Type 1):</spanx> 16 bytes. Echoed from the request to associate response with request.</t>
          </li>
          <li>
            <t><spanx style="strong">Server Time (Type 3):</spanx> 8 bytes. The server's wall-clock time when generating the response, in NTP format.</t>
          </li>
          <li>
            <t><spanx style="strong">Receive Timestamp (Type 4):</spanx> 8 bytes. The server's local time when the request was received, in NTP format.</t>
          </li>
          <li>
            <t><spanx style="strong">Send Timestamp (Type 5):</spanx> 8 bytes. The server's local time when the response was sent, in NTP format.</t>
          </li>
        </list>

        <t>Optional TLVs are used to extend TSQ without altering the core format. These TLVs MUST follow standard TLV structure and be included after the required fields in the message. Each is defined as follows:</t>
        <list style="symbols">
          <li>
            <t><spanx style="strong">Precision Mode Request (Type 250):</spanx> 0 bytes. Included by the client to request Precision Mode behavior.</t>
          </li>
          <li>
            <t><spanx style="strong">Precision Mode Acknowledgment (Type 250):</spanx> 0 bytes. Echoed by the server to confirm support.</t>
          </li>
          <li>
            <t><spanx style="strong">Time Source Info (Type 251):</spanx> Variable length. Optionally included by the server in the TSQ Response to indicate the current stratum and synchronization source. The format is as follows:
            </t>
            <artwork><![CDATA[
                0                   1                   2                   3
                0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
               +--------+--------+--------+--------+---------------------------+
               | Stratum (1B)    | Source Type (1B) | Optional Info (n bytes)  |
               +-----------------+------------------+--------------------------+

               - Stratum:        0 (unsynchronized), 1 (reference), 2+ (as in NTP)
               - Source Type:    1 = GPS, 2 = PTP, 3 = NTP, 4 = Manual, 5 = Unknown
               - Optional Info:  Optional UTF-8 metadata or site-specific tags
            ]]></artwork>
            <t>Clients MAY use this TLV to assess time accuracy or for logging/auditing. Servers MAY omit this field, and clients MUST tolerate its absence.</t>
          </li>
          <li>
            <t><spanx style="strong">Signature Capability (Type 252):</spanx> 0 bytes. Included by the client to indicate that the response MUST include a Signature Block (Type 255). If this TLV is present in a TSQ Request and the server does not include a valid Signature Block in the corresponding TSQ Response, the client MUST treat the response as unauthenticated and discard it. This TLV enables policy-driven enforcement of signed exchanges.</t>
          </li>
          <li>
            <t><spanx style="strong">Metadata (Type 253):</spanx> Variable length. Encoded as a series of UTF-8 key-value pairs. Each key and value is prefixed with a single-byte length. Example: <tt>[0x04] "site" [0x07] "us-east"</tt>. MAY be repeated for multiple annotations. Clients MUST ignore unknown keys.</t>
            <t>Example encoding:</t>
            <artwork><![CDATA[
              [0x04] 'site' [0x07] 'us-east'   --> 04 73 69 74 65 07 75 73 2d 65 61 73 74
            ]]></artwork>
          </li>
          <li>
            <t><spanx style="strong">Padding (Type 254):</spanx> Zero or more bytes. Used to align total message size for symmetry and minimize timing bias. The value MUST consist of zero-value bytes. This TLV MAY appear multiple times and MAY be placed anywhere in the message except before required fields.</t>
          </li>
          <li>
            <t><spanx style="strong">Signature Block (Type 255):</spanx> MUST be the final TLV in the message. Contains a digital signature over all prior TLVs in their exact byte order. The value contains the following fields:</t>
            <artwork><![CDATA[
              0                   1                   2                   3
              0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
             +--------+--------+--------+--------+---------------------------+
             | Algorithm ID (1B) | Key ID (4B) | Signature Length (2B)       |
             +-------------------+------------+-----------------------------+
             |                                                       |
             |               Signature Bytes (variable)              |
             |                                                       |
             +-------------------------------------------------------+
            ]]></artwork>

            <t>Field descriptions:</t>
            <list style="symbols">
              <t><spanx style="strong">Algorithm ID (1 byte):</spanx> Indicates the signature algorithm in use. See below.</t>
              <t><spanx style="strong">Key ID (4 bytes):</spanx> An identifier for the signing key (e.g., for key rotation).</t>
              <t><spanx style="strong">Signature Length (2 bytes):</spanx> Total number of signature bytes to follow.</t>
              <t><spanx style="strong">Signature Bytes:</spanx> The raw signature output from the selected algorithm.</t>
            </list>

            <t>Signatures MAY use <xref target="RFC8032"/> (Ed25519) or <xref target="RFC2104"/> (HMAC-SHA256), depending on deployment policy.</t>
          </li>
        </list>

        <t>All timestamps use the NTP format, a 64-bit unsigned fixed-point representation: the upper 32 bits represent seconds since the NTP epoch (January 1, 1900), and the lower 32 bits represent fractional seconds. This format ensures sub-microsecond resolution and compatibility with existing time protocols.</t>

      </section>
      <section title="TLV Type Registry">
        <t>The following table summarizes the currently defined TSQ TLV types:</t>
        <texttable>
          <ttcol>Type</ttcol>
          <ttcol>Name</ttcol>
          <ttcol>Direction</ttcol>
          <ttcol>Required</ttcol>
          <ttcol>Description</ttcol>

          <c>1</c><c>Nonce</c><c>Request and Response</c><c>Yes</c><c>Identifies exchange and prevents replay</c>
          <c>2</c><c>Transmit Timestamp</c><c>Request</c><c>Yes</c><c>Time client sent request (T1)</c>
          <c>3</c><c>Server Time</c><c>Response</c><c>Yes</c><c>Current wall time at server</c>
          <c>4</c><c>Receive Timestamp</c><c>Response</c><c>Yes</c><c>Time server received request (T2)</c>
          <c>5</c><c>Send Timestamp</c><c>Response</c><c>Yes</c><c>Time server sent response (T3)</c>

          <!-- 🔽 NEW reserved line -->
          <c>6–249</c><c>Reserved</c><c>–</c><c>No</c><c>Reserved for future extension</c>

          <c>250</c><c>Precision Mode Req/Ack</c><c>Request and Response</c><c>No</c><c>Negotiate symmetric message sizing</c>
          <c>251</c><c>Time Source Info</c><c>Response</c><c>No</c><c>Stratum and source metadata</c>
          <c>252</c><c>Signature Capability</c><c>Request</c><c>No</c><c>Client requests signed response</c>
          <c>253</c><c>Metadata</c><c>Request and Response</c><c>No</c><c>Deployment annotations (e.g., site ID)</c>
          <c>254</c><c>Padding</c><c>Request and Response</c><c>No</c><c>Zero-filled padding for alignment</c>
          <c>255</c><c>Signature Block</c><c>Response</c><c>Conditional</c><c>Cryptographic signature of message</c>
        </texttable>

        <t>TLV Type values 6 through 249 are reserved for future use and MUST NOT be assigned without IETF review.</t>

        <t>All TLV types not listed here are reserved. Future extensions MUST use unique type values and follow the TLV format rules defined in this section. Implementations MUST ignore unknown TLV types unless explicitly required by policy.</t>
      </section>
    </section>
      <section title="Precision Mode">
        <t>Precision Mode is an OPTIONAL feature of TSQ designed to reduce timing variance introduced by serialization delay and queuing asymmetries. It ensures that TSQ Request and Response messages are of equal size to enable low-jitter, symmetric round-trip time measurement.</t>

        <t><spanx style="strong">Negotiation:</spanx> Precision Mode is negotiated using TLV Type 250. The client includes a zero-length <spanx style="emph">Precision Mode Request</spanx> TLV (Type 250) in the TSQ Request to indicate support for Precision Mode. If the server also supports Precision Mode, it MUST include a zero-length <spanx style="emph">Precision Mode Acknowledgment</spanx> TLV (Type 250) in the TSQ Response. If the server does not support Precision Mode, it MUST omit this TLV. Clients MUST interpret the absence of the acknowledgment TLV as lack of support and MAY either proceed without Precision Mode or fail the exchange, based on local policy.</t>

        <t><spanx style="strong">Fixed-Length Packet Symmetry:</spanx> When Precision Mode is successfully negotiated, both endpoints MUST ensure that the total byte length of the TSQ Request and Response messages are identical. To do so, implementations MUST include a Padding TLV (Type 254) to pad the message as needed. Padding MUST consist entirely of zero-value bytes and MUST appear after all other TLVs except the Signature Block. If used with the Signature Block TLV, Padding MUST appear immediately before it.</t>

        <t><spanx style="strong">Interoperability:</spanx> Clients that require Precision Mode for accurate clock synchronization SHOULD implement a fallback behavior if the server does not acknowledge support. The use of a dual-role TLV (Type 250) avoids the need for separate type registration and keeps the negotiation mechanism simple. This TLV MAY be extended in the future to include payload data for enhanced negotiation, though current implementations MUST treat the TLV as zero-length.</t>
      </section>
      <section title="QUIC Datagram Mode">
        <t>In addition to stream-based transport, TSQ optionally supports transmission over QUIC Datagrams <xref target="RFC9221"/> for low-latency, unreliable synchronization exchanges. This is referred to as Datagram Mode.</t>

        <t><spanx style="strong">Operational Flow:</spanx> In Datagram Mode, the TSQ Request and Response are each encoded as a single TLV-encoded message and transmitted in a single QUIC DATAGRAM frame. This eliminates the need for a stream-based handshake, reducing round-trip latency. There is no flow control or retransmission of TSQ messages when sent this way.</t>

        <t><spanx style="strong">Message Format:</spanx> The message format is identical to stream-based TSQ: a sequence of TLVs beginning with a Nonce (Type 1) and including Server Time (Type 2), Receive/Send Timestamps, and optionally Padding, Metadata, and Signature TLVs. The same message structure applies; only the transport differs.</t>

        <t><spanx style="strong">Negotiation:</spanx> Datagram Mode is implicitly negotiated via ALPN and application profile. If both client and server support it, the client MAY send the first TSQ Request as a DATAGRAM. If the server replies using a DATAGRAM, the mode is established. If the server does not support DATAGRAM frames, it will not acknowledge or will fall back to a stream-based response. Clients MUST be prepared to retry using stream-based transport.</t>

        <t><spanx style="strong">Trade-Offs:</spanx> Datagram Mode offers reduced latency and avoids head-of-line blocking, but provides no delivery guarantees. This makes it suitable for approximate or opportunistic synchronization, but not for authenticated, auditable timestamps. Applications that require signature validation, retransmission, or ordering SHOULD use stream-based mode.</t>

      </section>
      <section title="Error Handling">
        <t>TSQ implementations MUST validate all TLV structures. Malformed messages SHOULD result in connection termination or silent discard. Clients MUST handle missing or invalid nonce echoes and timestamp anomalies.</t>

        <t>Timestamp anomalies include any condition where the computed round-trip time (RTT) or clock offset is implausible or mathematically invalid. This includes, but is not limited to:</t>
        <list style="symbols">
          <t>RTT calculation results in a negative or zero duration.</t>
          <t>Offset calculation exceeds deployment-defined thresholds (e.g., 24 hours).</t>
          <t>Timestamps appear non-monotonic (e.g., T3 earlier than T2).</t>
          <t>Receive time (T4) is earlier than transmit time (T1).</t>
        </list>

        <t>When encountering such anomalies, clients SHOULD discard the result, log a warning or error for diagnostic purposes, and MAY retry the exchange with a different server or after a short delay. Implementations MAY apply sanity checks or rate limits to prevent excessive retries in unstable environments.</t>

        <t>Deployments requiring strict synchronization SHOULD implement anomaly detection thresholds that align with operational tolerances (e.g., tolerable drift or jitter). No synchronization adjustment MUST be applied unless all four timestamps (T1–T4) are consistent and validated.</t>

      </section>
    </section>

    <section title="Security Considerations">
      <t>TSQ leverages QUIC's security model to ensure confidentiality, integrity, and replay protection. All TSQ messages are encapsulated within encrypted QUIC streams or datagrams, depending on mode.</t>
      <t>TSQ relies on the Application-Layer Protocol Negotiation (ALPN) extension in QUIC to distinguish TSQ traffic from other application protocols. Implementations MUST verify that the negotiated ALPN value is exactly "tsq". Clients MUST reject any QUIC connection where the negotiated ALPN does not exactly match "tsq". Failure to enforce ALPN validation could result in downgrade attacks where the connection is interpreted as TSQ despite not meeting protocol security requirements.</t>
      <t>The QUIC handshake provides mutual authentication if certificates are validated. In TSQ, this ensures both the client and server are communicating with authenticated endpoints.</t>
      <t>Replay protection is achieved via QUIC's transport guarantees. However, implementations MUST validate echoed nonces and timestamp monotonicity to guard against application-level replay attacks.</t>
      <t>TSQ supports a negotiation mechanism for clients that require signed responses. This is achieved using the Signature Capability TLV (Type 252), which signals that the client requires a digitally signed TSQ Response. Servers that receive this TLV MUST include a valid Signature Block TLV (Type 255) in the response or fail the request. If no Signature Block is present in the response, the client MUST treat the exchange as unauthenticated and discard it. This mechanism ensures deterministic policy enforcement for deployments requiring auditability.</t>
      <t>TSQ supports optional digital signatures to support auditability or long-term integrity. Signatures MAY be generated using Ed25519 or HMAC-SHA256 and included in the Signature Block TLV (Type 255).</t>
      <t>For security implications specific to Datagram Mode, see <xref target="Security Implications of Datagram Mode"/>.</t>
      <t>The Time Source Info TLV (Type 251) provides optional metadata about the server’s synchronization source and quality. While useful for transparency and diagnostics, clients MUST treat this TLV as advisory. It MUST NOT be used as a substitute for cryptographic integrity or freshness validation. Implementers SHOULD validate time quality using signatures, replay protection, and out-of-band policy when accuracy is critical.</t>
      <t>Privacy-conscious deployments SHOULD minimize identifying metadata in TSQ messages and MAY use ephemeral QUIC connections to reduce correlation risk. Servers MAY also implement rate-limiting to mitigate client fingerprinting or denial-of-service vectors.</t>

      <section anchor="Security_Implications_of_Datagram_Mode" title="Security Implications of Datagram Mode">
        <t>QUIC Datagram mode provides reduced latency and eliminates head-of-line blocking, but introduces several important security trade-offs compared to stream-based TSQ exchanges.</t>

        <list style="symbols">
          <t><spanx style="strong">Unreliability:</spanx> QUIC Datagram frames are not retransmitted or acknowledged. Messages may be lost, reordered, or duplicated.</t>
          <t><spanx style="strong">Spoofing Risk:</spanx> Since datagrams are stateless and unidirectional, responses can be spoofed by an on-path attacker unless validated using digital signatures.</t>
          <t><spanx style="strong">No Built-In Integrity:</spanx> QUIC Datagram mode lacks framing guarantees. Without the Signature Block TLV, clients have no cryptographic assurance of authenticity or freshness.</t>
        </list>

        <t>As a result, clients that operate in Datagram Mode SHOULD treat responses as advisory unless they include a valid Signature Block. Implementations that require auditability, integrity guarantees, or traceability SHOULD prefer stream-based TSQ exchanges.</t>

        <t>Where Datagram Mode is used, deployments MAY enforce signature usage via the Signature Capability TLV and validate all incoming messages against known server credentials.</t>
      </section>

    </section>
    <section title="Signature Format and Verification" toc="default">
      <t>TSQ supports optional message-level signatures for deployments that require auditability or long-term verifiability beyond QUIC's ephemeral session security. This mechanism is distinct from QUIC's built-in authentication and confidentiality, and SHOULD only be enabled when such properties are required.</t>

      <t>When enabled, the TSQ Response MUST include a TLV extension of type 255 (0xFF), known as the Signature Block.</t>
      <list style="symbols">
        <t>Signature Algorithm ID (1 byte)</t>
        <t>Key ID (4 bytes)</t>
        <t>Signature Length (2 bytes)</t>
        <t>Signature Bytes</t>
      </list>

      <t>Supported signature algorithms:</t>
      <list style="symbols">
        <li>
          <t><spanx style="strong">0x01:</spanx> Ed25519 using the standard Curve25519 curve</t>
        </li>
        <li>
        <t><spanx style="strong">0x02:</spanx> HMAC-SHA256 (requires shared secret)</t>
        </li>
      </list>

      <t>The data to be signed MUST include (in order):</t>
      <list style="symbols">
        <t>The echoed Nonce (Type 1)</t>
        <t>Transmit Timestamp (Type 2)</t>
        <t>Receive Timestamp (T2, Type 4)</t>
        <t>Send Timestamp (T3, Type 5)</t>
        <t>Optional TLVs (e.g., Metadata, Time Source Info), if present</t>
      </list>

      <t>Keys are provisioned out-of-band and identified by the Key ID. TSQ does not define a key distribution mechanism; implementers MAY use mechanisms such as DNSSEC, enrollment protocols, or manual configuration.</t>

      <t>Use of signatures SHOULD be negotiated via a policy or deployment profile. Clients that require signatures but do not receive them MUST treat the response as unauthenticated.</t>

      <t>Signatures mitigate threats such as long-term forgery, post-session repudiation, and auditing in compliance-sensitive deployments. They do not replace or extend QUIC's real-time transport security and SHOULD NOT be used as a substitute for encrypted transport.</t>

      <t>The presence of the Signature Capability TLV (Type 252) in the TSQ Request mandates the inclusion of a valid Signature Block TLV in the response. Failure to comply MUST result in rejection of the response by the client. This provides a lightweight, in-band method to enforce signature requirements on a per-request basis.</t>

    </section>

    <section title="Scalability and Deployment Considerations">
      <t>TSQ is designed to operate efficiently in large-scale, heterogeneous environments. It is suitable for use in enterprise, cloud-native, and mobile scenarios where traditional NTP may encounter limitations due to UDP/123 filtering, firewall traversal, or security posture.</t>
      <t>QUIC’s stream multiplexing and NAT rebinding support allow TSQ to serve mobile clients that frequently change IP addresses or network paths. Use of QUIC on UDP/443 also enables easier traversal through firewalls and middleboxes.</t>
      <t>TSQ connections are intended to be short-lived by default, allowing high churn rates with minimal state retention. However, QUIC session resumption MAY be used to optimize recurring exchanges with known servers.</t>
      <t>Implementations MAY operate in a stateless mode by avoiding long-lived session tracking and relying on QUIC’s address validation tokens to prevent abuse. Stateless designs are especially beneficial for high-volume deployments such as cloud-based time services.</t>
      <t>TSQ is not intended to replace the global NTP stratum hierarchy or public time pool infrastructure directly. However, it MAY be used in conjunction with such infrastructure, particularly where UDP-based protocols are not viable or additional metadata, security, or auditability is required.</t>
      <t>Servers MAY include a Time Source Info TLV in responses to expose stratum or reference source. This is particularly useful in hierarchical deployments or enterprise deployments with multiple upstream sources. However, TSQ does not impose or rely on a strict time hierarchy, and clients MUST treat this information as advisory.</t>
      <t>TSQ supports an optional stateless design by allowing servers to construct responses solely based on information included in the client request, without maintaining per-client session state. Specifically, the client's request includes a cryptographically secure nonce, and all timestamps necessary for round-trip time (RTT) calculation are echoed or generated in the response. If signature-based integrity protection is used, the server can sign the response using a long-lived private key without needing to store session-specific metadata. This enables large-scale deployments where the server handles a high volume of clients without incurring memory or tracking overhead per connection. However, implementations MUST ensure that nonce uniqueness and freshness are sufficient to prevent replay attacks and ambiguity in response validation. In particular, clients MUST generate cryptographically strong nonces using a secure random number generator. Nonces MUST be unpredictable and collision-resistant, as servers may operate in a stateless mode and rely solely on the nonce for response association. The default 16-byte nonce length is RECOMMENDED to ensure sufficient entropy for all deployment sizes. Reuse or predictability of nonces can lead to forged or replayed responses, especially in datagram mode.</t>
    </section>

    <section anchor="Experimental_Criteria" title="Experimental Criteria">
      <t>This document is published as an Experimental RFC to evaluate the viability and security of time synchronization over the QUIC transport protocol. The goals of this experiment are to:</t>

      <list style="symbols">
        <t>Demonstrate successful time synchronization in varied environments (e.g., cloud, mobile, IoT) where traditional NTP/NTS protocols face limitations.</t>
        <t>Validate interoperability between independent TSQ implementations across QUIC versions and TLS stacks.</t>
        <t>Evaluate the robustness of TSQ’s security model, including replay prevention, signature validation, and support for stateless operation.</t>
        <t>Assess the practicality of TSQ’s Precision Mode and Datagram Mode in real-world deployments.</t>
        <t>Implementers are encouraged to produce and test against at least one reference implementation that supports both Stream and Datagram modes, and to validate fallback behaviors (e.g., unsupported Precision Mode or missing Signature Block) to ensure graceful interoperability across partial implementations.</t>
      </list>

      <t>Feedback from implementers and operators will help determine whether TSQ is suitable for progression to the Standards Track, and whether refinements to the protocol, message formats, or security properties are necessary.</t>
    </section>
    <section title="IANA Considerations">
      <t>This document requests IANA to register the following value in the "TLS Application-Layer Protocol Negotiation (ALPN) Protocol IDs" registry:</t>
      <t>TSQ uses the ALPN identifier "tsq" to negotiate protocol support during the TLS handshake <xref target="RFC7301"/>.</t>
      <texttable>
        <ttcol align="left">Protocol</ttcol>
        <ttcol align="left">Identification Sequence</ttcol>
        <ttcol align="left">Reference</ttcol>
        <c>tsq</c>
        <c>0x03 74 73 71 ("tsq")</c>
        <c>This document</c>
      </texttable>
      <t>Per <xref target="RFC7301"/>, this identifier is used during the TLS handshake to indicate TSQ support.</t>
    </section>
    <section title="Acknowledgments">
      <t>Special thanks to Joe Clarke for insightful comments and review during early iterations of this document.</t>
      <t>Thanks also to participants in the NTP and QUIC IETF Working Groups whose discussions and documents shaped many of the ideas in this work.</t>
    </section>
  </middle>
  <back>
    <references title="Normative References">

      <reference anchor="RFC2104" target="https://www.rfc-editor.org/rfc/rfc2104.html">
        <front>
          <title>HMAC: Keyed-Hashing for Message Authentication</title>
          <author initials="H." surname="Krawczyk" fullname="Hugo Krawczyk"/>
          <author initials="M." surname="Bellare" fullname="Mihir Bellare"/>
          <author initials="R." surname="Canetti" fullname="Ran Canetti"/>
          <date year="1997" month="February"/>
        </front>
      </reference>

      <reference anchor="RFC2119" target="https://www.rfc-editor.org/rfc/rfc2119.html">
        <front>
          <title>Key words for use in RFCs to Indicate Requirement Levels</title>
          <author initials="S." surname="Bradner" fullname="Scott Bradner"/>
          <date year="1997" month="March"/>
        </front>
      </reference>

      <reference anchor="RFC7301" target="https://www.rfc-editor.org/rfc/rfc7301.html">
        <front>
          <title>Transport Layer Security (TLS) Application-Layer Protocol Negotiation Extension</title>
          <author initials="S." surname="Friedl" fullname="Stephen Friedl">
            <organization>Orange County Chapter</organization>
          </author>
          <author initials="A." surname="Popov" fullname="Andrei Popov">
            <organization>Microsoft</organization>
          </author>
          <author initials="A." surname="Langley" fullname="Adam Langley">
            <organization>Google</organization>
          </author>
          <author initials="E." surname="Stebila" fullname="Douglas Stebila">
            <organization>University of Waterloo</organization>
          </author>
          <date year="2014" month="July"/>
        </front>
      </reference>

      <reference anchor="RFC8032" target="https://www.rfc-editor.org/rfc/rfc8032.html">
        <front>
          <title>Edwards-Curve Digital Signature Algorithm (EdDSA)</title>
          <author initials="S." surname="Josefsson" fullname="Simon Josefsson"/>
          <author initials="I." surname="Liusvaara" fullname="Ilari Liusvaara"/>
          <date year="2017"/>
        </front>
      </reference>

      <reference anchor="RFC8174" target="https://www.rfc-editor.org/rfc/rfc8174.html">
        <front>
          <title>Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words</title>
          <author initials="B." surname="Leiba" fullname="Barry Leiba"/>
          <date year="2017" month="May"/>
        </front>
      </reference>

      <reference anchor="RFC9000" target="https://www.rfc-editor.org/rfc/rfc9000.html">
        <front>
          <title>QUIC: A UDP-Based Multiplexed and Secure Transport</title>
          <author initials="J." surname="Iyengar" fullname="Jana Iyengar"/>
          <author initials="M." surname="Thomson" fullname="Martin Thomson"/>
          <date year="2021" month="May"/>
        </front>
      </reference>

      <reference anchor="RFC9221" target="https://www.rfc-editor.org/rfc/rfc9221.html">
        <front>
          <title>Using QUIC Datagrams with HTTP/3</title>
          <author initials="D." surname="Schinazi" fullname="David Schinazi"/>
          <date year="2022" month="June"/>
        </front>
      </reference>
    </references>

    <references title="Informative References">

      <reference anchor="RFC5905" target="https://www.rfc-editor.org/rfc/rfc5905.html">
        <front>
          <title>Network Time Protocol Version 4: Protocol and Algorithms Specification</title>
          <author initials="D." surname="Mills" fullname="David L. Mills"/>
          <author initials="J." surname="Martin" fullname="James Martin"/>
          <author initials="J." surname="Burbank" fullname="Judy Burbank"/>
          <author initials="W." surname="Kasch" fullname="William Kasch"/>
          <date year="2010" month="June"/>
        </front>
      </reference>

      <reference anchor="RFC8915" target="https://www.rfc-editor.org/rfc/rfc8915.html">
        <front>
          <title>Network Time Security for the Network Time Protocol</title>
          <author initials="D." surname="Franke" fullname="Daniel Franke"/>
          <author initials="D." surname="Sibold" fullname="Dietmar Sibold"/>
          <author initials="K." surname="Teichel" fullname="Kristof Teichel"/>
          <author initials="M." surname="Malone" fullname="Martin Langer Malone"/>
          <author initials="A." surname="Sommers" fullname="Alexander D. Sommers"/>
          <date year="2020" month="September"/>
        </front>
      </reference>

      <reference anchor="I-D.ietf-ntp-roughtime" target="https://www.ietf.org/archive/id/draft-ietf-ntp-roughtime-14.html">
        <front>
          <title>Roughtime</title>
          <author initials="A." surname="Langley" fullname="Adam Langley"/>
          <author initials="B." surname="Dowling" fullname="Benjamin Dowling"/>
          <author initials="G." surname="Malone" fullname="D. Gavin Malone"/>
          <date year="2024" month="May"/>
        </front>
      </reference>

    </references>


    <section title="Comparison to Existing Protocols">
    <t>The following table compares traditional time synchronization approaches to TSQ:</t>
    <texttable>
      <ttcol align="center">Feature</ttcol>
      <ttcol align="center">NTP</ttcol>
      <ttcol align="center">NTS</ttcol>
      <ttcol align="center">TSQ</ttcol>
      <c>Transport</c>
      <c>UDP</c>
      <c>UDP+TLS</c>
      <c>QUIC (UDP/443)</c>
      <c>Encryption</c>
      <c>No</c>
      <c>Yes</c>
      <c>Always</c>
      <c>Extensibility</c>
      <c>Low</c>
      <c>Medium</c>
      <c>High</c>
      <c>Mobile Support</c>
      <c>No</c>
      <c>No</c>
      <c>Yes</c>
      <c>Precision Mode</c>
      <c>No</c>
      <c>No</c>
      <c>Yes</c>
    </texttable>

    <t>TSQ and Roughtime serve complementary purposes. While Roughtime provides cryptographic attestation of coarse-grained time and bootstraps trust in untrusted environments, TSQ is designed for ongoing synchronization with higher precision, session continuity, and transport-layer security. TSQ may follow Roughtime during startup or cold boot scenarios.</t>
    </section>
  
  </back>

</rfc>
